English
How to add
Step-by-step instructions for typical extensions. Each relies on an existing module as a model; paths and names are from the current code.
| Task | Model | File |
|---|---|---|
A new module in the binary: crate, MODULE, feature, LIST, requires | any modules/*/* | module.md |
| A protocol: inbound and/or outbound | modules/protocols/block, modules/protocols/socks, modules/protocols/trojan | protocol.md |
A transport: a variant of the transport block | modules/transports/ws | transport.md |
A rule condition in match | modules/routing/rule-process | rule-condition.md |
| A top-level section | modules/system/ntp | section.md |
| A subscription format | modules/config/subscriptions/src/links.rs | subscription-format.md |
Any extension is a module or part of a module, so start with module.md: the other instructions refer to it for the build and check steps.
General rules
- A module talks to the kernel only through the
ours-apicontract (Module,Provide, services); a module may not depend onours-kernel— see Contract, Layers. - Wire behaviour must match sing-box 1.14.4 (and Xray for VLESS extensions); the YAML format is our own. Differences are described in differences.
- After a change — the minimal set of checks from Checks: the crate's tests,
tests/layers.py,tests/features.py, and for new network behaviour an E2E scenario that also passes on the reference (PROXY=sing-box). - The description of a new module —
docs/architecture/modules/<name>.md(see Modules).