1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-06-29 01:12:24 +08:00

use conns to enumerate peers for network diagnostic

This commit is contained in:
Jeromy
2015-01-10 07:43:31 +00:00
committed by Juan Batiz-Benet
parent cac7e025b8
commit a2ec7f28dc

View File

@ -98,7 +98,13 @@ func (di *DiagInfo) Marshal() []byte {
}
func (d *Diagnostics) getPeers() []peer.ID {
return d.host.Network().Peers()
conns := d.host.Network().Conns()
peers := make([]peer.ID, len(conns))
for i, c := range conns {
peers[i] = c.RemotePeer()
}
return peers
}
func (d *Diagnostics) getDiagInfo() *DiagInfo {