mirror of
https://github.com/whyvl/wireproxy.git
synced 2025-04-29 19:01:42 +02:00
fix config parsing
This commit is contained in:
parent
e749217090
commit
ff99bfd4a6
3 changed files with 100 additions and 9 deletions
16
config.go
16
config.go
|
@ -149,13 +149,17 @@ func parseCIDRNetIP(section *ini.Section, keyName string) ([]netip.Addr, error)
|
|||
keys := key.StringsWithShadows(",")
|
||||
var ips = make([]netip.Addr, 0, len(keys))
|
||||
for _, str := range keys {
|
||||
prefix, err := netip.ParsePrefix(str)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if addr, err := netip.ParseAddr(str); err == nil {
|
||||
ips = append(ips, addr)
|
||||
} else {
|
||||
prefix, err := netip.ParsePrefix(str)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
addr := prefix.Addr()
|
||||
ips = append(ips, addr)
|
||||
addr := prefix.Addr()
|
||||
ips = append(ips, addr)
|
||||
}
|
||||
}
|
||||
return ips, nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue