mirror of
https://github.com/OffworldNexus/tunnel-weaver.git
synced 2026-11-08 21:06:00 +01:00
Small bird. Strong connections. HTTP tunneling and reverse proxying in Rust, with automated TLS and end-to-end authentication.
- Rust 72.7%
- Svelte 13.1%
- JavaScript 7.7%
- TypeScript 4.2%
- Gherkin 0.9%
- Other 1.3%
Two CI flakes (the usage covered_minutes assertion and a store
SQLITE_BUSY race) and the slow tunnel_e2e file all came from waits on
wall-clock time or on races. Every wait now hangs on a real event or
signal, and no retry loops or sleeps paper over it.
SQLITE_BUSY race (a real live-relay bug):
- A deferred `BEGIN` write transaction reads first. If another writer
commits before its first write, SQLite fails it at once with
SQLITE_BUSY_SNAPSHOT and busy_timeout does not apply.
- New `Store::begin_write()` opens `BEGIN IMMEDIATE` through SeaORM
`begin_with_options`. All 18 relay write transactions use it
(store/*, metrics.rs fold_day), and the raw sqlx slot write uses
`begin_with("BEGIN IMMEDIATE")`. Once the transaction is IMMEDIATE,
the only BUSY left is busy_timeout expiring, which is real overload.
A retry with the same deadline would change nothing, so there is no
retry loop.
- The weave client store gets the same fix (record_pairing,
set_default, forget), because `weave start` runs alongside other
weave processes.
- New per-crate clippy.toml in weaver-server and weave bans
`sea_orm::TransactionTrait::begin` and `sqlx::Connection::begin`, so a
deferred writer cannot come back.
- The race test went from 91/160 failures to 0/400.
Usage covered_minutes flake:
- MeteringManager gains a test-util `with_pinned_clock`. The
control_socket usage test pins the clock, advances it 1050 ms by hand
(no sleep, no ticker) and asserts covered_minutes == 1 and
open_ms == 1050 exactly.
tunnel_e2e:
- The test relay seeds its self-signed wildcard into the store and calls
cert_manager.init(), so registrations no longer place real ACME
orders with Let's Encrypt staging. That network call made
test_control_stream_is_the_registration_lease fail every time and kept
the file at ~20s. It now takes ~1s.
- All sleep-polling is replaced by signals:
TestRelay::until_routed/until_unrouted subscribe to the registry's
LiveHub change bus and then check, so they cannot miss a change.
TestOrigin::stop() awaits the accept loop. The cookie test reads the
origin record after the response, since the record is written before
the reply. The stalled-ACME test waits for the fake directory's first
accept. The metering test pins the relay clock and waits on the new
test-util `MeteringManager::observations()` watch channel, with exact
assertions requests == 1 and open_ms == 1000.
- 30 s HANG_GUARD timeouts only turn a hang into a named failure.
AGENTS.md: refresh the Testing contract (full suite ~25s warm, e2e
~120s) and add a last-measured entry.
Verified: fmt/clippy/deny/fuzz clean; full suite 624 passed/0 failed
five runs in a row; ignored 3 passed; e2e 34 scenarios/488 steps
passed; tunnel_e2e 80/80 parallel runs green.
|
||
|---|---|---|
| .github | ||
| ci | ||
| crates | ||
| docs | ||
| e2e | ||
| frontend | ||
| fuzz | ||
| vision | ||
| .gitignore | ||
| AGENTS.md | ||
| Cargo.lock | ||
| Cargo.toml | ||
| CONTRIBUTING.md | ||
| deny.toml | ||
| LICENSE | ||
| README.md | ||
| rust-toolchain.toml | ||
| rustfmt.toml | ||
Build & test · Architecture · Contribute · Apache 2.0
Tunnel Weaver is an open-core tunneling and reverse proxying system designed for exposing local services to public domains with automated TLS, end-to-end authentication, and multiplexed streams.
| Public endpoints | Authenticated connections | Multiplexed streams |
|---|---|---|
| Expose local services through public domains with automated TLS. | End-to-end authentication between the client and relay. | A Rust workspace with a sans-IO multiplexer at its core. |
Workspace Overview
The project is structured as a Cargo workspace:
crates/weaver-mux: Sans-IO stream multiplexer framing layer (Frame::parse).crates/weaver-proto: Shared protocol constants (PROTOCOL_VERSION) and core definitions.crates/weaver-server: Relay server binary (Linux-only).crates/weaver-assets: Shared embedded branded HTML error pages and security headers.crates/weave: Tunnel Weaver client CLI binary (Linux, macOS, Windows).fuzz/: LibFuzzer targets executed continuously in CI.
Prerequisites
- Rust: 1.98+ (Rust edition 2024).
Building & Testing
Workspace Build
cargo build --workspace
Running Tests
Run the workspace test suite:
# On Linux:
cargo test --workspace
# On macOS and Windows (excluding Linux-only server):
cargo test --workspace --exclude weaver-server
# Run ignored end-to-end tests:
cargo test --workspace -- --ignored
Linting & Formatting
cargo fmt --check
cargo clippy --workspace --all-targets -- -D warnings
cargo deny check
Contributing
See CONTRIBUTING.md for contribution guidelines, engineering rules, and architectural decision records (ADRs in docs/decisions/). docs/architecture.md maps the crate layers and every call that crosses them.
License
Licensed under the Apache License, Version 2.0. See LICENSE for details.