Skip to content

Workspace and crates

Source files: 352 · checked against Etemenanki 46c12e4 · katana v6.1.0 · shinku-quic v0.1.0
  • Etemenanki/Cargo.toml
  • Etemenanki/Cargo.lock
  • Etemenanki/.gitmodules
  • Etemenanki/.cargo/config.toml
  • Etemenanki/.github/workflows/build.yml
  • Etemenanki/README.md
  • Etemenanki/concepts/Cargo.toml
  • Etemenanki/environment/Cargo.toml
  • Etemenanki/protocols/Cargo.toml
  • Etemenanki/reality/Cargo.toml
  • Etemenanki/supervisor/Cargo.toml
  • Etemenanki/app/Cargo.toml
  • Etemenanki/subscribe/Cargo.toml
  • Etemenanki/webclient/Cargo.toml
  • Etemenanki/ffi/Cargo.toml
  • Etemenanki/ffi/bindgen/Cargo.toml
  • Etemenanki/ffi/uniffi.toml
  • Etemenanki/concepts/src/buffer.rs
  • Etemenanki/concepts/src/client.rs
  • Etemenanki/concepts/src/core.rs
  • Etemenanki/concepts/src/lib.rs
  • Etemenanki/concepts/src/link.rs
  • Etemenanki/concepts/src/net.rs
  • Etemenanki/concepts/src/relay.rs
  • Etemenanki/concepts/src/runtime.rs
  • Etemenanki/concepts/src/sniff.rs
  • Etemenanki/concepts/src/wake.rs
  • Etemenanki/environment/src/dial/mod.rs
  • Etemenanki/environment/src/dial/quic.rs
  • Etemenanki/environment/src/dial/socket.rs
  • Etemenanki/environment/src/dial/tcp.rs
  • Etemenanki/environment/src/dial/udp.rs
  • Etemenanki/environment/src/lib.rs
  • Etemenanki/environment/src/routing.rs
  • Etemenanki/environment/src/routing/dat.rs
  • Etemenanki/reality/src/auth.rs
  • Etemenanki/reality/src/camouflage.rs
  • Etemenanki/reality/src/client/connect.rs
  • Etemenanki/reality/src/client/hello.rs
  • Etemenanki/reality/src/client/mod.rs
  • Etemenanki/reality/src/codec.rs
  • Etemenanki/reality/src/keys.rs
  • Etemenanki/reality/src/kx.rs
  • Etemenanki/reality/src/lib.rs
  • Etemenanki/reality/src/server/accept.rs
  • Etemenanki/reality/src/server/handshake.rs
  • Etemenanki/reality/src/server/mod.rs
  • Etemenanki/reality/src/stream.rs
  • Etemenanki/reality/src/tls13/messages.rs
  • Etemenanki/reality/src/tls13/mod.rs
  • Etemenanki/reality/src/tls13/record.rs
  • Etemenanki/reality/src/tls13/schedule.rs
  • Etemenanki/reality/src/tls13/session.rs
  • Etemenanki/protocols/src/anytls/client/datagram.rs
  • Etemenanki/protocols/src/anytls/client/mod.rs
  • Etemenanki/protocols/src/anytls/client/session.rs
  • Etemenanki/protocols/src/anytls/client/stream.rs
  • Etemenanki/protocols/src/anytls/core.rs
  • Etemenanki/protocols/src/anytls/frame.rs
  • Etemenanki/protocols/src/anytls/mod.rs
  • Etemenanki/protocols/src/anytls/padding.rs
  • Etemenanki/protocols/src/anytls/settings.rs
  • Etemenanki/protocols/src/anytls/uot.rs
  • Etemenanki/protocols/src/anytls/users.rs
  • Etemenanki/protocols/src/core/harness.rs
  • Etemenanki/protocols/src/core/mod.rs
  • Etemenanki/protocols/src/dns/hosts.rs
  • Etemenanki/protocols/src/dns/message.rs
  • Etemenanki/protocols/src/dns/mod.rs
  • Etemenanki/protocols/src/dns/serve.rs
  • Etemenanki/protocols/src/error.rs
  • Etemenanki/protocols/src/flow.rs
  • Etemenanki/protocols/src/helpers/address.rs
  • Etemenanki/protocols/src/helpers/address_family.rs
  • Etemenanki/protocols/src/helpers/crypto.rs
  • Etemenanki/protocols/src/helpers/mod.rs
  • Etemenanki/protocols/src/helpers/parse.rs
  • Etemenanki/protocols/src/http/codec.rs
  • Etemenanki/protocols/src/http/config.rs
  • Etemenanki/protocols/src/http/core.rs
  • Etemenanki/protocols/src/http/mod.rs
  • Etemenanki/protocols/src/http/protocol.rs
  • Etemenanki/protocols/src/hysteria/auth.rs
  • Etemenanki/protocols/src/hysteria/config.rs
  • Etemenanki/protocols/src/hysteria/connection.rs
  • Etemenanki/protocols/src/hysteria/connector.rs
  • Etemenanki/protocols/src/hysteria/mod.rs
  • Etemenanki/protocols/src/hysteria/negotiate.rs
  • Etemenanki/protocols/src/hysteria/obfs.rs
  • Etemenanki/protocols/src/hysteria/protocol.rs
  • Etemenanki/protocols/src/hysteria/quic.rs
  • Etemenanki/protocols/src/hysteria/server/authenticator.rs
  • Etemenanki/protocols/src/hysteria/server/config.rs
  • Etemenanki/protocols/src/hysteria/server/datagrams.rs
  • Etemenanki/protocols/src/hysteria/server/endpoint.rs
  • Etemenanki/protocols/src/hysteria/server/inbound.rs
  • Etemenanki/protocols/src/hysteria/server/io.rs
  • Etemenanki/protocols/src/hysteria/server/masquerade.rs
  • Etemenanki/protocols/src/hysteria/server/mod.rs
  • Etemenanki/protocols/src/hysteria/server/shim.rs
  • Etemenanki/protocols/src/hysteria/slot.rs
  • Etemenanki/protocols/src/lib.rs
  • Etemenanki/protocols/src/macros.rs
  • Etemenanki/protocols/src/mux/demux.rs
  • Etemenanki/protocols/src/mux/frame.rs
  • Etemenanki/protocols/src/mux/mod.rs
  • Etemenanki/protocols/src/sniff/collector.rs
  • Etemenanki/protocols/src/sniff/http.rs
  • Etemenanki/protocols/src/sniff/mod.rs
  • Etemenanki/protocols/src/sniff/tls.rs
  • Etemenanki/protocols/src/socks/codec.rs
  • Etemenanki/protocols/src/socks/config.rs
  • Etemenanki/protocols/src/socks/handshake.rs
  • Etemenanki/protocols/src/socks/mod.rs
  • Etemenanki/protocols/src/socks/protocol.rs
  • Etemenanki/protocols/src/socks/server.rs
  • Etemenanki/protocols/src/socks/udp_link.rs
  • Etemenanki/protocols/src/ss_2022/codec.rs
  • Etemenanki/protocols/src/ss_2022/core.rs
  • Etemenanki/protocols/src/ss_2022/crypto.rs
  • Etemenanki/protocols/src/ss_2022/mod.rs
  • Etemenanki/protocols/src/ss_2022/protocol.rs
  • Etemenanki/protocols/src/ss_2022/replay.rs
  • Etemenanki/protocols/src/ss_2022/users.rs
  • Etemenanki/protocols/src/ss_aead.rs
  • Etemenanki/protocols/src/ss_legacy/aead.rs
  • Etemenanki/protocols/src/ss_legacy/codec.rs
  • Etemenanki/protocols/src/ss_legacy/core.rs
  • Etemenanki/protocols/src/ss_legacy/mod.rs
  • Etemenanki/protocols/src/ss_legacy/protocol.rs
  • Etemenanki/protocols/src/ss_legacy/users.rs
  • Etemenanki/protocols/src/sss/client.rs
  • Etemenanki/protocols/src/sss/codec.rs
  • Etemenanki/protocols/src/sss/core.rs
  • Etemenanki/protocols/src/sss/mod.rs
  • Etemenanki/protocols/src/sss/protocol.rs
  • Etemenanki/protocols/src/sss/server.rs
  • Etemenanki/protocols/src/sss/transform/base.rs
  • Etemenanki/protocols/src/sss/transform/http_chunk.rs
  • Etemenanki/protocols/src/sss/transform/mod.rs
  • Etemenanki/protocols/src/sss/transform/pad.rs
  • Etemenanki/protocols/src/sss/transform/parse.rs
  • Etemenanki/protocols/src/sss/transform/record.rs
  • Etemenanki/protocols/src/sss/transform/stream.rs
  • Etemenanki/protocols/src/sss/transform/stuff.rs
  • Etemenanki/protocols/src/sss/transform/zstd.rs
  • Etemenanki/protocols/src/sss/users.rs
  • Etemenanki/protocols/src/sss/varint.rs
  • Etemenanki/protocols/src/transports/accept.rs
  • Etemenanki/protocols/src/transports/camouflage.rs
  • Etemenanki/protocols/src/transports/coalesce.rs
  • Etemenanki/protocols/src/transports/connect.rs
  • Etemenanki/protocols/src/transports/grpc/framing.rs
  • Etemenanki/protocols/src/transports/grpc/liveness.rs
  • Etemenanki/protocols/src/transports/grpc/mod.rs
  • Etemenanki/protocols/src/transports/grpc/settings.rs
  • Etemenanki/protocols/src/transports/grpc/stream.rs
  • Etemenanki/protocols/src/transports/keepalive.rs
  • Etemenanki/protocols/src/transports/mod.rs
  • Etemenanki/protocols/src/transports/proxy_protocol.rs
  • Etemenanki/protocols/src/transports/reality.rs
  • Etemenanki/protocols/src/transports/stream.rs
  • Etemenanki/protocols/src/transports/tls/platform_roots.rs
  • Etemenanki/protocols/src/transports/tls/config.rs
  • Etemenanki/protocols/src/transports/tls/mod.rs
  • Etemenanki/protocols/src/transports/tls/stream.rs
  • Etemenanki/protocols/src/transports/ws/endpoint.rs
  • Etemenanki/protocols/src/transports/ws/mod.rs
  • Etemenanki/protocols/src/transports/ws/stream.rs
  • Etemenanki/protocols/src/trojan/codec.rs
  • Etemenanki/protocols/src/trojan/core.rs
  • Etemenanki/protocols/src/trojan/mod.rs
  • Etemenanki/protocols/src/trojan/protocol.rs
  • Etemenanki/protocols/src/trojan/users.rs
  • Etemenanki/protocols/src/tun/config.rs
  • Etemenanki/protocols/src/tun/device.rs
  • Etemenanki/protocols/src/tun/inbound.rs
  • Etemenanki/protocols/src/tun/ipv6.rs
  • Etemenanki/protocols/src/tun/mod.rs
  • Etemenanki/protocols/src/tun/tracked.rs
  • Etemenanki/protocols/src/tun/udp.rs
  • Etemenanki/protocols/src/vless/addons.rs
  • Etemenanki/protocols/src/vless/codec.rs
  • Etemenanki/protocols/src/vless/config.rs
  • Etemenanki/protocols/src/vless/core.rs
  • Etemenanki/protocols/src/vless/mod.rs
  • Etemenanki/protocols/src/vless/protocol.rs
  • Etemenanki/protocols/src/vless/validator.rs
  • Etemenanki/protocols/src/vless/vision/filter.rs
  • Etemenanki/protocols/src/vless/vision/framer.rs
  • Etemenanki/protocols/src/vless/vision/mod.rs
  • Etemenanki/protocols/src/vless/vision/padding.rs
  • Etemenanki/protocols/src/vless/vision/stream.rs
  • Etemenanki/protocols/src/vmess/accounts.rs
  • Etemenanki/protocols/src/vmess/aead.rs
  • Etemenanki/protocols/src/vmess/codec.rs
  • Etemenanki/protocols/src/vmess/core.rs
  • Etemenanki/protocols/src/vmess/framing.rs
  • Etemenanki/protocols/src/vmess/keys.rs
  • Etemenanki/protocols/src/vmess/mod.rs
  • Etemenanki/protocols/src/vmess/protocol.rs
  • Etemenanki/protocols/src/vmess/session.rs
  • Etemenanki/protocols/src/wireguard/config.rs
  • Etemenanki/protocols/src/wireguard/connector.rs
  • Etemenanki/protocols/src/wireguard/device.rs
  • Etemenanki/protocols/src/wireguard/mod.rs
  • Etemenanki/protocols/src/wireguard/slot.rs
  • Etemenanki/supervisor/src/build/apply.rs
  • Etemenanki/supervisor/src/build/dns.rs
  • Etemenanki/supervisor/src/build/inbound.rs
  • Etemenanki/supervisor/src/build/mod.rs
  • Etemenanki/supervisor/src/build/outbound.rs
  • Etemenanki/supervisor/src/build/route.rs
  • Etemenanki/supervisor/src/build/users.rs
  • Etemenanki/supervisor/src/build/validate.rs
  • Etemenanki/supervisor/src/carrier.rs
  • Etemenanki/supervisor/src/connector.rs
  • Etemenanki/supervisor/src/entity/id.rs
  • Etemenanki/supervisor/src/entity/mod.rs
  • Etemenanki/supervisor/src/entity/session.rs
  • Etemenanki/supervisor/src/entity/usage.rs
  • Etemenanki/supervisor/src/entity/user.rs
  • Etemenanki/supervisor/src/guard.rs
  • Etemenanki/supervisor/src/lib.rs
  • Etemenanki/supervisor/src/ping.rs
  • Etemenanki/supervisor/src/policy.rs
  • Etemenanki/supervisor/src/serve.rs
  • Etemenanki/supervisor/src/supervisor.rs
  • Etemenanki/supervisor/src/system/blocking.rs
  • Etemenanki/supervisor/src/system/handoff.rs
  • Etemenanki/supervisor/src/system/listener.rs
  • Etemenanki/supervisor/src/system/mod.rs
  • Etemenanki/supervisor/src/topology/balancer.rs
  • Etemenanki/supervisor/src/topology/flow.rs
  • Etemenanki/supervisor/src/topology/inbound/mod.rs
  • Etemenanki/supervisor/src/topology/mod.rs
  • Etemenanki/supervisor/src/topology/outbound/dns.rs
  • Etemenanki/supervisor/src/topology/outbound/freedom.rs
  • Etemenanki/supervisor/src/topology/outbound/mod.rs
  • Etemenanki/supervisor/src/topology/outbound/proxy.rs
  • Etemenanki/supervisor/src/topology/outbound/udp_fanout.rs
  • Etemenanki/supervisor/src/topology/plane.rs
  • Etemenanki/supervisor/src/topology/router.rs
  • Etemenanki/supervisor/src/topology/spec_plan/dns.rs
  • Etemenanki/supervisor/src/topology/spec_plan/inbound.rs
  • Etemenanki/supervisor/src/topology/spec_plan/mod.rs
  • Etemenanki/supervisor/src/topology/spec_plan/outbound.rs
  • Etemenanki/supervisor/src/topology/spec_plan/plan.rs
  • Etemenanki/supervisor/src/topology/spec_plan/route.rs
  • Etemenanki/supervisor/src/topology/spec_plan/transport.rs
  • Etemenanki/supervisor/src/track/metered.rs
  • Etemenanki/supervisor/src/track/mod.rs
  • Etemenanki/supervisor/src/track/pace.rs
  • Etemenanki/supervisor/src/track/sampler.rs
  • Etemenanki/app/src/api.rs
  • Etemenanki/app/src/config.rs
  • Etemenanki/app/src/instance.rs
  • Etemenanki/app/src/lib.rs
  • Etemenanki/app/src/lower.rs
  • Etemenanki/app/src/main.rs
  • Etemenanki/app/src/routes.rs
  • Etemenanki/app/src/subscribe.rs
  • Etemenanki/app/src/transport.rs
  • Etemenanki/subscribe/src/dns.rs
  • Etemenanki/subscribe/src/lib.rs
  • Etemenanki/subscribe/src/proxy_servers.rs
  • Etemenanki/subscribe/src/route.rs
  • Etemenanki/webclient/src/etag.rs
  • Etemenanki/webclient/src/lib.rs
  • Etemenanki/webclient/src/listen.rs
  • Etemenanki/webclient/src/router.rs
  • Etemenanki/webclient/src/tracking.rs
  • Etemenanki/ffi/src/client.rs
  • Etemenanki/ffi/src/convert.rs
  • Etemenanki/ffi/src/error.rs
  • Etemenanki/ffi/src/inspect.rs
  • Etemenanki/ffi/src/lib.rs
  • Etemenanki/ffi/src/platform.rs
  • Etemenanki/ffi/src/proxy.rs
  • Etemenanki/ffi/src/types.rs
  • Etemenanki/ffi/bindgen/src/main.rs
  • Etemenanki/protocols/benches/vmess_users.rs
  • Etemenanki/supervisor/benches/tracking.rs
  • Etemenanki/concepts/tests/runtime.rs
  • Etemenanki/concepts/tests/client.rs
  • Etemenanki/environment/tests/integration.rs
  • Etemenanki/environment/tests/integration/quic.rs
  • Etemenanki/environment/tests/unit/routing.rs
  • Etemenanki/reality/tests/client.rs
  • Etemenanki/reality/tests/server.rs
  • Etemenanki/reality/tests/support/dest.rs
  • Etemenanki/protocols/tests/pipeline.rs
  • Etemenanki/protocols/tests/pipeline/anytls.rs
  • Etemenanki/protocols/tests/pipeline/hysteria.rs
  • Etemenanki/protocols/tests/pipeline/reality.rs
  • Etemenanki/protocols/tests/pipeline/socks.rs
  • Etemenanki/protocols/tests/unit/vless/protocol.rs
  • Etemenanki/protocols/tests/unit/dns/message.rs
  • Etemenanki/protocols/tests/unit/hysteria/protocol.rs
  • Etemenanki/protocols/tests/unit/mux/frame.rs
  • Etemenanki/protocols/tests/unit/sniff/tls.rs
  • Etemenanki/supervisor/tests/anytls.rs
  • Etemenanki/supervisor/tests/guard.rs
  • Etemenanki/supervisor/tests/handoff.rs
  • Etemenanki/supervisor/tests/hot_swap.rs
  • Etemenanki/supervisor/tests/ping.rs
  • Etemenanki/supervisor/tests/socket_policy.rs
  • Etemenanki/supervisor/tests/sss.rs
  • Etemenanki/supervisor/tests/tracking.rs
  • Etemenanki/supervisor/tests/unit/plan.rs
  • Etemenanki/app/tests/integration.rs
  • Etemenanki/app/tests/support/mod.rs
  • Etemenanki/app/tests/support/runs.rs
  • Etemenanki/app/tests/integration/e2e_tun.rs
  • Etemenanki/app/tests/integration/e2e_wg.rs
  • Etemenanki/app/tests/integration/e2e_singbox_anytls.rs
  • Etemenanki/app/tests/integration/e2e_xray_reality.rs
  • Etemenanki/app/tests/integration/e2e_xray_wrapped.rs
  • Etemenanki/app/tests/integration/e2e_sss.rs
  • Etemenanki/webclient/tests/tracking.rs
  • Etemenanki/ffi/tests/convert.rs
  • Etemenanki/ffi/tests/inspect.rs
  • Etemenanki/ffi/tests/proxy.rs
  • Etemenanki/subscribe/tests/unit/subscribe.rs
  • katana/Cargo.toml
  • katana/Cargo.lock
  • katana/.cargo/config.toml
  • katana/.gitmodules
  • katana/.github/workflows/release.yml
  • katana/src/api/embedded_cert.rs
  • katana/src/api/helium.rs
  • katana/src/api/hysteria.rs
  • katana/src/api/mod.rs
  • katana/src/api/newv2board.rs
  • katana/src/blocking.rs
  • katana/src/config.rs
  • katana/src/lower/inbound.rs
  • katana/src/lower/mod.rs
  • katana/src/lower/outbound.rs
  • katana/src/lower/route.rs
  • katana/src/main.rs
  • katana/src/manager/mod.rs
  • katana/src/manager/node.rs
  • katana/src/rule.rs
  • katana/src/runtime.rs
  • katana/tests/integration.rs
  • katana/tests/integration/xray_interop.rs
  • katana/tests/integration/hysteria_interop.rs
  • katana/tests/integration/sniff.rs
  • katana/tests/support/mod.rs
  • shinku-quic/Cargo.toml
  • shinku-quic/shinku-quic/Cargo.toml

