every.channel: sanitized baseline
This commit is contained in:
commit
897e556bea
258 changed files with 74298 additions and 0 deletions
21
third_party/iroh-org/iroh-gossip/examples/setup.rs
vendored
Normal file
21
third_party/iroh-org/iroh-gossip/examples/setup.rs
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
use iroh::{protocol::Router, Endpoint};
|
||||
use iroh_gossip::{net::Gossip, ALPN};
|
||||
use n0_error::{Result, StdResultExt};
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<()> {
|
||||
// create an iroh endpoint that includes the standard address lookup mechanisms
|
||||
// we've built at number0
|
||||
let endpoint = Endpoint::bind().await?;
|
||||
|
||||
// build gossip protocol
|
||||
let gossip = Gossip::builder().spawn(endpoint.clone());
|
||||
|
||||
// setup router
|
||||
let router = Router::builder(endpoint.clone())
|
||||
.accept(ALPN, gossip.clone())
|
||||
.spawn();
|
||||
// do fun stuff with the gossip protocol
|
||||
router.shutdown().await.std_context("shutdown router")?;
|
||||
Ok(())
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue