nx_net_governor.nx
buildroot/runtime/nx_net_governor.nx
about
nx_net_governor.nx -- general network traffic-shaping governor (ISP-safe).
module: nishi-core.net.governor
depends: nx_syscalls.nx
capability: CORE_COMPUTE
wired_status: FULLY_WIRED
A REUSABLE bits-up primitive for ANY network client that must not look like
abuse to an ISP/IDS (which penalize BitTorrent-like / scan-like behavior:
many rapid connections to many IPs, sustained high bandwidth, DNS floods).
It shapes aggregate activity to a slow, ordinary profile:
* GLOBAL min-interval between ANY two requests/connections (low steady rate)
* total request/connection cap + total byte budget per run (low volume)
* per-transfer size cap (no huge transfers)
Pair with: standard ports, GET-only / no-seed, sequential concurrency, DNS
caching. Used by the crawler today; the SAME governor will pace the future
torrent client (per-peer connection rate + upload/download byte budgets) and
any other network worker. Deterministic; the caller passes the clock.
dependencies 1 imports · 3 importers
imports: nx_syscalls.nx
imported by: nx_crawl_https.nxnx_crawl_main.nxnx_net_governor_test.nx
structs
| 22 | struct NxNetGov |
consts
| 31 | const NX_NETGOV_BYTES: i64 = 56 // 7 * 8 |
functions
| 33 | func nx_gov_init(g: *NxNetGov, min_interval_ms: i64, max_requests: i64, |
| 46 | func nx_gov_can_fetch(g: *NxNetGov) -> i64 |
| 54 | func nx_gov_wait_ms(g: *NxNetGov, now_ms: i64) -> i64 |
| 61 | func nx_gov_record(g: *NxNetGov, now_ms: i64, bytes: i64) -> i64 |
| 70 | func nx_gov_resp_cap(g: *NxNetGov) -> i64 { return g.max_resp_bytes } called by 1: main |