code: func addLocalAddress(addrMgr *addrmgr.AddrManager, addr string, services wire.ServiceFlag) error {
  	host, portStr, err := net.SplitHostPort(addr)
  	if err != nil {
  		return err
  	}
  	port, err := strconv.ParseUint(portStr, 10, 16)
  	if err != nil {
  		return err
  	}
  
  	if ip := net.ParseIP(host); ip != nil && ip.IsUnspecified() {
  		// If bound to unspecified address, advertise all local interfaces
  		addrs, err := net.InterfaceAddrs()
  		if err != nil {
  			return err
  		}
  
  		for _, addr := range addrs {
  			ifaceIP, _, err := net.ParseCIDR(addr.String())
  			if err != nil {
  				continue
  			}
  
  			// If bound to 0.0.0.0, do not add IPv6 interfaces and if bound to
  			// ::, do not add IPv4 interfaces.
  			if (ip.To4() == nil) != (ifaceIP.To4() == nil) {
  				continue
  			}
  
  			netAddr := wire.NewNetAddressIPPort(ifaceIP, uint16(port), services)
  			addrMgr.AddLocalAddress(netAddr, addrmgr.BoundPrio)
  		}
  	} else {
  		netAddr, err := addrMgr.HostToNetAddress(host, uint16(port), services)
  		if err != nil {
  			return err
  		}
  
  		addrMgr.AddLocalAddress(netAddr, addrmgr.BoundPrio)
  	}
  
  	return nil
  }
docs: // addLocalAddress adds an address that this node is listening on to the
  // address manager so that it may be relayed to peers.