Fix public addr check

This commit is contained in:
世界 2022-07-16 10:18:30 +08:00
parent 09b55ce4b6
commit bd79d31e3b
No known key found for this signature in database
GPG key ID: CD109927C34A63C4
2 changed files with 2 additions and 2 deletions

View file

@ -10,7 +10,7 @@ linters-settings:
gci: gci:
sections: sections:
- standard - standard
- prefix(github.com/sagernet/sing) - prefix(github.com/sagernet/)
- default - default
staticcheck: staticcheck:
go: '1.18' go: '1.18'

View file

@ -17,7 +17,7 @@ func LocalAddrs() ([]netip.Addr, error) {
} }
func IsPublicAddr(addr netip.Addr) bool { func IsPublicAddr(addr netip.Addr) bool {
return !(addr.IsPrivate() || addr.IsLoopback() || addr.IsMulticast() || addr.IsGlobalUnicast() || addr.IsLinkLocalUnicast() || addr.IsInterfaceLocalMulticast()) return !(addr.IsPrivate() || addr.IsLoopback() || addr.IsMulticast() || addr.IsLinkLocalUnicast() || addr.IsInterfaceLocalMulticast())
} }
func LocalPublicAddrs() ([]netip.Addr, error) { func LocalPublicAddrs() ([]netip.Addr, error) {