Skip to content
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
wants to merge 19 commits into from
Closed

Conversation

EqCScO9nTa
Copy link

@EqCScO9nTa EqCScO9nTa commented Feb 13, 2020

commit 67c94ad 之前基于 #2237

匹配规则:

not: 后加规则,例如 not:geosite:cn 匹配所有非中国大陆域名。
该规则配合 Fake IP 可以保证绕过中国大陆域名模式下,仅有直连或将域名发往代理服务器两种可能。
同样需求 #2177

匹配规则:

二元匹配规则。
格式:and:规则A 规则Bor:规则A 规则B
即用空格隔开两个子规则。

为更加精确的规则匹配提供可能性。

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.
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.
@ghost
Copy link

ghost commented Feb 18, 2020

用感叹号如何,感觉简洁一点

!geosite:cn

@EqCScO9nTa
Copy link
Author

用感叹号如何,感觉简洁一点

我原来也有这样考虑,采用 not: 主要是为了维持原来配置的格式。

不过 ! 是可以作为一个可替换 / 简写用法的,只是我不太确定它在域名里面有没有别的作用。

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.
@github-actions
Copy link

github-actions bot commented Sep 3, 2020

It has been open 120 days with no activity. Remove stale label or comment or this will be closed in 5 days

@github-actions github-actions bot added the Stale label Sep 3, 2020
@github-actions github-actions bot closed this Sep 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant