English
ours-tracker
crates/tracker — live connections: what each one is routed through and how to close it.
Design
Trackeris a table shared by all shards, so it is split into stripes by connection id: shards do not fight over one lock on every open and close.- An entry is created before the connection's task is started, not after routing (
register→Tracked): the task's abort handle goes straight into the entry (attach), and reload marks the entry itself. A tracked connection needs nothing beyond its entry: the abort handle lives in it, so no separate closer object is kept. - An entry is invisible to reconsideration and statistics until routing has filled in what it goes through (
routed): reload must not judge a connection that is still being sniffed or resolved. Connection—metadata,outbound,redirect;is_closing,close.Tracker::for_each,len.Redirect/RedirectReceiver— the channel through which reload hands a packet stream a new outbound. A TCP stream cannot be moved, it has no channel: reload closes it.observe— optional (enable_monitor) bounded diagnostics:Monitor,Counters,Sample, a trace up toTRACE_LIMIT. Payload and protocol secrets are not collected.
Who uses it
ours-kernel (dev), ours-mod-dispatch (registration), ours-relay (counters), ui (connections in the API), dev — ours-mod-router, ours-mod-vless.
Specifics
Depends on ours-api, ours-atomic64 (64-bit counters on MIPS too), tokio.
Tests
Unit tests in src/; crates/tracker/tests/tracker_memory.rs — how much a tracked connection costs.