修复数字转换问题

This commit is contained in:
bjdgyc 2024-07-04 16:26:05 +08:00
parent 00bbbf414d
commit 726ae20f75
1 changed files with 5 additions and 3 deletions

View File

@ -181,11 +181,13 @@ func SetGroup(g *Group) error {
}
if regexp.MustCompile(`^\d{1,5}-\d{1,5}$`).MatchString(p) {
rp := strings.Split(p, "-")
portfrom, err := strconv.Atoi(rp[0])
// portfrom, err := strconv.Atoi(rp[0])
portfrom, err := strconv.ParseUint(rp[0], 10, 16)
if err != nil {
return errors.New("端口:" + rp[0] + " 格式错误, " + err.Error())
}
portto, err := strconv.Atoi(rp[1])
// portto, err := strconv.Atoi(rp[1])
portto, err := strconv.ParseUint(rp[1], 10, 16)
if err != nil {
return errors.New("端口:" + rp[1] + " 格式错误, " + err.Error())
}
@ -194,7 +196,7 @@ func SetGroup(g *Group) error {
}
} else {
port, err := strconv.Atoi(p)
port, err := strconv.ParseUint(p, 10, 16)
if err != nil {
return errors.New("端口:" + p + " 格式错误, " + err.Error())
}