chore(daemon): sort listeners (#10480)

This commit is contained in:
Marcin Rataj 2024-08-19 14:23:14 +02:00 committed by GitHub
parent 0d428310b2
commit 34008b6ffa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -818,7 +818,17 @@ func printLibp2pPorts(node *core.IpfsNode) {
addrMap[host][protocol] = struct{}{}
}
}
for host, protocolsSet := range addrMap {
// Produce a sorted host:port list
hosts := make([]string, 0, len(addrMap))
for host := range addrMap {
hosts = append(hosts, host)
}
sort.Strings(hosts)
// Print listeners
for _, host := range hosts {
protocolsSet := addrMap[host]
protocols := make([]string, 0, len(protocolsSet))
for protocol := range protocolsSet {
protocols = append(protocols, protocol)