code: func (s *Stack) CheckLocalAddress(nicid tcpip.NICID, protocol tcpip.NetworkProtocolNumber, addr tcpip.Address) tcpip.NICID {
  	s.mu.RLock()
  	defer s.mu.RUnlock()
  
  	// If a NIC is specified, we try to find the address there only.
  	if nicid != 0 {
  		nic := s.nics[nicid]
  		if nic == nil {
  			return 0
  		}
  
  		ref := nic.findEndpoint(protocol, addr, CanBePrimaryEndpoint)
  		if ref == nil {
  			return 0
  		}
  
  		ref.decRef()
  
  		return nic.id
  	}
  
  	// Go through all the NICs.
  	for _, nic := range s.nics {
  		ref := nic.findEndpoint(protocol, addr, CanBePrimaryEndpoint)
  		if ref != nil {
  			ref.decRef()
  			return nic.id
  		}
  	}
  
  	return 0
  }
docs: // CheckLocalAddress determines if the given local address exists, and if it
  // does, returns the id of the NIC it's bound to. Returns 0 if the address
  // does not exist.