support full domain matching

This commit is contained in:
Darien Raymond 2018-08-21 21:44:20 +02:00
parent 133f54e125
commit 10beea60bb
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169
3 changed files with 6823 additions and 0 deletions

View File

@ -12,6 +12,7 @@ include:another-file
domain:google.com
keyword:google
regex:www\.google\.com
full:www.google.com
```
Syntax:
@ -21,6 +22,7 @@ Syntax:
* Subdomain begins with `domain:`, followed by a valid domain name. The prefix `domain:` may be omitted.
* Keyword begins with `keyword:`, followed by string.
* Regular expression begins with `regex:`, followed by a valid regular expression (per Golang's standard).
* Full domain begins with `full:`, followed by a domain.
## How it works
@ -34,6 +36,7 @@ To generate a section:
1. Generate each `domain:` line into a [sub-domain routing rule](https://github.com/v2ray/v2ray-core/blob/master/app/router/config.proto#L21).
1. Generate each `keyword:` line into a [plain domain routing rule](https://github.com/v2ray/v2ray-core/blob/master/app/router/config.proto#L17).
1. Generate each `regex:` line into a [regex domain routing rule](https://github.com/v2ray/v2ray-core/blob/master/app/router/config.proto#L19)
1. Generate each `full:` line into a [full domain routing rule](https://github.com/v2ray/v2ray-core/blob/master/app/router/config.proto#L23)
## File name guideline

6815
data/ookla-speedtest Normal file

File diff suppressed because it is too large Load Diff

View File

@ -50,6 +50,11 @@ func (l *ParsedList) toProto() (*router.GeoSite, error) {
Type: router.Domain_Plain,
Value: entry.Value,
})
case "full":
site.Domain = append(site.Domain, &router.Domain{
Type: router.Domain_Full,
Value: entry.Value,
})
default:
return nil, errors.New("unknown domain type: " + entry.Type)
}