sing/common/metadata/network.go
2022-04-12 22:50:23 +08:00

10 lines
246 B
Go

package metadata
import "net/netip"
func NetworkFromNetAddr(network string, addr netip.Addr) string {
if addr.Is4() && (addr.IsUnspecified() || addr.IsGlobalUnicast() || addr.IsLinkLocalUnicast()) {
return network + "4"
}
return network
}