The kernel and katana live in two private repositories. Etemenanki is a Cargo workspace of ten crates:

  • five library crates that together form the proxy kernel, published to a private Cargo registry: etemenanki-concepts, etemenanki-environment, etemenanki-reality, etemenanki-protocols and etemenanki-supervisor;
  • etemenanki-app, a library with the etemenanki-app binary on top, and the two libraries it uses, etemenanki-subscribe and etemenanki-webclient;
  • etemenanki-ffi, the library Android and iOS apps link, and etemenanki-ffi-bindgen, its binding generator. Neither is published.

katana is a separate repository whose binary, the panel node agent, takes the kernel crates from the private registry: four by name, and etemenanki-reality through the protocols crate. It takes the helium-node-api crate, the types of Helium’s node API v2, from the same registry. shinku-quic holds the patched QUIC stack that Hysteria 2 runs on, published to the same registry; see the shinku-quic overview. A further repository, harranu, holds the route model that the kernel now carries a copy of.

This page is the map to read before changing anything. It covers which crate owns what, how features and dependencies flow between crates, what every source file is for, the lints that shape all parsing code, how the design arrived where it is (the 2.0 one-pipeline redesign, then the supervisor split), and the gates a change has to pass. The pages under Concepts, Environment, Protocols, Supervisor, Front ends and katana then go into each crate.

  • DirectoryEtemenanki/
    • Cargo.toml workspace manifest and shared dependency versions
    • Cargo.lock
    • .cargo/config.toml declares the private registry
    • .github/workflows/build.yml
    • Directoryconcepts/ etemenanki-concepts
      • …
    • Directoryenvironment/ etemenanki-environment
      • …
    • Directoryreality/ etemenanki-reality
      • …
    • Directoryprotocols/ etemenanki-protocols
      • …
    • Directorysupervisor/ etemenanki-supervisor
      • …
    • Directoryapp/ etemenanki-app, library and binary
      • example-config.toml
    • Directorysubscribe/ etemenanki-subscribe
      • example-subscribe.toml
    • Directorywebclient/ etemenanki-webclient
      • …
    • Directoryffi/ etemenanki-ffi
      • Directorybindgen/ etemenanki-ffi-bindgen, the uniffi-bindgen binary
        • …
      • uniffi.toml binding options: the Kotlin bindings target Android
      • build-android.sh
      • build-ios.sh
      • shell.nix
    • DirectoryXray-core/ git submodule, reference and interop tests only
      • …
    • Directoryhysteria/ git submodule, reference and interop tests only
      • …
    • Directorysing-box/ git submodule, reference and interop tests only
      • …
  • Directorykatana/
    • Cargo.toml depends on four kernel crates and helium-node-api by version
    • Cargo.lock
    • .cargo/config.toml declares the private registry
    • .github/workflows/release.yml
    • Directorysrc/
      • …
    • Directorytests/
      • …
    • DirectoryXboard/ panel reference tree, not built
      • …
    • DirectoryV2bX/ panel reference tree, not built
      • …
    • DirectoryXrayR/ panel reference tree, not built
      • …
Repository What it builds Consumes
Etemenanki The kernel libraries etemenanki-concepts, etemenanki-environment, etemenanki-reality, etemenanki-protocols and etemenanki-supervisor; etemenanki-app (library and binary), etemenanki-subscribe and etemenanki-webclient, all published to a private Cargo registry; etemenanki-ffi and etemenanki-ffi-bindgen, not published crates.io, its own path dependencies, shinku-quic’s shinku-quinn, shinku-h3-quinn and shinku-quic from the private registry (behind the hysteria feature, and for quinn also the environment’s quic feature and the supervisor), and, for the ffi only, libsubconv from the same registry
katana The katana binary Four kernel crates, from the private registry: etemenanki-concepts 2.1, etemenanki-environment 3.0, etemenanki-protocols 7.1.1 and etemenanki-supervisor 2.1 (its lockfile resolves them to 2.2.0, 3.2.2, 7.2.1 and 2.1.0, and etemenanki-reality 0.1.1 through the protocols crate); helium-node-api 0.2.0, from the same registry
shinku-quic shinku-quinn-proto, shinku-quinn, shinku-h3-quinn and shinku-quic, all 0.1.0, published to the private registry crates.io; the first three are vendored upstream quinn-proto (patched), quinn and h3-quinn (see The quinn patches)
harranu A standalone route-model crate Nothing in the kernel or katana depends on it any more

The workspace manifest lists exactly members = ["app", "concepts", "environment", "ffi", "ffi/bindgen", "protocols", "reality", "subscribe", "supervisor", "webclient"]. Everything else in the checkout, including the submodules, is invisible to Cargo.

etemenanki-ffi sets crate-type = ["lib", "cdylib", "staticlib"]: the cdylib is Android’s .so and what bindings are generated from, the staticlib goes into iOS’s XCFramework, and the lib serves the host tests. ffi/build-android.sh and ffi/build-ios.sh build it per target. etemenanki-ffi-bindgen is a one-file uniffi-bindgen binary pinned to the UniFFI version the library is built with (0.32.2), because bindings from another version do not match the library. Both set publish = false. The mobile embedding is described on ffi.

Xray-core/ (upstream XTLS/Xray-core, at its v26.10.17 tag), hysteria/ (upstream HyNetworks/hysteria) and sing-box/ (upstream SagerNet/sing-box, at its v1.14.3 tag) are git submodules declared in .gitmodules. Nothing in them is compiled by Cargo. They serve two purposes:

  • Porting reference. Most protocol modules are ports, and their module docs name the Go file they follow: trojan/protocol.rs ports proxy/trojan/protocol.go, mux/frame.rs ports common/mux/{frame.go,reader.go,writer.go}, hysteria/obfs.rs ports hysteria/extras/obfs/salamander.go, and hysteria/PROTOCOL.md is the specification both Hysteria 2 ends are written against. Shadowsocks 2022 is ported from sing-shadowsocks/shadowaead_2022, which is not vendored. The VLESS request addons and XTLS Vision port Xray’s proxy/vless/encoding/addons.{proto,go} and proxy/proxy.go; AnyTLS follows anytls-go’s docs/protocol.md and sing-anytls, and etemenanki-reality the XTLS/REALITY commit its crate docs pin, none of which is vendored.
  • Interoperability tests. app/tests/support/mod.rs builds the upstream binaries on first use: go build -o <run>/xray ./main inside Xray-core/, go build inside hysteria/app, and go build -o <run>/sing-box ./cmd/sing-box inside sing-box/ (its default protocol set, which includes AnyTLS), each into the test process’s own run directory (app/tests/support/runs.rs), and then renames the result to $CARGO_TARGET_TMPDIR/xray, $CARGO_TARGET_TMPDIR/hysteria or $CARGO_TARGET_TMPDIR/sing-box. The results sit behind LazyLock statics, XRAY_BIN, HYSTERIA_BIN and SINGBOX_BIN, so each test binary builds each upstream at most once. When go is missing or the build fails, the helper prints a SKIP: line and returns None, and every test that needs the binary returns early and passes. katana’s tests/support/mod.rs builds Xray and Hysteria the same way, from the sibling checkout ../Etemenanki/Xray-core and ../Etemenanki/hysteria, and also skips when that directory does not exist.

katana’s Xboard/, V2bX/ and XrayR/ submodules play the same reference role for panel compatibility. Nothing builds them.

The route model (first-match rule table, domain, CIDR and port matchers, GeoIP and GeoSite .dat loading) has moved twice: from local copies in the app and in katana into the shared harranu crate, and from harranu into etemenanki-environment:

Step Repository Commit
The app drops its local copy and depends on the published harranu crate Etemenanki 58ad56c Extract route model into shared harranu crate, drop patch hack
katana does the same, the same day katana 90c5e35 Replace vendored route model with the shared harranu crate
harranu 0.3 is vendored, unchanged, as etemenanki_environment::routing Etemenanki fc40d1c add etemenanki-environment: host dialers and the vendored route model
katana routes with the kernel’s copy katana e9bc640 route with the kernel’s route model instead of harranu

The reason for the last move is in fc40d1c: depending on harranu from a private registry made the workspace unbuildable wherever that registry was unreachable. (Since protocols 5.0.0 the workspace takes shinku-quic’s crates from that registry again, so a build needs it.) The consequence for contributors is that routing changes go into environment/src/routing.rs. A change to harranu reaches neither the supervisor nor katana. Since the vendoring, the kernel’s copy has grown past harranu: 2a23f58 matches domain regexes as sets (RegexSets, DomainRegexSet, parse_domain_regexes) instead of one search per pattern. The route model itself is described in Routing.

Dependencies point one way, from the front ends down to etemenanki-concepts and etemenanki-reality. Each arrow is a dependency declared in a manifest’s [dependencies]; a label names the features the dependent crate turns on.

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 (library and binary)"]
  ffi["etemenanki-ffi (not published)"]
  katana["katana (binary, own repository)"]
  environment --> concepts
  protocols --> concepts
  protocols --> environment
  protocols -->|"optional, its own reality feature"| reality
  supervisor --> concepts
  supervisor --> environment
  supervisor -->|"hysteria, tun, reality"| protocols
  webclient --> concepts
  webclient --> supervisor
  app --> concepts
  app --> environment
  app -->|"hysteria, tun, reality"| protocols
  app --> supervisor
  app --> subscribe
  app --> webclient
  ffi --> app
  ffi --> concepts
  ffi --> environment
  ffi -->|"hysteria, tun"| protocols
  ffi --> supervisor
  ffi --> subscribe
  ffi --> webclient
  katana --> concepts
  katana --> environment
  katana -->|"hysteria, reality, vendored-openssl"| protocols
  katana --> supervisor

etemenanki-subscribe depends on no other workspace crate: it is the subscribe-file schema alone (serde and toml). Neither does etemenanki-reality, on purpose: it sits below every other crate (its manifest names tokio, bytes, openssl, hkdf, hmac, sha2 and ml-kem), so a REALITY fix ships as a release of that crate alone. etemenanki-protocols reaches it only through its reality feature, behind wrapper types of its own (transports::reality::RealityServer, RealityStream and ClientConfig, and transports::Camouflage, which exists with or without the feature): no type of the reality crate shows in the protocols crate’s public API, so a reality release reaches downstreams through a lockfile update alone. The REALITY crate is on REALITY overview. etemenanki-ffi names it directly, for the subscribe file’s own types that inspect_subscribe reads and without_geo edits. etemenanki-webclient also names etemenanki-protocols as a dev-dependency. The app’s own vendored-openssl feature turns on etemenanki-protocols/vendored-openssl, as the ffi’s does.

Inside the workspace, each internal dependency carries three keys: a path (for example ../concepts) so a workspace build uses the local source, and a version plus a registry naming the private registry, which is what cargo publish writes into the published manifest in place of the path. Every published crate also sets publish to that registry alone, so none of them can reach crates.io by accident. Since 29948bf the requirements name a major and minor version only, with one exception: the supervisor asks for concepts 2.1.2, the release whose proxy client flushes the wire after each datagram. They differ per crate:

Dependent Requires
etemenanki-environment concepts 2.1
etemenanki-reality none
etemenanki-protocols concepts 2.0, environment 3.0, reality 0.1 (optional, feature reality)
etemenanki-supervisor concepts 2.1.2, environment 3.2, protocols 6.2 (features hysteria, tun, reality)
etemenanki-webclient concepts 2.0, supervisor 1.1
etemenanki-app concepts 2.0, environment 3.2, protocols 6.1 (features hysteria, tun, reality), supervisor 1.1, subscribe 1.0, webclient 2.0
etemenanki-ffi app 2.8, concepts 2.0, environment 3.0, protocols 6.0 (features hysteria, tun), supervisor 1.1, subscribe 1.0, webclient 2.0

The versions at 46c12e4, as the manifests and the workspace Cargo.lock record them, are concepts 2.1.2, environment 3.2.1, reality 0.1.1, protocols 6.2.1, supervisor 1.1.0, app 2.8.0, subscribe 1.0.0, webclient 2.0.0, ffi 0.4.1 and ffi-bindgen 0.1.0. Because every requirement is a caret requirement and the lockfile resolves each path dependency to the local crate, a requirement below the current version (the ffi’s environment 3.0, or the app’s protocols 6.1, say) is still satisfied by it.

A crate is published after everything it depends on: concepts, then environment, then reality (which needs nothing, but must be in the registry before protocols), protocols and supervisor, then subscribe and webclient, then app. shinku-quic’s four packages come before all of them when they change. The release history since 2.0.2:

