stackaddr/lib.rs
1//! # stackaddr
2//!
3//! `stackaddr` is a library for self-describing, layered address representation.
4//! It enables structured, extensible expression of network addresses and associated metadata,
5//! supporting both traditional transport protocols and identity-aware addressing.
6//!
7//! ## Features
8//! - Multi-layered address structure (L2–L7)
9//! - Protocol segments: `/ip4/127.0.0.1/tcp/443/tls/http`
10//! - Also, supports L2 MAC addresses like `/mac/aa:bb:cc:dd:ee:ff`.
11//! - Identity segments: `/node/<base32>`, `/uuid/<uuid>`
12//! - Metadata and path support
13//! - `Display` and `FromStr` support
14//! - Optional Serde serialization (`serde` feature)
15//!
16//! ## Example
17//! ```rust
18//! use stackaddr::{StackAddr, Protocol, Identity, Segment};
19//! use bytes::Bytes;
20//!
21//! let addr = StackAddr::from_parts(&[
22//! Segment::Protocol(Protocol::Ip4("192.168.10.10".parse().unwrap())),
23//! Segment::Protocol(Protocol::Udp(4433)),
24//! Segment::Protocol(Protocol::Quic),
25//! Segment::Identity(Identity::NodeId(Bytes::from_static(&[1; 32]))),
26//! ]);
27//!
28//! println!("{}", addr); // /ip4/192.168.10.10/udp/4433/quic/node/...
29//! ```
30
31/// Stack address and protocol representation.
32pub mod addr;
33
34/// Segment definitions, including protocol, identity, metadata, and path.
35pub mod segment;
36
37/// Error types used in [`StackAddr`] and related parsing operations.
38pub mod error;
39
40pub use addr::StackAddr;
41pub use error::StackAddrError;
42pub use segment::identity::Identity;
43pub use segment::protocol::Protocol;
44pub use segment::Segment;
45
46pub use netdev::mac::MacAddr;