mirror of https://github.com/bjdgyc/anylink.git
ports初始化
This commit is contained in:
parent
8df34428dd
commit
38b8f0b2aa
|
@ -164,6 +164,7 @@ func SetGroup(g *Group) error {
|
||||||
}
|
}
|
||||||
v.IpNet = ipNet
|
v.IpNet = ipNet
|
||||||
if regexp.MustCompile(`^\d{1,5}(,\d{1,5})*$`).MatchString(v.PortStr) {
|
if regexp.MustCompile(`^\d{1,5}(,\d{1,5})*$`).MatchString(v.PortStr) {
|
||||||
|
ports := []uint16{}
|
||||||
for _, port := range strings.Split(v.PortStr, ",") {
|
for _, port := range strings.Split(v.PortStr, ",") {
|
||||||
if port == "" {
|
if port == "" {
|
||||||
continue
|
continue
|
||||||
|
@ -172,8 +173,9 @@ func SetGroup(g *Group) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.New("端口:"+port+" 格式错误, " + err.Error())
|
return errors.New("端口:"+port+" 格式错误, " + err.Error())
|
||||||
}
|
}
|
||||||
v.Ports = append(v.Ports, uint16(portInt))
|
ports = append(ports, uint16(portInt))
|
||||||
}
|
}
|
||||||
|
v.Ports = ports
|
||||||
linkAcl = append(linkAcl, v)
|
linkAcl = append(linkAcl, v)
|
||||||
} else {
|
} else {
|
||||||
return errors.New("端口: "+v.PortStr+" 格式错误,请用逗号分隔的端口列表,比如: 22,80,443")
|
return errors.New("端口: "+v.PortStr+" 格式错误,请用逗号分隔的端口列表,比如: 22,80,443")
|
||||||
|
|
Loading…
Reference in New Issue