@cryptotaxi247 / kubo / commits / 34008b6ff

chore(daemon): sort listeners (#10480)

Marcin Rataj committed Aug 19, 2024 at 14:23 UTC 34008b6ffa1295a6dfd8f5bb8fd488975b212f60
1 file changed +11 -1
cmd/ipfs/kubo/daemon.go
+11 -1
@@ -818,7 +818,17 @@ func printLibp2pPorts(node *core.IpfsNode) {
818 addrMap[host][protocol] = struct{}{}
819 }
820 }
821 - for host, protocolsSet := range addrMap {
821 +
822 + // Produce a sorted host:port list
823 + hosts := make([]string, 0, len(addrMap))
824 + for host := range addrMap {
825 + hosts = append(hosts, host)
826 + }
827 + sort.Strings(hosts)
828 +
829 + // Print listeners
830 + for _, host := range hosts {
831 + protocolsSet := addrMap[host]
832 protocols := make([]string, 0, len(protocolsSet))
833 for protocol := range protocolsSet {
834 protocols = append(protocols, protocol)