code: func (ep *endpoint) Bind(addr tcpip.FullAddress) *tcpip.Error {
  	ep.mu.Lock()
  	defer ep.mu.Unlock()
  
  	// Callers must provide an IPv4 address or no network address (for
  	// binding to a NIC, but not an address).
  	if len(addr.Addr) != 0 && len(addr.Addr) != 4 {
  		return tcpip.ErrInvalidEndpointState
  	}
  
  	// If a local address was specified, verify that it's valid.
  	if len(addr.Addr) == header.IPv4AddressSize && ep.stack.CheckLocalAddress(addr.NIC, ep.netProto, addr.Addr) == 0 {
  		return tcpip.ErrBadLocalAddress
  	}
  
  	// Re-register the endpoint with the appropriate NIC.
  	if err := ep.stack.RegisterRawTransportEndpoint(addr.NIC, ep.netProto, ep.transProto, ep); err != nil {
  		return err
  	}
  	ep.stack.UnregisterRawTransportEndpoint(ep.registeredNIC, ep.netProto, ep.transProto, ep)
  
  	ep.registeredNIC = addr.NIC
  	ep.boundNIC = addr.NIC
  	ep.boundAddr = addr.Addr
  	ep.bound = true
  
  	return nil
  }
docs: // Bind implements tcpip.Endpoint.Bind.