From d4156b81e24acbd30e3e2c6f7dce3d77c2441d17 Mon Sep 17 00:00:00 2001 From: wangjia <809946525@qq.com> Date: Thu, 23 Jul 2026 01:32:43 +0800 Subject: [PATCH] =?UTF-8?q?refactor(agent):=20cleanDomains=20=E5=A7=94?= =?UTF-8?q?=E6=89=98=20cleanHosts,=E6=B6=88=E9=99=A4=E5=90=8C=E5=8C=85?= =?UTF-8?q?=E9=87=8D=E5=A4=8D=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.8 --- server/internal/agentd/warp.go | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/server/internal/agentd/warp.go b/server/internal/agentd/warp.go index acb40ee..1aed2fa 100644 --- a/server/internal/agentd/warp.go +++ b/server/internal/agentd/warp.go @@ -6,7 +6,6 @@ import ( "net" "os" "strconv" - "strings" ) // WarpConfig 描述节点上「部分域名走 Cloudflare WARP 干净出口」的分流配置(#29)。 @@ -66,15 +65,9 @@ func (wc *WarpConfig) mtu() int { } // cleanDomains 去空白/空项后返回域名清单(用于 domain_suffix)。 +// 与 ACL 的目的地域名规范化共用 cleanHosts,避免两处逻辑漂移。 func (wc *WarpConfig) cleanDomains() []string { - out := make([]string, 0, len(wc.Domains)) - for _, d := range wc.Domains { - d = strings.TrimSpace(strings.ToLower(d)) - if d != "" { - out = append(out, d) - } - } - return out + return cleanHosts(wc.Domains) } // endpointHostPort 拆 Endpoint 为 host + port(active() 已校验可拆)。