379 Commits

Author SHA1 Message Date
世界 07dba74657 Add initial_path option to remote rule-sets 2026-07-25 22:58:38 +08:00
世界 58affa1c6d Add JSON schema support 2026-07-25 22:58:38 +08:00
世界 5d744adaa3 dns: Add namespace and parallel support for evaluate 2026-07-23 21:08:26 +08:00
世界 52e72736ad route: simplify rule_set matching semantics
Since b0c6762bc, every rule inside a referenced rule-set was evaluated
as if merged into the outer rule, which required tracking per-branch
group states and let outer rules and rule-set rules satisfy each
other's grouped conditions in both directions.

Restrict merging to the only designed case: a rule-set containing
exactly one non-inverted default rule is merged into the outer rule as
before. Any other rule-set now matches as an ordinary condition of the
outer rule: it matches when any of its rules matches on its own, and
its rules no longer exchange grouped match state with the outer rule
in either direction. Multiple referenced rule-sets keep OR semantics.

Flat address rule-sets such as generated geosite/geoip sets contain a
single default rule, so their behavior is unchanged. The group-state
set machinery is replaced by a single required/satisfied mask pair.

Also update the route and DNS rule docs.
2026-07-23 14:16:55 +08:00
世界 d2e030bdca Improve network reset 2026-07-19 17:50:02 +08:00
世界 3d2461f3ba refactor: Async DNS 2026-07-19 16:37:16 +08:00
世界 7163aa08e3 Refactor UDP DNS hijack 2026-07-19 13:05:18 +08:00
世界 412300ed56 Fix bind control for auto redirect 2026-07-17 23:46:07 +08:00
世界 704b57cf3e Refactor endpoint listen 2026-07-17 11:05:01 +08:00
世界 c8ee3497b2 refactor: New tun udpnat 2026-07-16 21:35:01 +08:00
世界 c215021eca Add multiple tags support to rule-sets 2026-07-16 18:58:58 +08:00
世界 2392b176e2 Fix start lifecycle 2026-07-16 00:38:31 +08:00
世界 e34b57c3b0 boxdd: Add insecure mode 2026-07-16 00:38:31 +08:00
世界 81bfee7ef7 platform: Add http proxy support for Windows 2026-07-13 19:12:05 +08:00
世界 b911fb0788 Fix process and neighbor rules not matched in pre-match 2026-07-09 11:20:34 +08:00
世界 9fc7621596 Improve bridge 2026-07-09 11:20:32 +08:00
世界 e2b25f17db Add bridge outbound 2026-07-09 11:20:32 +08:00
世界 c808a1618d Imrpove flow tracking & sniff action 2026-07-09 11:20:32 +08:00
世界 eaec0cf88b Add L3 forwarding support 2026-07-09 11:20:31 +08:00
世界 37cce6d01a Improve remote rule-set update 2026-07-09 11:20:05 +08:00
世界 92df8ec274 route: Refetch rule-set when cache restore fails 2026-07-09 11:19:46 +08:00
世界 3d5d0b0ca0 Fix lint errors 2026-07-09 11:19:45 +08:00
世界 b0c4f12f09 Fix reset network 2026-07-09 11:19:17 +08:00
macronut 1581a72924 Add more spoof method
Signed-off-by: macronut <4027187+macronut@users.noreply.github.com>
2026-07-09 11:19:16 +08:00
世界 84eb7a103f Allow customizing TUN DNS mode and hijack interface DNS by default 2026-07-09 11:19:16 +08:00
世界 7c722b3d50 dns: Add preferred_by rule item 2026-07-09 11:19:15 +08:00
世界 a81ca0f5c5 dns: Add neighbor-based hostname resolution to local server 2026-07-09 11:19:15 +08:00
世界 dbe307461c dns: Add timeout configuration 2026-07-09 11:19:14 +08:00
世界 cac32a5f1d Improve UDP batch support 2026-07-09 11:19:13 +08:00
世界 9b97a0de6f Reject pure-IP rule-set references without match_response
DNS rules referencing rule-sets that contain only ip_cidr predicates
silently stopped matching when legacy DNS mode was disabled, because the
IP-CIDR branch cannot match against an in-flight DNS query. The existing
validation intentionally let every rule_set through on the premise that
mixed sets still work via their non-IP branches, which is only true when
such a branch exists. Track whether a rule-set carries any non-IP-CIDR
predicate and reject pure-IP references the same way bare ip_cidr fields
are already rejected.
2026-07-09 11:19:08 +08:00
世界 894f6eae60 Fix legacy rule-set download_detour blocked by empty direct check 2026-07-09 11:19:08 +08:00
世界 c1da99eede Refactor: HTTP clients, unified HTTP2/QUIC options, Apple engines 2026-07-09 11:19:07 +08:00
世界 c8101bf1b7 Add optimistic DNS cache 2026-07-09 11:17:55 +08:00
世界 ef954777d0 Add package_name_regex route, DNS and headless rule item 2026-07-09 11:17:53 +08:00
世界 c61e5820a5 Un-deprecate ip_accept_any DNS rule item 2026-07-09 11:17:51 +08:00
nekohasekai daff1623b2 Add evaluate DNS rule action and related rule items 2026-07-09 11:17:47 +08:00
世界 8d7015ffe1 Add macOS support for MAC and hostname rule items 2026-07-09 11:16:44 +08:00
世界 07b1e5563e Add Android support for MAC and hostname rule items 2026-07-09 11:16:44 +08:00
世界 801505e628 Add MAC and hostname rule items 2026-07-09 11:16:41 +08:00
世界 4e1af0600b Fix UDP sniff fragment timeout treated as fatal error 2026-06-20 19:45:36 +08:00
世界 761b7f4e12 Handle TUN loopback in direct outbound 2026-06-03 12:56:36 +08:00
世界 5e7fd7ad78 Fix lint errors 2026-05-13 23:39:27 +08:00
世界 6475a5e036 Skip kickWriteHandshake for server first protocols 2026-05-13 16:28:49 +08:00
世界 f102ef1d94 Fix process search skipped for Android again 2026-04-23 05:52:22 +08:00
世界 71f6a2ab4e Fix process search skipped for TUN 2026-04-21 15:45:05 +08:00
世界 e4bc459975 Skip process search for non-local source addresses 2026-04-20 09:49:39 +08:00
世界 3124cdd661 Fix windows bssid matching 2026-04-20 09:49:39 +08:00
世界 6381de7bab route: Fix query_type never matching in rule_set headless rules 2026-03-26 13:26:18 +08:00
世界 b0c6762bc1 route: merge rule_set branches into outer rules
Treat rule_set items as merged branches instead of standalone boolean
sub-items.

