Comply with go regexp & user defined regular expression prefix (#164)

To avoid further confusion like this: https://github.com/v2fly/domain-list-community/issues/163
This commit is contained in:
Loyalsoldier 2020-08-19 20:44:54 +08:00 committed by GitHub
parent f587eaeb04
commit a98b29b562
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 30 additions and 28 deletions

View File

@ -81,19 +81,21 @@ All data are under `data` directory. Each file in the directory represents a sub
include:another-file
domain:google.com @attr1 @attr2
keyword:google
regex:www\.google\.com
regexp:www\.google\.com$
full:www.google.com
```
**Syntax:**
> The following types of rules are **NOT** fully compatible with the ones that defined by user in V2Ray config file. Do **Not** copy and paste directly.
* Comment begins with `#`. It may begin anywhere in the file. The content in the line after `#` is treated as comment and ignored in production.
* Inclusion begins with `include:`, followed by the file name of an existing file in the same directory.
* Subdomain begins with `domain:`, followed by a valid domain name. The prefix `domain:` may be omitted.
* Keyword begins with `keyword:`, followed by a string.
* Regular expression begins with `regex:`, followed by a valid regular expression (per Golang's standard).
* Regular expression begins with `regexp:`, followed by a valid regular expression (per Golang's standard).
* Full domain begins with `full:`, followed by a complete and valid domain name.
* Domains (including `domain`, `keyword`, `regex` and `full`) may have one or more attributes. Each attribute begins with `@` and followed by the name of the attribute.
* Domains (including `domain`, `keyword`, `regexp` and `full`) may have one or more attributes. Each attribute begins with `@` and followed by the name of the attribute.
## How it works
@ -106,7 +108,7 @@ To generate a section:
3. Omit all empty lines.
4. Generate each `domain:` line into a [sub-domain routing rule](https://github.com/v2fly/v2ray-core/blob/master/app/router/config.proto#L21).
5. Generate each `keyword:` line into a [plain domain routing rule](https://github.com/v2fly/v2ray-core/blob/master/app/router/config.proto#L17).
6. Generate each `regex:` line into a [regex domain routing rule](https://github.com/v2fly/v2ray-core/blob/master/app/router/config.proto#L19).
6. Generate each `regexp:` line into a [regex domain routing rule](https://github.com/v2fly/v2ray-core/blob/master/app/router/config.proto#L19).
7. Generate each `full:` line into a [full domain routing rule](https://github.com/v2fly/v2ray-core/blob/master/app/router/config.proto#L23).
## How to organize domains

View File

@ -147,14 +147,14 @@ elasticbeanstalk.com
thinkboxsoftware.com
# AWS DNS
regex:.+\.awsdns-[0-9][0-9]\.co\.uk$
regex:.+\.awsdns-[0-9][0-9]\.com$
regex:.+\.awsdns-[0-9][0-9]\.net$
regex:.+\.awsdns-[0-9][0-9]\.org$
regex:.+\.awsdns-cn-[0-9][0-9]\.biz$
regex:.+\.awsdns-cn-[0-9][0-9]\.cn$
regex:.+\.awsdns-cn-[0-9][0-9]\.com$
regex:.+\.awsdns-cn-[0-9][0-9]\.net$
regexp:.+\.awsdns-[0-9][0-9]\.co\.uk$
regexp:.+\.awsdns-[0-9][0-9]\.com$
regexp:.+\.awsdns-[0-9][0-9]\.net$
regexp:.+\.awsdns-[0-9][0-9]\.org$
regexp:.+\.awsdns-cn-[0-9][0-9]\.biz$
regexp:.+\.awsdns-cn-[0-9][0-9]\.cn$
regexp:.+\.awsdns-cn-[0-9][0-9]\.com$
regexp:.+\.awsdns-cn-[0-9][0-9]\.net$
# Kindle
kindle.cn @cn

View File

@ -844,12 +844,12 @@ full:weather-data.apple.com @cn
full:www.apple.com.edgekey.net.globalredir.akadns.net @cn
full:www.apple.com.edgekey.net @cn
full:www.apple.com @cn
regex:^a[1-5]\.mzstatic\.com$ @cn
regex:^cdn(-cn)?[1-4]?\.apple-mapkit\.com$ @cn
regex:^cl[1-5]-cdn\.origin-apple\.com\.akadns\.net$ @cn
regex:^cl[1-5]\.apple\.com$ @cn
regex:^is[1-5](-ssl)?\.mzstatic\.com$ @cn
regex:^s[1-5]?\.mzstatic\.com$ @cn
regexp:^a[1-5]\.mzstatic\.com$ @cn
regexp:^cdn(-cn)?[1-4]?\.apple-mapkit\.com$ @cn
regexp:^cl[1-5]-cdn\.origin-apple\.com\.akadns\.net$ @cn
regexp:^cl[1-5]\.apple\.com$ @cn
regexp:^is[1-5](-ssl)?\.mzstatic\.com$ @cn
regexp:^s[1-5]?\.mzstatic\.com$ @cn
full:apple.com.akadns.net
full:courier-push-apple.com.akadns.net

View File

@ -86,7 +86,7 @@ click.ali213.net
pbmp.ali213.net
# Caixin
regex:^pinggai\d\.caixin\.com$
regexp:^pinggai\d\.caixin\.com$
# Chinaso
adq.chinaso.com

View File

@ -9,6 +9,6 @@ spyjinx.com
unrealengine.com
unrealtournament.com
regex:^cdn\d-epicgames-\d+\.file\.myqcloud\.com$ @cn
regex:^epicgames-download\d\.akamaized\.net$
regex:^epicgames-download\d-\d+\.file\.myqcloud\.com$ @cn
regexp:^cdn\d-epicgames-\d+\.file\.myqcloud\.com$ @cn
regexp:^epicgames-download\d\.akamaized\.net$
regexp:^epicgames-download\d-\d+\.file\.myqcloud\.com$ @cn

View File

@ -14,4 +14,4 @@ githubstatus.com
githubusercontent.com
full:github-avatars.oss-cn-hongkong.aliyuncs.com
regex:github-production-release-asset-[0-9a-zA-Z]{6}\.s3\.amazonaws\.com
regexp:github-production-release-asset-[0-9a-zA-Z]{6}\.s3\.amazonaws\.com

View File

@ -7,4 +7,4 @@ full:menu-static.gog-statics.com @cn
full:productcard.gog-statics.com @cn
full:static-login.gog-statics.com @cn
full:www4-static.gog-statics.com @cn
regex:^images(-\d)?\.gog-statics\.com$ @cn
regexp:^images(-\d)?\.gog-statics\.com$ @cn

View File

@ -565,4 +565,4 @@ full:translate.googleapis.com @cn
full:update.googleapis.com @cn
full:www-googletagmanager.l.google.com @cn
full:www.gstatic.com @cn
regex:^khm([0-3]|db)?\.google(apis)?\.com$ @cn
regexp:^khm([0-3]|db)?\.google(apis)?\.com$ @cn

View File

@ -1 +1 @@
regex:^speed\.(coe|open)\.ad\.[a-z]{2,6}\.prod\.hosts\.ooklaserver\.net$ @ads
regexp:^speed\.(coe|open)\.ad\.[a-z]{2,6}\.prod\.hosts\.ooklaserver\.net$ @ads

View File

@ -1,7 +1,7 @@
# viu.tv
viu.tv
full:api.viu.now.com
regex:^ewcdn[0-9]{2}\.nowe\.com$
regexp:^ewcdn[0-9]{2}\.nowe\.com$
#viu.com
viu.com

View File

@ -70,7 +70,7 @@ func (l *ParsedList) toProto() (*router.GeoSite, error) {
Value: entry.Value,
Attribute: entry.Attrs,
})
case "regex":
case "regexp":
site.Domain = append(site.Domain, &router.Domain{
Type: router.Domain_Regex,
Value: entry.Value,