Skip to main content

cp_tor/
lib.rs

1//! Anonymous search protocol over Tor for Canon Protocol (CP-013).
2//!
3//! This crate implements the protocol layer for live anonymous search
4//! between Canon nodes. It provides:
5//!
6//! - Data structures for peer registration, search requests/responses
7//! - Length-prefixed CBOR wire format for stream communication
8//! - Ephemeral session key derivation for query privacy
9//! - Token bucket rate limiting per requester
10//!
11//! The actual Tor integration (arti-client) is handled separately to
12//! keep this crate lightweight and testable without a Tor dependency.
13
14pub mod client;
15pub mod error;
16pub mod keys;
17pub mod rate_limit;
18pub mod runtime;
19pub mod server;
20pub mod types;
21pub mod wire;
22
23pub use client::{search, search_fanout, verify_response};
24pub use error::{Result, TorError};
25pub use keys::{derive_onion_keypair, node_id_from_public_key, verify_signature, SessionKey};
26pub use rate_limit::RateLimiter;
27pub use runtime::{RuntimeState, TorConfig, TorRuntime};
28pub use server::{handle_connection, handle_connection_loop, ServerConfig};
29pub use types::*;
30pub use wire::{read_message, write_keepalive, write_message};