code: func (m *Manager) BindRemote(ctx context.Context, addrs RemoteAddrs) error {
  	m.addrMu.Lock()
  	defer m.addrMu.Unlock()
  
  	if m.config.RemoteAPI != nil {
  		return errors.New("manager already has remote API address")
  	}
  
  	// If an AdvertiseAddr was specified, we use that as our
  	// externally-reachable address.
  	advertiseAddr := addrs.AdvertiseAddr
  
  	var advertiseAddrPort string
  	if advertiseAddr == "" {
  		// Otherwise, we know we are joining an existing swarm. Use a
  		// wildcard address to trigger remote autodetection of our
  		// address.
  		var err error
  		_, advertiseAddrPort, err = net.SplitHostPort(addrs.ListenAddr)
  		if err != nil {
  			return fmt.Errorf("missing or invalid listen address %s", addrs.ListenAddr)
  		}
  
  		// Even with an IPv6 listening address, it's okay to use
  		// 0.0.0.0 here. Any "unspecified" (wildcard) IP will
  		// be substituted with the actual source address.
  		advertiseAddr = net.JoinHostPort("0.0.0.0", advertiseAddrPort)
  	}
  
  	l, err := net.Listen("tcp", addrs.ListenAddr)
  	if err != nil {
  		return errors.Wrap(err, "failed to listen on remote API address")
  	}
  	if advertiseAddrPort == "0" {
  		advertiseAddr = l.Addr().String()
  		addrs.ListenAddr = advertiseAddr
  	}
  
  	m.config.RemoteAPI = &addrs
  
  	m.raftNode.SetAddr(ctx, advertiseAddr)
  	m.remoteListener <- l
  
  	return nil
  }
docs: // BindRemote binds a port for the remote API.