tokilake-core
The core tunnel and gateway abstraction library for the Tokilake ecosystem.
Repository
GitHub: https://github.com/anomalyco/tokilake/tree/main/rust/tokilake-core
Overview
tokilake-core provides fundamental trait definitions, session management, routing logic, and protocol codecs required to build scalable, multiplexed gateways. It sits between the network transport layer and the application edge.
Core Modules
tunnel: Transport-agnostic tunnel traits (TunnelSession,TunnelStream) using zero-costimpl Futurearchitecturessession: Lock-free, concurrent worker registration and namespace claiming viaDashMaproundtrip: Asynchronous HTTP-over-Tunnel request/response forwardingprotocol: NDJSON protocol definitions for control planesgateway: Extensible HTTP/WebSocket handler traitscodec: Tunnel data plane codec for request/response serializationerror: Error types usingthiserror
Supported Transports
- SMUX: Backward-compatible with standard
tokilakeworkers throughtokilake-smux - QUIC: Next-generation, zero-RTT capable high-throughput encrypted transport (via
quinn) - Memory: In-memory stream channels for unit testing
Integration
use ;
use TunnelSession;
// Initialize the global session manager
let session_manager = new;
// Handle incoming multiplexed streams through unified traits
Key Traits
/// Tunnel session trait - multiplexed stream container
/// Authenticator trait - authenticates tunnel worker tokens
/// Worker registry trait - manages worker registration
Dependencies
tokilake-smuxtokio(full features)serde(derive)serde_jsonthiserrordashmapparking_lottracingquinn(optional)base64
License
MIT License - see LICENSE