code: func (n *NIC) primaryEndpoint(protocol tcpip.NetworkProtocolNumber) *referencedNetworkEndpoint {
  	n.mu.RLock()
  	defer n.mu.RUnlock()
  
  	list := n.primary[protocol]
  	if list == nil {
  		return nil
  	}
  
  	for e := list.Front(); e != nil; e = e.Next() {
  		r := e.(*referencedNetworkEndpoint)
  		// TODO(crawshaw): allow broadcast address when SO_BROADCAST is set.
  		switch r.ep.ID().LocalAddress {
  		case header.IPv4Broadcast, header.IPv4Any:
  			continue
  		}
  		if r.tryIncRef() {
  			return r
  		}
  	}
  
  	return nil
  }
docs: // primaryEndpoint returns the primary endpoint of n for the given network
  // protocol.