Skip to content

Commit

Permalink
feat(hermes): print libp2p peer addresses
Browse files Browse the repository at this point in the history
  • Loading branch information
Reisen authored and ali-bahjati committed Sep 21, 2023
1 parent 272dbef commit 4ce04a2
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions hermes/src/network/p2p.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,16 @@ func RegisterObservationCallback(f C.callback_t, network_id, bootstrap_addrs, li
idht, err := dht.New(ctx, h, dht.Mode(dht.ModeServer),
dht.ProtocolPrefix(protocol.ID("/"+networkID)),
dht.BootstrapPeers(bootstrappers...),
dht.RoutingTableFilter(func(dht interface{}, p peer.ID) bool {
peerInfo := h.Peerstore().PeerInfo(p)
fmt.Printf("Accepted Peer: %s; Addresses: ", peerInfo.ID)
for _, addr := range peerInfo.Addrs {
fmt.Printf("%s ", addr)
}
fmt.Println("")

return true
}),
)
return idht, err
}),
Expand Down

0 comments on commit 4ce04a2

Please sign in to comment.