-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: add "Getting Started" to the README and add the readme to the d…
…ocs (#19) * add "Getting Started" to the README and add the readme to the docs * add readme code to an example * add deny from other protos --------- Co-authored-by: “ramfox” <“kasey@n0.computer”> Co-authored-by: Ruediger Klaehn <rklaehn@protonmail.com>
- Loading branch information
1 parent
2d90828
commit 1625123
Showing
4 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
use iroh::{protocol::Router, Endpoint}; | ||
use iroh_gossip::{net::Gossip, ALPN}; | ||
|
||
#[tokio::main] | ||
async fn main() -> anyhow::Result<()> { | ||
// create an iroh endpoint that includes the standard discovery mechanisms | ||
// we've built at number0 | ||
let endpoint = Endpoint::builder().discovery_n0().bind().await?; | ||
|
||
// build gossip protocol | ||
let gossip = Gossip::builder().spawn(endpoint.clone()).await?; | ||
|
||
// setup router | ||
let router = Router::builder(endpoint.clone()) | ||
.accept(ALPN, gossip.clone()) | ||
.spawn() | ||
.await?; | ||
// do fun stuff with the gossip protocol | ||
router.shutdown().await?; | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters