func IsRoutable(na *wire.NetAddress) bool {
	return IsValid(na) && !(IsRFC1918(na) || IsRFC2544(na) ||
		IsRFC3927(na) || IsRFC4862(na) || IsRFC3849(na) ||
		IsRFC4843(na) || IsRFC5737(na) || IsRFC6598(na) ||
		IsLocal(na) || (IsRFC4193(na) && !IsOnionCatTor(na)))
}
IsRoutable returns whether or not the passed address is routable over
the public internet.  This is true as long as the address is valid and is not
in any reserved ranges.
package addrmgr
import (
	"fmt"
	"net"
	"github.com/HcashOrg/hcashd/wire"
)
var (
	rfc1918Nets = []net.IPNet{
		ipNet("10.0.0.0", 8, 32),
		ipNet("172.16.0.0", 12, 32),
		ipNet("192.168.0.0", 16, 32),
	}
	rfc2544Net = ipNet("198.18.0.0", 15, 32)
	rfc3849Net = ipNet("2001:DB8::", 32, 128)
	rfc3927Net = ipNet("169.254.0.0", 16, 32)
	rfc3964Net = ipNet("2002::", 16, 128)
	rfc4193Net = ipNet("FC00::", 7, 128)
	rfc4380Net = ipNet("2001::", 32, 128)
	rfc4843Net = ipNet("2001:10::", 28, 128)
	rfc4862Net = ipNet("FE80::", 64, 128)
	rfc5737Net = []net.IPNet{
		ipNet("192.0.2.0", 24, 32),
		ipNet("198.51.100.0", 24, 32),
		ipNet("203.0.113.0", 24, 32),
	}
	rfc6052Net = ipNet("64:FF9B::", 96, 128)
	rfc6145Net = ipNet("::FFFF:0:0:0", 96, 128)
	rfc6598Net = ipNet("100.64.0.0", 10, 32)
	onionCatNet = ipNet("fd87:d87e:eb43::", 48, 128)
	zero4Net = ipNet("0.0.0.0", 8, 32)
	heNet = ipNet("2001:470::", 32, 128)
)
func ipNet(ip string, ones, bits int) net.IPNet {
	return net.IPNet{IP: net.ParseIP(ip), Mask: net.CIDRMask(ones, bits)}
}
func IsIPv4(na *wire.NetAddress) bool {
	return na.IP.To4() != nil
}
func IsLocal(na *wire.NetAddress) bool {
	return na.IP.IsLoopback() || zero4Net.Contains(na.IP)
}
func IsOnionCatTor(na *wire.NetAddress) bool {
	return onionCatNet.Contains(na.IP)
}
func IsRFC1918(na *wire.NetAddress) bool {
	for _, rfc := range rfc1918Nets {
		if rfc.Contains(na.IP) {
			return true
		}
	}
	return false
}
func IsRFC2544(na *wire.NetAddress) bool {
	return rfc2544Net.Contains(na.IP)
}
func IsRFC3849(na *wire.NetAddress) bool {
	return rfc3849Net.Contains(na.IP)
}
func IsRFC3927(na *wire.NetAddress) bool {
	return rfc3927Net.Contains(na.IP)
}
func IsRFC3964(na *wire.NetAddress) bool {
	return rfc3964Net.Contains(na.IP)
}
func IsRFC4193(na *wire.NetAddress) bool {
	return rfc4193Net.Contains(na.IP)
}
func IsRFC4380(na *wire.NetAddress) bool {
	return rfc4380Net.Contains(na.IP)
}
func IsRFC4843(na *wire.NetAddress) bool {
	return rfc4843Net.Contains(na.IP)
}
func IsRFC4862(na *wire.NetAddress) bool {
	return rfc4862Net.Contains(na.IP)
}
func IsRFC5737(na *wire.NetAddress) bool {
	for _, rfc := range rfc5737Net {
		if rfc.Contains(na.IP) {
			return true
		}
	}
	return false
}
func IsRFC6052(na *wire.NetAddress) bool {
	return rfc6052Net.Contains(na.IP)
}
func IsRFC6145(na *wire.NetAddress) bool {
	return rfc6145Net.Contains(na.IP)
}
func IsRFC6598(na *wire.NetAddress) bool {
	return rfc6598Net.Contains(na.IP)
}
func IsValid(na *wire.NetAddress) bool {
	return na.IP != nil && !(na.IP.IsUnspecified() ||
		na.IP.Equal(net.IPv4bcast))
}