换成单集群模式

This commit is contained in:
robin
2026-03-02 20:07:53 +08:00
parent 5d0b7c7e91
commit 2a76d1773d
432 changed files with 5681 additions and 5095 deletions

View File

@@ -173,6 +173,10 @@ func (this *DDoSProtectionManager) addTCPRules(tcpConfig *ddosconfigs.TCPConfig)
var ports = []int32{}
for _, portConfig := range tcpConfig.Ports {
// 校验端口范围
if portConfig.Port <= 0 || portConfig.Port > 65535 {
continue
}
if !lists.ContainsInt32(ports, portConfig.Port) {
ports = append(ports, portConfig.Port)
}
@@ -367,7 +371,19 @@ func (this *DDoSProtectionManager) encodeUserData(attrs []string) string {
return ""
}
return "ZZ" + strings.Join(attrs, "_") + "ZZ"
// 清洗每个属性值,只保留字母、数字和横杠
var safeAttrs = make([]string, len(attrs))
for i, attr := range attrs {
var safe strings.Builder
for _, c := range attr {
if (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c == '-' {
safe.WriteRune(c)
}
}
safeAttrs[i] = safe.String()
}
return "ZZ" + strings.Join(safeAttrs, "_") + "ZZ"
}
// 解码user data