MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / normalizeClusterNodes

Function normalizeClusterNodes

internal/home/client.go:403–419  ·  view source on GitHub ↗
(nodes []clusterNode)

Source from the content-addressed store, hash-verified

401}
402
403func normalizeClusterNodes(nodes []clusterNode) []clusterNode {
404 out := make([]clusterNode, 0, len(nodes))
405 for _, node := range nodes {
406 node.IP = strings.TrimSpace(node.IP)
407 if node.IP == "" || node.Port <= 0 {
408 continue
409 }
410 if node.ClientCount < 0 {
411 node.ClientCount = 0
412 }
413 out = append(out, node)
414 }
415 sort.SliceStable(out, func(i, j int) bool {
416 return out[i].ClientCount < out[j].ClientCount
417 })
418 return out
419}
420
421func (c *Client) switchToNodeLocked(node clusterNode) bool {
422 host := strings.TrimSpace(node.IP)

Callers 1

parseClusterNodesPayloadFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected