// TopServers returns endpoints sorted by criteria (faulty, slow, most used)
// if backendId is not empty, will filter out endpoints for that backendId
354090
func (m *mux) TopServers(beKey *engine.BackendKey) ([]engine.Server, error) {
	m.mtx.RLock()
	defer m.mtx.RUnlock()

	aggregates := make(map[backend.SrvURLKey]rtmcollect.BeSrvEntry)
	for _, fe := range m.filteredFrontends(beKey) {
		fe.AppendAllBeSrvRTMsTo(aggregates)
	}
	beSrvCfgs := make([]engine.Server, 0, len(aggregates))
	for _, beSrvEnt := range aggregates {
		beSrvCfgs = append(beSrvCfgs, beSrvEnt.CfgWithStats())
	}
	sort.Stable(&serverSorter{es: beSrvCfgs})
	return beSrvCfgs, nil
}
1136416
func GetDNSServers(o dhcp6.Options) (IPs, error) {
	v, err := o.GetOne(dhcp6.OptionDNSServers)
	if err != nil {
		return nil, err
	}

	var ips IPs
	err = ips.UnmarshalBinary(v)
	return ips, err
}
261438
func (b *BackendStats) SortedTopRequests() []Request {
	out := make([]Request, 0, len(b.TopRequests))
	for _, req := range b.TopRequests {
		out = append(out, req)
	}
	sort.Slice(out, func(i, j int) bool {
		if out[i].GetFreq() == out[j].GetFreq() {
			return out[i].Count > out[j].Count
		}
		return out[i].GetFreq() > out[j].GetFreq()
	})
	return out
}
260807
func flattenBackendPolicies(backends []*elb.BackendServerDescription) map[int64][]string {
	policies := make(map[int64][]string)
	for _, i := range backends {
		for _, p := range i.PolicyNames {
			policies[*i.InstancePort] = append(policies[*i.InstancePort], *p)
		}
		sort.Strings(policies[*i.InstancePort])
	}
	return policies
}
11897
func (l *lbmapCache) filterNewBackends(backends map[BackendAddrID]ServiceValue) map[BackendAddrID]ServiceValue {
	l.mutex.RLock()
	defer l.mutex.RUnlock()

	newBackends := map[BackendAddrID]ServiceValue{}

	for addrID, b := range backends {
		if _, found := l.backendIDByAddrID[addrID]; !found {
			newBackends[addrID] = b
		}
	}

	return newBackends
}
787731
func getAllServers(w http.ResponseWriter, r *http.Request) {
	mx.RLock()
	defer mx.RUnlock()
	if err := json.NewEncoder(w).Encode(servers); err != nil {
		log.Printf("[JSON Encoding Error] %s", err)
		http.Error(w, err.Error(), http.StatusInternalServerError)
	}
}
656595
func (c *client) clusterEndpoints(ctx context.Context, dbname string) (clusterEndpointsResponse, error) {
	var url string
	if dbname == "" {
		url = "_api/cluster/endpoints"
	} else {
		url = path.Join("_db", pathEscape(dbname), "_api/cluster/endpoints")
	}
	req, err := c.conn.NewRequest("GET", url)
	if err != nil {
		return clusterEndpointsResponse{}, WithStack(err)
	}
	applyContextSettings(ctx, req)
	resp, err := c.conn.Do(ctx, req)
	if err != nil {
		return clusterEndpointsResponse{}, WithStack(err)
	}
	if err := resp.CheckStatus(200); err != nil {
		return clusterEndpointsResponse{}, WithStack(err)
	}
	var data clusterEndpointsResponse
	if err := resp.ParseBody("", &data); err != nil {
		return clusterEndpointsResponse{}, WithStack(err)
	}
	return data, nil
}
250227
func (nc *Conn) Servers() []string {
	nc.mu.RLock()
	defer nc.mu.RUnlock()
	return nc.getServers(false)
}
591424
func (s *BaremetalService) ListBaremetalPxeServers(p *ListBaremetalPxeServersParams) (*ListBaremetalPxeServersResponse, error) {
	resp, err := s.cs.newRequest("listBaremetalPxeServers", p.toURLValues())
	if err != nil {
		return nil, err
	}

	var r ListBaremetalPxeServersResponse
	if err := json.Unmarshal(resp, &r); err != nil {
		return nil, err
	}

	return &r, nil
}
110255
func (m *MockCoreV1Interface) Endpoints(arg0 string) v11.EndpointsInterface {
	ret := m.ctrl.Call(m, "Endpoints", arg0)
	ret0, _ := ret[0].(v11.EndpointsInterface)
	return ret0
}
536042
func (c *Client) GetServers() []string {
	endpoints := c.servers.GetServers()
	res := make([]string, len(endpoints))
	for i := range endpoints {
		res[i] = endpoints[i].String()
	}
	sort.Strings(res)
	return res
}
28890
func (s *SeesawEngine) Vservers(ctx *ipc.Context, reply *seesaw.VserverMap) error {
	s.trace("Vservers", ctx)
	if ctx == nil {
		return errors.New("context is nil")
	}

	if !ctx.IsTrusted() {
		return errors.New("insufficient access")
	}

	if reply == nil {
		return fmt.Errorf("VserverMap is nil")
	}
	reply.Vservers = make(map[string]*seesaw.Vserver)
	s.engine.vserverLock.RLock()
	for name := range s.engine.vserverSnapshots {
		reply.Vservers[name] = s.engine.vserverSnapshots[name]
	}
	s.engine.vserverLock.RUnlock()
	return nil
}
1342723
func ValidateEndpoints(endpoints *api.Endpoints) validation.ErrorList {
	allErrs := ValidateObjectMeta(&endpoints.ObjectMeta, true, ValidateEndpointsName, validation.NewFieldPath("metadata"))
	allErrs = append(allErrs, validateEndpointSubsets(endpoints.Subsets, validation.NewFieldPath("subsets"))...)
	return allErrs
}
706196
func NewResilientServer(base *topo.Server, counterPrefix string) *ResilientServer {
	if *srvTopoCacheRefresh > *srvTopoCacheTTL {
		log.Fatalf("srv_topo_cache_refresh must be less than or equal to srv_topo_cache_ttl")
	}

	return &ResilientServer{
		topoServer:   base,
		cacheTTL:     *srvTopoCacheTTL,
		cacheRefresh: *srvTopoCacheRefresh,
		counts:       stats.NewCountersWithSingleLabel(counterPrefix+"Counts", "Resilient srvtopo server operations", "type"),

		srvKeyspaceNamesCache: make(map[string]*srvKeyspaceNamesEntry),
		srvKeyspaceCache:      make(map[string]*srvKeyspaceEntry),
	}
}
276404
func Convert_core_Endpoints_To_v1_Endpoints(in *core.Endpoints, out *v1.Endpoints, s conversion.Scope) error {
	return autoConvert_core_Endpoints_To_v1_Endpoints(in, out, s)
}
115251
func (s endpointSet) getEndpoints() (endpoints []string) {
	if len(s.endpoints) != 0 {
		return s.endpoints
	}
	for _, argPattern := range s.argPatterns {
		for _, lbls := range argPattern.Expand() {
			endpoints = append(endpoints, strings.Join(lbls, ""))
		}
	}
	s.endpoints = endpoints
	return endpoints
}
204913
func (s *RemoteApplication) Endpoints() ([]Endpoint, error) {
	return remoteEndpointDocsToEndpoints(s.Name(), s.doc.Endpoints), nil
}