veilnet/lib.rs
1//! Networking abstractions built on Veilid API primitives.
2//!
3//! veilnet provides high-level networking capabilities using the Veilid distributed hash table
4//! and private routing system. It enables applications to communicate over the Veilid network
5//! without dealing directly with low-level Veilid APIs.
6//!
7//! # Examples
8//!
9//! Creating a connection and setting up datagram communication:
10//!
11//! ```no_run
12//! use veilnet::{
13//! connection::Veilid,
14//! datagram::{Listener, Dialer}
15//! };
16//!
17//! # async fn example() -> Result<(), Box<dyn std::error::Error>> {
18//! let conn = Veilid::new().await?;
19//! let listener = Listener::new(conn, None, 8080).await?;
20//! let addr = listener.addr().clone();
21//!
22//! let conn2 = Veilid::new().await?;
23//! let mut dialer = Dialer::new(conn2).await?;
24//! let (route_id, _) = dialer.resolve(&addr).await?;
25//! dialer.send_to(route_id, b"Hello, world!".to_vec()).await?;
26//! # Ok(())
27//! # }
28//! ```
29
30#![recursion_limit = "256"]
31
32/// Connection management and Veilid network interface.
33pub mod connection;
34/// Datagram-style communication over Veilid private routes.
35pub mod datagram;
36pub mod proto;
37mod types;
38
39/// A connection to the Veilid network.
40pub use connection::Connection;
41/// An address for DHT-based communication in the Veilid network.
42pub use types::DHTAddr;