code: func (t *NetTransport) FinalAdvertiseAddr(ip string, port int) (net.IP, int, error) {
  	var advertiseAddr net.IP
  	var advertisePort int
  	if ip != "" {
  		// If they've supplied an address, use that.
  		advertiseAddr = net.ParseIP(ip)
  		if advertiseAddr == nil {
  			return nil, 0, fmt.Errorf("Failed to parse advertise address %q", ip)
  		}
  
  		// Ensure IPv4 conversion if necessary.
  		if ip4 := advertiseAddr.To4(); ip4 != nil {
  			advertiseAddr = ip4
  		}
  		advertisePort = port
  	} else {
  		if t.config.BindAddrs[0] == "0.0.0.0" {
  			// Otherwise, if we're not bound to a specific IP, let's
  			// use a suitable private IP address.
  			var err error
  			ip, err = sockaddr.GetPrivateIP()
  			if err != nil {
  				return nil, 0, fmt.Errorf("Failed to get interface addresses: %v", err)
  			}
  			if ip == "" {
  				return nil, 0, fmt.Errorf("No private IP address found, and explicit IP not provided")
  			}
  
  			advertiseAddr = net.ParseIP(ip)
  			if advertiseAddr == nil {
  				return nil, 0, fmt.Errorf("Failed to parse advertise address: %q", ip)
  			}
  		} else {
  			// Use the IP that we're bound to, based on the first
  			// TCP listener, which we already ensure is there.
  			advertiseAddr = t.tcpListeners[0].Addr().(*net.TCPAddr).IP
  		}
  
  		// Use the port we are bound to.
  		advertisePort = t.GetAutoBindPort()
  	}
  
  	return advertiseAddr, advertisePort, nil
  }
docs: // See Transport.