23 Commits
Author SHA1 Message Date
cfal a150125c6b Add conditions syntax for routing rules (#278)
* feat(config): add conditions while preserving mask rules

Accept conditions alongside the existing masks and mask spellings, rejecting conflicting matching fields and flat-source combinations. Normalize all forms into the existing predicate engine.

Add explicit masks leaves for composed expressions and source groups. Keep simple address exports compact and serialize richer rules under conditions.

Cover round-trips, nested source discovery, controller payloads, warning-free compatibility, and routing across accepted and rejected reloads.

* docs(routing): explain conditions and compatible mask syntax

Document expression composition, conflicting fields, source shorthand, and canonical serialization in English and Chinese. Record the controller diagnostic shape in the changelog.

Add a complete conditions example, validate it through the native configuration pipeline, and show conditions in the rule-source example.

* fix(config): clarify invalid rule conditions diagnostics

Name the mutually exclusive matching fields explicitly, including legacy aliases, instead of reporting an unwritten duplicate conditions key.

Explain that nested masks leaves accept only strings or nonempty string lists, with regression tests for JSON/YAML conflicts and invalid leaf shapes.

* refactor(tests): simplify rule conditions coverage

Stage all spelling and format variants before checking their shared canonical form. Restore that form once while preserving per-variant compilation and the complete decision matrix.

Remove conflict inputs already covered by stronger diagnostic assertions, clarify controller payload names, and validate all five rule forms in one fixture per CLI mode.

* fix(rules): correct source-group predicate guidance

Recommend the rule_source_group predicate without a masks wrapper so the rename hint works in nested expressions and source groups. Cover the suggested syntax and diagnostic in regression tests.

Update both documentation locales to describe source-group references under conditions or masks, including boolean composition.
2026-11-06 15:51:49 +08:00
cfal 70a192ab72 Fix duplicated group ancestry in Clash connection chains (#274)
Report shared selector and group ancestry once per selected occurrence while preserving reverse hop order, independently repeated references, routing behavior, and catalog identities. Cover nested selections and pinned TCP/UDP flows, simplify reporting metadata assembly, and clarify chain ordering, client naming, and DIRECT-to-proxy semantics in both controller guides.
2026-11-05 16:24:03 +08:00
cfal 0b51ab370f Allow accessible rule cache directories and create missing parents (#272)
Allow rule caches in directories accessible through group permissions or ACLs without requiring directory ownership, and create missing cache directories and parents automatically. Existing ownership and permissions remain unchanged, while world-writable directories, unsafe cache files, and conflicting cache leases remain rejected. Clarify the startup and cache-save permission requirements.
2026-11-04 18:57:43 +08:00
cfal 79cfce6ac0 Add opt-in NTP application clock correction (#270)
Add optional NTP synchronization for hosts where shoes cannot set the system clock. Share the corrected time across REALITY, VMess, Shadowsocks 2022, and TLS certificate validation, using protected direct UDP with bounded synchronization, periodic refresh, and reload-safe ownership. Preserve timestamp windows and replay protection, retain the last correction on refresh failure, and document configuration and clock limitations.
2026-11-03 21:50:41 +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 e08dbad8c2 Fix stale macOS config reload notifications (#257)
Filter delayed macOS filesystem notifications when watched regular-file metadata is unchanged, avoiding unnecessary configuration reloads after startup. Preserve observations across watcher rebuilds and registration failures, keep recovery channels independent, and retain genuine edits and explicit reloads while leaving uncertain metadata and other platforms unfiltered.
2026-11-01 06:05:38 +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 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 2401917d0e Add ordered health-checked fallback groups (#232)
Add opt-in fallback groups that route new flows through the first healthy eligible path and fail closed when no path remains, without overriding manual selections or replaying traffic. Reuse the shared probe engine with bounded generation-owned scheduling, resolver-aware path identity and reload cleanup, and reject transport combinations that cannot reliably attribute health to a concrete path.
2026-10-26 19:26:28 +08:00
cfal 51fbd24ceb Improve strict configuration diagnostics (#225)
Make configuration failures easier to locate without weakening validation: add configuration-entry and rule context, preserve native YAML error locations, and identify input files in validation errors. Reject previously ignored unknown fields in named PEM entries and TCP settings, clarify diagnostic limits and upgrade requirements, and add coverage for strict parsing, representative configurations, and offline validation behavior.
2026-10-26 14:56:33 +07:00
cfal 4ab9e8714c Add bounded background file logging (#224)
Move file I/O onto dedicated per-sink workers so slow storage does not stall relay threads. Bound pending records and escaped bytes, drop newest records on overload with health counters, and preserve FIFO ordering and flush barriers. Integrate bounded shutdown and reusable file-sink ownership with CLI and mobile FFI while preserving sanitization and existing log formatting.
2026-10-25 23:26:11 -04:00
cfal c112f00ea9 Fix fixture startup flakes and DNS connection-close failover (#222)
Retain fixture ports until listener handoff, await Shoes readiness before starting dependent peers, and settle native watcher setup notifications before activation assertions. Pin Hickory 0.26.3 to a connection-close recovery backport that preserves typed H3 errors and healthy-upstream failover without widening retry limits.
2026-10-25 11:13:14 -04:00
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 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 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 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 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 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