mirror of
https://github.com/SagerNet/sing.git
synced 2025-04-06 05:17:38 +03:00
10 lines
246 B
Go
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
|
|
}
|