Skip to content
This repository has been archived by the owner on Dec 7, 2019. It is now read-only.

Commit

Permalink
PeerInfoFromHost helper.
Browse files Browse the repository at this point in the history
  • Loading branch information
raulk committed Oct 24, 2018
1 parent 9609beb commit 16daa76
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions helpers.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package host

import pstore "github.com/libp2p/go-libp2p-peerstore"

// PeerInfoFromHost returns a PeerInfo struct with the Host's ID and all of its Addrs.
func PeerInfoFromHost(h Host) *pstore.PeerInfo {
return &pstore.PeerInfo{
ID: h.ID(),
Addrs: h.Addrs(),
}
}

0 comments on commit 16daa76

Please sign in to comment.