refactor: centralize peer control routing

This commit is contained in:
Eric Wendland 2026-07-05 23:51:08 +02:00
commit a32cab645f
4 changed files with 218 additions and 126 deletions

View file

@ -11,12 +11,14 @@ Within `geth-node`, daemon lifecycle code is separated from feature handlers:
signal handling, Iroh endpoint startup, the Iroh accept loop, and background
live-sync task spawning. `local_control.rs` owns async local `ControlRequest`
routing, safe trace-field classification, and named peer/resource/local handler
families before delegating to feature implementations. `resource_contracts.rs`
records the review boundary for each resource family: resource ID patterns,
capabilities, and mutation or host-access points. Runtime registries for
pubsub, pipes, and overlays live behind narrow mutex-protected structs in
`runtime.rs`. Protected peer-control ALPN dispatch remains a separate refactor
target.
families before delegating to feature implementations. `peer_control.rs`
centralizes inbound Iroh ALPN classification, peer endpoint-address parsing,
signed peer-card endpoint binding validation, and authenticated caller context
creation for protected peer-control, pipe, SSH-proxy, and overlay paths.
`resource_contracts.rs` records the review boundary for each resource family:
resource ID patterns, capabilities, and mutation or host-access points. Runtime
registries for pubsub, pipes, and overlays live behind narrow mutex-protected
structs in `runtime.rs`.
The local metadata store is SQLite product state. `geth-store` tracks a numeric
`schema_version` in the `meta` table and applies ordered migrations up to the

View file

@ -52,13 +52,13 @@ behavior.
- `[x]` Each command family has a small handler module or function group.
- `[x]` Local-only behavior remains covered by existing integration tests.
- `[~]` Extract protected peer-control routing.
- `[x]` Extract protected peer-control routing.
Acceptance criteria:
- `[x]` Shared bounded Iroh line-read and send-finish helpers live outside
the main feature handler module.
- `[x]` Outbound peer-control, pipe-wire, and overlay-wire request helpers
live outside the main feature handler module.
- `[~]` Iroh control ALPN handling, nonce checks, peer-card validation, and
- `[x]` Iroh control ALPN handling, nonce checks, peer-card validation, and
endpoint-binding validation are centralized.
- `[x]` Feature handlers receive authenticated caller context rather than
repeating peer-card boilerplate.