Fix PrefixFromNet

This commit is contained in:
世界 2024-05-29 15:30:41 +08:00
parent 967afcf6c1
commit ba68e017a9
No known key found for this signature in database
GPG key ID: CD109927C34A63C4

View file

@ -161,7 +161,7 @@ func PrefixFromNet(netAddr net.Addr) netip.Prefix {
switch addr := netAddr.(type) {
case *net.IPNet:
bits, _ := addr.Mask.Size()
return netip.PrefixFrom(AddrFromIP(addr.IP), bits)
return netip.PrefixFrom(AddrFromIP(addr.IP).Unmap(), bits)
default:
return netip.Prefix{}
}