-
Notifications
You must be signed in to change notification settings - Fork 8.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
添加更多的匹配规则 #2247
Closed
Closed
添加更多的匹配规则 #2247
Conversation
This file contains 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
A new item "useFake" in DnsObject for controlling fake IP function. After the fake IP function enabled, the local DNS server of v2ray will response with a unique fake IP for every unique domain name. Once v2ray received a request to one of the fake IP, it will replace the domain name of its destination with the previously saved one.
Move the rules parser to the V2Ray. Considering we parse the rules in the strmatcher package, programers only need to care about the rules themselves now. In the previous version, we prase the configure file in the V2Ctl and only send the base rules to the V2Ray. It works, but is hard to add complex rules and to reuse code.
Add a class implementing strmatcher.Matcher, which is used to check whether a domain is in the fake IP list or not. Using rules from dns.useFake, which is an array, to generate domain matching rules.
Testing is necessary!
Move useFake to fake.fakeRules, and add fake.fakeNet. Fake IP will be generated in the fakeNet domain.
We don't need StaticHosts anymore.
To be compatible with a old version of V2Ctl, StaticHosts are still processed on the V2Ray.
Update the matching rules handler of the DNS server. Revert the name dns.Config_HostMapping.Pattern back to Domain for compatibility. Add a new matching type DomainMatchingType_New for compatibility.
Seperating means sharing. Also remove redundant code in DNS host.
WOW, what a mess. Add a argument for compressPattern method to specify the default matching method. Add external rules data to router's protobuf structure.
Merge ParsePattern method of MatcherGroup and OrMatcher. Remove Type.New method, it's not needed anymore. Change OrMatcher.New() to NewOrMatcher() for convenience.
A not matcher reverses its submatcher.
用感叹号如何,感觉简洁一点
|
我原来也有这样考虑,采用 不过 |
An and matcher matches a domain only when both its children matchers match that domain.
Move the state variables into a class for better reuse.
A or matcher matches a domain when one of its children matchers matches that domain.
It has been open 120 days with no activity. Remove stale label or comment or this will be closed in 5 days |
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.
commit 67c94ad 之前基于 #2237
匹配规则:非
not:
后加规则,例如not:geosite:cn
匹配所有非中国大陆域名。该规则配合 Fake IP 可以保证绕过中国大陆域名模式下,仅有直连或将域名发往代理服务器两种可能。
同样需求 #2177
匹配规则:与, 或
二元匹配规则。
格式:
and:规则A 规则B
,or:规则A 规则B
即用空格隔开两个子规则。
为更加精确的规则匹配提供可能性。