Commit Release
1e74dfc release etemenanki-protocols 2.0.3 A sniffed SOCKS CONNECT whose client stays silent is answered once
39ef29c release etemenanki-environment 3.0.0, etemenanki-protocols 3.0.0, etemenanki-app 2.1.0 environment: domain regexes matched as sets; protocols: one AEAD chunk codec for both Shadowsocks flavours, the Shadowsocks 2022 salt replay filter and full-size records, and the async helpers only tests used removed; app: the subscribe file
7235a3b supervisor: move the runtime into etemenanki-supervisor supervisor 0.1.0
0720436 bump a patch version concepts 2.0.1, environment 3.0.1, protocols 3.0.1, app 2.1.1, subscribe 0.1.1; d10eaa0 then takes the supervisor to 0.1.1
eb4f693 supervisor: per-user speed limits and Hysteria 2 password auth (0.2.0) supervisor 0.2.0
11bfa21 release etemenanki-protocols 4.0.0, etemenanki-supervisor 0.3.0 protocols 4.0.0, supervisor 0.3.0
555b7df release etemenanki-protocols 4.0.1, etemenanki-supervisor 0.3.1 protocols 4.0.1, supervisor 0.3.1
a991b0d release etemenanki-concepts 2.1.0 concepts 2.1.0: the runtime buffers grow with the bytes that pass through them
c1783f6 release etemenanki-protocols 4.0.2 protocols 4.0.2: a refused gRPC stream keeps no connection and is logged, and a connection with no streams is told to go away after 30 s
972590b release etemenanki-supervisor 0.4.0 supervisor 0.4.0, breaking: Guarded is removed, a drain closes flows through the tracker, and a replaced or removed WireGuard outbound always closes its flows
f669c47 release etemenanki-protocols 4.0.3, etemenanki-supervisor 0.4.1 protocols 4.0.3: a sniff collector owns no memory until it is given bytes; supervisor 0.4.1: a connection’s task holds neither its future nor its core twice
0627a84 release etemenanki-protocols 4.1.0, etemenanki-supervisor 0.4.2 protocols 4.1.0: a VMess user set is prepared off the hot path and installed with a pointer swap; supervisor 0.4.2: an apply’s user work runs off the runtime
6a92abf release etemenanki-protocols 4.1.1 A gRPC peer that is still sending is not judged dead by the keepalive
5ba294a release etemenanki-protocols 4.1.2 WireGuard: a tunnel TCP connection whose application is gone is reaped, an expired session is revived, a failed name is looked up again after 10 s, one driver pass per batch of datagrams, and Cubic
2308b60 adjust versions concepts 2.1.1, environment 3.0.2, protocols 4.1.3, supervisor 0.4.3, app 2.1.2, subscribe 0.1.2, webclient 0.1.1, ffi 0.1.1, after 29948bf loosened the internal requirements
3be1887 release etemenanki-protocols 4.2.0, etemenanki-supervisor 0.5.0, etemenanki-webclient 0.2.0, etemenanki-app 2.2.0 A per-inbound switch for the VMess clock check, and why an auth id is refused
e6c1c41 release etemenanki-environment 3.1.0, etemenanki-protocols 4.3.0, etemenanki-supervisor 0.6.0, etemenanki-webclient 0.3.0, etemenanki-app 2.3.0 A TUN device refuses an IPv6 connection at its handshake when no egress reaches IPv6
436b1c1 release etemenanki-environment 3.2.0, etemenanki-protocols 4.4.0, etemenanki-supervisor 0.7.0, etemenanki-webclient 0.4.0, etemenanki-app 2.4.0 Builds for macOS and Windows: a Wintun TUN device, routes and interface binding off Linux
8c8a194 release etemenanki-protocols 4.5.0, etemenanki-supervisor 0.8.0, etemenanki-webclient 0.5.0, etemenanki-app 2.4.1 A per-user device limit, an IP ban for failed authentications, and closing a gRPC connection whose streams keep failing
8c5c6bc release etemenanki-protocols 5.0.0, etemenanki-supervisor 0.9.0, etemenanki-subscribe 0.2.0, etemenanki-webclient 0.6.0, etemenanki-app 2.5.0 Hysteria 2 on shinku-quic: a send rate agreed at /auth in both directions, port hopping and upstream’s QUIC settings, through to the config and the subscribe file; ffi 0.2.0 adds subscription inspection, configuration checks and route previews
8e51843 release etemenanki-protocols 5.0.1 The relay deadline armed before a sniffed flow opens, and Android’s system CA certificates
c3b144f release etemenanki-protocols 5.1.0, etemenanki-supervisor 0.10.0, etemenanki-webclient 0.7.0, etemenanki-app 2.5.1 VMess tries likely users before the full auth-id scan: the user a gRPC connection’s last authenticated stream matched, the users last matched from the client’s address, and a hot tier of recent users. A WebSocket inbound behind a trusted reverse proxy takes its client from a header; the new public fields on InboundSpec and StreamInbound make supervisor 0.10.0 a breaking release. TLS reads ahead on both ends, and h2’s writes on gRPC are held until h2 flushes, so a frame goes out as one TLS record
c8ed181 release etemenanki-protocols 5.2.0, etemenanki-supervisor 0.11.0, etemenanki-webclient 0.8.0, etemenanki-app 2.5.2 A stream inbound on a TCP listener may also take the connections a relay on the same host hands over on a Unix socket, its handoff socket, and serves them as ones it accepted; the new public InboundSpec::handoff and BindSpec::Handoff make supervisor 0.11.0 a breaking release, which webclient 0.8.0 and app 2.5.2 follow. protocols 5.2.0 decodes a PROXY protocol v2 header from bytes in hand (decode_v2, Header, MAX_V2_LEN) and holds every fixed field to the protocol
085ee6a release etemenanki-supervisor 0.11.1 An inbound’s TCP listener and its handoff socket count against one set of handshake and live-connection caps, the inbound’s; a handoff message is read into MAX_V2_LEN + 1 bytes, so a byte after a full-size PROXY header is refused like any other trailing byte
656ae50 release etemenanki-supervisor 0.11.2 A Unix or handoff socket is bound under a staging name beside its path and moved over the path at commit, so a refused apply leaves a running listener’s socket file in place
617311a release etemenanki-supervisor 0.11.3 The staging name is a dot and random letters, drawn afresh for every bind, and nothing found at a staging name is removed
f175f4d release etemenanki-environment 3.2.1, etemenanki-protocols 5.2.1 environment: geoip.dat and geosite.dat are read from disk as a stream, every record still checked, and only the entries a rule names are built; protocols: on iOS the TLS clients and the Hysteria 2 client trust Mozilla’s roots, built in from webpki-root-certs
759e9c2 release etemenanki-supervisor 0.11.4 The IP ban for failed authentications counts failures, bans, and the success that clears a count by the client’s /64 for IPv6 and by its address for IPv4; an IPv4-mapped IPv6 address counts as its IPv4 address. Before it, bfa183a takes ffi to 0.3.0: convert_subscription makes subscriptions in other clients’ formats into subscribe files with libsubconv, and without_geo drops a subscribe file’s geo matchers
66734fb release etemenanki-reality 0.1.0, etemenanki-protocols 6.0.0, etemenanki-supervisor 0.12.0, etemenanki-subscribe 0.3.0, etemenanki-webclient 0.9.0, etemenanki-app 2.6.0 AnyTLS, server and client; the new etemenanki-reality crate, and REALITY as an inbound and outbound transport for VLESS alone; VLESS request addons and the XTLS Vision flow, over REALITY only; SOCKS and Shadowsocks inbounds over a transport; subscribe nodes for AnyTLS, REALITY and the VLESS flow, and subscribe::VERSION; the public enums that grow with protocols and transports become #[non_exhaustive] (see below). ee34171 then locks the ffi’s libsubconv at 1.1.0, which writes AnyTLS, REALITY and Vision nodes
0a692ff release etemenanki-concepts 2.1.2, etemenanki-protocols 6.1.0, etemenanki-supervisor 0.13.0, etemenanki-subscribe 0.3.1, etemenanki-webclient 0.10.0, etemenanki-app 2.7.0 The sss protocol end to end, through the spec, the config and the subscribe file; concepts 2.1.2: a proxy client flushes the wire after each datagram; protocols 6.1.0: the SOCKS driver flushes the sniffed prefix it forwards. supervisor 0.13.0, subscribe 0.3.1 and webclient 0.10.0 were never published
ff66eea release etemenanki-supervisor 1.0.0, etemenanki-subscribe 1.0.0, etemenanki-webclient 1.0.0 The same content as 0a692ff, published as supervisor, subscribe and webclient 1.0.0 instead: the three leave 0.x. 9bdc415 then locks the ffi’s libsubconv at 1.2.0, which reads sss:// share links; ffi 0.3.1 is not published
0293c7d release etemenanki-app 2.7.1 An sss inbound’s reject table holds fallback and nothing else; any other key is refused by name
2f00a88 release etemenanki-reality 0.1.1, etemenanki-app 2.7.2 etemenanki-reality 0.1.1 for the app’s REALITY client; no configuration or API change
1b5de30 release etemenanki-protocols 6.2.0, etemenanki-supervisor 1.0.1, etemenanki-app 2.7.3 protocols 6.2.0: a VLESS request with an unknown user id is refused as such whatever flow it asks for; the VLESS client codecs reserve room for the Vision addons; the Vision writer sends its own direct command first, as Xray’s does, so two Etemenanki peers reach the raw socket; UDP through a Vision VLESS outbound rides XUDP, through the new VlessDatagram::with_flow (the reason for the minor). supervisor 1.0.1: a Vision VLESS outbound builds its datagram codec with the flow, and requires protocols 6.2. app 2.7.3 only carries both in its lock
6c84b15 release etemenanki-protocols 6.2.1, etemenanki-supervisor 1.1.0, etemenanki-webclient 2.0.0, etemenanki-app 2.8.0 protocols 6.2.1: on Windows and macOS, client TLS also trusts the platform’s CA store; supervisor 1.1.0: Supervisor::close_rerouted, which closes the live flows a route change moves to another outbound, and Supervisor::http_ping, a delay test through a named outbound, with the new public ping module; webclient 2.0.0: router takes the Supervisor instead of its Tracker (the breaking change), a route switch may ask to close what it moved, and GET /v1/outbounds/{tag}/delay; app 2.8.0 hands the API its supervisor (Instance::supervisor). ffi 0.4.0: set_route takes close_connections, and http_ping is new; 46c12e4 then adds Proxy::close_rerouted as ffi 0.4.1. Neither ffi version is published

Since 66734fb, the public enums that grow as protocols and transports are added are #[non_exhaustive], so a new variant in one of them is an addition rather than a breaking change: InboundTransport, TransportKind, TransportStream and Disposition in protocols; InboundProtocolSpec, OutboundProtocolSpec and StreamShape in the supervisor; Protocol, Stream, VmessSecurity, ShadowsocksMethod and Hysteria2Obfs in subscribe. The front ends match them with a wildcard arm: the app turns a subscribe node it cannot convert into a config error naming the node, and the ffi reports such a node as unknown. The supervisor’s runtime enums StreamProtocol and Outbound stay exhaustive, which is why sss, which added a variant to each, needed a new supervisor release that breaks compatibility.

No crate declares a default feature set, so every feature below is opt-in.

Feature Crate What it turns on Enabled by
reality etemenanki-protocols dep:etemenanki-reality; compiles transports::reality and vless::vision::VisionStream, and the Reality variants of InboundTransport, TransportKind and TransportStream, with TransportStream::Vision etemenanki-supervisor, etemenanki-app, katana; the ffi gets it through the supervisor
hysteria etemenanki-protocols dep:quinn (shinku-quinn), dep:h3, dep:h3-quinn (shinku-h3-quinn), dep:shinku-quic, dep:rustls, dep:rustls-native-certs, dep:rustls-pemfile, dep:rustls-pki-types, dep:blake2; compiles protocols::hysteria etemenanki-supervisor, etemenanki-app, etemenanki-ffi, katana
tun etemenanki-protocols dep:ipstack, dep:tun-rs, dep:etherparse, dep:rtnetlink (a Linux target dependency), dep:route_manager (a macOS and Windows target dependency), and on Windows tun-rs/interruptible; compiles protocols::tun under #[cfg(all(feature = "tun", any(unix, windows)))] etemenanki-supervisor, etemenanki-app, etemenanki-ffi; katana gets it through the supervisor
vendored-openssl etemenanki-protocols openssl/vendored: OpenSSL is built from source and linked statically katana; the vendored-openssl features of etemenanki-app and etemenanki-ffi forward to it
vendored-openssl etemenanki-app etemenanki-protocols/vendored-openssl, for targets without a system OpenSSL to link: Windows, and macOS without Homebrew’s A build that asks for it, or --all-features
vendored-openssl etemenanki-ffi etemenanki-protocols/vendored-openssl, for mobile targets without a system OpenSSL The ffi build scripts, or --all-features
quic etemenanki-environment dep:quinn; compiles dial::quic (QuicDialer, SocketWrap) No crate; only --all-features or an explicit --features quic

The reasons are recorded in the manifests. hysteria is off by default because it “pulls in a whole second TLS stack (quinn -> rustls)”, and a downstream that only wants the classic protocols must not inherit it on its next version bump. tun is off for the same reason: an interface-management stack should not reach crates that never touch it. reality is off “like the two above”: it brings a TLS 1.3 of its own and ML-KEM. The supervisor turns all three on, because it serves Hysteria 2, TUN and VLESS + REALITY inbounds for every front end, so every crate built on the supervisor, katana and the ffi included, compiles them: katana’s Cargo.lock at 4.10.0 contains etemenanki-reality, ml-kem, ipstack, tun-rs, etherparse, rtnetlink and route_manager. katana also names hysteria and reality itself, and opts in to vendored-openssl because its release binaries must not link OpenSSL dynamically (see CI).

protocols::hysteria builds its QUIC endpoints on quinn directly, which is shinku-quic’s patched shinku-quinn under its library name, and on shinku-quic itself for the congestion controller switched after the handshake (Negotiated), Brutal, HoppingSocket and Bandwidth; see the shinku-quic overview. The workspace names the shinku packages through aliases (quinn = { package = "shinku-quinn", … }), not a [patch], and crates.io’s quinn must never be added beside them. protocols::hysteria does not enable etemenanki-environment/quic, so no production build at the verified revision compiles QuicDialer. The supervisor names quinn directly too, only to name the TLS material a Hysteria 2 listener is swapped to.

Dependency in katana’s Cargo.toml Requirement Features Resolved in Cargo.lock
etemenanki-concepts version = "2.1", private registry none 2.2.0, registry source and checksum recorded
etemenanki-environment version = "3.0", private registry none 3.2.2
etemenanki-protocols version = "7.1.1", private registry vendored-openssl, hysteria, reality 7.2.1
etemenanki-supervisor version = "2.1", private registry none 2.1.0
helium-node-api version = "0.2.0", private registry none 0.2.0

helium-node-api is not a kernel crate: it holds the bodies of Helium’s node API v2 (config::NodeConfig, users::Users, report::Report, report::ReportAnswer), which Helium serializes from the same definitions; katana lowers the node config as it is, the one model of a node whatever the panel (src/api/mod.rs → Node). It depends on base64, serde, serde_json and uuid alone. The lockfile also resolves etemenanki-reality 0.1.1 and shinku-quic’s packages, at 0.1.0, through the protocols crate. A bare version is a caret requirement. For 2.1 that is any 2.x at or above 2.1.0, and for 7.1.1 any 7.x at or above 7.1.1; for a 0.x version the caret stops at the next minor, so the protocols crate’s 0.1 for etemenanki-reality accepts 0.1.0 up to, but not including, 0.2.0. The exact version is pinned by Cargo.lock, which records the registry source and a checksum for each crate, and the release workflow builds with --locked, so a build fails instead of resolving a different kernel. To move katana to a new kernel release, update one package at a time with cargo update -p <crate> --precise <version> and check that nothing else in the lockfile moved.

Both repositories declare the registry in .cargo/config.toml with the cargo:token credential provider. The token is never in the repository; CI passes it in through an environment variable.

Setting Value Where
Edition 2024 [workspace.package], inherited by every crate
Resolver 3 [workspace]
Shared versions One [workspace.dependencies] table; members write tokio.workspace = true Cargo.toml
Release profile lto = true Etemenanki Cargo.toml
Release profile (katana) lto = true, codegen-units = 4 katana Cargo.toml

Three traits from etemenanki-concepts are the seams every other crate plugs into. The details are on Server core, Server runtime and Links, connectors and net types.

concepts/src/link.rs → Connector and DatagramLink: what an outbound is, and how one is opened.

