mirror of
https://github.com/v2fly/domain-list-community.git
synced 2026-02-06 14:03:13 +07:00
Compare commits
8 Commits
2026012013
...
2026012214
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
614a880a55 | ||
|
|
676832d14a | ||
|
|
a2f08a142c | ||
|
|
2359ad7f8e | ||
|
|
330592feff | ||
|
|
f44fbc801d | ||
|
|
03c5e05305 | ||
|
|
bd21f84381 |
43
README.md
43
README.md
@@ -13,9 +13,7 @@ This project is not opinionated. In other words, it does NOT endorse, claim or i
|
||||
|
||||
## Notice
|
||||
|
||||
Rules with `@!cn` attribute has been cast out from cn lists. `geosite:geolocation-cn@!cn` is no longer available.
|
||||
|
||||
Check [#390](https://github.com/v2fly/domain-list-community/issues/390), [#3119](https://github.com/v2fly/domain-list-community/pull/3119) and [#3198](https://github.com/v2fly/domain-list-community/pull/3198) for more information.
|
||||
Rules with `@!cn` attribute has been cast out from cn lists. `geosite:geolocation-cn@!cn` is no longer available. Check [#390](https://github.com/v2fly/domain-list-community/issues/390), [#3119](https://github.com/v2fly/domain-list-community/pull/3119) and [#3198](https://github.com/v2fly/domain-list-community/pull/3198) for more information.
|
||||
|
||||
Please report if you have any problems or questions.
|
||||
|
||||
@@ -93,38 +91,45 @@ All data are under `data` directory. Each file in the directory represents a sub
|
||||
# comments
|
||||
include:another-file
|
||||
domain:google.com @attr1 @attr2
|
||||
full:analytics.google.com @ads
|
||||
keyword:google
|
||||
regexp:www\.google\.com$
|
||||
full:www.google.com
|
||||
regexp:^odd[1-7]\.example\.org(\.[a-z]{2})?$
|
||||
```
|
||||
|
||||
**Syntax:**
|
||||
|
||||
> [!NOTE]
|
||||
> Adding new `regexp` and `keyword` rules is discouraged because it is easy to use them incorrectly, and proxy software cannot efficiently match these types of rules.
|
||||
|
||||
> [!NOTE]
|
||||
> 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 `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`, `regexp` and `full`) may have one or more attributes. Each attribute begins with `@` and followed by the name of the attribute.
|
||||
|
||||
> **Note:** Adding new `regexp` and `keyword` rules is discouraged because it is easy to use them incorrectly, and proxy software cannot efficiently match these types of rules.
|
||||
- Keyword begins with `keyword:`, followed by a substring of a valid domain name.
|
||||
- Regular expression begins with `regexp:`, followed by a valid regular expression (per Golang's standard).
|
||||
- Domain rules (including `domain`, `full`, `keyword`, and `regexp`) may have none, one or more attributes. Each attribute begins with `@` and followed by the name of the attribute. Attributes will remain available in final lists and `dlc.dat`.
|
||||
- Domain rules may have none, one or more affiliations, which additionally adds the domain rule into the affiliated target list. Each affiliation begins with `&` and followed by the name of the target list (nomatter whether the target has a dedicated file in data path). This is a method for data management, and will not remain in the final lists or `dlc.dat`.
|
||||
- Inclusion begins with `include:`, followed by the name of another valid domain list. A simple `include:listb` in file `lista` means adding all domain rules of `listb` into `lista`. Inclusions with attributes stands for selective inclusion. `include:listb @attr1 @-attr2` means only adding those domain rules *with* `@attr1` **and** *without* `@attr2`. This is a special type for data management, and will not remain in the final lists or `dlc.dat`.
|
||||
|
||||
## How it works
|
||||
|
||||
The entire `data` directory will be built into an external `geosite` file for Project V. Each file in the directory represents a section in the generated file.
|
||||
|
||||
To generate a section:
|
||||
**General steps:**
|
||||
|
||||
1. Remove all the comments in the file.
|
||||
2. Replace `include:` lines with the actual content of the file.
|
||||
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/routercommon/common.proto#L21).
|
||||
5. Generate each `full:` line into a [full domain routing rule](https://github.com/v2fly/v2ray-core/blob/master/app/router/routercommon/common.proto#L23).
|
||||
6. Generate each `keyword:` line into a [plain domain routing rule](https://github.com/v2fly/v2ray-core/blob/master/app/router/routercommon/common.proto#L17).
|
||||
7. Generate each `regexp:` line into a [regex domain routing rule](https://github.com/v2fly/v2ray-core/blob/master/app/router/routercommon/common.proto#L19).
|
||||
1. Read files in the data path (ignore all comments and empty lines).
|
||||
2. Parse and resolve source data, turn affiliations and inclusions into actual domain rules in proper lists.
|
||||
3. Deduplicate and sort rules in every list.
|
||||
4. Export desired plain text lists.
|
||||
5. Generate `dlc.dat`:
|
||||
- turn each `domain:` line into a [sub-domain routing rule](https://github.com/v2fly/v2ray-core/blob/master/app/router/routercommon/common.proto#L21).
|
||||
- turn each `full:` line into a [full domain routing rule](https://github.com/v2fly/v2ray-core/blob/master/app/router/routercommon/common.proto#L23).
|
||||
- turn each `keyword:` line into a [plain domain routing rule](https://github.com/v2fly/v2ray-core/blob/master/app/router/routercommon/common.proto#L17).
|
||||
- turn each `regexp:` line into a [regex domain routing rule](https://github.com/v2fly/v2ray-core/blob/master/app/router/routercommon/common.proto#L19).
|
||||
|
||||
Read [main.go](./main.go) for details.
|
||||
|
||||
## How to organize domains
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ include:curseforge
|
||||
include:cygames
|
||||
include:ea
|
||||
include:embark
|
||||
include:eneba
|
||||
include:epicgames
|
||||
include:escapefromtarkov
|
||||
include:faceit
|
||||
|
||||
@@ -16,6 +16,8 @@ include:yokaverse
|
||||
7k7k.com
|
||||
# 刀锋盒子 皖B2-20190103-4
|
||||
9xgame.com
|
||||
# 韵律谱面研究站 桂ICP备20001846号-3
|
||||
arcaea.cn
|
||||
# 《异象回声》游戏官网 沪ICP备2023010411号-1
|
||||
astral-vector.com
|
||||
# 九九互动 粤ICP备19068416号
|
||||
|
||||
@@ -10,3 +10,6 @@ yctdyy.com
|
||||
|
||||
# 南方医科大学深圳医院
|
||||
smuszh.com
|
||||
|
||||
# 四川大学华西医院
|
||||
cd120.com
|
||||
|
||||
2
data/eneba
Normal file
2
data/eneba
Normal file
@@ -0,0 +1,2 @@
|
||||
eneba.com
|
||||
eneba.games
|
||||
@@ -102,6 +102,8 @@ include:w3schools
|
||||
include:zotero
|
||||
|
||||
chemequations.com # 线上化学方程式!
|
||||
geogebra.org
|
||||
wolframalpha.com
|
||||
|
||||
# Entertainment & Games & Music & Podcasts & Videos
|
||||
include:category-entertainment
|
||||
@@ -300,6 +302,7 @@ include:wikimedia
|
||||
|
||||
atwiki.jp
|
||||
touhouwiki.net
|
||||
wiki.gg
|
||||
|
||||
# Others
|
||||
include:avaxhome
|
||||
|
||||
@@ -488,6 +488,12 @@ include:chinaunicom @-!cn
|
||||
## IPIP ip地理位置数据库
|
||||
include:ipip @-!cn
|
||||
|
||||
## 白描
|
||||
baimiao.tech
|
||||
baimiaoapp.com
|
||||
shinescan.tech
|
||||
uzero.cn
|
||||
|
||||
chaziyu.com # 滇ICP备2024035496号
|
||||
fofa.info # Fofa网站测绘(华顺信安)
|
||||
icplishi.com # 粤ICP备20009057号
|
||||
|
||||
3
data/okx
3
data/okx
@@ -1,8 +1,9 @@
|
||||
okex.com
|
||||
okx.com
|
||||
okx-dns.com
|
||||
okx-dns1.com
|
||||
okx-dns2.com
|
||||
okx.cab
|
||||
okx.com
|
||||
|
||||
# OKC Browser
|
||||
oklink.com @cn
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
include:askdiandian
|
||||
|
||||
rednotecdn.com
|
||||
xhscdn.com
|
||||
xhscdn.net
|
||||
xhslink.com
|
||||
|
||||
25
main.go
25
main.go
@@ -30,10 +30,10 @@ const (
|
||||
)
|
||||
|
||||
var (
|
||||
TypeChecker = regexp.MustCompile(`^(domain|full|keyword|regexp|include)$`)
|
||||
ValueChecker = regexp.MustCompile(`^[a-z0-9!\.-]+$`)
|
||||
AttrChecker = regexp.MustCompile(`^[a-z0-9!-]+$`)
|
||||
SiteChecker = regexp.MustCompile(`^[A-Z0-9!-]+$`)
|
||||
TypeChecker = regexp.MustCompile(`^(domain|full|keyword|regexp|include)$`)
|
||||
DomainChecker = regexp.MustCompile(`^[a-z0-9\.-]+$`)
|
||||
AttrChecker = regexp.MustCompile(`^[a-z0-9!-]+$`)
|
||||
SiteChecker = regexp.MustCompile(`^[A-Z0-9!-]+$`)
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -123,6 +123,8 @@ func parseEntry(line string) (Entry, error) {
|
||||
entry.Type = strings.ToLower(kv[0])
|
||||
if entry.Type == RuleTypeRegexp {
|
||||
entry.Value = kv[1]
|
||||
} else if entry.Type == RuleTypeInclude {
|
||||
entry.Value = strings.ToUpper(kv[1])
|
||||
} else {
|
||||
entry.Value = strings.ToLower(kv[1])
|
||||
}
|
||||
@@ -133,12 +135,19 @@ func parseEntry(line string) (Entry, error) {
|
||||
if !TypeChecker.MatchString(entry.Type) {
|
||||
return entry, fmt.Errorf("invalid type: %s", entry.Type)
|
||||
}
|
||||
if entry.Type == RuleTypeRegexp {
|
||||
switch entry.Type {
|
||||
case RuleTypeRegexp:
|
||||
if _, err := regexp.Compile(entry.Value); err != nil {
|
||||
return entry, fmt.Errorf("invalid regexp: %s", entry.Value)
|
||||
}
|
||||
} else if !ValueChecker.MatchString(entry.Value) {
|
||||
return entry, fmt.Errorf("invalid value: %s", entry.Value)
|
||||
case RuleTypeInclude:
|
||||
if !SiteChecker.MatchString(entry.Value) {
|
||||
return entry, fmt.Errorf("invalid included list name: %s", entry.Value)
|
||||
}
|
||||
default: // `full`, `domain` and `keyword` are all (parts of) domains
|
||||
if !DomainChecker.MatchString(entry.Value) {
|
||||
return entry, fmt.Errorf("invalid domain: %s", entry.Value)
|
||||
}
|
||||
}
|
||||
|
||||
// Parse/Check attributes and affiliations
|
||||
@@ -214,7 +223,7 @@ func parseList(refName string, refList []*Entry) error {
|
||||
if len(entry.Affs) != 0 {
|
||||
return fmt.Errorf("affiliation is not allowed for include:%s", entry.Value)
|
||||
}
|
||||
inc := &Inclusion{Source: strings.ToUpper(entry.Value)}
|
||||
inc := &Inclusion{Source: entry.Value}
|
||||
for _, attr := range entry.Attrs {
|
||||
if strings.HasPrefix(attr, "-") {
|
||||
inc.BanAttrs = append(inc.BanAttrs, attr[1:]) // Trim attribute prefix `-` character
|
||||
|
||||
Reference in New Issue
Block a user