mirror of
https://source.quilibrium.com/quilibrium/ceremonyclient.git
synced 2024-12-27 00:55:17 +00:00
23 lines
456 B
Go
23 lines
456 B
Go
|
package peerstore
|
||
|
|
||
|
import (
|
||
|
"github.com/libp2p/go-libp2p/core/peer"
|
||
|
pstore "github.com/libp2p/go-libp2p/core/peerstore"
|
||
|
)
|
||
|
|
||
|
func PeerInfos(ps pstore.Peerstore, peers peer.IDSlice) []peer.AddrInfo {
|
||
|
pi := make([]peer.AddrInfo, len(peers))
|
||
|
for i, p := range peers {
|
||
|
pi[i] = ps.PeerInfo(p)
|
||
|
}
|
||
|
return pi
|
||
|
}
|
||
|
|
||
|
func PeerInfoIDs(pis []peer.AddrInfo) peer.IDSlice {
|
||
|
ps := make(peer.IDSlice, len(pis))
|
||
|
for i, pi := range pis {
|
||
|
ps[i] = pi.ID
|
||
|
}
|
||
|
return ps
|
||
|
}
|