pub enum Outbound<S, D> {
Stream(S),
Datagram(D),
}
pub trait Connector<Target> {
type Stream: AsyncRead + AsyncWrite + Unpin;
type Datagram: DatagramLink;
type Future: Future<Output = io::Result<Outbound<Self::Stream, Self::Datagram>>>;
fn connect(&mut self, target: Target) -> Self::Future;
}
pub trait DatagramLink: Unpin {
type Addr;
fn poll_send_to(
&mut self,
cx: &mut Context<'_>,
buf: &[u8],
to: &Self::Addr,
) -> Poll<io::Result<usize>>;
fn poll_recv_from(
&mut self,
cx: &mut Context<'_>,
buf: &mut ReadBuf<'_>,
) -> Poll<io::Result<Self::Addr>>;
}

concepts/src/core.rs → ProxyCoreDecode: the server side of a protocol as a sans-I/O state machine.

pub trait ProxyCoreDecode {
type Key: Copy + Ord + Send + Sync + 'static;
type Target;
type Error;
type TransportAddr: Clone + Send + Sync + 'static;
const STAGING_RESERVE: usize;
const MAX_DATAGRAM: usize = 4096;
fn handle(
&mut self,
event: Event<'_, Self>,
effects: &mut Effects<'_, Self>,
) -> Result<usize, Self::Error>;
fn held(&self) -> &[u8] { .. }
}

concepts/src/runtime.rs → ProxyServerRuntime: the per-connection driver that ties a core, its transport and a connector together.

pub struct ProxyServerRuntime<const BUF_SIZE: usize, Core, Trans, Conn, Mode = ProxyRunsQuiet>
where
Core: ProxyCoreDecode,
Conn: Connector<Core::Target>,
{ .. }
impl<const BUF_SIZE: usize, Core, T, Conn>
ProxyServerRuntime<BUF_SIZE, Core, StreamTransport<T>, Conn, ProxyRunsQuiet>
where
Core: ProxyCoreDecode,
T: AsyncRead + AsyncWrite + Unpin,
Conn: Connector<Core::Target>,
{
pub fn new(transport: T, core: Core, connector: Conn) -> Self { .. }
}
impl<const BUF_SIZE: usize, Core, D, Conn>
ProxyServerRuntime<BUF_SIZE, Core, DatagramTransport<D>, Conn, ProxyRunsQuiet>
where
Core: ProxyCoreDecode,
D: DatagramLink<Addr = Core::TransportAddr>,
Conn: Connector<Core::Target>,
{
pub fn over_datagrams(link: D, core: Core, connector: Conn) -> Self { .. }
}

new wraps a byte stream, over_datagrams a DatagramLink; both assert BUF_SIZE > Core::STAGING_RESERVE, because a smaller buffer would never have room to read. showing_progress turns the quiet Future into the Stream of Traffic reports described under tokio-stream below.

protocols/src/flow.rs → Flow<T>: the Target of every server core in etemenanki-protocols.

pub struct Flow<T> {
pub destination: Destination,
pub user: NetworkUser<T>,
pub sniffed: Option<SniffedBehavior>,
pub source: Option<IpAddr>,
}

supervisor/src/topology/flow.rs fixes T for every front end, and adds where a flow entered:

pub type Flow = etemenanki_protocols::flow::Flow<Principal>;
pub struct Principal {
user: Option<UserKey>,
label: CompactString,
revoked: OnceLock<UserRemovalPolicy>,
}
pub struct FlowContext {
pub inbound_tag: CompactString,
pub source: Option<IpAddr>,
}

A Principal is who a flow was admitted as: the user’s key and its label (Principal::user), or nobody in particular (Principal::anonymous), and whether the user has since been revoked. FlowContext is the inbound tag and client address a connector routes by. Both are on Users, principals and sessions and Listeners and the serve loop.

Who implements what, at the verified revisions (katana implements none of these traits any more):

Trait Implementations
ProxyCoreDecode TrojanCore, VlessCore, VMessCore, ShadowsocksCore, Ss2022Core, HttpCore, AnyTlsCore, SssCore, PassthroughCore, Hy2StreamCore, Hy2UdpCore, TunUdpCore. SOCKS is the exception: socks/server.rs → SocksInbound drives its own control connection.
ProxyCoreEncode (client codec) TrojanStream, VlessStream, VMessStream, SsStream, Ss2022Stream, SssStream, SocksConnect, HttpConnect, and NoCodec
ProxyCoreEncodeDatagram TrojanDatagram, VlessDatagram, VMessDatagram, SssDatagram, and NoCodec
Connector<Target> concepts: SocketConnector, ProxyClientConnector, every FnMut(Target) -> Fut closure; environment: Dialer (for DialTarget and SocketTarget); protocols: TransportConnector, SssConnector (which wraps another connector’s stream in sss’s transform chains), WgConnector, Hy2Connector, AnyTlsConnector; supervisor: AppConnector (supervisor/src/connector.rs), FreedomConnector
DatagramLink concepts: UdpSocket, UdpOutbound, NoDatagram, ProxyClientRuntime; environment: DualStackUdp; protocols: SocksUdpLink, WgDatagramLink, Hy2DatagramLink, AnyTlsDatagram, QuicDatagrams, TunUdpLink; supervisor: FanOutLink, ResolvingUdp, OutboundDatagram, BlackholeLink, DnsUdpLink (topology/outbound/dns.rs), MeteredDatagram<D> (track/metered.rs)
Dependency Crates Why it is there
tokio (full) every crate but subscribe and ffi-bindgen The runtime, sockets and timers. The dev-dependencies of concepts, environment, reality, protocols and the supervisor add test-util for start_paused tests, because idle, keepalive, drain and removal deadlines are minutes long.
tokio-stream concepts, protocols, supervisor, webclient The Stream trait: in ProxyShowsProgress mode ProxyServerRuntime is a Stream whose items are Result<Traffic, RuntimeError<_>> progress reports, rather than a Future. The webclient streams server-sent events over the tracker’s channels.
tokio-util protocols, supervisor CancellationToken and TaskTracker: the supervisor runs every accept loop and connection on a TaskTracker, each session under a child of the root token (supervisor/src/serve.rs → Shared::spawn_until, which ends a connection’s future with FutureExt::with_cancellation_token_owned), and the Hysteria 2 and TUN inbounds stop their tasks with one. AbortOnDropHandle ties a background task to the value that owns it: the HTTP/2 driver of a dialed gRPC stream, and the HTTP/3 driver and datagram pump of a Hysteria 2 client connection.
futures protocols, supervisor, webclient, ffi The Sink and Stream traits over a tokio-tungstenite socket (ws/stream.rs), and a Shared future so concurrent callers await one Hysteria 2 connection build (hysteria/slot.rs).
pin-project concepts Pinned projections in the hand-written futures of relay.rs.
compact_str, smallvec concepts and up Remote::Domain holds a CompactString; EffectList is a SmallVec with INLINE_EFFECTS = 4 inline slots, so a typical event allocates nothing.
parking_lot concepts, protocols, supervisor, ffi Short, never-awaited locks: wake.rs → ReadyQueue, the user tables, the rebuildable connection slots.
arc-swap protocols, supervisor Values replaced under live readers: user tables (vmess/accounts.rs, the Hysteria 2 authenticator, the supervisor’s per-inbound tables) and the supervisor’s data plane (topology/plane.rs).
scc supervisor The live-flow registry (track/mod.rs → Inner::flows, an scc::HashMap), picked by the manifest’s comment over the alternatives for open-and-close churn beside the sampler’s full scans.
rand protocols Salts, request padding, VMess session keys, DNS query IDs, AnyTLS padding sizes and the lengths of sss’s pad transform.
openssl, tokio-openssl protocols; openssl also reality Every TLS session over TCP but REALITY’s: the TLS transport (transports/tls/config.rs builds servers from SslAcceptor::mozilla_intermediate_v5, sets a minimum of TLS 1.2 on both sides, and turns on OpenSSL’s read-ahead on both) and the DNS-over-TLS and DNS-over-HTTPS backends in dns/mod.rs. On Android and iOS, transports/tls/platform_roots.rs supplies the roots for this stack and for the Hysteria 2 client’s rustls, since neither finds a store there on its own: on Android the system’s CA certificates, read file by file, and on iOS Mozilla’s roots from webpki-root-certs. On Windows and macOS it supplies this stack’s roots too, the platform’s store listed through rustls-native-certs, because OpenSSL built from source looks only under its build-time OPENSSLDIR, a placeholder on Windows and /usr/local/ssl on macOS. In etemenanki-reality, OpenSSL runs the record AEAD (EVP, one record at a time), X25519, Ed25519 and the throwaway certificate, under a TLS 1.3 handshake that crate speaks itself.
webpki-root-certs protocols, iOS targets only; also a protocols dev-dependency Mozilla’s root certificates, which stand in for the trust store on iOS, where an app cannot reach the system’s: transports/tls/platform_roots.rs → bundled converts them to OpenSSL certificates once per process. The dev-dependency lets a host test check that every one converts.
rustls-native-certs protocols: feature hysteria, and always on macOS and Windows targets; also a protocols dev-dependency The platform’s trust store as DER certificates; it does not bring rustls in. The Hysteria 2 client’s rustls loads its system roots with it (hysteria/connection.rs → system_roots). On Windows and macOS, transports/tls/platform_roots.rs → native converts what it lists (the Windows certificate store, the macOS keychains) to OpenSSL certificates once per process, skipping one that does not convert. The dev-dependency lets a host test check that every certificate the host’s store lists converts.
quinn (shinku-quinn 0.1), h3, h3-quinn (shinku-h3-quinn 0.1), rustls, rustls-pemfile, rustls-pki-types protocols, feature hysteria; quinn alone also in environment (feature quic) and the supervisor QUIC and HTTP/3 for Hysteria 2, and the QUIC dialer. quinn and h3-quinn are shinku-quic’s packages under package aliases, from the private registry; Cargo.lock holds shinku-quinn, shinku-quinn-proto and shinku-h3-quinn, and no crates.io quinn. rustls is there only because it is quinn’s one crypto backend.
shinku-quic 0.1 protocols, feature hysteria The congestion controllers and sockets around quinn: Negotiated, which switches a connection to Brutal at the rate agreed at /auth, HoppingSocket for port hopping, and Bandwidth. See the shinku-quic overview.
blake2 protocols, feature hysteria The Salamander obfuscator’s hash.
boringtun, smoltcp protocols (always) WireGuard: boringtun’s Tunn runs the WireGuard protocol, smoltcp is the userspace TCP/IP stack inside the tunnel. Not behind a feature.
h2, http protocols; http also the supervisor h2 carries the gRPC transport over HTTP/2 (transports/grpc/, and serving one HTTP/2 connection as many streams in transports/accept.rs). The http types also serve the WebSocket upgrade headers and the Hysteria 2 HTTP/3 authentication and masquerade. The supervisor takes a delay test’s URL apart with http::Uri (ping.rs → PingUrl).
tokio-tungstenite protocols The WebSocket transport.
httparse protocols, supervisor HTTP/1.x request and response heads in http/protocol.rs, and the response heads a delay test reads (supervisor/src/ping.rs).
ipstack, tun-rs, rtnetlink, route_manager protocols, feature tun The userspace IP stack, device creation (a Wintun adapter on Windows, where tun-rs takes its interruptible feature), and route installation: rtnetlink on Linux, route_manager 0.2 (Cargo.lock: 0.2.16) on macOS and Windows.
etherparse protocols, feature tun Reading a client’s IPv6 SYN and building the RST that refuses it (tun/ipv6.rs), before the stack sees the packet.
aes, aes-gcm, chacha20poly1305, hkdf, sha1, sha2, md-5, crc32fast, blake3, subtle protocols The ciphers, KDFs and hashes of VMess, Shadowsocks and Trojan: md-5 for the Shadowsocks EVP_BytesToKey, the VMess command key, the VMess ChaCha20-Poly1305 body key and the md5 of an AnyTLS padding scheme, HKDF-SHA1 for Shadowsocks AEAD subkeys, SHA-256 for the VMess KDF and an AnyTLS password, SHA-224 for the Trojan password hash, CRC32 for the checksum inside a VMess auth id, BLAKE3 for the Shadowsocks 2022 session and identity subkeys.
sha2, hex webclient The config file’s ETag (webclient/src/etag.rs).
socket2 environment, protocols; the supervisor on Unix Socket options that must be set between creation and bind or connect (SocketOptions), and TCP keepalive (transports/keepalive.rs). The supervisor binds a handoff socket with it, so the socket file gets its mode before it listens, and checks a handed-over socket’s type and peer (system/listener.rs, system/handoff.rs).
libc 0.2 supervisor, Unix only The one recvmsg that receives a handed-over socket as SCM_RIGHTS, which neither std nor socket2 offers (system/handoff.rs → recv_with_fds, the only unsafe code in the supervisor), and the handoff socket’s SOMAXCONN backlog.
windows-sys 0.61 (Win32_Networking_WinSock) environment, Windows only IP_UNICAST_IF and IPV6_UNICAST_IF, binding a socket to an interface index, which socket2 does not offer on Windows (dial/socket.rs).
cidr, regex, prost environment; cidr also the supervisor Route matchers; prost decodes each record (a CIDR or a domain) of geoip.dat and geosite.dat, and routing/dat.rs parses the list and entry levels around the records by hand. The supervisor’s RealIpSpec holds the networks of the proxies a WebSocket inbound trusts as cidr::IpCidrs. The app also uses cidr directly.
moka (future) protocols The DNS answer cache in dns/mod.rs, a moka::future::Cache bounded at CACHE_CAPACITY = 8192 names.
axum webclient The client REST API’s HTTP server (HTTP/1, JSON, query strings); tower and http-body-util drive it in the tests of the webclient and the app.
uniffi ffi ("0.32"), ffi-bindgen (0.32.2) The Kotlin and Swift bindings of the mobile library, and the generator that writes them; Cargo.lock resolves 0.32.2.
libsubconv (1.0, private registry; Cargo.lock: 1.2.0), base64 ffi; base64 also protocols ffi/src/convert.rs: libsubconv makes a subscription in another client’s format (mihomo, share links, sing-box, Surge, Surfboard, Loon, Quantumult X) into a subscribe file, the nodes only, with the routes and DNS of its best template; at 1.2.0 it writes AnyTLS, REALITY, Vision and sss nodes, and reads sss:// share links. base64 unwraps a subscription sent as base64. libsubconv requires the registry’s etemenanki-subscribe at exactly 1.0.0, so Cargo.lock holds that published copy beside the workspace member, and it declares rust-version = "1.98". See ffi.
serde, serde_json serde: supervisor, app, subscribe, webclient; serde_json: webclient The supervisor serializes UsageDelta for a panel, and carries no config types; the app, subscribe and webclient use serde for their schemas and JSON. The webclient turns a route switch’s report into a serde_json value to add closed to it.
toml, toml_edit, clap, notify, tracing-subscriber app (tracing-subscriber also ffi; toml also subscribe and ffi) Configuration, route-pick edits that keep the file’s formatting (app/src/routes.rs), the command line, the file watcher behind reload, and log output.
thiserror, anyhow thiserror in most crates, anyhow in protocols Error types, including ProtocolError and its opaque Other variant.
uuid concepts, protocols, supervisor, app UserAuthorization::Uuid for VMess, VLESS and sss users.
hkdf, hmac, sha2, ml-kem 0.3 (hazmat; Cargo.lock: 0.3.3) reality The TLS 1.3 key schedule (HKDF-Expand-Label, the Finished MAC), REALITY’s auth key and the HMAC in its throwaway certificate, all run only during the handshake; ml-kem is the ML-KEM-768 half of X25519MLKEM768, because openssl 0.10 has no ML-KEM encapsulation and a system OpenSSL may predate 3.5. Its randomness comes from OpenSSL’s RNG, through the call the hazmat feature documents.
zstd-safe 7.2 (std only; Cargo.lock: 7.3.0) protocols sss’s zstd transform: one-shot frames only, so neither the legacy format nor the dictionary builder is built.
proptest, criterion dev: supervisor; criterion also protocols The usage ledger’s exactly-once property test, and the benches protocols/benches/vmess_users.rs and supervisor/benches/tracking.rs.
reqwest (gzip, native-tls-vendored), serde_json, notify, socket2 katana The panel HTTP clients and their JSON bodies, every request asking for a gzip-compressed answer (on Linux native-tls is OpenSSL, and the vendored flavour builds it statically, like the kernel’s vendored-openssl); the config watcher; and socket2 to tell whether the host serves IPv6 on :: (src/lower/inbound.rs → dual_stack).
helium-node-api katana The typed bodies of Helium’s node API v2, the node config, the users answer and the report, from the private registry. Its node config is katana’s model of every panel’s node (src/api/mod.rs → Node): helium’s answer goes to lowering as it came, and the newV2board client converts a UniProxy answer into one; src/api/helium.rs maps the users and the report to and from katana’s own models.
mimalloc katana, musl targets only The global allocator of the musl build (src/main.rs → GLOBAL), because musl’s own allocator takes one global lock for every allocation and free. The glibc build keeps glibc’s allocator.