Evaluate each branch inside a referenced rule-set as if it were merged
into the outer rule and keep OR semantics between branches. This lets
outer grouped fields satisfy matching groups inside a branch without
introducing a standalone outer fallback or cross-branch state union.

Keep inherited grouped state outside inverted default and logical
branches. Negated rule-set branches now evaluate !(...) against their
own conditions and only reapply the outer grouped match after negation
succeeds, so configs like outer-group && !inner-condition continue to
work.

Add regression tests for same-group merged matches, cross-group and
extra-AND failures, DNS merged-branch behaviour, and inverted merged
branches. Update the route and DNS rule docs to clarify that rule-set
branches merge into the outer rule while keeping OR semantics between
branches.
2026-03-25 14:00:29 +08:00
世界 d454aa0fdf route: formalize nested rule_set group-state semantics
Before 795d1c289, nested rule-set evaluation reused the parent rule
match cache. In practice, this meant these fields leaked across nested
evaluation:

- SourceAddressMatch
- SourcePortMatch
- DestinationAddressMatch
- DestinationPortMatch
- DidMatch

That leak had two opposite effects.

First, it made included rule-sets partially behave like the docs'
"merged" semantics. For example, if an outer route rule had:

  rule_set = ["geosite-additional-!cn"]
  ip_cidr  = 104.26.10.0/24

and the inline rule-set matched `domain_suffix = speedtest.net`, the
inner match could set `DestinationAddressMatch = true` and the outer
rule would then pass its destination-address group check. This is why
some `rule_set + ip_cidr` combinations used to work.

But the same leak also polluted sibling rules and sibling rule-sets.
A branch could partially match one group, then fail later, and still
leave that group cache set for the next branch. This broke cases such
as gh-3485: with `rule_set = [test1, test2]`, `test1` could touch
destination-address cache before an AdGuard `@@` exclusion made the
whole branch fail, and `test2` would then run against dirty state.

795d1c289 fixed that by cloning metadata for nested rule-set/rule
evaluation and resetting the rule match cache for each branch. That
stopped sibling pollution, but it also removed the only mechanism by
which a successful nested branch could affect the parent rule's grouped
matching state.

As a result, nested rule-sets became pure boolean sub-items against the
outer rule. The previous example stopped working: the inner
`domain_suffix = speedtest.net` still matched, but the outer rule no
longer observed any destination-address-group success, so it fell
through to `final`.

This change makes the semantics explicit instead of relying on cache
side effects:

- `rule_set: ["a", "b"]` is OR
- rules inside one rule-set are OR
- each nested branch is evaluated in isolation
- failed branches contribute no grouped match state
- a successful branch contributes its grouped match state back to the
  parent rule
- grouped state from different rule-sets must not be combined together
  to satisfy one outer rule

In other words, rule-sets now behave as "OR branches whose successful
group matches merge into the outer rule", which matches the documented
intent without reintroducing cross-branch cache leakage.
2026-03-24 15:03:43 +08:00