mirror of
https://source.quilibrium.com/quilibrium/ceremonyclient.git
synced 2024-11-16 05:05: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
|
||
|
}
|