diff --git a/app.py b/app.py index d79d14f..8f975d8 100644 --- a/app.py +++ b/app.py @@ -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") diff --git a/index.html b/index.html index 01a6ca4..0e30de6 100644 --- a/index.html +++ b/index.html @@ -116,7 +116,7 @@ th,td{padding:9px 8px;border-bottom:1px solid #eee;text-align:left}