753 Commits
Author SHA1 Message Date
世界 4444f297c2 Fix address filter matching for inverted DNS rules
Inverted rules whose address filter conditions come from rule sets or
logical rules were rejected during pre-lookup matching, so the lookup was
never sent and the rules never matched; for plain ip rule sets this was a
regression from the rule-set invert fix in 1.12.22. Pre-lookup matching
now tracks whether the result depends on deferred address filter
conditions and defers such rules to the response phase, while results
already determined by evaluated conditions are still decided during
pre-lookup.
2026-08-22 16:14:54 +08:00
Gavin LuoandGitHub 7ac8e5c0ab Fix reset network 2026-08-10 23:10:24 +08:00
Shtorm 051e928b01 Update sing-box core 2026-08-06 14:09:46 +03:00
世界 890544e88b Fix rule-set file descriptor leak 2026-07-27 15:51:12 +08:00
世界 7b9439f761 route: Refetch rule-set when cache restore fails 2026-07-27 15:51:12 +08:00
Shtorm 93e34d124b Merge tag 'v1.13.14' into extended
Integrate upstream sing-box v1.13.14 (18 commits, v1.13.12..v1.13.14).

Conflict resolutions:
- Makefile: keep fork's upload_android (no otherLegacy, codeberg-release.sh),
  add upstream's SFA-version-metadata.json step.
- go.sum: regenerated via go mod tidy from merged go.mod.
- transport/wireguard/endpoint_options.go: keep fork fields, add ICMPTimeout.
- clients/android, clients/apple: keep fork's submodule pointers.
2026-06-26 01:28:40 +03:00
Shtorm edf38d33d6 Add Snell protocol. Refactor MASQUE HTTP/2, Fair Queue. Update XHTTP, OpenVPN, Sudoku, Fallback. Fixes 2026-06-26 01:25:57 +03:00
世界 4e1af0600b Fix UDP sniff fragment timeout treated as fatal error 2026-06-20 19:45:36 +08:00
Shtorm 9f5ccf43d4 Add SSH inbound, log level. Update MTPROXY. Fixes 2026-06-07 07:59:43 +03:00
Shtorm e363c2ff78 Add Mieru inbound, refactor sudoku. Fixes 2026-06-04 07:54:26 +03:00
世界 761b7f4e12 Handle TUN loopback in direct outbound 2026-06-03 12:56:36 +08:00
Shtorm b953954b60 Update sing-box core, refactor MASQUE, update XHTTP 2026-05-29 01:31:57 +03: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
Shtorm 851ac2322e Fix OverrideGateway 2026-04-30 19:19:40 +03:00
Shtorm c307b8dc2d Add MTProxy, MASQUE, VPN, Link parser. Update AmneziaWG. Remove Tunneling 2026-04-29 22:11:30 +03:00
世界 f102ef1d94 Fix process search skipped for Android again 2026-04-23 05:52:22 +08:00
Shtorm 614af37bc4 Update sing-box core 2026-04-22 19:23:23 +03:00
世界 71f6a2ab4e Fix process search skipped for TUN 2026-04-21 15:45:05 +08:00
世界 8b64ae650b 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
世界 9ba5a05020 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
世界 9cfb117903 Fix windows bssid matching 2026-04-20 09:49:39 +08:00
Shtorm 9bb1b847be Update sing-box core 2026-04-06 20:54:24 +03:00
世界 6381de7bab route: Fix query_type never matching in rule_set headless rules 2026-03-26 13:26:18 +08:00
世界 75f64acd9f 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
世界 fdfd0ffb07 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
世界 3564cdf07e route: formalize nested rule_set group-state semantics
Before 8bf01b7ad, 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.

8bf01b7ad 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
世界 9ac1e2ff32 Match package_name in process_path rule on Android 2026-03-23 18:57:35 +08:00
世界 e5053ffcda Match package_name in process_path rule on Android 2026-03-23 18:57:35 +08:00
世界 0045103d14 Fix package_name shared uid matching 2026-03-23 18:57:35 +08:00
世界 f3a79dda87 Fix package_name shared uid matching 2026-03-23 18:57:35 +08:00
世界 3f05a37f65 Optimize Linux process finder 2026-03-23 18:57:35 +08:00
世界 828c324b18 Optimize Linux process finder 2026-03-23 18:57:35 +08:00
世界 b8e5a71450 Add process information cache to avoid duplicate lookups
PreMatch and full match phases each created a fresh InboundContext,
causing process search (expensive OS syscalls) to run twice per
connection. Use a freelru ShardedLRU cache with 200ms TTL to serve
the second lookup from cache.
2026-03-23 14:26:45 +08:00
世界 60c8e40386 Add process information cache to avoid duplicate lookups
PreMatch and full match phases each created a fresh InboundContext,
causing process search (expensive OS syscalls) to run twice per
connection. Use a freelru ShardedLRU cache with 200ms TTL to serve
the second lookup from cache.
2026-03-23 14:26:45 +08:00
世界 795d1c2892 Fix nested rule-set match cache isolation 2026-03-23 12:26:19 +08:00
世界 8bf01b7add Fix nested rule-set match cache isolation 2026-03-23 12:26:19 +08:00
世界 d2fa21d07b Deprecate Socksaddr.IsFqdn: do not reject potentially valid domain names 2026-03-16 09:37:59 +08:00
世界 6da6aff8b4 Deprecate Socksaddr.IsFqdn: do not reject potentially valid domain names 2026-03-16 09:37:59 +08:00
Shtorm 7c141d4afc Update sing-box core 2026-03-10 04:50:32 +03:00
Shtorm 494fa5a9da Update sing-box core 2026-03-10 04:25:01 +03:00
世界 1803471e02 endpoint: Fix UDP resolved destination 2026-03-02 13:55:26 +08:00
世界 7ff25431c0 endpoint: Fix UDP resolved destination 2026-03-02 13:55:26 +08:00
世界 8ae93a98e5 Remove overdue deprecated features 2026-03-01 12:30:43 +08:00
世界 da06212268 Remove overdue deprecated features 2026-03-01 12:30:43 +08:00
Shtorm 48546f7777 Resolve conflicts 2026-02-26 22:57:25 +03:00