feat(hermes): print libp2p peer addresses

This commit is contained in:
Reisen 2023-09-21 10:10:00 +00:00 committed by Ali Behjati
parent 272dbef9b3
commit 4ce04a2abf
1 changed files with 10 additions and 0 deletions

View File

@ -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
}),