feat(rules): extend slash-separated OR payload support to GEOSITE, GEOIP, and IP-ASN#2774
Open
aJC7737 wants to merge 1 commit into
Open
feat(rules): extend slash-separated OR payload support to GEOSITE, GEOIP, and IP-ASN#2774aJC7737 wants to merge 1 commit into
aJC7737 wants to merge 1 commit into
Conversation
wwqgtxx
force-pushed
the
Alpha
branch
5 times, most recently
from
May 15, 2026 10:13
61b8d7f to
17bed79
Compare
wwqgtxx
force-pushed
the
Alpha
branch
3 times, most recently
from
June 12, 2026 02:06
f513c49 to
d67572b
Compare
aJC7737
force-pushed
the
more-slash-support
branch
from
June 29, 2026 12:14
f10959e to
add46c0
Compare
Author
Changes Since the Original ImplementationCompared with
|
Extend slash-separated payload matching to GEOSITE, GEOIP, SRC-GEOIP, IP-ASN, and SRC-IP-ASN rules. The shared parser trims payload segments, rejects empty segments, deduplicates values while preserving order, and supports per-rule normalization. GEOIP keeps lan pseudo-rule behavior, supports mixed payloads such as lan/cn, and exposes combined matchers for multi-value payloads. Add tests for parser behavior, canonical payload output, mixed GEOIP matching, DNS fallback error handling, exported value copies, and combined matcher behavior. Update config examples for routing rules and geosite: prefix use.
aJC7737
force-pushed
the
more-slash-support
branch
from
July 9, 2026 05:57
add46c0 to
1ea3e5d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Extend slash-separated payload support to more rule types so one rule can OR-match multiple values without a long
ORrule.This supports:
GEOSITE,cn/gfw,PROXYGEOIP,lan/cn,DIRECTSRC-GEOIP,cn/us,DIRECTIP-ASN,1/13335,PROXYSRC-IP-ASN,13335/396982,DIRECTThe behavior matches existing slash-separated list patterns in rules such as
IN-TYPE,IN-USER,IN-NAME,REMATCH-NAME, and numeric range rules.Support Table
What Changed
Rule behavior
GEOSITEaccepts slash-separated categories and matches if any category matches.GEOIPaccepts slash-separated countries and pseudo-values and matches if any value matches.lan/cnare supported.lanbehavior is preserved.SRC-GEOIPinherits the same support.IP-ASNaccepts slash-separated ASNs and matches if any ASN matches.SRC-IP-ASNinherits the same support.Parsing
Added a shared slash-separated payload parser that:
cn//us,/cn, andcn/Internal behavior
GEOSITEandGEOIPpayloads.GEOIP.GetCountries()ASN.GetASNs()GetCountry()andGetASN()compatibility by returning the first parsed value.Documentation
Added examples for:
GEOSITE,GEOIP,SRC-GEOIP, andIP-ASNgeosite:prefix usage in DNS-related config examplesExamples
Tests
Added/updated tests covering:
lanand mixed payload behaviorTested with: