Skip to content

feat: raise default MAX_PEERS to 32 - #166

Merged
jamiesun merged 1 commit into
mainfrom
feat/default-max-peers-32
Jun 12, 2026
Merged

jamiesun merged 1 commit into
mainfrom
feat/default-max-peers-32

Conversation

@jamiesun

Copy link
Copy Markdown
Owner

What

Bump the default of the -Dmax-peers build option from 16 to 32.

  • Range / cap unchanged: still validated to 1..128.
  • Derived MAX_POLICY_ENTRIES is now 32 + MAX_ROUTES*2 + 224 = **272** (was 256 at the old default).

Why

Real deployments now routinely exceed 16 spokes, so 32 is a better out-of-the-box default. It stays compile-time (the registry/config are fixed zero-alloc arrays); operators who need more can still go up to 128, and the policy table scales automatically.

Size impact

Static musl subnetrad grows ~20 KB (265 KB → 284 KB), subnetra is unchanged (142 KB). Both remain well within the 512 KB iron-law budget.

Changes

  • build.zig: -Dmax-peers default 16 → 32; comment/help text updated.
  • src/config.zig, src/uds.zig: comments updated to "default 32 → 272"; dropped the obsolete "reproduces the historical 256-entry table" wording.
  • Docs (EN + ZH): installation.md + reference.md updated to default 32.

Verification

  • zig build + zig build test green at the new default 32 (and still at 16/64/128).
  • zig build --help shows default 32.
  • Cross-compiled x86_64-linux-musl: subnetrad 284 KB < 512 KB.
  • Both mdbooks build; check-links.py passes.

Operators now routinely need more than the previous default of 16 peers, so
bump the `-Dmax-peers` default to 32 (the 1..128 range and 128 cap are
unchanged). The derived `MAX_POLICY_ENTRIES` becomes 32 + MAX_ROUTES*2 + 224 =
272, and the static musl subnetrad grows ~20KB to ~284KB — well within the
512KB iron-law budget.

Docs (EN + ZH) and the in-code comments are updated to state "default 32 → 272"
and drop the now-obsolete "reproduces the historical 256-entry table" wording.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@jamiesun
jamiesun merged commit 4fdd436 into main Jun 12, 2026
10 checks passed
@jamiesun
jamiesun deleted the feat/default-max-peers-32 branch June 12, 2026 11:56
@jamiesun jamiesun mentioned this pull request Jun 12, 2026
jamiesun added a commit that referenced this pull request Jun 12, 2026
Bump build.zig.zon .version 0.8.3 -> 0.9.0 ahead of tagging.

Highlights since v0.8.3:
- feat: configurable MAX_PEERS via the `-Dmax-peers` build option, 1..128 (#165)
- feat: raise the default peer cap to 32 (#166)
- docs: Exit Node & Outbound guide, simplified to the proxy-outbound pattern (#162, #163)
- docs: quickstart now uses a hub + two spokes (#164)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant