code: func addrStringToNetAddr(addr string) (net.Addr, error) {
  	host, strPort, err := net.SplitHostPort(addr)
  	if err != nil {
  		return nil, err
  	}
  
  	port, err := strconv.Atoi(strPort)
  	if err != nil {
  		return nil, err
  	}
  
  	// Skip if host is already an IP address.
  	if ip := net.ParseIP(host); ip != nil {
  		return &net.TCPAddr{
  			IP:   ip,
  			Port: port,
  		}, nil
  	}
  
  	// Tor addresses cannot be resolved to an IP, so just return an onion
  	// address instead.
  	if strings.HasSuffix(host, ".onion") {
  		if cfg.NoOnion {
  			return nil, errors.New("tor has been disabled")
  		}
  
  		return &onionAddr{addr: addr}, nil
  	}
  
  	// Attempt to look up an IP address associated with the parsed host.
  	ips, err := btcdLookup(host)
  	if err != nil {
  		return nil, err
  	}
  	if len(ips) == 0 {
  		return nil, fmt.Errorf("no addresses found for %s", host)
  	}
  
  	return &net.TCPAddr{
  		IP:   ips[0],
  		Port: port,
  	}, nil
  }
docs: // addrStringToNetAddr takes an address in the form of 'host:port' and returns
  // a net.Addr which maps to the original address with any host names resolved
  // to IP addresses.  It also handles tor addresses properly by returning a
  // net.Addr that encapsulates the address.