code: func (a *AddrManager) HostToNetAddress(host string, port uint16, services wire.ServiceFlag) (*wire.NetAddress, error) {
  	// Tor address is 16 char base32 + ".onion"
  	var ip net.IP
  	if len(host) == 22 && host[16:] == ".onion" {
  		// go base32 encoding uses capitals (as does the rfc
  		// but Tor and bitcoind tend to user lowercase, so we switch
  		// case here.
  		data, err := base32.StdEncoding.DecodeString(
  			strings.ToUpper(host[:16]))
  		if err != nil {
  			return nil, err
  		}
  		prefix := []byte{0xfd, 0x87, 0xd8, 0x7e, 0xeb, 0x43}
  		ip = net.IP(append(prefix, data...))
  	} else if ip = net.ParseIP(host); ip == nil {
  		ips, err := a.lookupFunc(host)
  		if err != nil {
  			return nil, err
  		}
  		if len(ips) == 0 {
  			return nil, fmt.Errorf("no addresses found for %s", host)
  		}
  		ip = ips[0]
  	}
  
  	return wire.NewNetAddressIPPort(ip, port, services), nil
  }
docs: // HostToNetAddress returns a netaddress given a host address.  If the address
  // is a Tor .onion address this will be taken care of.  Else if the host is
  // not an IP address it will be resolved (via Tor if required).