[go: up one dir, main page]

Crate corium

Crate corium 

Source
Expand description

§Corium - Distributed Mesh Networking Library

Corium provides a secure, decentralized mesh networking stack built on:

  • Identity: Ed25519-based cryptographic identities (32-byte public keys)
  • DHT: Kademlia-style distributed hash table for peer discovery and data storage
  • PubSub: GossipSub epidemic broadcast for reliable message dissemination
  • Transport: SmartSock with automatic path selection (direct/relay)
  • NAT Traversal: UDP relay infrastructure for NAT-bound nodes

§Architecture

The codebase uses the Actor Pattern extensively for safe concurrent state:

  • Each component (DHT, GossipSub, Relay) has a public Handle and private Actor
  • Handles are cheap to clone and communicate via async channels
  • Actors own all mutable state and process commands sequentially

§Security Model

  • All peer connections use mutual TLS with Ed25519 certificates
  • Identity = Public Key (no separate identity layer)
  • All stored data is content-addressed or cryptographically signed
  • Rate limiting and bounded data structures prevent resource exhaustion
  • S/Kademlia PoW: Identity generation requires Proof-of-Work (Sybil resistance)

§Module Overview

ModulePurpose
nodeHigh-level API combining all components
identityKeypairs, Identities, signed Contacts
cryptoTLS certificate generation and verification
dhtKademlia DHT with adaptive parameters, XOR-metric routing, and storage
gossipsubEpidemic broadcast for PubSub
relayUDP relay server/client for NAT traversal
transportSmartSock multi-path transport layer
protocolsProtocol trait definitions (DhtNodeRpc, etc.)
rpcQUIC-based RPC layer implementing protocols
messagesSerialization types for all wire protocols

Structs§

Identity
IdentityProof
Proof-of-Work for identity generation.
Node
PoWError
Error type for Proof-of-Work generation failures.

Constants§

POW_DIFFICULTY
Number of leading zero bits required in PoW hash.