refactor: 大型重构

This commit is contained in:
ZacharyZcR
2024-12-20 14:19:23 +08:00
parent bdeabec67e
commit 1278a0355f
2 changed files with 14 additions and 45 deletions
+14
View File
@@ -9,6 +9,20 @@ import (
// ParsePort 解析端口配置字符串为端口号列表
func ParsePort(ports string) []int {
// 预定义的端口组
portGroups := map[string]string{
"service": ServicePorts,
"db": DbPorts,
"web": WebPorts,
"all": AllPorts,
"main": MainPorts,
}
// 检查是否匹配预定义组
if definedPorts, exists := portGroups[ports]; exists {
ports = definedPorts
}
if ports == "" {
return nil
}