refactor(agent): cleanDomains 委托 cleanHosts,消除同包重复逻辑
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -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() 已校验可拆)。
|
||||
|
||||
Reference in New Issue
Block a user