Expand description
§stackaddr
stackaddr is a library for self-describing, layered address representation.
It enables structured, extensible expression of network addresses and associated metadata,
supporting both traditional transport protocols and identity-aware addressing.
§Features
- Multi-layered address structure (L2–L7)
- Protocol segments:
/ip4/127.0.0.1/tcp/443/tls/http- Also, supports L2 MAC addresses like
/mac/aa:bb:cc:dd:ee:ff.
- Also, supports L2 MAC addresses like
- Identity segments:
/node/<base32>,/uuid/<uuid> - Metadata and path support
DisplayandFromStrsupport- Optional Serde serialization (
serdefeature)
§Example
use stackaddr::{StackAddr, Protocol, Identity, Segment};
use bytes::Bytes;
let addr = StackAddr::from_parts(&[
Segment::Protocol(Protocol::Ip4("192.168.10.10".parse().unwrap())),
Segment::Protocol(Protocol::Udp(4433)),
Segment::Protocol(Protocol::Quic),
Segment::Identity(Identity::NodeId(Bytes::from_static(&[1; 32]))),
]);
println!("{}", addr); // /ip4/192.168.10.10/udp/4433/quic/node/...Re-exports§
pub use addr::StackAddr;pub use error::StackAddrError;pub use segment::identity::Identity;pub use segment::protocol::Protocol;pub use segment::Segment;
Modules§
- addr
- Stack address and protocol representation.
- error
- Error types used in
StackAddrand related parsing operations. - segment
- Segment definitions, including protocol, identity, metadata, and path.
Structs§
- MacAddr
- Structure of MAC address