42 Commits
Author SHA1 Message Date
cfal 0f1aec2939 Refresh dependencies and CI tooling (#277)
* Refresh dependencies and CI tooling while preserving fork pins

* Make privileged test fixtures compatible with Ubuntu 26
2026-11-06 14:59:25 +08:00
cfal dd2f370a9f Expand whole-path routing regression coverage (#266)
Expand regression coverage for whole-path routing across forwarding, DNS, rule downloads, probes, and session reuse to guard against route changes affecting established flows or shared state. Add native Caddy and WireGuard cases plus dual-stack kernel-TUN coverage, strengthen routing boundaries and controller assertions, enable routing and consumer suites on macOS, and make test fixtures portable across platforms.
2026-11-02 03:09:03 +08:00
cfal 54e5002666 Strengthen protocol and lifecycle regression coverage (#267)
Close regression gaps in message framing, AnyTLS recovery and UoT interoperability, routing limits, and reload retention. Harden test helpers to reject empty child runs, verify HTTP response integrity, and terminate curl on failure or cancellation; tighten CI test selection and simplify the supporting fixtures.
2026-11-02 01:22:11 +08:00
cfal ab770fe05c Support whole-path client groups with resolved routing plans (#256)
Allow client groups to select complete paths of different lengths consistently across forwarding, DNS, downloads, and carrier routes. Separate source configuration from bounded runtime plans, preserve selection boundaries and per-flow path pinning, and keep TCP/UDP rotation and automatic selection independent. Unify chain syntax while retaining legacy proxy-list alternatives, and cache up to 16 NaiveProxy sessions by selected prefix, pruning closed entries before LRU eviction without interrupting active tunnels. Add routing measurements, lifecycle coverage, and updated English and Chinese configuration guidance.
2026-11-01 18:49:23 +08:00
cfal 53282c5019 Add configuration documentation site (#260)
* Validate published configuration examples

* Move configuration reference into Starlight site

* Check documentation site in CI

* Complete optional docs dependency lock entries
2026-11-01 03:15:45 +08:00
cfal 8ab0f49ec4 Fix nested XHTTP SNI and Vision TLS framing (#254)
* fix(xhttp): suppress inherited SNI inside the carrier

Retain the hop identity for certificate verification while restoring the absent default wire SNI for inner protocols. Extend the TLS identity matrix through the XHTTP builder to cover omitted, null, and explicit SNI.

* fix(vision): keep the initial prefix in one TLS record

Floor configured Vision client TLS buffers at 21 bytes so peers receive the UUID and first frame header together. Preserve ordinary TLS limits and cover tiny buffers with record-level assertions, UDP exchanges, and sing-box/Xray peer tests.

* fix(tls): drain deferred KeyUpdate replies before Vision writes

Materialize pending KeyUpdate replies before draining TLS output so they cannot fragment the initial Vision prefix. Preserve queued application data and fatal alerts after session failure, with framing and backpressure regressions.

* refactor(tls): clarify identity and Vision regression tests

Replace positional identity-path flags with a test-local enum, use the existing message shutdown helper, and document the XHTTP inner SNI boundary. Preserve test coverage and production behavior.

* ci: pin Xray test peers to 26.10.31

Replace the unavailable release download with the latest release and its verified checksum. Align source-built peers and fixture version checks with the same release.
2026-11-01 00:32:17 +08:00
cfal 652320af58 Reuse AnyTLS client sessions across requests (#253)
Reuse idle AnyTLS carriers across TCP and UDP-over-TCP requests to avoid repeated connections and transport handshakes. Sessions remain exclusive to each active request and isolated by proxy route, with configurable idle retention, warm-open watchdogs, shared negotiated padding, and safe response draining after peer FIN. Add configuration documentation, regression coverage, and CI interoperability checks against a pinned reference peer.
2026-10-31 21:02:21 +08:00
cfal 681db3f4ee Fix protocol framing, authentication, and UDP routing (#251)
Fix protocol edge cases that could corrupt framing, misroute UDP traffic, or leave clients waiting. Bound frame sizes and padding, preserve TUIC traffic until authentication, route each UDP destination independently, and correct Vision/XUDP handling. Keep TLS verification identity separate from wire SNI, preserve local endpoint addresses, validate WebSocket upgrades including early-data handshakes, and flush terminal proxy failures.
2026-10-31 19:48:56 +08:00
cfal 753d14a436 Add config-driven remote rule sources (#231)
Add reusable rule-source groups and config-driven remote downloads with explicit proxy and DNS routing, in-memory retention, and optional private atomic disk caching. Preserve active traffic across download and reload failures while keeping configuration checks offline. Consolidate process-wide limits and rule_cache_dir under global_settings, retain global_limits as a warning-emitting alias, and remove ordered fallback groups and health_check configuration.
2026-10-31 19:46:04 +08:00
cfal 6888329d14 Add WebSocket early-data support (#250)
Support WebSocket early data for compatibility with sing-box, Xray, and Mihomo. Add opt-in client sending through path or header carriers, automatic server reception of up to 2048 bytes from Sec-WebSocket-Protocol, strict handshake validation, and fixes for buffered data and stream metadata, with configuration documentation and interoperability coverage.
2026-10-31 18:39:17 +08:00
cfal e0282cf72c Add native Hysteria2 and TUIC clients (#249)
Adds native Hysteria2 and TUIC v5 outbound clients so proxy routes can use either protocol directly for TCP and UDP. Includes pooled QUIC connections with bounded resource use, cancellation-safe TUIC commands, Hysteria2 Salamander obfuscation and port hopping, hardened HTTP/3 authentication, TLS verification, configuration examples, and interoperability coverage in CI.
2026-10-31 16:56:16 +08:00
cfal 1fac4c231c Add Xray-compatible Sudoku TCP masking (#246)
Adds an outermost sudoku_mask wrapper so TCP clients and servers can interoperate with Xray FinalMask, including configurable layouts and padding, stacked masks, and XHTTP carriers. Preserves explicit flush ownership and prevents Vision or raw TCP splice from bypassing the mask, with configuration validation and documentation for supported placements and limits. Native UDP/QUIC masking is not included.
2026-10-30 22:58:56 +08:00
cfal 7460f5d046 Add managed Linux desktop TUN capture (#241)
Add managed Linux TUN and REDIRECT capture with independent DNS interception, protected bootstrap and outbound sockets, best-effort systemd-resolved integration, and retained-ingress reload and recovery. Include configuration documentation, service integration, and kernel coverage.
2026-10-30 15:07:46 +08:00
cfal c3453ef1ab Add ARMv7 release builds and verified artifact packaging (#239)
Add Linux ARMv7 hard-float GNU and static musl binaries so 32-bit ARMv7 systems can use prebuilt Shoes releases. Retain the six existing targets, pin build tooling and cross images, and validate each packaged binary with native or QEMU checks before uploading it. Harden future releases with version and tag validation, SHA-256 checksums, and GitHub build-provenance attestations, and document platform requirements and artifact verification.
2026-10-28 12:29:58 +08:00
cfal 33bbea93e4 Refresh dependencies and build tooling (#235)
Refresh eligible Rust dependencies and build tooling, including notify 8.2.1, Web PKI roots 1.0.11 and the ctutils constant-time fix. Handle macOS watcher restart failures, update Unicode-domain data, and require Rust 1.99.1 while preserving maintained fork pins and protocol baselines. Retain parking_lot 0.12 and the upstream nix pin for Android/iOS compatibility.
2026-10-27 10:43:07 +08:00
cfal 8f52f98103 Support SS2022 client identity key chains (#233)
Support server-key:user-key and longer identity chains for Shadowsocks 2022 AES clients, allowing connections to multi-user servers and identity relays. Add the required identity headers, configuration validation, and usage documentation while preserving existing single-key and legacy configurations. This is client-only support; native SS2022 UDP and server-side multi-user support remain out of scope.
2026-10-26 18:39:44 +08:00
cfal 38523d65ed Add performance reports, Linux coverage, and rule property tests (#228)
Add advisory selector/reload performance reports, optional Linux unit/process coverage with changed-line summaries, and bounded rule-parser property tests to make regressions and verification gaps easier to spot. Reports reject invalid measurements and account for timing noise without introducing hard performance gates; existing tests and production behavior remain unchanged.
2026-10-26 16:50:44 +08:00
cfal 1e02a9887b Add retention and reload lifetime regressions (#218)
Catch resource retention across failed setup, cancellation, reloads, and owner destruction with allocation, task, descriptor, and permit regressions, alongside deterministic matcher invariants. Strengthen reload measurements with committed-upstream verification, exact-byte live-session checks, bounded cleanup, and byte-exact provenance, and add the coverage to CI.
2026-10-24 22:53:56 -04:00
cfal a361e69b77 Publish multiarchitecture Shoes images to GHCR (#215)
Add a non-root Docker image for the Shoes binary and publish native amd64 and arm64 images to GHCR on master pushes and published releases. Reuse commit images by digest, gate branch and release tags on container smoke checks, and guard against stale promotions. Include the full license bundle and document configuration, writable state, and image tags.
2026-10-23 22:30:44 -04:00
cfal a72cc7f0bb Expand test coverage and fix the protocol bugs it exposed (#212)
Broadens unit and integration coverage of WebSocket framing, ShadowTLS and REALITY ClientHello parsing, VLESS fallback, Hysteria2 and TUIC authentication, DNS, and connection budgets across reloads, and fixes the defects it exposed: WebSocket streams now accept control frames up to RFC 6455's 125-byte limit, no longer report EOF into partly filled read buffers, and flush buffered frames before shutting down; the shared ClientHello parser reassembles hellos split across TLS records, as Go TLS stacks do; and message-stream shutdown after EOF is bounded like the stream relay's. It also builds the binary on the library crate instead of compiling every module twice, removes the unused UdpMessageStream, moves ShadowTLS interop tests to local handshake servers, makes filtered CI test steps fail when they select no tests, consolidates the WebSocket payload-reading code, and documents how to measure coverage along with the remaining gaps, including why WebSocket Close frames stay unanswered.
2026-10-23 06:18:10 -04:00
cfal abf24533a9 remove unused mobile SDK wrappers (#207)
* build: remove distributable mobile SDK wrappers

Remove the Android Kotlin/Gradle wrapper, AAR and XCFramework packaging, and mobile SDK release publishing.

Preserve Rust JNI/C embedding and native cross-compilation CI, with checks for library outputs and the generated C header. Document app-owned integration and retain desktop release-notice verification.

* ci: verify mobile header after locked native builds

cbindgen resolves Cargo metadata without --locked and can update Cargo.lock. Run it after the native builds so it cannot hide a stale lockfile from their checks.

* docs: remove obsolete mobile wrapper examples

Remove examples referencing nonexistent JNI wrapper methods and clarify the app-owned callback contract. Keep native mobile support unchanged.

* docs: clarify native mobile CI coverage
2026-10-22 03:08:57 -04:00
cfal b586e8c654 Fix stream byte loss and expand lifecycle coverage (#206)
Preserve payload bytes across fragmented VLESS response headers, nonempty WebSocket Ping frames, and ShadowTLS authentication fallback. Expand authentication, buffering, half-close, flow-control, and TUN reload coverage; harden isolated test selection, enable macOS process-watcher tests, and document suite boundaries and remaining gaps.
2026-10-22 02:20:03 -04:00
cfal de1e827922 Update dependencies and refresh BLAKE3 fork (#204)
Update Rust dependencies for current fixes, including ML-KEM's removal of secret-dependent table lookups, and refresh the BLAKE3 fork while retaining binary-context key derivation. Allow wildcard GotaTun updates with source-notice validation, replace unmaintained test-only PEM parsing, and update Android and CI tooling with current AGP source-set APIs. Preserve Web PKI protections and required fork patches; defer YAML parser migration.
2026-10-21 22:00:13 -04:00
cfal b5371552ae Fix TUN lifecycle and Naive HTTP/2 stalls (#203)
Prevent TUN startup resets and orphaned connections by deferring inbound TCP publication until handshakes complete, bounding half-open admission, and propagating worker failures while preserving Linux link-down and Apple queue-backpressure recovery. Fix Naive HTTP/2 writes that stall despite available credit and improve transfer diagnostics. Preserve full-payload and clean-EOF Mihomo REALITY coverage with reply-first sequencing, retaining early half-close as an opt-in peer regression. Upgrade Xray test peers to the 26.10.21 security release after upstream withdrew the previous releases.
2026-10-21 16:58:17 -04:00
cfal 5fc319a13d Add indexed routing predicates and local rule sources (#201)
Compile routing rules into shared indexes while preserving ordered policy evaluation and DNS decisions. Add typed predicates and bounded local SRS, sing-box JSON, Mihomo YAML/text/MRS, and GeoSite/GeoIP DAT sources through named rule groups or inline masks, with format detection, source caching, pre-activation compilation, and source-aware reloads. Include configuration examples, regression coverage, benchmark tooling, and dependency notices.
2026-10-20 22:11:01 -04:00
cfal 50b9ad163f Strengthen WireGuard integration and lifecycle coverage (#190)
Expand WireGuard coverage for TCP and UDP forwarding, peer isolation, transport outages, rekeying, reloads, DNS routing, native TUN, and FFI lifecycle behavior to catch failures that affect real deployments. Add macOS lifecycle coverage and portable fixtures, and fix IPv6 DNS upstream literals being misclassified as hostnames.
2026-10-17 21:55:52 -04:00
cfal a3f26e260c Expand VLESS interoperability coverage and fix XHTTP shutdown (#189)
Expand legacy and encrypted VLESS coverage across peer transports, Vision transitions, session lifecycle, replay isolation, and chained connections, with Xray updated to 26.10.17. Preserve complete XHTTP HTTP/2 responses when peers gracefully stop an unfinished upload while continuing to reject truncated responses and incomplete packet uploads. Isolate the pinned sing-box server TLS 1.2 shutdown limitation in a test-only workaround, retaining an ignored reproducer and a reference to SagerNet/sing-vmess#16 for removal when the peer pin includes the fix.
2026-10-17 20:35:38 -04:00
cfal 2be0409531 Add userspace WireGuard endpoints (#186)
Add named userspace WireGuard endpoints so Shoes can route inbound and outbound traffic through WireGuard without a kernel interface. Includes TCP/UDP forwarding, proxy-chain transports, reload lifecycle management, configuration validation, documentation, and dependency notices for release artifacts.
2026-10-17 15:23:44 -04:00
cfal db35d96276 Add native VLESS Encryption and resumption (#185)
Add opt-in native VLESS Encryption with X25519 and ML-KEM key chains, authenticated record encryption, bounded session resumption, and native Vision support while preserving legacy TLS/REALITY behavior and outer transports. Include validated configuration, credential generation, examples, interoperability fixtures, and regression coverage.
2026-10-17 12:24:08 -04:00
cfal 001495285a Add HTTP/2 CONNECT proxy support (#184)
Add standard HTTP/2 CONNECT to HTTP and mixed listeners and opt-in HTTP proxy clients, allowing concurrent TCP tunnels to share a connection while preserving legacy HTTP/1 and NaiveProxy behavior. Keep the H2 transport independent of NaiveProxy, preserve route isolation and per-stream authentication, require matching TLS ALPN for explicit H2 clients, and handle flow control, cancellation, and graceful shutdown. Include configuration documentation, an example, compatibility regressions, and interoperability coverage for sing-box, Mihomo, and the native Caddy-based Naive server.
2026-10-16 17:54:08 -04:00
cfal 0cc416f8c5 Improve XHTTP backpressure and interoperability (#180)
Improve XHTTP transfer reliability under slow destinations and resource pressure with bounded packet pipelining, admission before body reads, queue-acceptance acknowledgements, and cancellation-safe session handling. Preserve reusable H1 uploads, correct H2/H3 finalization, add configurable receive windows and download-tail timeouts, validate effective request capacity, and expand Xray/Mihomo interoperability coverage with pinned peers in CI.
2026-10-16 07:49:20 -04:00
cfal 5b8da8fd61 Add XHTTP/SplitHTTP transport support (#179)
Adds Xray-compatible XHTTP/SplitHTTP with packet-up, stream-up, and stream-one modes over HTTP/1.1, HTTP/2, and HTTP/3, including REALITY and existing proxy chains. Bounded buffering, flow-control-aware admission, connection pooling, and inactivity-based timeouts maintain backpressure without imposing a minimum upload rate. Preserves TLS key-exchange and ML-DSA policies, adds configuration examples and interoperability coverage, and vendors an h3 fix to prevent empty DATA frames from truncating streams.
2026-10-15 13:39:44 -04:00
cfal a5f7d1eb1a Add post-quantum REALITY support (#178)
Prefer X25519MLKEM768 with X25519 fallback for modern REALITY compatibility, and add optional pinned ML-DSA-65 authentication with configuration fields and key generation. Harden handshake validation and preserve transparent forwarding for incompatible targets or clients, with migration documentation and pinned Xray interoperability coverage.
2026-10-15 09:55:11 -04:00
cfal eb47459fc1 Support native hybrid TLS key-exchange allowlists (#177)
Add ordered native rustls key-exchange allowlists for TLS and QUIC. Hybrid-only configurations require TLS 1.3 without classical fallback or early data; omitted settings preserve existing defaults. Reject incompatible or ignored security settings, document configuration, and cover transport and Xray/sing-box interoperability.
2026-10-10 20:33:30 +08:00
cfal 657501211c Cover REALITY h2mux idle reuse and GOAWAY recovery (#176)
Add sing-box coverage for padded, single-carrier h2mux over REALITY, including concurrent TCP/UDP traffic and idle reuse. Verify GOAWAY carrier replacement, Shoes stream draining, and the forced-close deadline, and run peer lifecycle coverage in CI. Distinguish successful recovery from active-stream preservation, which sing-box does not provide on GOAWAY.
2026-10-10 19:37:11 +08:00
cfal ba45f3a81c Close protocol and lifecycle coverage gaps (#172)
Add coverage for buffered parsing, UDP fragment budgets, proxy handshakes, DNS fallback, and connection-capacity reuse. Fix dropped empty UDP replies and malformed HTTP CONNECT success-status acceptance, stabilize readiness timeout tests, run process contracts in regular CI, and add a manual kernel TUN workflow.
2026-10-09 23:29:28 +08:00
cfal 1b936045c6 Expand TUN test coverage (#167)
Close gaps around TUN wakeups, UDP routing, and concurrent traffic with deterministic wake/setup tests, rootless IPv4/IPv6 raw-FD coverage, and opt-in kernel tests for real IPv6 and mixed TCP/UDP progress. Add Linux host-FFI and macOS rootless CI coverage while keeping privileged device tests out of ordinary CI. Wait for Mihomo routing readiness to prevent startup packet loss in AnyTLS tests.
2026-10-06 20:00:11 +08:00
cfal 60ed3838b3 tests: publish integration test suites (#157)
* tests: add integration tests

* build: register integration test suites

* ci: validate all test suites
2026-09-18 23:01:22 +07:00
Andrey YastrebovandClaude Opus 4.6 60490161f4 Migrate Android library to AGP 9.0 with version catalog (#136)
- Upgrade AGP from 8.3.2 to 9.0.1
- Remove kotlin-android plugin (AGP 9.0 has built-in Kotlin support)
- Remove kotlinOptions block (jvmTarget inherited from compileOptions)
- Add gradle/libs.versions.toml version catalog to avoid hardcoded
  plugin versions in build.gradle.kts
- Bump compileSdk from 34 to 35 (required by AGP 9.0)
- Bump CI Gradle from 8.6 to 9.5.0 (AGP 9.0 requires Gradle 9.1+)
- Remove obsolete gradle.properties (enableJetifier, kotlin.code.style)

Verified: assembleRelease builds successfully with Gradle 9.4 + AGP 9.0.1.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-08-09 23:42:05 +07:00
Andrey YastrebovandClaude Sonnet 4.6 80f910874b Add mobile build artifacts for iOS and Android (#127)
* Add mobile build artifacts for iOS and Android

- Add GitHub Actions workflow to build XCFramework (iOS) and AAR (Android)
  and publish them to GitHub releases on tag pushes
- Add scripts/build-ios.sh and scripts/build-android.sh for local builds
- Add android/ project (Gradle library module with Kotlin JNI wrapper)
- Add include/shoes.h C header for FFI consumers
- Gitignore /output build directory

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>

* Fix Android JNI build: pin jni to 0.21, use --locked

The committed Cargo.toml had `jni = "*"` which resolved to jni 0.22.4 in
CI. jni 0.22 renamed JNIEnv to EnvUnowned, breaking the Android FFI code
written for the 0.21 API.

- Pin jni to "=0.21" (resolves to 0.21.1 via Cargo.lock)
- Add --locked to cargo ndk to enforce the lock file in CI

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>

* Migrate Android JNI bindings to jni 0.22

jni 0.22 split JNIEnv into two types:
- EnvUnowned<'local> — FFI-safe type for native method signatures
- Env<'local> — high-level wrapper with get_string, new_string, etc.

Changes:
- Replace JNIEnv with EnvUnowned in all function signatures
- Use EnvUnowned::with_env() to access the Env inside each function
- Use Outcome enum (Ok/Err/Panic) from into_outcome() for error handling
- Replace new_global_ref return type: GlobalRef -> Global<JObject<'static>>
- Replace attach_current_thread() guard pattern with callback closure
- Replace &str method names/sigs with jni_str!/jni_sig! compile-time macros

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>

* Auto-generate iOS C header with cbindgen

Replace hand-written include/shoes.h with cbindgen-generated output.
The header is now derived from doc comments on extern "C" functions
in src/ffi/ios.rs, keeping it in sync with the Rust source.

- Add cbindgen.toml (exports only ProtectSocketCallback + FFI functions)
- build-ios.sh runs cbindgen before building the XCFramework
- CI installs cbindgen in the iOS job

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Fix clippy and rustfmt CI failures

- Reorder jni imports in ffi/android.rs to match rustfmt order
- Remove unnecessary `as usize` cast in shadow_tls_server_handler.rs
- Collapse match guard in config/validate.rs (clippy::collapsible_match)

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
2026-04-27 01:46:58 +08:00
cfal c624c6389e config: better errors, add tests (#65)
* add custom Serialize and Deserialize traits and remove serde untagged structs

* examples/shadowtls_v3_remote_handshake.yaml: fix example

* .github/workflows: add test workflows

* tcp/tcp_handler_util.rs: cargo fmt

* clippy fixes

* cargo fmt
2025-06-22 22:56:39 +04:00
cfal 36f94c1dba .github/workflows/build.yml: add build workflow (#62) 2025-06-21 19:33:23 +04:00