chore: updated README for new spec

This commit is contained in:
Namilsk 2026-11-28 18:20:39 +03:00
parent f4b1fce0ad
commit 27eaabbed8
No known key found for this signature in database
GPG key ID: 2B2F0A4D870B4F9F

172
README.md
View file

@ -1,54 +1,144 @@
# nsc (Network security control)
A kernel-space traffic routing engine featuring overlay network integration, Xray-core GeoDB compatibility, a network kill switch, and advanced policy-based routing.
# NSC
<div align = "center">
NSC (Network Security Control) is a Rust prototype for policy-based routing of
local IPv4 TCP and UDP traffic, with planned DNS and overlay proxy integration on
Linux. The routing contract is described in the
[v0.1 specification](doc/ROUTING_DEV.md) and its
[architecture overview](doc/HOW_WORKS_ROUTING.md).
<a href="https://rust-lang.org" target="_blank">
<img src="https://img.shields.io/badge/language-rust-blue?logo=rust">
</a>
> **Project status:** NSC is not yet a usable traffic-routing or killswitch
> implementation. The current executable reads packets from a hard-coded TUN
> device and calls the packet-header parser. It does not install the specified
> OUTPUT → TC → TPROXY path, enforce routing policy, or relay application flows.
<a href="https://opensource.org">
<img src="https://img.shields.io/badge/license-OSI_Compliant-brightgreen?logo=open-source-initiative&logoColor=white">
</a>
## Current implementation
<a href="https://anthrill.namily.tech">
<img src="https://img.shields.io/badge/Anthrill_project-part?logo=data:image/webp;base64,UklGRlQCAABXRUJQVlA4WAoAAAAQAAAAPwAAPwAAQUxQSBABAAABgJpt27Llet4fqSzgJHd3d9cVyEQbgoNG0+YW3SExAQu4O/w4PN+LUyJiAsx/R8QunrUHKJ+bygLsAEqm3W733WAKiPOAijn387fDSYCzQKoW3a+9Hs4BnAOmdtn95okswBngalx1v+t4OqAHpnHD/d53Y+mAElK96ta8m8gVlBLd6jlaeXp1Wjl69VrZ1mV9+bK/fZl6DVoZH1+jdU1aWXoN1tVpZetVa+Xp1WpFHmtdpCkJIT3XKiMxiI4RSBp7v9UiEKMuULT4PrstLjCOBGnafNt1px8Yx4J389br9ltjQYyTwadj+6Xz7mAQ43Tw7Tp7ctMXCWIsFAgfuHVPpYAYSwXS80CMxQKYP858+lZQOCAeAQAAcAgAnQEqQABAAD6NOJZHpSOiITX12ACgEYlpANSNit3gS3ap8HzocCCPlL2pi94lXmUmWoa8mIQ70V9tBhHd1q6te9VRxOyUo9DeAAD++4sJYIfa/Ze+MAroZ8ZOnAcpzt6pGtr+Uwhs1fXl6LTlsBZu1JdFizWQ29RWRqcTiy3RAQSNESMQGB+f3lcDJt/gfxVZZOGsuvgPAp7KcvOFUlz8FOqf+D2GMhWw9VnJgtMrHyVABWbcIRl1Sz+tmAmNKMnOzPbihkK9N7TRApFs7kxGzmaOnAn3Jqeslzo98euK1XpW5K7+ZPkSLI6akOiI+LzU6Lx1s5mrI8G9x+YHPazwK7l3F1AzyYuAmrrbxXr1aDicQvDCyi+NeBoAAA==&logoColor=white&color=FFFFFF">
</a>
| Area | Present in the repository | Status |
| --- | --- | --- |
| Packet handling | TUN read loop and raw packet-header parsing | Prototype sniffer only |
| Configuration | Basic TOML parsing for rules, proxies, and policy values | Not loaded by the running executable; full v0.1 validation is pending |
| Geodata | GeoIP2 MMDB and V2Ray geodata parsing components | Rule matching and routing integration are incomplete |
| FakeDNS | UDP/TCP DNS server and fake-address resolver components | Prototype; v0.1 DNS policy and publication contract is not implemented end to end |
| Interception and enforcement | No complete OUTPUT → TC → TPROXY backend or independent egress guard | Planned |
| Proxying and lifecycle | No integrated transparent relay, reload path, or boot-only service integration | Planned |
<a href="https://geti2p.net">
<img src="https://img.shields.io/badge/I2P-Supported-black?logo=data:image/webp;base64,UklGRogBAABXRUJQVlA4WAoAAAAQAAAADwAADwAAQUxQSJgAAAABgFpt2/Lm+fl/QxvEM6hYZrTMSbmO2wlgAa6lMSqZW0sDsMLwN0NETAARSZCt0bhLA4n6BRSOv9vt/9tpgSciCWvtoXu8SIRAm7EOhbDCcgiesMiyCZFgfBn2ZYcqA6sMI5C0maPfYe32MuJt9iLguWB5VCFDc8mwDpEgPDC4QSRid9irCQSgNOxUQX96dmZmemSsXsoaAFZQOCDKAAAAEAMAnQEqEAAQAAIANCWwAnQwTclUHiPh926uNi1lWNzAAP79uZX9EzSIyJ9t8f+0xSMv6bqHXKwpwWp+pjkd+TYR2hsQfJn4My+3Kr6ay8TRn0POLj5Tr3epFf/Z0+boJYOtUJ7y//8Vbtun/EXraMbsahWqqZDk5X0+P6WATMVLO1MVKrdJGsY/XR9Johg3JFBcq/mG11Lg/lMWdTYRTzoH3+f+fL/ezoV/aHr7fvBvoL3uIzxw8E90A8UNo693xkt9ej/EoO/wAA==&logoColor=white&color=1f4987">
</a>
</div>
<br>
The current executable must not be treated as a protected networking profile.
The component-level work does not yet provide an end-to-end routing guarantee.
**The current project spec**: [click](https://anthrill.namily.tech/how.html#nsc)
## Routing v0.1 configuration examples
**Routing documentation**: [Overview](doc/HOW_WORKS_ROUTING.md) · [Specification](doc/ROUTING_DEV.md)
These examples show the target configuration contract from
[specification §5](doc/ROUTING_DEV.md#5-configuration-contract). They are not
currently runnable profiles: the executable does not load a routing config, and
the parser does not yet support every field shown here. Replace
`192.0.2.53` with an IPv4 DNS resolver authorized for your host; it is a
documentation-only address.
Our resources:
- http://anthrill.i2p (about, docs, wiki)
- https://namily.tech (VPN, docs, wiki mirrors)
- https://git.namily.tech (forgejo, register-opened)
### REAL DNS by default
### Deprecated spec (expanded; this functionality will also be implemented)
The project is designed by the desire to transfer all the charms of routing and tun-in of modern VPN cores to Mesh networks.
Tun-in interface with marching on TOR/I2P similar to v2ray/xray
Ordinary DNS uses the configured upstream. No synthetic answers are requested.
```toml
[policy]
clearnet = "allowed"
dns_mode = "real"
[dns]
upstreams = ["udp://192.0.2.53:53"]
```
## brief impl plan:
### client-side usage essentianls
1. [ ] TUN raw data (headers) parsing 50-70% done =)
2. [x] parse geoip2 (mmdb for now) thingies (
3. [x] add v2ray protocols buffer support (geo{ip,site}.dat)
4. [ ] add full fakedns sniffer; 45-50% done
5. [ ] parse user's Config
6. [ ] impl routing logic based on client's Config
7. [ ] make this thing easy adn convenient to use
8. [ ] custom Tor/i2p profiles/Config presets (via proxies like 127.0.0.1:10808)
### Clearnet through a configured proxy
### inner infra
1. [ ] write as much tests as possible covering hopefully all logic
2. [ ] keep code readable and comprehensive
3. [ ] ideally review each others PRs after initial MVP stage
4. [ ] leave references/helpful comments on parts when code isn't obvious from the first glance
`allow-proxy` blocks direct clearnet access while permitting application traffic
through the configured proxy. The rule selects that proxy for clearnet names.
```toml
[policy]
clearnet = "killswitched"
killswitch_mode = "allow-proxy"
dns_mode = "real"
[dns]
upstreams = ["udp://192.0.2.53:53"]
[[proxy]]
alias = "socks-exit"
url = "socks5://127.0.0.1:1080"
[[rule]]
target = "clearnet"
action = "proxy"
proxy_name = "socks-exit"
```
### Full killswitch with FAKE DNS for `.i2p`
Full mode blocks clearnet application destinations, including destinations that
would otherwise use a proxy. The `.i2p` rule explicitly selects FAKE DNS and the
configured i2pd SOCKS endpoint; other DNS remains REAL.
```toml
[policy]
clearnet = "killswitched"
killswitch_mode = "full"
dns_mode = "real"
[dns]
upstreams = ["udp://192.0.2.53:53"]
[[proxy]]
alias = "i2pd"
url = "socks5://127.0.0.1:1080" # Use the SOCKS port configured in i2pd.
[[rule]]
target = "suffix:i2p"
action = "proxy"
proxy_name = "i2pd"
dns_mode = "fake"
```
The examples follow the normative v0.1 defaults and constraints. In particular,
DNS mode is independent of transport action, overlay names are not sent to the
clearnet resolver, and a DNS answer alone does not authorize a connection.
## Runtime and lifecycle contract
The lifecycle below is specified for the future v0.1 runtime; it is not yet
implemented by the current executable:
- Run one NSC process from system boot until reboot. The planned systemd unit uses
`Restart=no`.
- Apply configuration changes through SIGHUP. A successful reload keeps the
runtime identity and existing fake-address mappings; a failed reload leaves
the active policy unchanged.
- Do not stop or restart NSC during a live client session. Binary upgrades take
effect after the next system boot.
- After a crash, retain the independent firewall guard and recover by rebooting.
A reboot starts a new runtime epoch and clears in-memory fake-address mappings.
See [specification §10](doc/ROUTING_DEV.md#10-lifecycle-publication-and-failure)
for the startup, readiness, reload, failure, and init requirements.
## Backend and implementation work
There is no published backend deployment descriptor yet. The
[descriptor contract](doc/ROUTING_DEV.md#112-deployment-descriptor) lists the
required kernel, hook, mark, route, listener, ABI, and resource-limit details;
implementation is tracked in [issue #8](https://git.namily.tech/Anthrill/NSC/issues/8).
Related work:
- [Complete the configuration schema](https://git.namily.tech/Anthrill/NSC/issues/1)
and [implement routing and killswitch decisions](https://git.namily.tech/Anthrill/NSC/issues/2).
- [Implement TC admission](https://git.namily.tech/Anthrill/NSC/issues/9) and the
[local OUTPUT → TC → TPROXY path](https://git.namily.tech/Anthrill/NSC/issues/10).
- Add [transparent listeners](https://git.namily.tech/Anthrill/NSC/issues/12),
[TCP relay](https://git.namily.tech/Anthrill/NSC/issues/13),
[UDP relay](https://git.namily.tech/Anthrill/NSC/issues/14), and
[HTTP proxy modes](https://git.namily.tech/Anthrill/NSC/issues/15).
- Integrate the [runtime startup path](https://git.namily.tech/Anthrill/NSC/issues/16),
[reload](https://git.namily.tech/Anthrill/NSC/issues/17), and
[boot-only packaging](https://git.namily.tech/Anthrill/NSC/issues/19).
Browse [all open issues](https://git.namily.tech/Anthrill/NSC/issues) for the
current implementation plan.