code: func endpointsToEndpointsMap(endpoints *v1.Endpoints, hostname string, hns HostNetworkService) proxyEndpointsMap {
  	if endpoints == nil {
  		return nil
  	}
  
  	endpointsMap := make(proxyEndpointsMap)
  	// We need to build a map of portname -> all ip:ports for that
  	// portname.  Explode Endpoints.Subsets[*] into this structure.
  	for i := range endpoints.Subsets {
  		ss := &endpoints.Subsets[i]
  		for i := range ss.Ports {
  			port := &ss.Ports[i]
  			if port.Port == 0 {
  				klog.Warningf("Ignoring invalid endpoint port %s", port.Name)
  				continue
  			}
  			svcPortName := proxy.ServicePortName{
  				NamespacedName: types.NamespacedName{Namespace: endpoints.Namespace, Name: endpoints.Name},
  				Port:           port.Name,
  			}
  			for i := range ss.Addresses {
  				addr := &ss.Addresses[i]
  				if addr.IP == "" {
  					klog.Warningf("Ignoring invalid endpoint port %s with empty host", port.Name)
  					continue
  				}
  				isLocal := addr.NodeName != nil && *addr.NodeName == hostname
  				epInfo := newEndpointInfo(addr.IP, uint16(port.Port), isLocal, hns)
  				endpointsMap[svcPortName] = append(endpointsMap[svcPortName], epInfo)
  			}
  			if klog.V(3) {
  				newEPList := []*endpointsInfo{}
  				for _, ep := range endpointsMap[svcPortName] {
  					newEPList = append(newEPList, ep)
  				}
  				klog.Infof("Setting endpoints for %q to %+v", svcPortName, newEPList)
  			}
  		}
  	}
  	return endpointsMap
  }
docs: // Translates single Endpoints object to proxyEndpointsMap.
  // This function is used for incremental updated of endpointsMap.
  //
  // NOTE: endpoints object should NOT be modified.