Other dev-only dependencies: rcgen, rustls and rustls-pki-types in environment (certificates for the QUIC dialer test); etherparse in the ffi (IP packets for the fake TUN device); openssl, boringtun and smoltcp in the app (test certificates and an in-process WireGuard peer), and base64 there for the REALITY keys its end-to-end tests write into configs; base64 in reality, for test keys in the form configs hold them; openssl, socket2, h2, bytes and tokio-tungstenite in the supervisor (test certificates, the socket type a socket-policy hook is shown, a gRPC client opening many streams on one connection, and a WebSocket client whose upgrade carries the headers a proxy would add). Besides tokio with test-util, katana’s only dev-dependency is openssl with vendored, for the self-signed certificates of its Xray TLS tests; vendoring it matches the kernel’s vendored-openssl, so both resolve to one OpenSSL build.

OpenSSL terminates every TLS session that runs over TCP, with one exception: REALITY, whose TLS 1.3 handshake etemenanki-reality speaks itself, because no stock stack can replay dest’s ServerHello or pad each record to dest’s lengths. Even there, OpenSSL protects the records and does X25519 and Ed25519; the RustCrypto crates (HKDF, HMAC, the hashes and ML-KEM) run only during the handshake; see REALITY overview. rustls enters the build only with quinn: under the hysteria feature of etemenanki-protocols, or the quic feature of etemenanki-environment, which no crate enables. It is there because QUIC embeds TLS in its handshake state machine and quinn offers no other backend. Both rustls configurations the code builds, in protocols::hysteria, are built with an explicitly named provider:

let provider = Arc::new(rustls::crypto::ring::default_provider());
let builder = rustls::ClientConfig::builder_with_provider(provider)

That is hysteria/connection.rs → tls_config for the client and hysteria/server/endpoint.rs → tls_config for the server. The plain ClientConfig::builder() and ServerConfig::builder() panic when a downstream unifies a second crypto-provider feature into the build, so they must never be used. The server configuration also pins TLS 1.3: QuicServerConfig unwraps rustls::quic::ServerConnection::new on the first packet, so a configuration without TLS 1.3 would panic inside the accept loop rather than fail at build time.

Line counts are at the verified revision and include doc comments. Unit tests live outside src/ (see Tests), so the counts are code and documentation only, with two exceptions: three inline mod tests blocks in etemenanki-concepts (most of them the buffer tests in buffer.rs), and one small block in katana.

4,154 lines. The sans-I/O model: server cores, client codecs, the two runtimes, links and connectors. It contains no protocol code and depends on no other workspace crate.

File Lines Responsibility
lib.rs 44 Crate docs, including the one-task diagram, and the module list
core.rs 732 The protocol traits. Server side: ProxyCoreDecode, Event, Effect, Effects, EffectList. Client side: ProxyCoreEncodeHandshake, ProxyCoreEncode, ProxyCoreEncodeDatagram, Handshake, Reply, Opened, NoCodec
runtime.rs 1,418 ProxyServerRuntime, the Transport trait with StreamTransport and DatagramTransport, Traffic, RuntimeError, the ProxyRunsQuiet and ProxyShowsProgress modes, WORK_BUDGET
client.rs 692 ProxyClientRuntime (a codec over a dialed upstream, exposed as a byte stream or a DatagramLink that flushes the wire after each packet it writes), ProxyClientConnector, ProxyClientConnecting
link.rs 223 DatagramLink, Outbound, Connector and its closure impl, UdpOutbound, SocketConnector, SocketTarget, NoStream, NoDatagram
buffer.rs 472 ReadBuffer and WriteBuffer, capped at N and grown on demand (the read buffer from INITIAL, 2 KiB; the write buffer from nothing), and Staging, the append-only view of a WriteBuffer’s free tail that a core writes into and that grows it; the buffer tests, inline
wake.rs 180 ReadyQueue and KeyWaker: per-key wake-ups, so the runtime polls only the outbounds that became ready
relay.rs 277 UnidirectionalConnection, BidirectionalConnection, Relayed: byte-copy futures for passthrough paths
net.rs 94 UserAuthorization, NetworkUser, DialNetwork, Remote, Destination
sniff.rs 22 SniffedProtocol, SniffedBehavior, the Sniffer trait

2,013 lines. Two halves that do not depend on each other: how this host opens a socket, and which outbound a flow is routed to.

File Lines Responsibility
lib.rs 40 Crate docs and the lint policy
dial/mod.rs 100 DialTarget, Dialer, and its Connector impls for DialTarget and SocketTarget
dial/socket.rs 297 SocketOptions (source address, Interface, packet mark, TCP keepalive, SocketHook), AddressFamily, per-OS support decided at compile time, including IP_UNICAST_IF on Windows
dial/tcp.rs 109 TcpDialer, connect_any across addresses, DEFAULT_CONNECT_TIMEOUT = 10 s per attempt
dial/udp.rs 208 UdpDialer, bind, bind_dual, source_toward (the source the kernel would send from, asked without sending), DualStackUdp
dial/quic.rs 90 Feature quic: QuicDialer, SocketWrap
routing.rs 842 The route model: RouteTarget, RouteMatch, RouteTable (with every_outcome, every output a flow may reach once a domain is sniffed), DomainRegex, the regex sets (RegexSets, DomainRegexSet, parse_domain_regexes), GeoData and build_geo_data, which builds only the sets the rules name, .dat protobuf messages
routing/dat.rs 327 The streaming .dat reader: for_each_entry walks geoip.dat or geosite.dat from disk entry by entry, parsing the list and entry levels by hand to prost’s rules and decoding every record with prost, and Entry::replay reads an entry a rule names a second time to build from it

Dialers are covered in Dialers, routing in Routing.

5,053 lines. REALITY, server and client: a TLS 1.3 of its own, the session_id authentication and the camouflage relay to dest. It depends on no other workspace crate. Its pages start at REALITY overview.

File Lines Responsibility
lib.rs 77 Crate docs, the lint policy, and the public surface: client, server, RealityStream, RawParts, ConfigError, and the decoders of Xray’s formats (decode_private_key, decode_public_key, decode_short_id, decode_client_version)
keys.rs 394 The configured values in Xray’s formats: the X25519 keys, the shortIds, the client version bounds and the server names, with Debug redacted where a value lets a client in
kx.rs 198 The handshake’s key exchange: X25519 through OpenSSL, and the hybrid X25519MLKEM768 with ML-KEM-768 from ml-kem
auth.rs 292 REALITY’s authentication: the auth key, the session_id sealed and opened with it, and the throwaway Ed25519 certificate whose signature field is an HMAC under it
codec.rs 130 Bounds-checked reading and writing of TLS’s length-prefixed encodings
tls13/mod.rs 182 The TLS 1.3 subset REALITY needs: one full handshake, three cipher suites, no resumption
tls13/schedule.rs 313 The key schedule without PSKs: the transcript hash, HKDF-Expand-Label, the secrets, the Finished MAC, traffic keys and key updates
tls13/record.rs 260 Records: the header, plaintext records, and AEAD protection through OpenSSL EVP one record at a time
tls13/messages.rs 646 The handshake messages, parsed strictly and never panicking: ClientHello (MAX_CLIENT_HELLO), ServerHello, EncryptedExtensions, Certificate, CertificateVerify, Finished, KeyUpdate
tls13/session.rs 60 An established connection’s application traffic keys and their KeyUpdate steps
server/mod.rs 211 ServerConfig (with the handshake timeout, DEFAULT_HANDSHAKE_TIMEOUT) and CamouflageReason, a refusal’s category safe to log
server/handshake.rs 523 The server handshake, sans-I/O: decide, DestCapture, build_flight, AwaitFinished; DEST_CAPTURE_LIMIT, MAX_USELESS_RECORDS
server/accept.rs 441 accept and Outcome: the async driver over the client and dest sockets
camouflage.rs 232 Camouflage: the relay between a client that is not ours and dest
stream.rs 438 RealityStream: application data one record at a time, and into_raw_parts, which gives the socket back for Vision’s raw switch
client/mod.rs 349 ClientConfig and the sans-I/O client handshake
client/hello.rs 236 The client’s ClientHello: Chrome 133’s, as uTLS’s HelloChrome_133 writes it
client/connect.rs 71 connect: the client’s async driver

35,796 lines. Every protocol is a server core plus a client codec on top of the traits above; transports turn sockets into byte streams; the shared pieces sit beside them.

