fix: multi-node online stats, per-node Hy2 ports, and panel reload stability
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+1
-1
@@ -127,7 +127,7 @@ ufw default allow outgoing
|
||||
ufw allow 22/tcp comment 'SSH'
|
||||
ufw allow 80/tcp comment 'HTTP-ACME-Panel'
|
||||
ufw allow 443/tcp comment 'Reality'
|
||||
ufw allow 8443/udp comment 'Hysteria2'
|
||||
ufw allow 8443:8499/udp comment 'Hysteria2-multi-node'
|
||||
ufw --force enable
|
||||
|
||||
log "部署 Nginx fallback 站点 ..."
|
||||
|
||||
+34
-29
@@ -54,49 +54,54 @@ def build_config(env: dict[str, str], nodes: list[dict]) -> dict:
|
||||
raise SystemExit(f".env 缺少 {key}")
|
||||
|
||||
vless_users = [{"uuid": n["uuid"], "flow": "xtls-rprx-vision"} for n in nodes]
|
||||
# name 与 VLESS uuid 一致,便于 v2ray/clash API 按用户统计流量
|
||||
hy2_users = [
|
||||
{"name": n["uuid"], "password": n["hy2_password"]} for n in nodes
|
||||
]
|
||||
clash_secret = env.get("CLASH_API_SECRET", "")
|
||||
hy2_base_port = 8443
|
||||
|
||||
config = {
|
||||
"log": {"level": "warn", "timestamp": True},
|
||||
"inbounds": [
|
||||
{
|
||||
"type": "vless",
|
||||
"tag": "vless-reality-in",
|
||||
"listen": "0.0.0.0",
|
||||
"listen_port": 443,
|
||||
"users": vless_users,
|
||||
"tls": {
|
||||
inbounds: list[dict] = [
|
||||
{
|
||||
"type": "vless",
|
||||
"tag": "vless-reality-in",
|
||||
"listen": "0.0.0.0",
|
||||
"listen_port": 443,
|
||||
"users": vless_users,
|
||||
"tls": {
|
||||
"enabled": True,
|
||||
"server_name": env["REALITY_SERVER_NAME"],
|
||||
"reality": {
|
||||
"enabled": True,
|
||||
"server_name": env["REALITY_SERVER_NAME"],
|
||||
"reality": {
|
||||
"enabled": True,
|
||||
"handshake": {
|
||||
"server": env["REALITY_SERVER_NAME"],
|
||||
"server_port": 443,
|
||||
},
|
||||
"private_key": env["REALITY_PRIVATE_KEY"],
|
||||
"short_id": [env["REALITY_SHORT_ID"]],
|
||||
"handshake": {
|
||||
"server": env["REALITY_SERVER_NAME"],
|
||||
"server_port": 443,
|
||||
},
|
||||
"private_key": env["REALITY_PRIVATE_KEY"],
|
||||
"short_id": [env["REALITY_SHORT_ID"]],
|
||||
},
|
||||
},
|
||||
},
|
||||
]
|
||||
for index, node in enumerate(nodes):
|
||||
inbounds.append(
|
||||
{
|
||||
"type": "hysteria2",
|
||||
"tag": "hysteria2-in",
|
||||
"tag": f"hy2-in-{node['id']}",
|
||||
"listen": "0.0.0.0",
|
||||
"listen_port": 8443,
|
||||
"users": hy2_users,
|
||||
"listen_port": hy2_base_port + index,
|
||||
"users": [
|
||||
{"name": node["uuid"], "password": node["hy2_password"]},
|
||||
],
|
||||
"tls": {
|
||||
"enabled": True,
|
||||
"server_name": env["DOMAIN"],
|
||||
"certificate_path": "/etc/sing-box/certs/fullchain.pem",
|
||||
"key_path": "/etc/sing-box/certs/privkey.pem",
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
)
|
||||
|
||||
clash_secret = env.get("CLASH_API_SECRET", "")
|
||||
|
||||
config = {
|
||||
"log": {"level": "info", "timestamp": True},
|
||||
"inbounds": inbounds,
|
||||
"outbounds": [{"type": "direct", "tag": "direct"}],
|
||||
"route": {
|
||||
"rules": [{"ip_is_private": True, "action": "reject"}],
|
||||
|
||||
Reference in New Issue
Block a user