An easy-to-use tracker for Iroh NodeId's in GossipSub topics. This library includes a hosted iroh-topic-tracker BOOTSTRAP_NODE to facilitate seamless tracking.
-
Get the last connected NodeId's for a given gossip topic:
cargo run --example client
-
Run your own dedicated topic tracker node:
cargo run --example server
(Note: Adjust the
secret.rs
SecretKey to ensure secure communication and update theBOOTSTRAP_NODES
public key intopic_tracker.rs
(line ~33) to correctly point to the desired bootstrap node for discovery.)
To build the server in release mode:
cargo build --release --example server
Refer to the examples below for quick guidance:
use iroh_topic_tracker::topic_tracker::TopicTracker;
let topic = Topic::from_passphrase("my topic name");
let topic_tracker = TopicTracker::new(&endpoint);
topic_tracker.get_topic_nodes(&topic).await?;
use iroh_topic_tracker::topic_tracker::TopicTracker;
let topic = Topic::from_passphrase("my test topic");
let endpoint = Endpoint::builder()
.secret_key(SecretKey::generate(rand::rngs::OsRng))
.discovery_n0()
.discovery_dht()
.bind()
.await?;
let topic_tracker = TopicTracker::new(&endpoint);
let router = Router::builder(endpoint.clone())
.accept(TopicTracker::ALPN, topic_tracker.clone())
.spawn()
.await?;
topic_tracker.get_topic_nodes(&topic).await?;