Area Lines Page
Crate root (including ss_aead.rs), core/, helpers/ 1,822 Protocol foundations
sniff/ 370 Sniffing
dns/ 1,544 DNS
transports/ (reality.rs under feature reality) 3,709 TCP and TLS, WebSocket and gRPC, REALITY transport
mux/ 919 mux.cool and XUDP
socks/, http/ 1,431 and 732 SOCKS, HTTP
trojan/, vless/ (vless/vision/ included) 836 and 2,500 Trojan, VLESS, VLESS Vision
anytls/ 3,218 AnyTLS
sss/ 4,092 sss, sss transforms
vmess/ 3,385 VMess crypto, VMess wire
ss_legacy/, ss_2022/ 794 and 1,433 Shadowsocks, Shadowsocks 2022
hysteria/ (feature hysteria) 5,548 Hysteria 2 client, Hysteria 2 server
wireguard/ 2,069 WireGuard
tun/ (feature tun, Unix and Windows) 1,394 TUN
File Lines Responsibility
lib.rs 41 Lint policy and module list, with the hysteria and tun gates
flow.rs 70 Flow, the target of every core
error.rs 74 ProtocolError and its mapping onto io::ErrorKind
macros.rs 23 byte_newtype!, fixed-size byte newtypes for key material
ss_aead.rs 329 The AEAD record stream both Shadowsocks flavours share: Cipher, Aead, ChunkEncoder, ChunkDecoder, RecordStep
core/mod.rs 475 FlowKey, SubKey, Phase, Timing, HANDSHAKE_TIMEOUT, RELAY_IDLE_TIMEOUT, SniffPrefix, Passthrough, PassthroughCore
core/harness.rs 125 CoreHarness: a hand-driven runtime stand-in for testing a core without sockets
helpers/address.rs 342 AddressCodec (the type-byte address format of SOCKS5, Trojan, Shadowsocks, VLESS and VMess), parse_authority, format_authority
helpers/address_family.rs 232 AddressFamilyStrategy, FamilySupport, resolve_candidates, destination_to_socketaddrs
helpers/crypto.rs 54 evp_bytes_to_key, hkdf_sha1_ss_subkey, increment_le, ct_eq
helpers/parse.rs 53 take, take_array, need_more: panic-free slice access (see Lints)
helpers/mod.rs 4 Module list
sniff/mod.rs 84 SNIFF_TIMEOUT, SNIFF_LIMIT, sniff, worth_sniffing, plausible_domain
sniff/collector.rs 87 Collector and Verdict: the accumulator of a flow’s first bytes, which owns no memory until it is given some
sniff/tls.rs 101 TlsSniffer: ClientHello SNI
sniff/http.rs 98 HttpSniffer: HTTP/1.x Host
dns/mod.rs 950 Resolver, Backend, ResolverSpec, ResolverOptions, the cache and its TTL bounds
dns/message.rs 401 The minimal DNS wire codec: asking for A/AAAA and reading the answer, and reading a client’s question and answering it
dns/serve.rs 119 Answering applications’ DNS queries with a Resolver
dns/hosts.rs 74 The system hosts file as a lookup table a resolver consults before any server
File Lines Responsibility
transports/mod.rs 24 Module list, with reality behind its feature
transports/accept.rs 266 InboundTransport (#[non_exhaustive]), Accepted, Disposition (Done, or Camouflage for a REALITY socket that is not a client of ours), TRANSPORT_HANDSHAKE_TIMEOUT, serving an HTTP/2 connection as many streams (over Coalesced, through h2_io), refusing and logging requests for other paths, and telling an idle connection to go away
transports/coalesce.rs 133 Coalesced, HELD_MAX: h2’s writes held until h2 flushes and sent as one write, never more than one TLS record’s plaintext (16 KiB); a deliberately non-vectored writer
transports/proxy_protocol.rs 166 read_v2, decode_v2, Header, MAX_V2_LEN: a PROXY protocol v2 header read off an accepted socket when one was sent, or decoded from bytes already in hand, with every fixed field held to the protocol
transports/connect.rs 234 TransportKind (#[non_exhaustive], with Reality and its Vision framing behind the feature), TransportConnector: resolve, connect, wrap an upstream
transports/stream.rs 124 TransportStream (#[non_exhaustive]), the one byte-stream type every transport yields, with Reality and Vision behind the feature; into_vision_server, which wraps an accepted REALITY stream in the Vision adapter; and real_ip_header, what an accepted WebSocket upgrade’s client-address header said
transports/camouflage.rs 55 Camouflage: a socket REALITY handed to dest, run as a relay with an idle limit; the type exists with or without the feature
transports/reality.rs 368 Feature reality: RealityServer, which dials dest itself, with the socket policy and resolver it is given and outside routing and accounting; ClientConfig; RealityStream, with the socket under it that Vision writes raw bytes on while reads still come through the record layer, and RawParts; the decoders of Xray’s formats; DEST_WARN_INTERVAL. No type of etemenanki-reality passes this module
transports/keepalive.rs 33 set_keepalive for every accepted or dialed socket
transports/tls/mod.rs 16 Module list, with platform_roots on Android, iOS, Windows and macOS
transports/tls/config.rs 230 ServerConfig, ClientConfig, Alpn, VerifyMode over OpenSSL, with read-ahead on both ends
transports/tls/platform_roots.rs 104 The roots OpenSSL built from source does not find (ROOTS): Android’s system CA certificates, read file by file from the Conscrypt module’s store or the system image’s; on iOS Mozilla’s roots from webpki-root-certs; on Windows and macOS the platform’s store through rustls-native-certs (native); each converted once per process
transports/tls/stream.rs 91 MaybeTlsStream, tcp_from_std, accept_optional_tcp, wrap_optional_tcp
transports/ws/mod.rs 8 Module list
transports/ws/endpoint.rs 335 WsRoute (with real_ip_header), WsTarget, path and early-data handling, reading a client-address header (RealIpHeader, MAX_REAL_IP_ADDRESSES), MAX_EARLY_DATA, MAX_WS_MESSAGE_LEN
transports/ws/stream.rs 394 WsStream: WebSocket messages as bytes, and what an accepted upgrade’s client-address header said; WS_IDLE_TIMEOUT, WS_KEEPALIVE_INTERVAL
transports/grpc/mod.rs 10 Module list
transports/grpc/framing.rs 320 encode_hunk, encode_multi_hunk, HunkDecoder
transports/grpc/settings.rs 186 HTTP/2 settings, MAX_GRPC_MESSAGE_LEN, H2_IDLE_TIMEOUT, H2_KEEPALIVE_INTERVAL, H2_KEEPALIVE_TIMEOUT, H2_PONG_TIMEOUT, GrpcPaths, GrpcMode
transports/grpc/liveness.rs 300 Liveness: the idle deadline and PING supervision of a served connection; ReadClock and Heard, which count any byte from the peer as a sign of life; Verdict
transports/grpc/stream.rs 312 GrpcStream: one HTTP/2 stream as bytes; a dialed connection’s h2 runs over Coalesced
File Lines Responsibility
mux/mod.rs 54 MUX_ADDRESS, MUX_PORT, mux_destination, is_mux_destination; the server side, with XUDP’s one UDP session under a Vision VLESS client as the only client use
mux/frame.rs 395 The mux.cool frame codec, FrameMeta, SessionStatus, MAX_META_LEN, MAX_DATA_LEN, FRAME_OVERHEAD_MAX; the New frame an XUDP client opens its session with
mux/demux.rs 470 Demux: the server-side demultiplexer shared by the Trojan, VLESS and VMess cores; feed for a plain carrier, feed_chunks for all of a VMess read’s chunks in one call
File Lines Responsibility
socks/mod.rs 14 Module list
socks/protocol.rs 249 SOCKS4, 4a and 5 wire constants and primitives; endpoint, the canonical (IpAddr, u16) both ends compare a relay datagram’s sender by
socks/handshake.rs 273 The server handshake up to the reply: handshake, handshake_with_udp_source (crate-private; also returns the source a UDP ASSOCIATE names), Request, Version, reply writers
socks/server.rs 454 SocksInbound: the bespoke driver that owns the control connection, and flushes the sniffed prefix it forwards; ExpectedSender, the one client a UDP association hears
socks/codec.rs 154 SocksConnect: the SOCKS5 CONNECT client codec
socks/udp_link.rs 207 SocksUdpLink: a client-side UDP ASSOCIATE as a DatagramLink
socks/config.rs 80 SocksServerConfig, SocksAuth
http/mod.rs 11 Module list
http/protocol.rs 255 Request and response heads, fixed responses, forwarded-request rewriting
http/core.rs 322 HttpCore: CONNECT tunnels and absolute-form forwarding
http/codec.rs 96 HttpConnect: the CONNECT client codec
http/config.rs 48 HttpServerConfig
File Lines Responsibility
trojan/mod.rs 11 Module list
trojan/protocol.rs 240 Request header and UDP packet framing, password_hash
trojan/users.rs 89 TrojanServerConfig, Validator
trojan/core.rs 353 TrojanCore
trojan/codec.rs 143 TrojanStream, TrojanDatagram
vless/mod.rs 20 Module list
vless/protocol.rs 229 Request and response headers, the request’s addons included, and length-prefixed UDP packets
vless/addons.rs 122 VlessFlow, parse_addons, encode_addons: the request addons as Xray’s protobuf, strict, with xtls-rprx-vision the only flow; ENCODED_MAX, the most bytes they take
vless/validator.rs 77 Validator, the user table
vless/config.rs 49 VlessServerConfig
vless/core.rs 378 VlessCore, which serves plain VLESS, looks the user id up first, and refuses a Vision request from a known user that reaches it without the adapter
vless/codec.rs 298 VlessStream (announcing the flow), VlessDatagram: plain length-prefixed UDP, or under Vision (with_flow) XUDP over mux.cool session 0; staging reserves room for the Vision addons
vless/vision/mod.rs 40 XTLS Vision: the commands, DEFAULT_SEED, MAX_BUFFER
vless/vision/padding.rs 233 pad and Unpad: Vision frames, ported from XtlsPadding and XtlsUnpadding
vless/vision/framer.rs 511 ReadFramer, WriteFramer: the VLESS header left unframed, the body padded, and the terminal command chosen as Xray’s VisionWriter does, from one inner-TLS filter that sees both directions
vless/vision/filter.rs 142 TlsFilter: whether the first buffers are an inner TLS 1.3 handshake, so the raw switch is safe, whether TLS 1.2 or later is underneath, and how many buffers are left to inspect
vless/vision/stream.rs 401 Feature reality: VisionStream, the adapter that drives the framers over a RealityStream and switches to the raw socket one direction at a time: its write half after its own direct command, both halves on the peer’s
File Lines Responsibility
anytls/mod.rs 28 Module docs and re-exports
anytls/frame.rs 235 The authentication (sha256(password) and padding0) and the 7-byte frame header, Command, password_hash
anytls/settings.rs 84 The key=value lines of Settings and ServerSettings, MAX_LEN
anytls/padding.rs 267 PaddingScheme: a strict parser, DEFAULT_SCHEME, MAX_SCHEME_LEN, the md5 and the size draws
anytls/users.rs 118 Validator and AnyTlsUser: the user table, keyed by sha256(password) and compared in constant time
anytls/uot.rs 185 sing’s UDP-over-TCP, versions 1 and 2
anytls/core.rs 1,052 AnyTlsCore: one session per TLS connection, its streams keyed by wire id (StreamKey); MAX_STREAMS, MAX_UDP_PAYLOAD, UDP_REASSEMBLY_BUDGET
anytls/client/mod.rs 359 AnyTlsConnector and AnyTlsClientConfig: the session pool and its idle reaper; STREAM_OPEN_TIMEOUT, DEFAULT_IDLE, MIN_IDLE
anytls/client/session.rs 563 ClientSession: one TLS connection, its frame reader and its padded writer
anytls/client/stream.rs 197 AnyTlsStream: a byte stream that owns its session while it lives
anytls/client/datagram.rs 130 AnyTlsDatagram: UDP through a stream, with every packet naming its peer
File Lines Responsibility
sss/mod.rs 24 Module list and re-exports
sss/protocol.rs 312 The request header and the datagram record; HEADER_MAX, PACKET_HEADER_MAX, MAX_DATAGRAM
sss/varint.rs 120 The three-byte varint
sss/users.rs 90 Validator: the user table, keyed by UUID
sss/server.rs 281 The pre-authentication gate: ServerSettings, accept, Rejection with its drain and fallback; DEFAULT_HEADER_TIMEOUT
sss/core.rs 362 SssCore, with TCP_BUF_SIZE and UDP_BUF_SIZE
sss/codec.rs 177 SssStream, SssDatagram
sss/client.rs 79 ClientSettings and SssConnector
sss/transform/mod.rs 506 Transform, Chain and its encoder and decoder; HEADER_MAX, MAX_CHAIN, MAX_PREFIX
sss/transform/parse.rs 378 The whitepaper’s notation, such as stuff(f=0x00,k=5), parsed and printed
sss/transform/base.rs 401 baseN for N = 16, 32 and 64, with the RFC 4648 or a permuted alphabet
sss/transform/stuff.rs 101 stuff
sss/transform/zstd.rs 274 zstd: independent frames, per-thread contexts
sss/transform/record.rs 131 record
sss/transform/http_chunk.rs 264 http-chunk
sss/transform/pad.rs 149 pad
sss/transform/stream.rs 443 TransformStream: the chains around a transport; CALL_SIZE, DECODED_LIMIT, MAX_FLUSH_DELAY
File Lines Responsibility
vmess/mod.rs 20 Module list
vmess/aead.rs 586 The HMAC-SHA256 KDF, the AES-128 auth-id codec, the sealed header envelope
vmess/keys.rs 211 Typed 16-byte key material, so a key cannot be passed where an IV is expected
vmess/accounts.rs 930 Account, AccountValidator, UserHint: matching an auth id to a user, trying a hinted user, the users last matched from the client’s address and the hot tier before the full scan; the clock check and its off switch (with_clock_check), why an id is refused (AuthFailure), user sets and hot tiers prepared off the hot path and installed with a pointer swap, and keeping the replay state across user-set changes
vmess/protocol.rs 386 Request and response header codecs, Security, RequestOptions
vmess/framing.rs 368 ChunkStream, ChunkDecoder: body-chunk framing
vmess/session.rs 108 OutboundSession: per-connection key and IV derivation
vmess/core.rs 581 VMessCore, with the user to try first (with_hint) and the one it matched (user_hint)
vmess/codec.rs 195 VMessStream, VMessDatagram
File Lines Responsibility
ss_legacy/mod.rs 16 Module list; supported ciphers
ss_legacy/aead.rs 92 Method, session, random_salt, MAX_PAYLOAD, FIRST_CHUNK_LEN
ss_legacy/users.rs 123 ShadowsocksUser, ShadowsocksServerConfig, Resolved key table
ss_legacy/protocol.rs 9 The shared ADDR codec
ss_legacy/core.rs 437 ShadowsocksCore
ss_legacy/codec.rs 117 SsStream
ss_2022/mod.rs 14 Module list
ss_2022/crypto.rs 219 The 2022-blake3-* methods, session_key, session, identity_subkey, eih_hash, fold_key, BlockCipher, the timestamp window
ss_2022/protocol.rs 254 Request and response header framing, extended identity headers
ss_2022/users.rs 191 Ss2022User, Ss2022ServerConfig, Validator, normalise_psk, decode_psk
ss_2022/replay.rs 105 SaltFilter, the request-salt replay filter
ss_2022/core.rs 480 Ss2022Core
ss_2022/codec.rs 170 Ss2022Stream
File Lines Responsibility
hysteria/mod.rs 33 Module list and the shared-connection model
hysteria/protocol.rs 796 QUIC varints, TCPRequest and TCPResponse, padding, UDP messages and defragmentation
hysteria/auth.rs 177 The HTTP/3 authentication exchange
hysteria/obfs.rs 429 Salamander packet obfuscation, the key switch and the receive gate
hysteria/quic.rs 109 What both ends share: transport_config, a connection’s QUIC transport parameters from QuicOptions under a congestion controller, and datagram sending, whole first and fragmented only when the peer refuses the whole message
hysteria/negotiate.rs 90 Whose rate wins: how the two ends’ bandwidth blocks become a Brutal send rate for each direction, or the fallback congestion control
hysteria/connection.rs 638 Hy2Conn: one authenticated client connection, its socket (a HoppingSocket with port hopping), the send rate agreed at /auth, and the rustls client configuration
hysteria/slot.rs 235 ConnSlot: the lazily built, rebuildable shared connection
hysteria/connector.rs 216 Hy2Connector, Hy2Stream, Hy2DatagramLink
hysteria/config.rs 220 Hy2Config (built with Hy2Config::new), Obfs, BandwidthConfig, PortHopping, QuicOptions and its defaults, DEFAULT_MAX_CONCURRENT_STREAMS
hysteria/server/mod.rs 12 Module list
hysteria/server/inbound.rs 1,037 Hy2Inbound with its two-phase start and in-place setters, each connection’s own Negotiated congestion controller and the rate set at /auth, Hy2StreamCore
hysteria/server/shim.rs 525 Splitting one QUIC connection between HTTP/3 and proxy streams
hysteria/server/datagrams.rs 357 QuicDatagrams, Hy2UdpCore
hysteria/server/authenticator.rs 216 Authenticator: which user a credential belongs to
hysteria/server/endpoint.rs 146 The server QUIC endpoint and its rustls configuration, and for_connection, the transport parameters each accepted connection gets
hysteria/server/io.rs 114 QuicIo: h3 stream types as AsyncRead and AsyncWrite
hysteria/server/masquerade.rs 82 Masquerade: the answer given to anyone who is not a client
hysteria/server/config.rs 116 ServerConfig (rates, ignore_client_bandwidth, the congestion fallback and the QUIC settings among its fields), ListenerConfig, DEFAULT_MAX_CONNECTIONS, DEFAULT_MAX_CIRCUITS
File Lines Responsibility
wireguard/mod.rs 41 Module docs: why WireGuard is an outbound only
wireguard/config.rs 109 WgConfig, parse_key
wireguard/device.rs 1,425 WgDevice: the single driver task owning boringtun’s Tunn, the smoltcp stack and the peer socket; at most one uplink item held per connection, CHANNEL_CAP = 256; RoomWaits for full downlink channels, RECV_BATCH, the connection Lifetimes, and reviving an expired session (REKEY_RETRY)
wireguard/connector.rs 343 WgConnector (with reaches, whether the tunnel can carry an address’s family), WgStream, WgDatagramLink, FAILED_LOOKUP_TTL
wireguard/slot.rs 151 DeviceSlot: the lazily built, rebuildable tunnel
tun/mod.rs 64 Module docs: the platforms, what is dropped, keeping the outbound path off the device
tun/config.rs 23 TunConfig, DEFAULT_MTU, DEFAULT_UDP_IDLE_TIMEOUT, DEFAULT_MAX_FLOWS
tun/device.rs 469 Device (a descriptor on Unix, a share of a Wintun session on Windows); creating, addressing and routing the interface on Linux, macOS and Windows (check_platform, open); adopting a supplied descriptor on Unix (adopt); and the async adapter the stack reads packets through, which screens what the client sends
tun/inbound.rs 352 TunInbound over ipstack, with without_ipv6 and screening_ipv6
tun/ipv6.rs 107 Ipv6Screen and Ipv6Unreachable: refusing a client’s IPv6 SYN with an RST, or dropping its IPv6
tun/udp.rs 286 TunUdpLink, TunUdpCore
tun/tracked.rs 93 TrackedTcp: counted streams, so shutdown can wait for them

12,201 lines. The runtime every front end runs: desired state, reconciliation, listeners, the connection pipeline, outbounds and routing, users and sessions, tracking and usage. It parses no config format. Its pages start at the supervisor overview.

File Lines Responsibility
lib.rs 55 Crate docs and the public re-exports
supervisor.rs 1,490 Supervisor, SupervisorBuilder: one actor task that owns what runs and serialises applies and user changes, with the work that grows with the users on the blocking pool; close_rerouted and http_ping
ping.rs 282 The delay test through one outbound or balancer: HttpPing, PingError, PingUrl, DEFAULT_PING_URL, two HEAD requests on one connection under one timeout
serve.rs 1,008 The connection pipeline: accept loops, an inbound’s admission caps (InboundCaps), sessions, the PROXY header, a handed-over socket served as an accepted TCP one, a trusted proxy’s real-IP header and the ban check, a REALITY socket handed to dest and relayed with its live permit alone, the Vision adapter around an accepted REALITY stream, serve_connection, serve_sss (sss’s gate before any runtime), drive, the VMess hot-tier refresh (refresh_hot_tiers, HOT_TIER_POLL), run_hysteria_inbound, run_tun_inbound with its IPv6 screen
connector.rs 133 AppConnector: admits a flow on its session, routes it on the current plane and opens it, metered
guard.rs 246 Guard, Report: failed authentications and bans per IPv4 address or IPv6 /64, a gRPC connection’s failed streams in a row, and the sweep
carrier.rs 57 Carrier: what the streams of one gRPC connection share, the failed streams in a row and the user the last authenticated VMess stream matched
policy.rs 79 Policies (with ip_ban and carrier_max_failures), IpBanPolicy, DrainPolicy, UserRemovalPolicy
build/mod.rs 11 Module list: constructing what runs from a validated spec
build/validate.rs 843 Semantic validation of a Spec, the one owner of every rule about what a spec means
build/apply.rs 108 ApplyReport, ApplyError: what an apply did, or why it was refused
build/inbound.rs 525 Inbound handlers from their specs, the user tables inside them, a WebSocket route that reads a real-IP header, and a REALITY server that dials its dest under the socket policy and the system resolver
build/outbound.rs 352 Outbound handlers from their specs
build/route.rs 35 The route table from its spec, with its geo data
build/users.rs 158 Which users an inbound admits, and as which Principal
build/dns.rs 102 The resolvers from the DNS spec, and the DNS service
entity/mod.rs 4 Module list
entity/id.rs 151 Identities for what a supervisor runs: OutboundId with its version, Resource, SessionId, UserKey, FlowId, RuleId
entity/user.rs 137 Users, their credentials, speed and device limits, and user sets as their own resource
entity/session.rs 438 Sessions: every accepted connection, indexed by the user it was admitted as; the device limit, held when a session binds
entity/usage.rs 307 Per-user usage accounting, polled or pushed to a UsageSink
system/mod.rs 4 Module list
system/blocking.rs 29 off_runtime and drop_off_runtime: work that grows with the users, on the blocking pool
system/handoff.rs 200 Receiving a handed-over connection: one recvmsg with SCM_RIGHTS and a receive timeout, the checks on what came, and the one-byte answer. Unix only
system/listener.rs 743 Listeners: what a BindSpec is bound to, a handoff socket with its mode, group and directory among them, a Unix or handoff socket staged under a random name and published at its path at commit, and the task serving it
topology/mod.rs 7 Module list
topology/flow.rs 97 Flow, Principal, FlowContext
topology/plane.rs 307 The data plane: one consistent snapshot of routes, outbounds and balancers, read by every routing decision; closing a drained version’s flows; whether a live flow would now go to another outbound (reroutes); whether a TUN client’s IPv6 flow has any target that reaches IPv6
topology/router.rs 174 The compiled route table, naming slots rather than outbounds; decide_tracked, the decision for a live flow from what the tracker kept
topology/balancer.rs 225 Balancers: picking among upstreams by health
topology/inbound/mod.rs 293 What an accept loop serves: BindSpec, HandoffSpec, TunSource, StreamInbound, StreamProtocol (with whether a VLESS inbound wraps Vision), Hy2Handler, TunHandler, InboundHandler
topology/outbound/mod.rs 347 Outbound, one variant per protocol client plus the local pseudo-protocols, SssOutbound, and the client buffer sizes
topology/outbound/proxy.rs 217 ProxyClient, generic over the connector it dials through (TransportConnector by default), OutboundStream, OutboundDatagram, BlackholeLink
topology/outbound/freedom.rs 205 FreedomConnector (with lacks_ipv6), ResolvingUdp
topology/outbound/udp_fanout.rs 255 FanOutLink: routing a UDP association packet by packet
topology/outbound/dns.rs 290 The DNS service as an outbound, DnsUdpLink
topology/spec_plan/mod.rs 112 Spec: desired state, independent of any config format
topology/spec_plan/inbound.rs 276 Inbounds as desired state, with a handoff socket and RealIpSpec; InboundProtocolSpec::transport, the one list of protocols that take a transport
topology/spec_plan/outbound.rs 180 Outbounds as desired state, with AnytlsOutboundSpec
topology/spec_plan/route.rs 53 The route table and balancers as desired state
topology/spec_plan/dns.rs 27 Name resolution as desired state
topology/spec_plan/transport.rs 164 The transport under a stream protocol (StreamShape, Reality among its variants), its TLS material, and its REALITY settings (RealityServerSpec, RealityClientSpec)
topology/spec_plan/plan.rs 342 plan: comparing what runs with a desired spec, step by step and bind by bind
track/mod.rs 529 Tracker: every live flow, its byte counts and its kill switch
track/metered.rs 220 The wrappers a flow’s outbound is relayed through, counting and killable
track/pace.rs 126 Per-user speed limits: one token bucket per user
track/sampler.rs 258 The sampler: per-tick rates and totals, and the usage ledger’s reconcile

4,346 lines. A library with the etemenanki-app binary on top: the TOML front end that lowers a config into a Spec and runs a supervisor on it.

File Lines Responsibility
lib.rs 17 Crate docs and the module list
main.rs 278 CLI (-c/--config, --test), tracing setup, the config watcher, signals
config.rs 908 The TOML schema (deny_unknown_fields throughout), load, parse_bytes
subscribe.rs 590 Merging a subscribe file into the config; a node it cannot convert is a config error naming the node
lower.rs 1,667 Lowering a config into the supervisor’s Spec, decoding REALITY’s keys and shortIds and parsing sss’s transform chains and durations on the way
instance.rs 358 The running instance: a Supervisor (Instance::supervisor) and what reloading it needs
routes.rs 216 The routes a client can switch, and switching them for the REST API or another front end
api.rs 168 The REST API’s hold on the config file (ConfigFile), and [api]
transport.rs 144 tls_layer, resolve_stream (which takes security = "reality" to the REALITY shape, over network = "tcp" only), reject_stream_settings: the stream-settings checks inbounds and outbounds share

The app’s internals are on etemenanki-app: from TOML to a spec, Reloading etemenanki-app, The subscribe file and The client REST API.

etemenanki-subscribe, etemenanki-webclient and etemenanki-ffi

Section titled “etemenanki-subscribe, etemenanki-webclient and etemenanki-ffi”
Crate File Lines Responsibility
subscribe (567) lib.rs 65 The subscribe file: what a provider hands a client, its lint policy, and VERSION, the format revision a client announces as etemenanki-subscribe/<VERSION>
proxy_servers.rs 363 The nodes a subscription offers, in the app’s [[outbound]] key names: AnyTLS, REALITY, the VLESS flow and sss among them
route.rs 89 Route groups: [[route_group]]
dns.rs 50 The provider’s suggested [dns]
webclient (1,092) lib.rs 243 A REST API for switching a client’s routing, closing what a switch moved, testing an outbound’s delay, and watching its connections and traffic; ConfigControl
router.rs 301 The routes over a Supervisor, the bearer check, the delay endpoint, errors mapped to statuses
tracking.rs 282 The connection and traffic endpoints, read from the supervisor’s Tracker
listen.rs 210 Where the API listens and who may use it; Unix paths on Unix only
etag.rs 56 Entity tags for the config file
ffi (1,731) lib.rs 59 Etemenanki embedded in an Android or iOS app, as a client; #![cfg(unix)]
proxy.rs 398 The proxy an app runs: one per VPN session, on a runtime of its own; route switches that may close what they moved, close_rerouted and http_ping
client.rs 168 A config lowered for a client on a phone: client inbounds only, the platform’s TUN device, no REST API
inspect.rs 216 The calls that need no running proxy: inspect_subscribe, check_config, route_view, ffi_version
convert.rs 265 Subscriptions in other clients’ formats made into subscribe files with libsubconv (convert_subscription, ConvertedSubscription), and a subscribe file without its geo matchers (without_geo)
types.rs 435 The records the app reads: routes, apply results, traffic and connections, a delay test’s result (HttpDelay), and what a subscription offers (SubscribeInfo, NodeInfo, GroupInfo, RouteMatcher)
platform.rs 98 What the app provides: keeping the proxy’s sockets out of its tunnel, and a log
error.rs 92 What a call across the boundary fails with

ffi/bindgen/src/main.rs (11 lines) is the uniffi-bindgen entry point. These crates are on The subscribe file, The client REST API and ffi.

4,696 lines, one binary crate. The details are on the katana overview.

File Lines Responsibility
main.rs 55 CLI (-c/--config, --test); mimalloc as the global allocator of a musl build
config.rs 443 The TOML schema
runtime.rs 419 The process root: one NodeManager per [[node]], and the config watcher that fans live updates out
api/mod.rs 332 PanelClient over the two panel types, and the shared models: Node, a type alias of the helium-node-api crate’s node config, which every panel’s answer becomes, and katana’s own user, report and audit-rule types; the HTTP client, which asks for gzip-compressed answers
api/newv2board.rs 720 The newV2board (UniProxy) client: parse_node_config converts an answer into the contract’s node config, decoding the keys, flow, cipher and transport UniProxy spells in strings with the kernel’s decoders, refusing by name what katana cannot serve, and checking the result with the contract’s validate; it holds a panel’s protocol tag to the node type and refuses an sss node
api/helium.rs 304 The helium client, on Helium’s node API v2: the config answer, already the helium-node-api crate’s node config, goes to lowering as it came; the users and report types mapped to and from katana’s models; and the local keys the panel describes refused
api/hysteria.rs 150 A Hysteria 2 node in the contract’s terms where no panel says all of it: local, the node [node.hysteria] describes on its own port; uniproxy, a UniProxy node’s obfuscation and rates completed with [node.hysteria]’s UDP relay and masquerade, the rates overridden there; obfs, the Salamander rules both share
api/embedded_cert.rs 72 Provides the client identity katana presents when a panel asks for one, unless the node sets enable_mtls = false
blocking.rs 29 off_runtime and drop_off_runtime: a node’s per-user work on the blocking pool
manager/mod.rs 23 The per-node manager: one supervisor per [[node]]
manager/node.rs 793 Per-node bootstrap, sync and static updates, each answer lowered off the runtime into the spec its supervisor runs, disruptive_part (what of a node a change to closes every session), and the reports to the panel
lower/mod.rs 221 Lowering a node, its panel’s answer and its users into a Spec, each user held to their own speed limit, with the device limits and the guard’s policies
lower/inbound.rs 654 A contract node’s listener as an InboundSpec (AnyTLS, SOCKS and HTTP over TLS, Shadowsocks over a transport, VLESS over REALITY with or without Vision, sss, and Hysteria 2 among them), judging only this host’s settings and refusing them by name (the certificate settings, Hysteria 2’s credential kind and congestion control), each user’s credential for it, real_ip, the WebSocket client header from real_ip_header and real_ip_from, and handoff, a stream node’s handoff socket from handoff_dir and handoff_group, named by handoff_file for its port and, on one address, its listen_ip
lower/outbound.rs 330 The process-wide [[outbound]] entries and [dns] as specs
lower/route.rs 56 A node’s [node.route] as a RouteSpec, each geo file stamped when it is lowered
rule.rs 95 Destination audit: the panel’s rules as a node’s first routes

environment/src/lib.rs, reality/src/lib.rs and protocols/src/lib.rs open with the same attribute:

#![deny(
clippy::unwrap_used,
clippy::expect_used,
clippy::indexing_slicing,
clippy::arithmetic_side_effects
)]
// Tests exercise known-good inputs and may use the panicking forms freely.
#![cfg_attr(
test,
allow(
clippy::unwrap_used,
clippy::expect_used,
clippy::indexing_slicing,
clippy::arithmetic_side_effects
)
)]

