English
Modules
A module is an ours-mod-* crate in modules/<group>/<directory> that describes itself with the constant MODULE: ours_api::Module (name, requires, provides), or with INBOUND and OUTBOUND when the inbound and the outbound are separate features. The binary lists the modules in app/ours/src/modules.rs, each under its own feature; the kernel builds a slot registry from the list (ours_kernel::Modules). The Module/Provide contract — contract, how the kernel builds and reloads an instance — kernel, how modules take part in loading YAML — configuration.
One file per crate; the file name is the module name, without -inbound/-outbound. Each has: the purpose, requires and why, what it provides, features, dependencies on libs/ and crates/, the src/ files, specifics, tests.
The terms the pages rely on: Module and Provide, requires, points and extensions, services, units and the dispatcher, entity blocks, reload. Libraries — libs/, auxiliary crates — crates/.
Composition checks
requires_are_listedinapp/ours/src/modules.rs— aconstcheck: a module whoserequiresdid not get into the build breaks compilation, not startup.every_module_of_the_workspace_is_listed_or_left_out_by_its_feature— everyMODULEfound by the binary'sbuild.rsin the sources is either in the list or turned off by the feature with its name.a_module_requires_the_modules_its_crate_depends_on— a crate that calls another module's crate must require it (an optional dependency — only if that module is in the build). The converse is not needed: a module may use another's point or service by name (this is howdnsrequiresrouter).
System
Always in the build (except ntp); the rest rely on them.
dispatch— the dispatcher: rules, sniffing, choosing the outbound, relay, reload policy.dial—Dialer,detour, thedialblock, network namespaces.tls— the root store, thetlsblock, client/server, uTLS, REALITY, kTLS.cache— the cache file (thecachesection).ntp— the SNTP client and the clock offset.
Protocols
anytls— AnyTLS: sessions over TLS with padding.block— an outbound that refuses everyone.direct— the direct outbound and thedirectinbound.http— the HTTP proxy inbound/outbound.mixed— an HTTP and SOCKS inbound on one port.mtproto— the MTProto proxy inbound for Telegram, behind fake TLS.hysteria— Hysteria v1 over QUIC.hysteria2— Hysteria2 over QUIC/HTTP/3.shadowsocks— AEAD and 2022.shadowtls— ShadowTLS v1–v3.socks— SOCKS4/4a/5.redirect— a transparent TCP proxy throughSO_ORIGINAL_DST.tproxy— a transparent proxy through nftablestproxy.tun— a TUN device: the system stack,auto_route,auto_redirect.trojan— Trojan.tuic— TUIC v5.vless— VLESS, Vision, XUDP, mux.cool, VLESS encryption.wireguard— the WireGuard endpoint: TUN and the kernel stack, inbound and outbound.mux— sing-mux: smux, yamux, h2mux (themuxblock).
Transports
transport— thetransportpoint and the transport interface.transport-ws— WebSocket.transport-http— HTTP/1.1 and HTTP/2 registration; the shared HTTP/2 layer isours-protowithh2.transport-grpc— gRPC-lite on top of the HTTP/2 layer ofours-proto.transport-httpupgrade— HTTP Upgrade.transport-xhttp— Xray's XHTTP (split HTTP).
Routing
router— route rules, rule-sets, conditions, analysis forauto_nft.rule-process— conditions on the process and the user.group— outbound groups: manual choice, probes, distribution.
DNS
dns— servers, the cache, the DNS router, FakeIP,dns.listen.adblock— filtering client DNS queries by AdGuard/hosts lists.
Configuration and subscriptions
subscriptions— subscriptions: formats, the store, on-the-fly updates.clients— what is handed out to clients: WireGuard peers and their configurations, links.
The requires graph
dispatch, dial, tls, cache, mux, block, tproxy, redirect, tun,
mtproto — nothing
direct, socks, ntp, wireguard — dial
shadowsocks — dial (+ mux with `mux`; + tls, transport, transport-ws with `v2ray-plugin`)
transport, http, mixed, anytls, shadowtls, hysteria,
hysteria2, tuic — dial, tls
trojan, vless — dial, tls, transport (+ mux with the `mux` feature)
transport-ws, transport-http, transport-httpupgrade,
transport-grpc — transport
transport-xhttp — transport, tls
router, group — tls, cache
rule-process — router
dns — router, dial, tls, cache
adblock — dns, dial, tls
subscriptions — tls, cache, dial
clients — wireguardThe start order follows this graph: a required module is built and started earlier.