fix: 限制边缘节点仅使用 IPv4 并记录维护约定

This commit is contained in:
2026-10-04 00:21:36 +08:00
parent 5326c572a2
commit 349ab8329e
8 changed files with 69 additions and 14 deletions

View File

@@ -52,7 +52,7 @@ for tag, pvar in (("hy2-direct", "PORT_HY2_DIRECT"), ("hy2-warp", "PORT_HY2_WARP
p = port(pvar)
if not p:
continue
ib = {"type": "hysteria2", "tag": tag, "listen": "::", "listen_port": p,
ib = {"type": "hysteria2", "tag": tag, "listen": "0.0.0.0", "listen_port": p,
"up_mbps": up, "down_mbps": down,
"users": [{"name": "node-main", "password": os.environ["NODE_PASSWORD"]}],
"tls": tls()}
@@ -67,7 +67,7 @@ for tag, pvar in (("tuic-direct", "PORT_TUIC_DIRECT"), ("tuic-warp", "PORT_TUIC_
if not p:
continue
inbounds.append({
"type": "tuic", "tag": tag, "listen": "::", "listen_port": p,
"type": "tuic", "tag": tag, "listen": "0.0.0.0", "listen_port": p,
"users": [{"name": "node-main", "uuid": os.environ["XUI_UUID"],
"password": os.environ["NODE_PASSWORD"]}],
"congestion_control": tuic_cc, "auth_timeout": "3s",
@@ -79,7 +79,10 @@ if not inbounds:
warp_tags = [i["tag"] for i in inbounds if i["tag"].endswith("-warp")]
direct_tags = [i["tag"] for i in inbounds if i["tag"].endswith("-direct")]
rules = []
rules = [
{"action": "resolve", "strategy": "ipv4_only", "server": "ipv4-dns"},
{"ip_cidr": ["::/0"], "action": "reject"},
]
if warp_tags:
rules.append({"inbound": warp_tags, "outbound": "warp"})
if direct_tags:
@@ -88,6 +91,8 @@ rules.append({"protocol": "bittorrent", "outbound": "block"})
cfg = {
"log": {"level": "warn", "timestamp": True},
"dns": {"servers": [{"type": "udp", "tag": "ipv4-dns", "server": "1.1.1.1",
"server_port": 53}], "strategy": "ipv4_only", "final": "ipv4-dns"},
"inbounds": inbounds,
"outbounds": [
{"type": "direct", "tag": "direct"},