Together these four lints forbid the usual ways a byte from the network could panic the process: .unwrap() and .expect(), buf[i] and buf[a..b], and any integer operation that can overflow or panic, + on a usize included. They do not cover every panic (an explicit assert! or unreachable! still compiles), so they are a floor, not a proof.

subscribe/src/lib.rs carries a lighter attribute, #![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic)], with the same cfg_attr(test, allow(…)) for its tests. etemenanki-concepts, the supervisor, the app, the webclient, the ffi and katana carry no crate-wide deny.

The only local exceptions are nine functions in etemenanki-protocols that re-allow clippy::arithmetic_side_effects alone, each with a reason that states the bound; etemenanki-reality has none:

Function File Stated reason
put_varint, read_varint transports/grpc/framing.rs A shift by a constant 7 on u64; a shift amount kept below 64
read_varint, read_varint_slice hysteria/protocol.rs The QUIC varint prefix caps the fold at 62 bits
decode_varint hysteria/server/shim.rs The same 62-bit cap
deadline transports/grpc/liveness.rs An Instant only overflows past the end of the monotonic clock
after transports/ws/stream.rs, socks/server.rs The same Instant argument
smoltcp_after wireguard/device.rs A smoltcp Instant is i64 microseconds, which the 60 s linger cannot overflow

A new exception follows the same form: one small function, one lint, and a reason a reviewer can check.

The cfg_attr(test, …) half matters because of how unit tests are compiled: they are mounted into the module they test (see Tests), so they are part of the crate under cfg(test) and would otherwise inherit the ban.

A parser in etemenanki-protocols takes a byte slice that is possibly incomplete and certainly untrusted, and has three outcomes: a value with the number of bytes it used, “not enough bytes yet”, or an error. helpers/parse.rs supplies the building blocks:

pub fn take<'a, I>(data: &'a [u8], index: I, what: &'static str) -> Result<&'a [u8], ProtocolError>
where
I: SliceIndex<[u8], Output = [u8]>;
pub fn take_array<const N: usize>(data: &[u8], at: usize) -> Result<[u8; N], ProtocolError>;
pub fn need_more<T>(result: std::io::Result<T>) -> std::io::Result<Option<T>>;
  • take is data.get(index) with a short read mapped to ProtocolError::Truncated(what).
  • take_array computes the end offset with checked_add (overflow becomes ProtocolError::Overflow("field offset")) and copies a fixed-size array, which is what u16::from_be_bytes and friends need.
  • need_more turns a truncation, which reaches io::Error as UnexpectedEof, into Ok(None), and leaves every other error an error. It is how a parser handed a growing buffer says “ask me again with more bytes”.

vless/protocol.rs → parse_request_header shows the resulting style. Single bytes come from first() and get(), fixed fields are checked as soon as they are available, and offsets, the ones that follow the variable-length addons included, are computed with saturating_add or checked_add:

pub fn parse_request_header(buf: &[u8]) -> io::Result<Option<(RequestHeader, usize)>> {
let Some(&version) = buf.first() else {
return Ok(None);
};
if version != VERSION {
return Err(io::Error::new(
io::ErrorKind::InvalidData,
format!("invalid vless request version: {version}"),
));
}
let Some(uuid) = need_more(take_array::<16>(buf, 1).map_err(io::Error::from))? else {
return Ok(None);
};
// ... the addons (`parse_addons`), the command, then the address via
// `take(buf, addr_at.., "vless address")`, where `addr_at` follows the addons
}

The errors come from error.rs → ProtocolError, which classifies what went wrong. Its From<ProtocolError> for io::Error impl fixes the io::ErrorKind that callers above the protocol layer see:

