Crate stackaddr

Crate stackaddr 

Source
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.
  • Identity segments: /node/<base32>, /uuid/<uuid>
  • Metadata and path support
  • Display and FromStr support
  • Optional Serde serialization (serde feature)

§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::Segment;
pub use segment::identity::Identity;
pub use segment::protocol::Protocol;

Modules§

addr
Stack address and protocol representation.
error
Error types used in StackAddr and related parsing operations.
segment
Segment definitions, including protocol, identity, metadata, and path.

Structs§

MacAddr
48-bit MAC address (IEEE EUI-48).