Skip to main content

Module p2p

Module p2p 

Source
Expand description

Peer-to-peer mesh networking.

Structs§

Asn
Autonomous System Number wrapper.
AsnPolicy
Policy governing ASN diversity requirements.
Message
A signed peer-to-peer message with optional recipient.
MessageReplayGuard
Stateful acceptance guard for signed peer-to-peer messages.
PeerId
Unique identifier for a peer in the P2P mesh, wrapping a DID.
PeerInfo
Metadata describing a known peer (addresses, key hash, reputation).
PeerMetadata
Extended peer metadata including ASN information.
PeerRegistry
In-memory registry of known peers in the P2P mesh.
RateLimiter
Rate-limit tracking per peer.

Enums§

DiversityResult
Result of an ASN diversity check.

Constants§

MAX_P2P_MESSAGE_PAYLOAD_BYTES

Functions§

check_asn_diversity
Check whether the peer set meets the ASN diversity threshold.
discover_peers
Discover new peers from bootstrap addresses and register them.
identify_stale_peers
Return the IDs of peers that have not been seen within max_age_ms of now.
message_signing_payload
Canonical CBOR payload signed by a peer-to-peer message sender.
rotate_peers
Evict stale peers from current and replace them with diverse candidates.
select_diverse_peers
Select peers that maximise ASN diversity.
send
Send a message, verifying the recipient exists in the registry (if addressed).
validate_message_structure
Validate structural integrity of a peer-to-peer message.
verify_message
Verify a peer-to-peer message Ed25519 signature against the sender public key.