feat: 组网支持多个地址(逗号/换行分隔,任一可达即用)

This commit is contained in:
3970260761 committed 2026-11-09 09:44:20 +08:00
1 parent 966090af32
commit bf7cd99dd7
2 files changed
+28 -20

No files matched your search

+27 -19
View File
@@ -352,28 +352,36 @@ def run_check():
if done:
connected.append({"type": "ipv6", "target": ip6, "domain": ", ".join(done)})
# 2. EasyTier / group network (ping 检测,无需端口)
et_host = (cfg.get("easytier_host") or "").strip()
if not et_host:
# 2. EasyTier / group network (ping 检测,无需端口) — 支持多个地址,任一可达即用
raw_et = cfg.get("easytier_host") or cfg.get("easytier_hosts") or ""
if isinstance(raw_et, list):
et_hosts = [str(x).strip() for x in raw_et if str(x).strip()]
else:
et_hosts = [x.strip() for x in str(raw_et).replace("\\n", ",").split(",") if x.strip()]
if not et_hosts:
s.append("- 组网 未配置")
else:
ok = ping_ok(et_host)
STATUS["easytier"] = {"ok": ok, "host": et_host}
if not ok:
s.append(f"✗ 组网 {et_host} 不可达")
elif not domains:
connected.append({"type": "easytier", "target": et_host, "domain": None})
s.append(f"✓ 组网 {et_host} 可达")
reachable = [h for h in et_hosts if ping_ok(h)]
STATUS["easytier"] = {"ok": bool(reachable), "hosts": et_hosts, "reachable": reachable}
if not reachable:
s.append(f"✗ 组网 {', '.join(et_hosts)} 均不可达")
else:
done, bad = [], []
for d in domains:
(done if update_dns(cfg, d, et_host) else bad).append(d)
line = f"✓ 组网 {et_host} → {', '.join(done)}" if done else f"✗ 组网 {et_host} DNS更新失败"
if bad:
line += f" (失败: {', '.join(bad)})"
s.append(line)
if done:
connected.append({"type": "easytier", "target": et_host, "domain": ", ".join(done)})
et_host = reachable[0]
if not domains:
connected.append({"type": "easytier", "target": et_host, "domain": None})
s.append(f"✓ 组网 {et_host} 可达" + (f" (共{len(reachable)}/{len(et_hosts)}可达)" if len(et_hosts) > 1 else ""))
else:
done, bad = [], []
for d in domains:
(done if update_dns(cfg, d, et_host) else bad).append(d)
line = f"✓ 组网 {et_host} → {', '.join(done)}" if done else f"✗ 组网 {et_host} DNS更新失败"
if bad:
line += f" (失败: {', '.join(bad)})"
if len(et_hosts) > 1:
line += f" [可达 {len(reachable)}/{len(et_hosts)}]"
s.append(line)
if done:
connected.append({"type": "easytier", "target": et_host, "domain": ", ".join(done)})
# 3. NPS
nps_server = cfg.get("nps_server")
+1 -1
View File
@@ -116,7 +116,7 @@ th,td{padding:9px 8px;border-bottom:1px solid #eee;text-align:left}
<div class="sec-block">
<h3>🔗 组网 (EasyTier) <span class="tag">备用线路 ① · ping 连通即解析 A 记录</span></h3>
<label>组网地址 <span class="hint">填组网 IP,ping 能通即视为连通,无需端口</span></label><input id="easytier_host" placeholder="1.1.1.19">
<label>组网地址 <span class="hint">支持多个,逗号或换行分隔;ping 能通即视为连通,无需端口</span></label><textarea id="easytier_host" rows="2" placeholder="1.1.1.19, 1.1.1.20"></textarea>
</div>
<div class="sec-block sec-nps">
<h3>🚇 NPS 内网穿透 <span class="tag">备用线路 ② · 最后兜底</span></h3>