Skip to content

Developer Guide

This part is for people who change the code. It describes the Etemenanki workspace (the kernel crates, the supervisor and the programs built on it), katana and shinku-quic, down to individual state machines, buffers, locks and tasks.

Crate or program Role
etemenanki-concepts The sans-I/O proxy model: server cores, client codecs, the per-connection runtimes, links and connectors. It contains no protocol code.
etemenanki-environment Host-side networking: TCP and UDP dialers (plus an optional QUIC dialer) sharing one socket policy, and the route model.
etemenanki-reality REALITY’s server and client: a TLS 1.3 of its own, the session_id authentication and the camouflage relay to the cover site. It depends on no other crate of the workspace.
etemenanki-protocols Every protocol and transport: SOCKS, HTTP, Shadowsocks, Trojan, VLESS (with the XTLS Vision flow), VMess, AnyTLS, sss, Hysteria 2, WireGuard and TUN; TCP, TLS, WebSocket, gRPC and REALITY (through etemenanki-reality); mux.cool and XUDP; DNS; sniffing.
etemenanki-supervisor The runtime every program runs on. A front end lowers its own format into a typed spec; the supervisor validates it, plans a reconcile against what runs, and applies it without dropping live connections. It owns listeners, sessions, routing, outbounds, users, flow tracking, per-user usage and speed limits.
etemenanki-app The standalone proxy, as a library and a binary: the TOML schema, the subscribe-file merge, lowering a config into a spec, reloading by apply, and the file side of the REST API.
etemenanki-subscribe The subscribe-file format a provider hands a client: nodes, DNS settings and route groups. Format only.
etemenanki-webclient The REST API a client is driven by: switching route groups, reloading, and watching connections and traffic. HTTP only.
etemenanki-ffi The proxy as a library for Android and iOS apps, with UniFFI bindings. Client only; not published.
shinku-quic A separate repository: the patched quinn stack Hysteria 2 runs on, and Hysteria’s Brutal sender, a controller switched after the handshake, and client-side port hopping. It knows QUIC, not Hysteria.
katana The panel node agent: panel clients, the node manager, lowering each node and its users into a spec, destination audit and traffic reporting. Everything that serves connections is the supervisor’s.

Dependencies point one way, from the programs down to the concepts:

flowchart BT
  concepts["etemenanki-concepts"]
  environment["etemenanki-environment"]
  reality["etemenanki-reality"]
  protocols["etemenanki-protocols"]
  supervisor["etemenanki-supervisor"]
  subscribe["etemenanki-subscribe"]
  webclient["etemenanki-webclient"]
  app["etemenanki-app"]
  ffi["etemenanki-ffi"]
  katana["katana"]
  shinku["shinku-quic"]
  environment --> concepts
  protocols --> environment
  protocols --> reality
  protocols --> shinku
  supervisor --> protocols
  webclient --> supervisor
  app --> webclient
  app --> subscribe
  ffi --> app
  katana --> supervisor

Each arrow is a direct dependency; a crate may also use the ones further down directly. etemenanki-subscribe and etemenanki-reality depend on no other crate of the workspace; etemenanki-protocols reaches etemenanki-reality only through its reality feature, behind wrapper types of its own. katana is a separate repository and takes the four library crates it needs (etemenanki-concepts, etemenanki-environment, etemenanki-protocols and etemenanki-supervisor) from a private Cargo registry at pinned versions, and etemenanki-reality through the protocols crate’s reality feature; the app, the REST API and the mobile library are built together with the kernel in one workspace. shinku-quic is a separate repository too, released to the same registry; etemenanki-protocols, the supervisor and the environment crate take its quinn under a package alias.

Every page follows the same outline, as far as its subject allows:

  1. Responsibilities: what the component does, and what it deliberately leaves to others.
  2. Key types: the traits, structs and functions you will meet in the code, with their signatures.
  3. Data flow: how bytes, events or requests move through it, usually drawn as a Mermaid diagram.
  4. Invariants: what must always hold, and which mechanism guarantees it.
  5. Failure paths: errors, cancellation and shutdown.
  6. Limits: buffer sizes, timeouts and caps.
  7. Tests: which tests pin the behaviour down.

The repositories are private, so these pages do not link into them. Code is named by repository-relative path and symbol, for example concepts/src/core.rs → ProxyCoreDecode. Line numbers are avoided because they move.

Under each page title, Source files lists the files the page describes and the revision they were last checked against. When any of those files changes after that revision, the page is re-checked.