netaddress.go
func NewNetAddressString(addr string) (*NetAddress, error) {

	host, portStr, err := net.SplitHostPort(addr)
	if err != nil {
		return nil, err
	}

	ip := net.ParseIP(host)
	if ip == nil {
		if len(host) > 0 {
			ips, err := net.LookupIP(host)
			if err != nil {
				return nil, err
			}
			ip = ips[0]
		}
	}

	port, err := strconv.ParseUint(portStr, 10, 16)
	if err != nil {
		return nil, err
	}

	na := NewNetAddressIPPort(ip, uint16(port))
	return na, nil
}
func NewNetAddressString(addr string) (*NetAddress, error) {

	host, portStr, err := net.SplitHostPort(addr)
	if err != nil {
		return nil, err
	}

	ip := net.ParseIP(host)
	if ip == nil {
		if len(host) > 0 {
			ips, err := net.LookupIP(host)
			if err != nil {
				return nil, err
			}
			ip = ips[0]
		}
	}

	port, err := strconv.ParseUint(portStr, 10, 16)
	if err != nil {
		return nil, err
	}

	na := NewNetAddressIPPort(ip, uint16(port))
	return na, nil
}
func NewNetAddressString ( addr string ) ( * NetAddress , error ) { host , portStr , err := net . SplitHostPort ( addr ) if err != nil { return nil , err } ip := net . ParseIP ( host ) if ip == nil { if len ( host ) > 0 { ips , err := net . LookupIP ( host ) if err != nil { return nil , err } ip = ips [ 0 ] } } port , err := strconv . ParseUint ( portStr , 10 , 16 ) if err != nil { return nil , err } na := NewNetAddressIPPort ( ip , uint16 ( port ) ) return na , nil }
// NewNetAddressString returns a new NetAddress using the provided
// address in the form of "IP:Port". Also resolves the host if host
// is not an IP.
NewNetAddressString returns a new NetAddress using the provided address in the form of IP : Port . Also resolves the host if host is not an IP .