Skip to content

Commit

Permalink
More node module docs
Browse files Browse the repository at this point in the history
  • Loading branch information
rklaehn committed Jul 5, 2024
1 parent 66f4cd1 commit 793b300
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion iroh/src/node.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,34 @@
//! Node API
//!
//! A node is a server that serves various protocols.
//! An iroh node is a server that is identified by an Ed25519 keypair and is
//! globally reachable via the [node id](crate::net::NodeId), which is the
//! public key of the keypair.
//!
//! By default, an iroh node speaks a number of built-in protocols. You can
//! *extend* the node with custom protocols or *disable* built-in protocols.
//!
//! # Building a node
//!
//! Nodes get created using the [`Builder`] which provides a very powerful API
//! to configure every aspect of the node.
//!
//! When using the default set of protocols, use [spawn](Builder::spawn)
//! to spawn a node directly from the builder.
//!
//! When adding custom protocols, use [build](Builder::build) to get a
//! [`ProtocolBuilder`] that allows to add custom protocols, then call
//! [spawn](ProtocolBuilder::spawn) to spawn the fully configured node.
//!
//! To implement a custom protocol, implement the [`ProtocolHandler`] trait
//! and use [`ProtocolBuilder::accept`] to add it to the node.
//!
//! # Using a node
//!
//! Once created, a node offers a small number of methods to interact with it,
//! most notably the iroh-net [endpoint](Node::endpoint) it is bound to.
//!
//! But the main way to interact with a node is through the
//! [`client`](crate::client::Iroh).
//!
//! To shut down the node, call [`Node::shutdown`].
use std::path::Path;
Expand Down

0 comments on commit 793b300

Please sign in to comment.