Document the Rust-core / Xray boundary (ADR-0007) to stop data-plane confusion#5
Merged
Merged
Conversation
…odel The integration proposals (Topology A/B SOCKS5 handoff, TCP sequence-number injection, SNI spoofing, eBPF/XDP packet rewriting, 'Rust as egress engine') all assume the Rust core forwards bytes to the internet. Verified against the source, it does not: - PolicyAwareTlsBackend has no socket dialing; it only models ALPN lock/bypass. - main.rs handle_client reads+parses a ClientHello and runs JA3 self-audit; it never forwards upstream or hands off to Xray. - the only TcpStream::connect in src/ is a unit-test client. - xdp/tun/overlay/scheduler modules are models and regression fixtures. This is exactly the confusion ADR-0001 anticipates but states too briefly, so: - ADR-0007: the Rust core is a validation/parsing/policy-modeling library plus a self-audit harness, explicitly NOT the data plane. Packet-injection / SNI-spoofing / raw-socket / eBPF-on-egress and 'Rust as egress' are out of scope (would require a new ADR revisiting ADR-0001 + threat-model + the consent-based privilege story from ADR-0002/0006). Notes that process_supervisor.py already gives atomic Rust+Xray lifecycle containment without changing the byte path. - architecture.md: add a 'Rust core: validation library, not a data plane' section making the Xray=data-plane / Rust=validate-around-it split visible. - ingress_xdp_gateway.rs: module doc comment clarifying it is a model/fixture, not a loaded eBPF program (the most misleading module name). - repository-structure.md: index ADR-0007. Docs + one harmless Rust doc-comment. Full offline suite: 34/34 pass.
Review Summary by QodoDocument Rust-core/Xray boundary (ADR-0007) to prevent data-plane confusion
WalkthroughsDescription• Establishes Rust core as validation library, not data plane • Clarifies boundary between Rust validation and Xray data plane • Prevents recurring confusion about packet forwarding scope • Adds module documentation to reduce misleading naming Diagramflowchart LR
A["Rust Core<br/>Validation Library"] -->|config + evidence| B["Xray<br/>Data Plane"]
C["Proposals:<br/>SOCKS5, Packet Injection,<br/>eBPF/XDP, SNI Spoofing"] -->|out of scope| A
D["process_supervisor.py<br/>Lifecycle Management"] -->|atomic containment| B
File Changes1. docs/adr/0007-rust-core-is-validation-not-data-plane.md
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This proposal set (Topology A/B Rust↔Xray SOCKS5 handoff,
dial_upstream_via_xray_socks, TCP sequence-number injection, SNI spoofing, eBPF/XDP packet rewriting, "Rust as egress engine",CoherentMachineConductor) all rests on one assumption: that the Rust core forwards bytes to the internet. I verified against the actual source that it does not. So the right move is not to wire in a data plane — it's to document the boundary so this recurring confusion stops generating large, off-strategy rewrites.What the source actually shows
PolicyAwareTlsBackend(tls_orchestrator_backend.rs) — only models ALPN lock/bypass; no socket dialing.main.rshandle_client— reads + parses a ClientHello and runs a JA3 self-audit; never forwards upstream or hands off to Xray.TcpStream::connectinsrc/is the client side of a unit test iningress_loopback.rs.ingress_xdp_gateway.rs,ingress_android_tun.rs,cooperative_overlay.rs,scheduler.rsare models/fixtures, not loaded kernel programs or a live egress scheduler.The proposal's own
ingress_loopback.rssnippet even gets the type wrong (destination: self.destination_hintas non-Option), while the real code usesOption<SocketAddr>— a tell that it's working from an approximate mental model, not the repo.What I changed (docs + one harmless doc-comment)
docs/adr/0007-rust-core-is-validation-not-data-plane.md(new) — establishes that the Rust core is a validation/parsing/policy-modeling library + self-audit harness, explicitly not the data plane. Packet-injection / SNI-spoofing / raw-socket / eBPF-on-egress / "Rust as egress" are out of scope and would require a new ADR revisiting ADR-0001 plus a real threat-model review plus the consent-based privilege story from ADR-0002/0006. Notes thatprocess_supervisor.pyalready gives atomic Rust+Xray lifecycle containment (Windows Job Object kill-on-close / POSIX group) without changing the byte path — so a "run both as one machine" conductor needs no data-plane change.docs/architecture.md— adds a "Rust core: validation library, not a data plane" section making theXray = data plane/Rust = validate around itsplit visible in the primary architecture doc (it previously documented only the Xray runtime graph and never said whatsrc/is).src/ingress_xdp_gateway.rs— module doc-comment clarifying it is a model/fixture, not a loaded eBPF program (most misleading module name).docs/repository-structure.md— indexes ADR-0007.Idea-by-idea disposition
ProjectState/CheckResult/RepairAction, listener-exposure warning, one next actionmain) — seescripts/core/readiness.pyverified-session)process_supervisor.py, atomic kill-on-close)Why docs, not code
The Rust core deliberately has no data plane (ADR-0001). Adding one would be a second competing runtime, raising exactly the complexity the feedback says to reduce, and would pull in raw-socket privileges that ADR-0002/0006 keep consent-based. The highest-leverage fix is to make the boundary explicit so future proposals are evaluated against it.
Testing
Rust unchanged except a doc-comment (cargo absent in CI sandbox → Rust step skips as designed; comment is syntactically inert).