Variant Meaning io::ErrorKind
Truncated(&'static str) Input shorter than the protocol requires UnexpectedEof
Overflow(&'static str) Arithmetic over an untrusted length or offset overflowed InvalidData
Malformed(&'static str) A field held a value the protocol does not permit InvalidData
Unsupported(&'static str) A feature this implementation does not provide InvalidData
Unauthenticated(&'static str) The peer could not be authenticated PermissionDenied
Crypto(&'static str) An AEAD or key-derivation step failed Other
Io(io::Error) A lower-level I/O failure passed through unchanged
Other(anyhow::Error) Anything that cannot be classified Other

The UnexpectedEof mapping is load-bearing: need_more relies on it to tell “wait” from “reject”.

Parser tests follow a common pattern: encode a valid message, cut it short at many points, and assert that nothing panics and that each prefix is either “need more” or an error. Examples:

Test File Pins
request_header_is_parsed_from_a_slice_once_whole protocols/tests/unit/vless/protocol.rs A VLESS header cut at its field boundaries, inside the address, and one byte short is None; the whole header parses and reports its exact length, leaving trailing payload alone
truncated_and_malformed_input_never_panics protocols/tests/unit/dns/message.rs Every prefix of a DNS answer decodes without panicking; an rdlength past the end is an error
varint_truncated_at_every_boundary, tcp_response_truncated_at_every_boundary protocols/tests/unit/hysteria/protocol.rs Hysteria 2 varints and responses at every truncation point
rejects_truncated_metadata protocols/tests/unit/mux/frame.rs A mux.cool frame whose metadata is cut short
a_truncated_client_hello_yields_nothing_rather_than_garbage protocols/tests/unit/sniff/tls.rs A ClientHello cut at several points yields the real SNI or nothing, never a different name

Release 1.x moved bytes through tasks and channels. Release 2.0 drives each connection from a single task that owns the connection’s transport, buffers, protocol core and every outbound it opens. Only carriers shared by many connections keep driver tasks of their own: an HTTP/2 connection carrying gRPC streams, a WireGuard device, and a Hysteria 2 QUIC connection. The old pipeline was removed, not kept alongside, which is why every crate went to 2.0.0 together.

flowchart LR
  sock["raw socket"] --> trans["TcpInboundTransport"]
  trans --> vc["VcLink: two mpsc channels of Bytes"]
  vc --> server["ProxyProtocolServer (tower Service)"]
  server --> circuit["ServerCircuit"]
  circuit --> router["Router"]
  router --> client["ProxyProtocolClient"]
  client --> out["OutboundTransport dial"]

A transport turned the socket into a VcLink, a pair of bounded mpsc channels carrying Bytes frames. A tower-style ProxyProtocolServer decoded the handshake into a ServerCircuit, and OneOrManyTask carried the spawned copy loops in JoinSets, with an unbounded receiver stream for multiplexed connections. Every hop was a task or a channel.

The main steps of the migration, in the Etemenanki history:

Commit Step
20d118b rewrite concepts The new core, runtime, buffer, wake, link and relay modules; the old ones move to concepts::legacy
9b7be19 split the proxy server and client traits ProxyCoreDecode for servers; ProxyCoreEncode and ProxyClientRuntime for clients
fc40d1c add etemenanki-environment Host dialers as Connectors, and the vendored route model
a5c225b protocols: move the task-and-channel pipeline under legacy Old servers, clients and transports move to protocols::legacy; shared codec code stays in place
8bad424 … 6b33b3c Slice parsers and encoders per protocol, the shape the new cores need
8653d8f pipeline foundations Flow, Timing, SniffPrefix, PassthroughCore, TransportStream, InboundTransport, TransportConnector
95ea530 … 8300195 A sans-I/O core and client codec per protocol, then SOCKS, Hysteria 2, WireGuard and TUN
5c826f4 app: serve every inbound and outbound on the new pipeline The app switches over; configuration schema, routing and hot reload are unchanged
44c5109, e79a357 drop the legacy pipeline protocols::legacy and concepts::legacy are deleted; tower leaves every Etemenanki manifest
054cf34 release etemenanki 2.0.0 All four crates at 2.0.0
6c727ee, 53eed3b, 2f1f8cb The WireGuard uplink bound and the mux.cool downlink fix, released as protocols 2.0.1
351abcc, 596916d A SOCKS5 UDP association held to its control connection’s client, released as protocols 2.0.2

Consequences that still shape the code:

  • No compatibility layer. ServerCircuit, VcLink, RoutingKey, OneOrManyTask and the Service-shaped servers and clients are gone. New code does not add adapters back.
  • Tests compare a core with its codec. The 1.x oracle tests (*_vs_legacy_*) went with the old pipeline. The protocol tests now run each server core against its own client codec, both by hand through CoreHarness and over real sockets, and leave agreement with upstream to the Xray and Hysteria interop suites.
  • Replies wait for the dial. A proxy request is answered once its outbound is actually connected, or refused with a reason when it is not. The one exception is a request that names an IP and is sniffed: the client sends nothing before the reply, so HTTP CONNECT, SOCKS and Hysteria 2 answer such a request at once.
  • Some doc comments still say “new pipeline”. They mean the only pipeline.

Release 2.0 still ran each front end’s own copy of the runtime: the app kept its accept loops, connectors, outbound table and generation-based reload in app/src/, and katana kept its own. The supervisor split moved all of that into one crate, etemenanki-supervisor, driven by a typed desired state:

  • a front end lowers its configuration into a Spec and hands it to Supervisor::apply;
  • plan compares what runs with the spec and lists the steps; the supervisor prepares everything that can fail, then commits;
  • a refused spec changes nothing, and a committed one reaches live connections only as its policies say.

The app’s generations are gone: reloading is an apply like any other. How that works is on the supervisor overview and Planning and applying a change.

Commit Step
7235a3b supervisor: move the runtime into etemenanki-supervisor The runtime leaves the app for the new crate
301d805 supervisor: define the model types (not wired) Spec, users and sessions as types
3a3cc44 app: lower the TOML config into a supervisor Spec The app becomes a front end that lowers
909d7d2 supervisor: reconcile specs live, without dropping connections plan, prepare and commit
7841e81 app: run the supervisor from the lowered spec, reloading by apply Generations end; reload is an apply
23039fc supervisor: track flows and sessions, and account per-user usage Tracker, sessions, the usage ledger
eb4f693 supervisor: per-user speed limits and Hysteria 2 password auth (0.2.0) track/pace.rs, Hysteria2UserAuth::Password
990da92 supervisor: open every outbound socket under a host socket policy SupervisorBuilder::socket_options
daa83fd supervisor: serve a supplied TUN descriptor (TunSource::Fd) For the mobile front end
099b696 app: share route switching and reloading with other front ends app/src/routes.rs, webclient
a4fdec4 ffi: add etemenanki-ffi, the proxy for Android and iOS apps (UniFFI) The mobile front end
11bfa21, 555b7df protocols 4.0.0 and 4.0.1, supervisor 0.3.0 and 0.3.1
katana 03bedb5 rewrite katana v4.0.0: one supervisor per node, with its own src/lower/
katana b13aeac serve IPv6 on listen_ip 0.0.0.0, as Xray does katana v4.0.1
katana 8f1803b, 4d4fd96 katana v4.1.0: endpoint_address_family for WireGuard, and the warning for several nodes on one WireGuard outbound
katana v4.1.2 to v4.1.9 Kernel updates (concepts 2.1.0, protocols 4.0.2 to 4.1.2, supervisor 0.4.0 to 0.4.2); dbd1a61, released in v4.1.6: a poll’s user work runs off the runtime and the duplicate-credential check is linear; 4c996ee, released in v4.1.9: an IPv6 literal in brackets is an outbound server’s address
katana ee4a06a katana v4.2.0: disable_vmess_clock_check
katana acd8d15 katana v4.3.0: katana presents a client certificate when a panel asks for one
katana f4cc62b katana v4.4.0: enable_device_limit holds users to the panel’s device limit and bans IPs that fail to authenticate; a gRPC connection whose streams keep failing is closed
katana f53233e katana v4.5.0: the helium panel type
katana 8920c28 katana v4.6.0: a Hysteria 2 node takes the panel’s up_mbps, down_mbps and ignore_client_bandwidth, overridable in [node.hysteria]; built on protocols 5.0.0 and supervisor 0.9.0
katana a5bdd09 katana v4.7.0: real_ip_header and real_ip_from, so a WebSocket node behind a reverse proxy takes its client from the proxy; musl builds allocate with mimalloc (9a7a52c); built on protocols 5.1.0 and supervisor 0.10.0
katana b3edabd katana v4.8.0: handoff_dir and handoff_group, a Unix socket per stream node on which a relay on the same host hands connections over; a reload that changes only real_ip_header or real_ip_from applies at once (d1db2e3); built on protocols 5.2.0 and supervisor 0.11.0
katana 756edb2 katana 4.8.1 (8e0ca45): a node on one address names its handoff socket <listen_ip>-<port>.sock, and handoff_dir is checked against the node’s longest name; built on supervisor 0.11.1. katana 4.8.2 (be112c8) and 4.8.3 (9430549) move to supervisor 0.11.2 and 0.11.3, 4.8.4 (ddd70fe) to environment 3.2.1 and protocols 5.2.1, and 4.8.5 (5a8d462) to supervisor 0.11.4
katana 8ee0466 katana v4.9.0: nodes for AnyTLS, SOCKS and HTTP over TLS, Shadowsocks over a transport, and VLESS over REALITY, with or without Vision, from helium’s tls_settings; helium’s protocol tag is checked against the node type; built on protocols 6.0.0 and supervisor 0.12.0, with the reality feature on
katana 758b6bf katana v4.10.0: sss nodes; built on concepts 2.1.2, protocols 6.1.0 and supervisor 1.0.0
katana 7b51f92 katana v4.10.1: built on protocols 6.2.0 and supervisor 1.0.1, so a VLESS request with an unknown user id counts toward the IP ban whatever flow it asks for, and a Vision inbound sends its own direct command after an inner TLS 1.3 handshake, as Xray does
katana 1ac09bb katana v5.0.0 (be65c12): helium nodes on Helium’s node API v2 alone, with the helium-node-api crate’s types; the panel describes the whole inbound, Hysteria 2’s UDP relay and masquerade included, so a helium node’s node_type, enable_vless, vless_flow and [node.hysteria] keys but congestion are refused; the users answer says its limits once; a UniProxy sss node is refused
katana 0a4ea56 katana v5.1.0 (2e98f35): built on protocols 7.0.0 and supervisor 2.0.0; sss nodes’ chains in the notation of the sss whitepaper; a route’s geo files stamped when it is lowered, so a file replaced at the same path rebuilds the route on the next apply
katana 791755d, 5e6387c, 84084b3, cbf6b96 katana v6.0.0 (05abcbf): a TCP node whose panel asks for header obfuscation other than none is refused; SSPanel is gone, and with it [node.api] vless_flow, disable_custom_config and the illegal-access reports; enable_mtls = false presents no client certificate; built on protocols 7.1.1 and supervisor 2.1.0
katana af09e2a katana v6.0.1 (d7270ec): every panel request asks for a gzip-compressed answer
katana 390b4dc, 7c5fe99 katana 6.1.0 (4d51c8d): one node model, the helium-node-api crate’s node config, from every panel; a UniProxy answer is converted into it and what katana cannot serve is refused by name as the answer is read, with the reason in the logged line; a server_port outside 1 to 65535 is refused; a [node.hysteria] edit gives a newV2board node a new panel client; built on concepts 2.2.0, environment 3.2.2, protocols 7.2.1 and helium-node-api 0.2.0

Protocol changes released along the way, since 2.0.2:

Commit Change
cb0db94 socks: reply once when a sniffed CONNECT’s client stays silent protocols 2.0.3
2a23f58 routing: match domain regexes as sets, not one search per pattern environment 3.0.0
231e1fb ss-2022: refuse a replayed request salt The Shadowsocks 2022 salt filter (ss_2022/replay.rs)
828515b shadowsocks: cap legacy chunks at 0x3FFF and skip empty ones The SIP004 length cap and empty records
260f019, 8a4d3dc, bb30df6 The shared Shadowsocks AEAD codec (ss_aead.rs), and the async helpers only tests used removed from every protocol
68c7554, c685441, f9acc49 WireGuard: the remote’s FIN as end of file and a reset as an error, tunnel ports never handed out twice, timer sends surviving transient errors
9a10817 protocols: create tun devices only where the OS lets a process tun::check_platform
6782b6e concepts: flush the wire after a datagram a proxy client sends concepts 2.1.2: a wire that holds small writes until a flush no longer keeps a packet until the next one
193d557 protocols: flush the sniffed prefix a SOCKS CONNECT forwards protocols 6.1.0: the client’s first bytes reach such an upstream before the client sends more
Invariant Enforced by Pinned by
Dependencies point one way: concepts ← environment ← protocols ← supervisor ← front ends, and reality ← protocols The manifests; Cargo rejects a dependency cycle The build itself
No type of etemenanki-reality shows in the protocols crate’s public API Wrapper types of the protocols crate’s own in transports/reality.rs and transports/camouflage.rs, and a crate-local RawParts for Vision No test
etemenanki-concepts has no protocol code and no I/O in its cores No workspace dependency in concepts/Cargo.toml; cores receive bytes as Events and answer with Effects core_is_driven_without_any_io (concepts/tests/runtime.rs), codec_is_driven_without_any_io (concepts/tests/client.rs)
A proxied connection runs in one task, even through an upstream proxy spoken by a client codec ProxyClientRuntime is an AsyncRead + AsyncWrite value the server runtime polls in place. Shared carriers (a dialed gRPC connection, the WireGuard device, a Hysteria 2 connection) run separate driver tasks server_runtime_relays_through_a_client_runtime_in_one_task (concepts/tests/client.rs)
Hysteria 2, TUN and REALITY compile only where asked for Optional dependencies behind hysteria, tun and reality in etemenanki-protocols, no default features. The supervisor asks for all three, so every crate built on it (the app, the ffi, katana) gets them The manifests; katana’s Cargo.lock has shinku-quinn, shinku-quic, ipstack, tun-rs and etemenanki-reality
rustls never picks a crypto provider implicitly builder_with_provider with the ring provider in both tls_config functions; the server also pins TLS 1.3 No dedicated test. Every Hysteria 2 handshake test, such as new_server_vs_new_client_tcp in protocols/tests/pipeline/hysteria.rs, builds both configurations, but no test unifies a second provider
Protocol parsing cannot panic on untrusted input The crate-wide clippy denies and helpers/parse.rs The truncation tests listed under Lints
The route model keeps harranu’s first-match semantics routing.rs, grown from the vendored copy first_matching_rule_wins, any_matcher_within_a_rule_matches, port_parser_rejects_an_inverted_range and the rest of environment/tests/unit/routing.rs
plan is pure: no sockets, no tasks topology/spec_plan/plan.rs compares specs only supervisor/tests/unit/plan.rs
Every rule about what a spec means has one owner supervisor/src/build/validate.rs; a front end refuses what its own format gets wrong supervisor/tests/unit/validate.rs
A refused spec changes nothing Prepare builds everything that can fail before the commit a_refused_spec_changes_nothing (supervisor/tests/hot_swap.rs)

Neither repository’s CI runs tests, formatting or clippy. The workflows build release binaries; the validation gates below are run before a change lands and before every release.

Workflow Trigger What it does
Etemenanki build.yml Pull requests, manual (the push trigger was removed in 75b08e1) Installs pkg-config and libssl-dev, then cargo build --release --package etemenanki-app --target x86_64-unknown-linux-gnu, and uploads the binary
katana release.yml Tags v*, manual Builds x86_64-unknown-linux-gnu and x86_64-unknown-linux-musl with --locked; fails if readelf shows a dynamic libssl or libcrypto, and fails if the musl binary has a program interpreter or any NEEDED entry; on a tag push, publishes both binaries with .sha256 files as a GitHub release

The dynamic-OpenSSL check in release.yml is why katana enables vendored-openssl: the binaries must run on hosts whatever their OpenSSL version.

CI builds for Linux only. The macOS and Windows builds the crates support are made by the apps that embed them, not by either repository’s workflows.

Terminal window
cargo fmt --all -- --check
cargo test --workspace
cargo clippy --workspace --all-targets --all-features -- -D warnings
# before a release, additionally:
cargo check --workspace --locked

A few consequences of these exact commands:

  • cargo test --workspace runs every member, the reality, supervisor, subscribe, webclient and ffi suites included, and unifies features across members. The supervisor and the app enable hysteria, tun and reality on etemenanki-protocols (the ffi hysteria and tun), so the workspace run also compiles and runs the hysteria, hysteria_options, reality and (on Unix) tun modules of protocols/tests/pipeline.rs. cargo test -p etemenanki-protocols alone does not; add --features hysteria,tun,reality.
  • --all-targets in the clippy gate also compiles the criterion benches, protocols/benches/vmess_users.rs and supervisor/benches/tracking.rs.
  • --all-features in the clippy gate turns on everything at once: etemenanki-environment/quic, so dial/quic.rs and its test are linted; tun, whose rtnetlink dependency exists only on Linux targets and route_manager only on macOS and Windows; and vendored-openssl, the protocols feature and the app’s and etemenanki-ffi’s, which builds OpenSSL from source and needs perl, make and a C compiler.
  • Nothing enables quic in a workspace test run, because no member asks for it. The QUIC dialer tests (dials_a_quic_server_over_loopback, a_socket_wrap_sees_the_endpoint_socket in environment/tests/integration/quic.rs) run only with cargo test -p etemenanki-environment --features quic.
  • Interop tests need Go and the submodules. Without go, or with an uninitialised submodule, the Xray, Hysteria and sing-box tests print SKIP: and pass. A green run on such a machine has not exercised them; run git submodule update --init and install Go before trusting it. Xray-core v26.10.17 declares Go 1.27, which GOTOOLCHAIN=auto fetches.
  • Some tests need more than Go. a_routed_connect_is_answered_while_the_app_runs (app/tests/integration/e2e_tun.rs) needs permission to create a TUN device (in practice CAP_NET_ADMIN); on PermissionDenied it prints SKIP: and returns. wireguard_outbound_live_env_tcp (app/tests/integration/e2e_wg.rs) is #[ignore] and needs ETEMENANKI_WG_* environment variables and network access.

Unit tests are files under <crate>/tests/unit/…, mounted into the module they test. etemenanki-environment, etemenanki-reality, etemenanki-protocols, etemenanki-supervisor, etemenanki-app, etemenanki-subscribe and katana follow this layout (katana keeps two small tests inline besides); etemenanki-concepts instead keeps fourteen tests inline in buffer.rs (eleven), relay.rs and wake.rs, and tests its runtimes through their public API.

#[cfg(test)]
#[path = "../../tests/unit/trojan/core.rs"]
mod tests;

They compile as a child module, so they can reach private items, and they are covered by the cfg_attr(test, allow(…)) above. Integration tests are ordinary Cargo test targets:

Crate Integration target Covers Test functions
concepts tests/runtime.rs, tests/client.rs The runtimes with toy cores and codecs (TinyMux, TinyUdp, TinyCodec and others), and the flush after each datagram a proxy client sends 53, of which 14 inline in src/
reality tests/server.rs, tests/client.rs (both with tests/support/dest.rs, a local OpenSSL dest on 127.0.0.2) The REALITY server and client over TCP: probes answered by dest itself, authenticated clients for every suite and group, the record layer, RFC 8448’s handshake, fuzzed ClientHellos 147, of which 139 unit
environment tests/integration.rs (tcp, udp, and quic behind the feature) Dialers on loopback 39, of which 31 unit
protocols tests/pipeline.rs (hysteria and hysteria_options behind hysteria, reality behind reality, tun behind tun on Unix) Each server core against its client codec over real sockets; AnyTLS behind real TLS (serve_runtime_over, a runtime behind an inbound transport); REALITY; transports; DoT and DoH; Hysteria 2 rates, port hopping and QUIC settings 801, of which 709 unit
supervisor tests/anytls.rs, tests/guard.rs, tests/handoff.rs (Unix only), tests/hot_swap.rs, tests/ping.rs, tests/socket_policy.rs, tests/sss.rs, tests/tracking.rs AnyTLS and sss between two supervisors, the guard (device limits, IP bans, gRPC connections closed for failed streams, WebSocket clients named by a trusted proxy), connections handed over on a handoff socket, applies against live traffic and closing the flows a route change moved, delay tests against local HTTP servers, the socket policy, tracking and usage 235, of which 173 unit
app tests/integration.rs (20 e2e_* modules, e2e_reload, e2e_api, e2e_hysteria_options, e2e_xray_reality, e2e_xray_wrapped, e2e_singbox_anytls and e2e_sss among them) The real etemenanki-app binary against Xray (REALITY and Vision both ways, Vision’s UDP over XUDP included, and Shadowsocks, SOCKS and HTTP inside transports), sing-box (AnyTLS both ways), Hysteria, a WireGuard peer, a TUN device, and a second app process for sss 180, of which 75 unit
subscribe none The subscribe schema 7, all unit
webclient tests/tracking.rs The connection and traffic endpoints, a route switch that closes what it moved only when asked, and the delay endpoint 7
ffi tests/proxy.rs, tests/inspect.rs, tests/convert.rs (all Unix only) A proxy run through the ffi, with a fake TUN device; reading a subscription, checking a config and its route view without a running proxy; converting other formats’ subscriptions and share links, AnyTLS, REALITY and sss among them, and dropping geo matchers; close_rerouted and http_ping 23
katana tests/integration.rs (xray_interop, hysteria_interop, sniff) The real katana binary behind a fake panel, driven by Xray and Hysteria clients; disable_sniffing end to end 160, of which 145 unit and 2 inline in src/

Counts are #[test] and #[tokio::test] attributes at the verified revisions. How to write and run each kind is on Testing.