Refactor: metadata use netip.Addr
This commit is contained in:
10
rule/base.go
10
rule/base.go
@@ -2,7 +2,7 @@ package rules
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"net"
|
||||
"net/netip"
|
||||
"strings"
|
||||
|
||||
C "github.com/Dreamacro/clash/constant"
|
||||
@@ -50,17 +50,17 @@ func findNetwork(params []string) C.NetWork {
|
||||
return C.ALLNet
|
||||
}
|
||||
|
||||
func findSourceIPs(params []string) []*net.IPNet {
|
||||
var ips []*net.IPNet
|
||||
func findSourceIPs(params []string) []*netip.Prefix {
|
||||
var ips []*netip.Prefix
|
||||
for _, p := range params {
|
||||
if p == noResolve || len(p) < 7 {
|
||||
continue
|
||||
}
|
||||
_, ipnet, err := net.ParseCIDR(p)
|
||||
ipnet, err := netip.ParsePrefix(p)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
ips = append(ips, ipnet)
|
||||
ips = append(ips, &ipnet)
|
||||
}
|
||||
|
||||
if len(ips) > 0 {
|
||||
|
||||
Reference in New Issue
Block a user