func deriveScope(addr MachineAddress) Scope {
	if addr.Type == HostName {
		return addr.Scope
	}
	ip := net.ParseIP(addr.Value)
	if ip == nil {
		return addr.Scope
	}
	if ip.IsLoopback() {
		return ScopeMachineLocal
	}
	if isIPv4PrivateNetworkAddress(addr.Type, ip) ||
		isIPv6UniqueLocalAddress(addr.Type, ip) {
		return ScopeCloudLocal
	}
	if isIPv4ReservedEAddress(addr.Type, ip) {
		return ScopeFanLocal
	}

	if ip.IsLinkLocalMulticast() ||
		ip.IsLinkLocalUnicast() ||
		ip.IsInterfaceLocalMulticast() {
		return ScopeLinkLocal
	}
	if ip.IsGlobalUnicast() {
		return ScopePublic
	}
	return addr.Scope
}
// deriveScope attempts to derive the network scope from an address'
// type and value, returning the original network scope if no
// deduction can be made.
deriveScope attempts to derive the network scope from an address'
type and value, returning the original network scope if no
deduction can be made.
// deriveScope attempts to derive the network scope from an address ' // type and value returning the original network scope if no // deduction can be made .
func deriveScope(addr MachineAddress) Scope {
	if addr.Type == HostName {
		return addr.Scope
	}
	ip := net.ParseIP(addr.Value)
	if ip == nil {
		return addr.Scope
	}
	if ip.IsLoopback() {
		return ScopeMachineLocal
	}
	if isIPv4PrivateNetworkAddress(addr.Type, ip) ||
		isIPv6UniqueLocalAddress(addr.Type, ip) {
		return ScopeCloudLocal
	}
	if isIPv4ReservedEAddress(addr.Type, ip) {
		return ScopeFanLocal
	}
	if ip.IsLinkLocalMulticast() ||
		ip.IsLinkLocalUnicast() ||
		ip.IsInterfaceLocalMulticast() {
		return ScopeLinkLocal
	}
	if ip.IsGlobalUnicast() {
		return ScopePublic
	}
	return addr.Scope
}
func deriveScope ( addr MachineAddress ) Scope { if addr . Type == HostName { return addr . Scope } ip := net . ParseIP ( addr . Value ) if ip == nil { return addr . Scope } if ip . IsLoopback ( ) { return ScopeMachineLocal } if isIPv4PrivateNetworkAddress ( addr . Type , ip ) || isIPv6UniqueLocalAddress ( addr . Type , ip ) { return ScopeCloudLocal } if isIPv4ReservedEAddress ( addr . Type , ip ) { return ScopeFanLocal } if ip . IsLinkLocalMulticast ( ) || ip . IsLinkLocalUnicast ( ) || ip . IsInterfaceLocalMulticast ( ) { return ScopeLinkLocal } if ip . IsGlobalUnicast ( ) { return ScopePublic } return addr . Scope }
deriveScope attempts to derive the network scope from an address'
type and value, returning the original network scope if no
deduction can be made.
deriveScope attempts to derive the network scope from an address ' type and value returning the original network scope if no deduction can be made .