Clean up network/* packages, revamp online status detection

This commit is contained in:
Daniel
2019-10-25 13:33:36 +02:00
parent c72f956fe8
commit fdb5f6fcf7
27 changed files with 738 additions and 268 deletions

View File

@@ -10,7 +10,7 @@ const (
Global
LocalMulticast
GlobalMulticast
Invalid
Invalid int8 = -1
)
// ClassifyIP returns the classification for the given IP address.
@@ -77,9 +77,7 @@ func IPIsLocalhost(ip net.IP) bool {
// IPIsLAN returns true if the given IP is a site-local or link-local address.
func IPIsLAN(ip net.IP) bool {
switch ClassifyIP(ip) {
case SiteLocal:
return true
case LinkLocal:
case SiteLocal, LinkLocal:
return true
default:
return false