lib/peer/src/root.zig

daab053ee43316e1809a84551d573ddd1e5bf3d2

 1 //! Provides peer identities, network addresses, and bootstrap tickets used to
 2 //! find other nodes. A node is named by an Ed25519 public key stored as 32
 3 //! bytes and represented in text as 43 base64url characters: the *peer
 4 //! identifier*. Because this key names the node itself, identity remains valid
 5 //! wherever the node is reachable.
 6 //!
 7 //! An *address* represents an endpoint as an IPv4 or IPv6 address with a port,
 8 //! or a relay host name with a port. Nodes exchange addresses using a *ticket*,
 9 //! a bootstrap record prefixed with `tiny-peer:` in text that pairs one peer
10 //! identifier with a list of address hints. Nothing in a ticket is signed or
11 //! authenticated. Verifying the peer key and securing the session belong to the
12 //! transport handshake that runs later.
13 //!
14 //! The caller selects the address capacity for a ticket and supplies the
15 //! backing storage. Because operations write into caller buffers, encoding and
16 //! decoding allocate nothing.
17 
18 const address = @import("address.zig");
19 const identity = @import("identity.zig");
20 const ticket = @import("ticket.zig");
21 
22 pub const Address = address.Address;
23 pub const Relay = address.Relay;
24 pub const address_text_bytes_max = address.text_bytes_max;
25 
26 pub const Identity = identity.Identity;
27 pub const PeerId = identity.PeerId;
28 pub const peer_id_text_bytes = identity.text_bytes;
29 
30 pub const Capacity = ticket.Capacity;
31 pub const Limits = ticket.Limits;
32 pub const Ticket = ticket.Ticket;
33 pub const TicketStorage = ticket.TicketStorage;
34 pub const ticket_address_count_max = ticket.address_count_max;
35 pub const decode = ticket.decode;
36 pub const encode = ticket.encode;