Commit Graph
436 Commits
Author SHA1 Message Date
cfal 5fdbe696c5 Make reload rollback safe and release TCP setup state (#219)
* Release setup-only routing owners before TCP relay

* Restore failed reloads and retain unchanged TCP listener sockets

* Simplify reload activation and listener lifecycle code

* Reject duplicate fixed TCP addresses during direct startup

* Preserve inherited TUN descriptors across rejected reloads

* Defer overlapping TCP listeners until retirement

* Document reload rollback and listener retention

* Exercise retained TCP sockets in lifecycle retention regression
2026-10-25 07:50:31 -04:00
cfal b0b30617a2 Add automatic URL-test upstream groups (#221)
Add URL-scoped health and delay-based upstream selection so new connections can use healthy, transport-compatible proxies without requiring a controller listener. This introduces strict client_group.type configuration in place of strategy, bounded automatic probes with lazy activity tracking and reload fencing, controller reporting, and configuration documentation. It also preserves local failure attribution through outbound HTTP/2 adapters so local resource limits do not incorrectly penalize proxy health.
2026-10-24 23:52:28 -04: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 a40aae55cc Improve native DNS caching and coalesce concurrent lookups (#220)
Share native resolver cache entries across destination ports and coalesce concurrent misses with bounded, cancellation-safe ownership. Preserve ordered address candidates, caller ports, and error details while using a conservative 60-second result-age policy rather than a DNS record TTL. Cover cancellation, expiry, failure, and capacity limits with deterministic tests and document the default behavior and trade-offs.
2026-10-24 20:44:33 -04:00
cfal f6abcd8245 Add ACME certificates and live TLS/QUIC rotation (#217)
Add shared file and ACME certificate sources for automatic issuance, renewal, and live TLS/QUIC rotation without interrupting existing connections. Support HTTP-01 and TLS-ALPN-01, durable retry and account state, and CLI/FFI lifecycle handoffs. Extend live rotation to existing file-backed identities and document stricter certificate validation requirements.
2026-10-24 06:17:31 -04:00
cfal fb1fa5b8bb Upgrade Tokio to fix Interval timer race (#216) v0.3.4 2026-10-24 04:33:18 -04:00
cfal aa20a6cffd Finalize version 0.3.4 release notes 2026-10-24 07:05:35 +00: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 38db23f27d Log Clash controller startup and allow wildcard CORS (#214)
Make Clash controller endpoints visible at startup and allow dashboards from any origin when explicitly configured with `cors_origins: ["*"]`. Startup messages include TCP addresses or Unix socket paths, while wildcard CORS preserves authentication and preflight restrictions; controller configuration changes still require a restart.
2026-10-23 21:29:52 -04:00
cfal fbcc5f9d46 Add Clash API and runtime proxy selectors (#213)
Expose runtime proxy selection and connection visibility without restarting Shoes. This adds an opt-in authenticated Clash-compatible TCP/Unix API, persistent selector choices, traffic and connection statistics, delay probes, live logs, and per-flow cancellation, with reload-aware integration across proxy protocols, DNS, and TUN.
2026-10-23 17:50:36 -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 c24bdf8be5 Organize REALITY modules and tests (#211)
Clarifies the fork-backed REALITY code layout by naming modules after their responsibilities, colocating client and server handlers, and grouping shared fixtures and handshake tests under src/reality/tests. Keeps the reality_ filename prefixes and preserves protocol behavior while reusing existing helpers and simplifying imports.
2026-10-22 19:34:05 -04:00
cfal 4e0bd96a34 Replace the custom REALITY TLS stack with rustls (#209)
Replace the bespoke REALITY TLS engine with a pinned rustls fork while retaining Shoes authentication, ML-DSA policy, transparent fallback, and Vision support. Stage and validate target-mirrored handshake flights before sending synthetic bytes, consolidate TLS connection handling, and remove obsolete connection layers and helpers. Outbound handshakes use the native rustls fingerprint; unsupported target layouts fall back transparently, and unclean TLS closure reports UnexpectedEof.
2026-10-22 06:40:20 -04:00
cfal b10c100288 Simplify XHTTP rejections and allow matching_headers value lists (#208)
XHTTP required-header support still carried leftovers from its earlier connection-closing design. This removes `close_on_http1_error` entirely (configs that set it now fail to load), so header and path mismatches return the same plain 404 on every HTTP version, and makes every XHTTP error response a bare status with an empty body. `matching_headers` values can now be lists so secrets can rotate without downtime, and client `headers` now reject names that differ only in case and values with leading or trailing whitespace, neither of which could ever match. Redundant H2/H3 reset handling is removed while the ordering and H3 upload-reset handling that prevent session closures and held request slots are kept, documented and covered by a regression test; new interop tests cover Xray and Mihomo clients sending required headers, and the README explains that Xray clients using `extra` must put `headers` inside it.
2026-10-22 04:41:27 -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 0b7363bdde Prepare version 0.3.4 2026-10-21 04:03:06 +00:00
cfal 14b4df6cc4 Update Web PKI dependencies for eMudhra CA compromise (#202)
Update rustls-webpki to 0.103.16 and webpki-roots/webpki-root-certs to 1.0.10 for CVE-2026-111943. Remove emSign ECC Root CA - G3 from bundled roots and reject the eight compromised intermediate keys, including cross-signed chains. Refresh dependency notices and document the certificate-chain impact and rebuild requirement.
2026-10-20 23:30:28 -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 ccd251612e Make XHTTP resource caps opt-in (#200)
* Reserve VLESS fixture ports until peer startup

* Make XHTTP admission and byte caps opt-in

* Cover Xray recovery with explicit XHTTP request caps
2026-10-20 22:59:50 +08:00
cfal 5f5901f9ea Attribute AnyTLS code derived from anytls-rs (#199)
Portions of src/anytls/, including the padding scheme, frame definitions,
settings map and stream tests, are derived from anytls-rs
(https://github.com/jxo-me/anytls-rs). Reproduce its MIT license notice in
THIRD_PARTY_NOTICES.md, which ships with release tarballs, the Android AAR
and the iOS XCFramework, and reference it from the module documentation.
2026-10-20 22:59:34 +08:00
cfal 76df520c34 Add route-only HTTP Host sniffing (#198)
Extend opt-in TCP sniffing to use cleartext HTTP/1.0 and HTTP/1.1 Host headers alongside TLS SNI for hostname-based routing. Preserve original destinations, byte replay, sniff limits, Fake DNS precedence, and one route per connection. Add strict parsing, transport and lifecycle coverage, documentation, and an authenticated example with local-address safeguards.
2026-10-20 02:01:12 -04:00
cfal bd67e459b9 fix TCP loss recovery with smoltcp fork (#197)
* fix TCP loss recovery with pinned smoltcp fork

* docs: explain smoltcp fork retention and validation

* build: pin smoltcp fork main loss-recovery fixes
2026-10-19 19:34:12 -04:00
cfal f485914a93 Add opt-in Fake DNS and TLS SNI routing (#195)
Add opt-in Fake DNS and TLS SNI routing for clients that connect by IP. Restore synthetic destinations across TCP, UDP, and TUN while preserving reply identities; prefer sniffed SNI for hostname rules without rewriting connection targets. Add persistent fake-IP mappings, stable WireGuard server identities through optional names or public keys, upstream-address guards, deadline-aware DNS fallback, configuration documentation, and examples.
2026-10-19 10:54:40 -04:00
cfal 1c23dd0b03 Reserve VLESS fixture ports until peer startup (#196) 2026-10-19 00:28:43 -04:00
cfal e95e93ee42 Avoid false Mihomo loopback detection in XHTTP fixtures (#194) 2026-10-19 10:57:52 +08:00
cfal 58ce196429 fix(xhttp): keep multiplexed request rejections local (#193) 2026-10-19 08:52:19 +08:00
cfal d521e99ef4 Stage SOCKS5 negotiation and flush handshake replies (#192)
The SOCKS5 client sent its greeting, credentials, and CONNECT request in one burst before reading any reply. RFC 1928 sends the request only after method negotiation, and servers such as Cloudflare WARP's local proxy drop the early bytes, so connections through them timed out (fixes #159, supersedes #188). The client now waits for each reply in turn and rejects methods it did not offer. Clients that wait like this stalled against shoes servers that left handshake replies unflushed, most visibly with SOCKS inside ShadowTLS, so the SOCKS and mixed inbounds now flush their negotiation and error replies, the WebSocket inbound flushes its 101 before the inner handshake, the local ShadowTLS handshake flushes each server flight, and ShadowTLS sends each record as it is written. Tests cover each handshake step and authenticated and ShadowTLS-wrapped SOCKS chains; servers running SOCKS or mixed inbounds inside ShadowTLS should be upgraded before or together with clients.
2026-10-18 19:07:34 -04:00
cfal c17693c001 Unify WireGuard client and server configuration (#191)
Make WireGuard use the same inline client and server protocol syntax as other proxies, replacing named endpoints before release. Add automatic sharing of equivalent clients, encrypted peer chains, explicit server routing policy, and validation that rejects conflicting settings while keeping unused clients inactive. Update examples, configuration documentation, and lifecycle and interoperability coverage.
2026-10-18 15:00:43 -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 aae1945e5c Fix Vision DIRECT decisions under backpressure (#187)
Preserve recognized TLS framing when backpressure requires resubmitting an unaccepted write tail, preventing eligible Vision connections from incorrectly falling back to END. Restrict DIRECT to supported TLS 1.3 cipher suites and keep ServerHello parsing within its declared handshake and extension boundaries. Add regression coverage for TLS and REALITY, fragmented and coalesced records, malformed handshakes, and exact-byte preservation across DIRECT and END transitions.
2026-10-17 14:23:56 -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 ace8651c2c Add XHTTP required headers and optional error closure (#183)
Add server-side matching_headers to require exact header values and close connections that fail validation, plus an opt-in close_on_error setting to close the carrier instead of returning XHTTP errors or admission refusals. Return plain empty 400/404 responses by default to avoid exposing XHTTP-specific headers, and document shared-connection effects and transport exceptions.
2026-10-16 16:12:24 -04:00
cfal b7cd98ffac Fix bracketed IPv6 parsing and clarify Snell compatibility (#182)
parse bracketed IPv6 literals as IP addresses instead of hostnames so configured IPv6 destinations resolve correctly, while preserving numeric scope IDs for binds and rejecting malformed bracketed input. document the legacy Clash.Meta/Mihomo Snell version-to-cipher mapping, v0.3.3 salt requirements, and unsupported v2 connection reuse and half-close behavior, with address regressions and a single-request v2 compatibility test. thanks to @AYastrebov for identifying the IPv6 parsing gap in #155.
2026-10-16 15:31:38 -04:00
cfal 92976551ff Prepare version 0.3.3 v0.3.3 2026-10-16 13:53:22 +00:00
cfal 1237aee568 Use patched h3 fork and update Rust dependencies (#181)
* Use pinned h3 fork instead of vendored sources

* Update Rust dependencies

* Document h3 fork maintenance
2026-10-16 09:30:30 -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 7cfcad30bd Harden TLS, h2mux, authentication, and file logging (#175)
Disable unused TCP TLS early data while preserving resumption and QUIC behavior. Bound h2mux errors, reject invalid protocol placement and authentication secrets before startup or reload, validate Shadowsocks 2022 key lengths, replace configuration-triggered panics with credential-free errors, and escape untrusted controls in file logs.
2026-10-10 19:23:20 +08:00
cfal 4339f80fd6 Fix h2mux data loss under backpressure (#174)
Keep outbound padding buffers intact when inbound padding ends, and wait for application-data credit when an HTTP/2 write sends only the response status byte. Add regressions for both failure modes and sing-box interoperability coverage with h2mux, max_connections: 1, and padding enabled, including concurrent TCP/UDP traffic, bulk transfers, half-closes, and reuse of a single carrier.
2026-10-10 04:05:37 +08:00
cfal 1d1750cff1 Make REALITY separate-mode tests independent of public endpoints (#173)
Replace Debian-dependent REALITY separate-mode tests with an owned local TLS 1.3 template. Add structural handshake and fixture-cleanup coverage, and verify exact small and 200 KiB downloads and patterned uploads through sing-box in the local integration suite. Production REALITY behavior and the remaining external interoperability tests are unchanged.
2026-10-10 00:26:24 +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