mirror of
https://gitclone.com/github.com/MetaCubeX/Clash.Meta
synced 2025-02-23 02:53:15 +08:00
parent
5af7f4e847
commit
288899a473
@ -41,9 +41,8 @@ func ResolveInterface(name string) (*Interface, error) {
|
||||
ipNets := make([]netip.Prefix, 0, len(addrs))
|
||||
for _, addr := range addrs {
|
||||
var pf netip.Prefix
|
||||
switch addr.(type) {
|
||||
switch ipNet := addr.(type) {
|
||||
case *net.IPNet:
|
||||
ipNet := addr.(*net.IPNet)
|
||||
ip, _ := netip.AddrFromSlice(ipNet.IP)
|
||||
ones, bits := ipNet.Mask.Size()
|
||||
if bits == 32 {
|
||||
@ -51,7 +50,6 @@ func ResolveInterface(name string) (*Interface, error) {
|
||||
}
|
||||
pf = netip.PrefixFrom(ip, ones)
|
||||
case *net.IPAddr:
|
||||
ipNet := addr.(*net.IPAddr)
|
||||
ip, _ := netip.AddrFromSlice(ipNet.IP)
|
||||
ip = ip.Unmap()
|
||||
pf = netip.PrefixFrom(ip, ip.BitLen())
|
||||
|
Loading…
Reference in New Issue
Block a user