Compare commits

...

70 Commits

Author SHA1 Message Date
MkQtS
b3bae7de8f Update category-ads (#3222)
* remove ads attr from openaicom.imgix.net

imgix.net is serving for pictures, not ads/tracking

* category-ads: include more ad domains
2026-01-28 13:07:34 +08:00
Jinzhe Zeng
4e9b28f951 add crixet.com to openai (#3221)
Crixet has been acquired by OpenAI, per https://crixet.com
2026-01-28 11:49:57 +08:00
xiyao
3c0a538219 samsung: add ospserver.net (#3219)
Samsung OneUI update server
2026-01-27 16:52:46 +08:00
MkQtS
2160230ef9 terabox: add more domains (#3218) 2026-01-27 15:24:47 +08:00
MkQtS
5c38f34456 Add cmd/datdump/main.go (#3213)
* Feat: add a new datdump tool

* Refactor: address code review comments

* Refactor: remove export all from main program

use datdump instead

* Refactor: allow spaces in exportlists

e.g. `--exportlists="lista, listb"`

* all: cleanup

* apply review suggestion

---------

Co-authored-by: database64128 <free122448@hotmail.com>
2026-01-24 23:11:35 +08:00
Zeehan2005
8e62b9b541 Enhance README with additional attribute @cn details (#3212)
Expanded the explanation of attributes in the README to include domains available in China mainland.

[skip ci]
2026-01-24 16:05:37 +08:00
EpLiar
85edae7ba1 Add new Binance API endpoint 'binanceru.net' (#3210) 2026-01-23 14:57:08 +08:00
MkQtS
1bd07b2e76 Support to export all lists to a plain yml (#3211)
* Refactor: improve deduplicate

* Feat: support to export all lists to a plain yml

use: `--exportlists=_all_`

* Docs: add links for dlc plain yml

[skip ci]
2026-01-23 14:56:35 +08:00
Kusu
614a880a55 okx: add okx.cab (#3209) 2026-01-22 22:14:50 +08:00
MkQtS
676832d14a Improve value checkers and docs (#3208)
* Refactor: improve value checkers

* Docs: small improvements

[skip ci]
2026-01-22 18:46:53 +08:00
MkQtS
a2f08a142c Docs: update for selective inclusion and affiliations (#3207)
[skip ci]
2026-01-22 14:30:10 +08:00
MkQtS
2359ad7f8e Add eneba (#3205) 2026-01-22 11:40:44 +08:00
MkQtS
330592feff xiaohongshu: add rednotecdn.com (#3204) 2026-01-22 11:30:18 +08:00
blackyau
f44fbc801d category-hospital-cn: add cd120.com (#3203) 2026-01-22 10:57:38 +08:00
深鸣
03c5e05305 Add more !cn domains (#3200) 2026-01-21 09:44:07 +08:00
深鸣
bd21f84381 Add more cn domains (#3199)
* category-games-cn: add arcaea.cn
* geolocation-cn: add baimiao
2026-01-21 09:42:31 +08:00
MkQtS
912c689da3 Cast out !cn rules from cn lists (#3198)
* Cast out !cn rules from cn lists

* Docs: add notice about !cn rules in cn lists
2026-01-20 21:36:27 +08:00
Luo Chen
d1addde6f7 xiaomi: add xiaomi-iot domains (#3097)
- Add account.xiaomi.com for OAuth2 authentication
- Add ha.api.io.mi.com for HTTP API
- Add miot-spec.org for MIoT specification API
- Add cn-ha.mqtt.io.mi.com for MQTT broker
2026-01-20 21:06:11 +08:00
MkQtS
ec95fedc45 Refactor main.go (#3119)
* Refactor: reduce the use of strings.TrimSpace

* Refactor: use string attr before toProto

* Refactor parseEntry

- add value/attribute checker(check missing space)
- allow multiple spaces
- sort attributes
- improve readablity

* Refactor exportPlainTextList

- remove unnecessary variable
- improve readablity

* Remove support for partial include

This reverts e640ac2783

It is problematic and I will implement a new one

* Refactor: promote refMap

* Feat: add support for partial include

- refactor inclusion logic
- add basic deduplicate

* Refactor exporting plaintext list

* Feat: add support for affiliation

A domain rule is always added to the list corresponding to the filename
it resides in. Additionally, you can now add affiliations to a domain
rule, and the rule will be added to the list specified by the
affiliation. Each affiliation begins with `&` and followed by the name
of the affiliation.

This helps us to reduce the number of data files without compromising
functionality, and avoid writing a same rule in different files.

* Feat: add advanced deduplicate for subdomains

only for domain/full subdomains without attr

* Refactor: import and use slices

* Refactor: improve code
2026-01-20 20:58:32 +08:00
MkQtS
d50e2e1ad7 Update some cn rules (#3197)
* turn some full type rules into domain

* remove some unnecessary cn attrs
2026-01-20 15:33:15 +08:00
MkQtS
ab42940731 Update sensorsdata (#3196) 2026-01-20 14:33:58 +08:00
Cavano
efd57f30ee Add youmind (#3195) 2026-01-20 14:22:00 +08:00
xiyao
3ee190ac78 Add liveperson and standardchartered (#3192)
* Add liveperson

* Add standardchartered
2026-01-20 11:21:13 +08:00
Aethersailor
fa279bdd79 category-emby: add server2.cn2gias.uk (#3194) 2026-01-20 11:04:34 +08:00
tooadstool
b18f5e3049 Update annas-archive (#3193) 2026-01-20 11:04:18 +08:00
MkQtS
5411cefcaa Add more !cn domains (#3191)
* geolocation-!cn: reorder

* geolocation-!cn: add more CMP domains

* geolocation-!cn: add cataboom.com
2026-01-19 13:46:32 +08:00
Zeehan2005
d84e864ce8 Add pubg (#3175) 2026-01-17 13:36:10 +08:00
Loyalsoldier
49444d78b7 Update epochmediagroup (#3185) 2026-01-17 01:42:22 +08:00
someguyfromnowhere1
dad8e15cd0 Update xvideos (#3180)
Added several domains related to the site. These domains are only used when changing the language to Russian, Arabic, or Indian.
2026-01-15 13:13:39 +08:00
jinqiang zhang
e6e731a616 volcengine: add volcgslb-mlt.com (#3182) 2026-01-15 13:09:31 +08:00
EndlessEnding
8c0b190c3f Add 報導者 to category-media (#3179) 2026-01-14 17:53:11 +08:00
MkQtS
9f846c0f2e Add more cn domains (#3178)
* chinamobile: add cmft.com.cn

* category-entertainment-cn: add pipi.cn

* category-social-media-cn: add zsxq.com

* geolocation-cn: add more domains
2026-01-14 12:58:33 +08:00
MkQtS
fe01057830 Update category-entertainment (#3177)
* add steaminventoryhelper

* category-entertainment: include category-acg
2026-01-14 12:33:35 +08:00
深鸣
3ba71a115d category-games: add more domains (#3174) 2026-01-13 20:35:33 +08:00
MkQtS
8f1fe6b425 google-deepmind: add antigravity domains (#3173) 2026-01-13 14:08:15 +08:00
MkQtS
82ad580e6e google-deepmind: add more notebooklm domains (#3172) 2026-01-13 13:36:43 +08:00
MkQtS
488ee0334e cloudflare: add more domains (#3169)
encryptedsni.com
from https://blog.cloudflare.com/encrypt-that-sni-firefox-edition/

cloudflarechallenge.com
from https://blog.cloudflare.com/introducing-cryptographic-attestation-of-personhood/

cloudflareresearch.com
from https://blog.cloudflare.com/experiment-with-pq/

browser.run
cfdata.org
cloudflarebrowser.com
cloudflarecp.com
from https://developers.cloudflare.com/cloudflare-one/traffic-policies/global-policies/

cloudflare-terms-of-service-abuse.com
cloudflare.dev
cloudflaresupport.com
cloudflareworkers.com
from public information
2026-01-12 13:32:25 +08:00
深鸣
1b63c69d76 Add more non-cn domains (#3167) 2026-01-12 13:04:45 +08:00
深鸣
6dee1594d4 Add more cn domains (#3166) 2026-01-12 12:59:26 +08:00
深鸣
49cbfc60e5 Add more ad domains (#3168) 2026-01-12 12:23:58 +08:00
深鸣
8786ff74f0 Add more ad domains (#3164)
* Add more ad domains

* Merge some ad domains into their corresponding main rules

---------

Co-authored-by: MkQtS <81752398+MkQtS@users.noreply.github.com>
2026-01-11 22:01:15 +08:00
MkQtS
cc8a866863 Add more cn domains (#3163)
* chinamobile: add more domains

* chinaunicom: add wosms.cn

* zhangtao: add more domains

* category-media-cn: add more domains
2026-01-10 22:30:40 +08:00
深鸣
593e467448 tencent-ads: add more domains (#3162) 2026-01-10 22:28:26 +08:00
深鸣
76b32b86b8 geolocation-cn: add more domains (#3161) 2026-01-10 16:48:26 +08:00
深鸣
1150b420a4 xiaomi-ads: add tracker.xiaomixiaoai.com (#3160) 2026-01-10 14:57:56 +08:00
Stephanos Komnenos
2a0fb64efd category-pt: add nexushd.org (#3158) 2026-01-10 14:56:52 +08:00
深鸣
c05ce9952d xiaomi-ads: add stats.music.xiaomi.com (#3159) 2026-01-10 11:15:23 +08:00
xizi
67389b37cc Add schoopia (#3156)
Add domains for 翻转校园
2026-01-09 09:54:32 +08:00
TripleA
39431a9e8f google-deepmind: add missing subdomain for Google AI Labs (#3157) 2026-01-09 09:47:54 +08:00
xizi
b8fc0cd9d7 feat(jiguang): add missing domain easytomessage.com (#3155)
Add missing domain for Jiguang (JPush) service.

According to the official Jiguang documentation, `easytomessage.com` is a required domain for the push service to function correctly on network-restricted environments.

Reference:
https://community.jiguang.cn/article/408970
2026-01-09 09:46:36 +08:00
bafometik
9f59a5e666 category-ru: add more domains (#3144) 2026-01-08 23:07:32 +08:00
Aleksandr Fedotov
07f769cf85 Add category-retail-ru (#3154) 2026-01-08 23:00:26 +08:00
MkQtS
6833d994c0 category-dev: add more domains 2026-01-08 13:59:24 +08:00
MkQtS
b150c66d47 category-password-management: add authpass.app 2026-01-08 13:59:24 +08:00
MkQtS
248c0f7b86 geolocation: add more domains 2026-01-08 13:59:24 +08:00
un1ntend3d
de2c5cf208 category-cryptocurrency: add bingx.com (#3140) 2026-01-08 12:27:24 +08:00
MkQtS
44d511e74e Add technogym (#3152) 2026-01-08 12:18:11 +08:00
TripleA
5928f612ba Update category-public-tracker (#3151)
Strict comparison by www removed
2026-01-08 11:59:21 +08:00
Aleksandr Fedotov
246b6150af Add mosmetro (#3146) 2026-01-08 11:50:46 +08:00
Aleksandr Fedotov
ffb25af399 Add category-ecommerce-ru (#3149) 2026-01-08 11:41:48 +08:00
Aleksandr Fedotov
f96f3d1abd Add category-entertainment-ru (#3150) 2026-01-08 11:34:37 +08:00
Aleksandr Fedotov
8fc66473ff category-ru: remove anime domains (#3148)
* animevost.org is changing mirrors; the domain is unstable

* seasonvar.ru is already in the category-ru
2026-01-08 11:30:46 +08:00
xizi
49101e3aab taptap: add tapapks.com (#3147)
Add missing download domain.
2026-01-08 11:21:25 +08:00
bafometik
d2c662bf5e mailru-group: add tamtam.chat (#3145) 2026-01-07 15:13:39 +08:00
MkQtS
7a6e4cb1f5 Update apple (#3138)
* apple: deduplicate

- swift is included in apple-dev
- `full:certs.apple.com @cn` is added in apple-pki
- `full:crl.apple.com @cn` is added in apple-pki
- `full:ocsp-lb.apple.com.akadns.net @cn` is added in apple-pki
- `full:ocsp.apple.com @cn` is added in apple-pki
- `full:ocsp2-lb.apple.com.akadns.net @cn` is added in apple-pki
- `full:ocsp2.apple.com @cn` is added in apple-pki
- `full:valid.apple.com @cn` is added in apple-pki

* apple: move `valid.origin-apple.com.akadns.net` to apple-pki

keep consistent with valid.apple.com
2026-01-06 16:07:03 +08:00
MkQtS
511577436c category-collaborate-cn: add todesk.cn (#3139) 2026-01-06 15:51:06 +08:00
MkQtS
8a2718204b google: deduplicate (#3137)
- `full:safebrowsing-cache.google.com @cn` appears twice
- `full:crl.pki.goog @cn` is added in google-trust-services
- `full:firebase-settings.crashlytics.com @cn` is added in firebase
- `full:ocsp.pki.goog @cn` is added in google-trust-services
- `full:pki-goog.l.google.com @cn` is added in google-trust-services
- `full:redirector.c.play.google.com @cn` is added in google-play
2026-01-06 14:08:09 +08:00
HedgDifuse
e3b3197a42 Add category-proxy-tunnels with ngrok and pinggy (#3130)
* add category-proxy-tunnels

* add ngrok and pinggy
2026-01-06 12:33:11 +08:00
I'm xun.
f8488acb8c google-deepmind: add ai.studio (#3134) 2026-01-05 18:25:38 +08:00
6kembion9-byte
ed2bce57e7 Add more torrent domains (#3118)
* category-public-tracker: add nnmclub.to

* geolocation-!cn: add rutor.info
2026-01-05 17:06:33 +08:00
93 changed files with 1047 additions and 477 deletions

View File

@@ -33,15 +33,17 @@ jobs:
echo "TAG_NAME=$(date +%Y%m%d%H%M%S)" >> $GITHUB_ENV
shell: bash
- name: Build dlc.dat file
- name: Build dlc.dat and plain lists
run: |
cd code || exit 1
go run ./ --outputdir=../ --exportlists=category-ads-all,tld-cn,cn,tld-\!cn,geolocation-\!cn,apple,icloud
go run ./cmd/datdump/main.go --inputdata=../dlc.dat --outputdir=../ --exportlists=_all_
cd ../ && rm -rf code
- name: Generate dlc.dat sha256 hash
run: |
sha256sum dlc.dat > dlc.dat.sha256sum
sha256sum dlc.dat_plain.yml > dlc.dat_plain.yml.sha256sum
- name: Generate Zip
run: |
@@ -66,6 +68,6 @@ jobs:
- name: Release and upload assets
run: |
gh release create ${{ env.TAG_NAME }} --generate-notes --latest --title ${{ env.RELEASE_NAME }} ./dlc.dat ./dlc.dat.*
gh release create ${{ env.TAG_NAME }} --generate-notes --latest --title ${{ env.RELEASE_NAME }} ./dlc.dat ./dlc.dat.* ./dlc.dat_plain.yml ./dlc.dat_plain.yml.*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

1
.gitignore vendored
View File

@@ -8,4 +8,5 @@
dlc.dat
# Exported plaintext lists.
/*.yml
/*.txt

View File

@@ -10,6 +10,14 @@ This project is not opinionated. In other words, it does NOT endorse, claim or i
- **dlc.dat**[https://github.com/v2fly/domain-list-community/releases/latest/download/dlc.dat](https://github.com/v2fly/domain-list-community/releases/latest/download/dlc.dat)
- **dlc.dat.sha256sum**[https://github.com/v2fly/domain-list-community/releases/latest/download/dlc.dat.sha256sum](https://github.com/v2fly/domain-list-community/releases/latest/download/dlc.dat.sha256sum)
- **dlc.dat_plain.yml**[https://github.com/v2fly/domain-list-community/releases/latest/download/dlc.dat_plain.yml](https://github.com/v2fly/domain-list-community/releases/latest/download/dlc.dat_plain.yml)
- **dlc.dat_plain.yml.sha256sum**[https://github.com/v2fly/domain-list-community/releases/latest/download/dlc.dat_plain.yml.sha256sum](https://github.com/v2fly/domain-list-community/releases/latest/download/dlc.dat_plain.yml.sha256sum)
## 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.
Please report if you have any problems or questions.
## Usage example
@@ -85,38 +93,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
@@ -126,7 +141,7 @@ Theoretically any string can be used as the name, as long as it is a valid file
### Attributes
Attribute is useful for sub-group of domains, especially for filtering purpose. For example, the list of `google` domains may contains its main domains, as well as domains that serve ads. The ads domains may be marked by attribute `@ads`, and can be used as `geosite:google@ads` in V2Ray routing.
Attribute is useful for sub-group of domains, especially for filtering purpose. For example, the list of `google` may contains its main domains, as well as domains that serve ads. The ads domains may be marked by attribute `@ads`, and can be used as `geosite:google@ads` in V2Ray routing. Domains and services that originate from outside China mainland but have access point in China mainland, may be marked by attribute `@cn`.
## Contribution guideline

164
cmd/datdump/main.go Normal file
View File

@@ -0,0 +1,164 @@
package main
import (
"bufio"
"flag"
"fmt"
"os"
"path/filepath"
"strings"
"github.com/v2fly/domain-list-community/internal/dlc"
router "github.com/v2fly/v2ray-core/v5/app/router/routercommon"
"google.golang.org/protobuf/proto"
)
var (
inputData = flag.String("inputdata", "dlc.dat", "Name of the geosite dat file")
outputDir = flag.String("outputdir", "./", "Directory to place all generated files")
exportLists = flag.String("exportlists", "", "Lists to be exported, separated by ',' (empty for _all_)")
)
type DomainRule struct {
Type string
Value string
Attrs []string
}
type DomainList struct {
Name string
Rules []DomainRule
}
func (d *DomainRule) domain2String() string {
dstring := d.Type + ":" + d.Value
if len(d.Attrs) != 0 {
dstring += ":@" + strings.Join(d.Attrs, ",@")
}
return dstring
}
func loadGeosite(path string) ([]DomainList, map[string]*DomainList, error) {
data, err := os.ReadFile(path)
if err != nil {
return nil, nil, fmt.Errorf("failed to read geosite file: %w", err)
}
vgeositeList := new(router.GeoSiteList)
if err := proto.Unmarshal(data, vgeositeList); err != nil {
return nil, nil, fmt.Errorf("failed to unmarshal: %w", err)
}
domainLists := make([]DomainList, len(vgeositeList.Entry))
domainListByName := make(map[string]*DomainList, len(vgeositeList.Entry))
for i, vsite := range vgeositeList.Entry {
rules := make([]DomainRule, 0, len(vsite.Domain))
for _, vdomain := range vsite.Domain {
rule := DomainRule{Value: vdomain.Value}
switch vdomain.Type {
case router.Domain_RootDomain:
rule.Type = dlc.RuleTypeDomain
case router.Domain_Regex:
rule.Type = dlc.RuleTypeRegexp
case router.Domain_Plain:
rule.Type = dlc.RuleTypeKeyword
case router.Domain_Full:
rule.Type = dlc.RuleTypeFullDomain
default:
return nil, nil, fmt.Errorf("invalid rule type: %+v", vdomain.Type)
}
for _, vattr := range vdomain.Attribute {
rule.Attrs = append(rule.Attrs, vattr.Key)
}
rules = append(rules, rule)
}
domainLists[i] = DomainList{
Name: strings.ToUpper(vsite.CountryCode),
Rules: rules,
}
domainListByName[domainLists[i].Name] = &domainLists[i]
}
return domainLists, domainListByName, nil
}
func exportSite(name string, domainListByName map[string]*DomainList) error {
domainList, ok := domainListByName[strings.ToUpper(name)]
if !ok {
return fmt.Errorf("list '%s' does not exist", name)
}
if len(domainList.Rules) == 0 {
return fmt.Errorf("list '%s' is empty", name)
}
file, err := os.Create(filepath.Join(*outputDir, name+".yml"))
if err != nil {
return err
}
defer file.Close()
w := bufio.NewWriter(file)
fmt.Fprintf(w, "%s:\n", name)
for _, domain := range domainList.Rules {
fmt.Fprintf(w, " - %q\n", domain.domain2String())
}
return w.Flush()
}
func exportAll(filename string, domainLists []DomainList) error {
file, err := os.Create(filepath.Join(*outputDir, filename))
if err != nil {
return err
}
defer file.Close()
w := bufio.NewWriter(file)
w.WriteString("lists:\n")
for _, domainList := range domainLists {
fmt.Fprintf(w, " - name: %s\n", strings.ToLower(domainList.Name))
fmt.Fprintf(w, " length: %d\n", len(domainList.Rules))
w.WriteString(" rules:\n")
for _, domain := range domainList.Rules {
fmt.Fprintf(w, " - %q\n", domain.domain2String())
}
}
return w.Flush()
}
func main() {
flag.Parse()
// Create output directory if not exist
if _, err := os.Stat(*outputDir); os.IsNotExist(err) {
if mkErr := os.MkdirAll(*outputDir, 0755); mkErr != nil {
fmt.Println("Failed to create output directory:", mkErr)
os.Exit(1)
}
}
fmt.Printf("Loading %s...\n", *inputData)
domainLists, domainListByName, err := loadGeosite(*inputData)
if err != nil {
fmt.Println("Failed to loadGeosite:", err)
os.Exit(1)
}
var exportListSlice []string
for raw := range strings.SplitSeq(*exportLists, ",") {
if trimmed := strings.TrimSpace(raw); trimmed != "" {
exportListSlice = append(exportListSlice, trimmed)
}
}
if len(exportListSlice) == 0 {
exportListSlice = []string{"_all_"}
}
for _, eplistname := range exportListSlice {
if strings.EqualFold(eplistname, "_all_") {
if err := exportAll(filepath.Base(*inputData)+"_plain.yml", domainLists); err != nil {
fmt.Println("Failed to exportAll:", err)
continue
}
} else {
if err := exportSite(eplistname, domainListByName); err != nil {
fmt.Println("Failed to exportSite:", err)
continue
}
}
fmt.Printf("list: '%s' has been exported successfully.\n", eplistname)
}
}

View File

@@ -17,6 +17,7 @@
4399biule.com
4399dmw.com
4399er.com
4399hdhh.com
4399hhh.com
4399inc.com
4399mail.com
@@ -30,17 +31,22 @@
4399yyy.com
5054399.com
5054399.net
5wyxi.com
71acg.com
71acg.net
abdf002.com
appeeres.com
buke999.com
bx1k.com
edu4399.com
funnycore.com
guoping123.com
haohaowan.net
i3839.com
ihykb.com
img4399.com
mail4399.com
maindown4399.com
me4399.com
my4399.com
mysiteres.com
@@ -52,4 +58,6 @@ wanwan4399.com
we4399.com
webgame163.com
youba.com
yxhapi.com
yxhhdl.com
yxhimg.com

View File

@@ -1,3 +1,5 @@
annas-archive.in
annas-archive.li
annas-archive.org
annas-archive.pm
annas-archive.se

View File

@@ -1,5 +1,5 @@
include:apple-ads
include:apple-dev
include:apple-dev # swift inside
# Not include:apple-intelligence
include:apple-pki
include:apple-tvplus
@@ -7,7 +7,6 @@ include:apple-update
include:beats
include:icloud
include:itunes
include:swift
# All .apple domains
apple
@@ -856,7 +855,7 @@ full:s4.mzstatic.com @cn
full:s5.mzstatic.com @cn
# The rules below are from https://github.com/felixonmars/dnsmasq-china-list/blob/master/apple.china.conf
# Revision: 4d392cc0a822ac5626bb97fef3fe5e04e86b28b0
# Revision: f6a2093b254a7d2baca959bd16581666ca394303
# Duplicates removed
# According to the consensus in #503, do not include the domain name apps.apple.com directly.
# Use in config file like this: "geosite:apple@cn"
@@ -874,7 +873,6 @@ full:cds-cdn.v.aaplimg.com @cn
full:cds.apple.com @cn
full:cds.apple.com.akadns.net @cn
full:cdsassets.apple.com @cn
full:certs.apple.com @cn
full:cl2-cn.apple.com @cn
full:cl4-cn.apple.com @cn
full:clientflow.apple.com @cn
@@ -882,7 +880,6 @@ full:clientflow.apple.com.akadns.net @cn
full:cn-smp-paymentservices.apple.com @cn
full:configuration.apple.com @cn
full:configuration.apple.com.akadns.net @cn
full:crl.apple.com @cn
full:cstat.apple.com @cn
full:cstat.cdn-apple.com @cn
full:dd-cdn.origin-apple.com.akadns.net @cn
@@ -935,10 +932,6 @@ full:mesu-china.apple.com.akadns.net @cn
full:mesu.apple.com @cn
full:ml.cdn-apple.com @cn
full:music.apple.com @cn
full:ocsp-lb.apple.com.akadns.net @cn
full:ocsp.apple.com @cn
full:ocsp2-lb.apple.com.akadns.net @cn
full:ocsp2.apple.com @cn
full:oscdn.apple.com @cn
full:oscdn.origin-apple.com.akadns.net @cn
full:osxapps.itunes.g.aaplimg.com @cn
@@ -981,8 +974,6 @@ full:tj-pod1-smp-device.apple.com @cn
full:updates-http.cdn-apple.com @cn
full:updates-http.cdn-apple.com.akadns.net @cn
full:updates.cdn-apple.com @cn
full:valid.apple.com @cn
full:valid.origin-apple.com.akadns.net @cn
full:weather-data.apple.com @cn
full:weather-data.apple.com.akadns.net @cn
full:weather-map.apple.com @cn

View File

@@ -1,3 +1,4 @@
advertising.apple.com @ads
api-adservices.apple.com @ads
iadsdk.apple.com @ads
iad.apple.com @ads

View File

@@ -7,3 +7,4 @@ full:ocsp.apple.com @cn
full:ocsp2-lb.apple.com.akadns.net @cn
full:ocsp2.apple.com @cn
full:valid.apple.com @cn
full:valid.origin-apple.com.akadns.net @cn

View File

@@ -28,6 +28,7 @@ binancezh.top
# API
binanceapi.com
binanceru.net
bnbstatic.com
bntrace.com
nftstatic.com

View File

@@ -1,11 +1,14 @@
include:fqnovel-ads
ad.toutiao.com @ads
analytics.tiktok.com @ads
bds.snssdk.com @ads
byteadverts.com @ads
ctobsnssdk.com @ads
dig.bdurl.net @ads
extlog.snssdk.com @ads
i.snssdk.com @ads
log.zijieapi.com @ads
mcs.snssdk.com @ads
pangolin-dsp-toutiao-b.com @ads
pangolin-dsp-toutiao.com @ads

View File

@@ -12,14 +12,17 @@ include:atom-data-ads
include:baidu-ads
include:bytedance-ads
include:category-ads-ir
include:cctv @ads
include:clearbit-ads
include:disney @ads
include:dmm-ads
include:duolingo-ads
include:emogi-ads
include:flurry-ads
include:github-ads
include:gamersky @ads
include:google-ads
include:growingio-ads
include:hetzner @ads
include:hiido-ads
include:hotjar-ads
include:hunantv-ads
@@ -37,14 +40,18 @@ include:netease-ads
include:newrelic-ads
include:ogury-ads
include:ookla-speedtest-ads
include:openai @ads
include:openx-ads
include:picacg-ads
include:picacg @ads
include:pikpak @ads
include:pixiv @ads
include:pocoiq-ads
include:pubmatic-ads
include:qihoo360-ads
include:samsung @ads
include:segment-ads
include:sensorsdata-ads
include:sina-ads
include:snap @ads
include:sohu-ads
include:spotify-ads
include:supersonic-ads
@@ -52,6 +59,8 @@ include:tagtic-ads
include:tappx-ads
include:television-ads
include:tencent-ads
include:tendcloud @ads
include:twitter @ads
include:uberads-ads
include:umeng-ads
include:unity-ads
@@ -59,7 +68,7 @@ include:xhamster-ads
include:xiaomi-ads
include:ximalaya-ads
include:yahoo-ads
include:zhihu-ads
include:zhihu @ads
# Other domains for ads serving
51.la
@@ -73,6 +82,7 @@ adbutter.net
addthisedge.com
ads.trafficjunky.net
ads.wteam.xyz
adservice.sigmob.cn
adtechus.com
adtrue.com
adxprtz.com
@@ -192,7 +202,18 @@ reachmax.cn
# 热云数据
reyun.com
# 神策数据
static.sensorsdata.cn
# 诸葛io
zhugeapi.com
zhugeapi.net
zhugeio.com
# 车来了
atrace.chelaile.net.cn
logs.chelaile.net.cn
# 航旅纵横
analytics.umetrip.com
sensors.umetrip.com.cn

View File

@@ -5,6 +5,7 @@
ad-delivery.net @ads
adinplay.com @ads
adnxs.com @ads
adview.cn @ads
ads.trafficjunky.net @ads
advertserve.com @ads
casalemedia.com @ads
@@ -18,7 +19,7 @@ mfadsrvr.com @ads
mgid.com @ads
ns1p.net @ads
pubmatic.com @ads
snapads.com @ads
sigmob.com @ads
spotxchange.com @ads
unimhk.com @ads
upapi.net @ads

View File

@@ -7,10 +7,12 @@ include:elevenlabs
include:google-deepmind
include:groq
include:huggingface
include:liveperson
include:openai
include:perplexity
include:poe
include:xai
include:youmind
# CodeRabbit
coderabbit.ai

View File

@@ -1,9 +1,9 @@
include:boc
include:ccb
include:citic
include:cmb
include:boc @-!cn
include:ccb @-!cn
include:citic @-!cn
include:cmb @-!cn
include:hsbc-cn
include:icbc
include:icbc @-!cn
include:unionpay
abchina.com

View File

@@ -1,42 +1,37 @@
# 远程桌面/远程组网
## 连连控
asklink.com
## EasyTier
easytier.cn
## Oray
oray.com
oray.net
orayer.com
orayimg.com
sunlogin.net
## ToDesk
todesk.com
## 连连控
asklink.com
## 叮当猫脚本管理系统 懒人精灵远程调试
privateapi.xyz
# xEdge干将互联
## ToDesk
todesk.cn
todesk.com
## xEdge干将互联
include:xedge
# 文档协作
## Tower 团队协作
tower.im
## 秀米编辑器
tritoninfo.net
xiumi.us
xiumius.com
## 语雀
nlark.com
yuque.com
## 石墨文档
shimo.im
shimonote.com
smgv.cn
## 语雀
nlark.com
yuque.com
## Tower 团队协作
tower.im
## 秀米编辑器
tritoninfo.net
xiumi.us
xiumius.com
## 吾道
woodo.cn

View File

@@ -79,7 +79,6 @@ include:spaceship
include:st
include:synology
include:symantec
include:tailscale
include:theboringcompany
include:tonec
include:uber

View File

@@ -25,6 +25,7 @@ include:zb
1inch.io
aave.com
bingx.com
bitbank.cc
bitcoin.org
bitfinex.com

View File

@@ -114,7 +114,9 @@ mobatek.net
mpv.io
mysql.com
neovim.io
netfilter.org
newpipe.net
nftables.org
nixos.org
nodesource.com
notepad-plus-plus.org
@@ -138,6 +140,7 @@ shellcheck.net
shields.io
sqlite.org
sublimetext.com
tampermonkey.net
termius.com
unpkg.com
videojs.com

View File

@@ -4,7 +4,7 @@ include:apipost
include:baltamatica
include:cnblogs
include:csdn
include:deepin
include:deepin @-!cn
include:gitee
include:goproxy
include:huawei-dev

View File

@@ -1,3 +1,5 @@
include:category-ecommerce-ru
include:adidas
include:bestbuy
include:booking
@@ -19,7 +21,6 @@ include:momo
include:muji
include:nike
include:nordstrom
include:ozon
include:pchome
include:rakuten
include:ruten
@@ -27,6 +28,7 @@ include:shopee
include:shopify
include:suruga-ya
include:target
include:technogym
include:walmart
include:wish

View File

@@ -0,0 +1,2 @@
include:ozon
include:wildberries

View File

@@ -5,6 +5,7 @@ include:applysquare
include:hugecore
include:hujiang
include:koolearn
include:schoopia
include:shanbay
include:xueersi
include:yuanfudao

View File

@@ -188,3 +188,6 @@ emby1.69yun69.com
# 云梯
yunti.online
# 守候网络
server2.cn2gias.uk

View File

@@ -1,5 +1,7 @@
# This list contains services related to entertainment & games & music & podcasts & videos outside China mainland.
include:category-acg
include:category-entertainment-ru
include:category-games-!cn
include:category-novel
@@ -46,7 +48,6 @@ include:mytvsuper
include:netflix
include:niconico
include:now
include:okko
include:olevod
include:pbs
include:pixiv
@@ -54,7 +55,6 @@ include:plutotv
include:pocketcasts
include:primevideo
include:roku
include:rutube
include:showtimeanytime
include:sling
include:sonypictures
@@ -105,6 +105,9 @@ bag.itunes.apple.com
bookeeper.itunes.apple.com
# Entertainment oriented media
# This section references the "Source Considerations" page on the Chinese Wikipedia:
# - https://zh.wikipedia.org/wiki/WikiProject:电子游戏/来源考量
# - https://zh.wikipedia.org/wiki/WikiProject:ACG/來源考量
## 4Gamer.net
4gamer.net
## 4Gamers
@@ -117,20 +120,28 @@ appget.com
appmedia.jp
## Automaton
automaton-media.com
## 橙心社
cxacg.com
## 电faminicogamer
denfaminicogamer.jp
## ASCII Media Works
dengekionline.com
## E-ROAD
eroge-road.com
## esports.gg
esports.gg
## ファミ通
famitsu.com
## GameApps.HK
gameapps.hk
## 遊戲基地
gamebase.com.tw
## IID, Inc.
gamebusiness.jp
gamespark.jp
inside-games.jp
## Game Focus
gamefocus.co.kr
## GameMeca
gamemeca.com
## Gameover有機網
@@ -142,6 +153,8 @@ onlinegamer.jp
greatgame.asia
## HobbiGame
hobbigame.com
## ゲーム文化保存研究所
igcc.jp
## IGN
ign.com
ignimg.com
@@ -153,18 +166,30 @@ mediaclip.jp
maedahiroyuki.com
## MANTANWEB
mantan-web.jp
## モエデジ
moedigi.com
## Moepedia
moepedia.net
## マイナビニュース
mynavi.jp
## Openbook阅读通
openbook.org.tw
## QooApp
qoo-app.com
## Real Sound
realsound.jp
## れポたま!
repotama.com
## Saiga NAK
saiganak.com
## SQOOL
sqool.net
## The Games Daily
tgdaily.co.kr
## Thisisgame
thisisgame.com
## 玩具人
toy-people.com
## Wanuxi
wanuxi.com
## よろず〜

View File

@@ -6,7 +6,7 @@ include:aamgame
include:acfun
include:acplay
include:bestv
include:bilibili
include:bilibili @-!cn
include:ciweimao
include:dedao
include:douyin
@@ -18,7 +18,7 @@ include:gamersky
include:gitv
include:hunantv
include:huya
include:iqiyi
include:iqiyi @-!cn
include:ku6
include:kuaikan
include:kuaishou
@@ -89,6 +89,8 @@ motie.com
motieimg.com
# 梨视频
pearvideo.com
# 皮皮网
pipi.cn
# SF轻小说二次元
sfacg.com
# 书海小说
@@ -109,6 +111,9 @@ zhulang.com
zongheng.com
# 娱乐资讯媒体
# 该部分参考了中文维基百科的「来源考量」:
# - https://zh.wikipedia.org/wiki/WikiProject:电子游戏/来源考量
# - https://zh.wikipedia.org/wiki/WikiProject:ACG/來源考量
include:tgbus
include:vgtime
@@ -143,11 +148,15 @@ ign.com.cn
nadianshi.com
## 游戏日报
news.yxrb.net
## 手谈姬
shoutanjjj.com
## 游戏机实用技术
ucg.cn
## 游戏茶馆
youxichaguan.com
## 游戏葡萄
youxiputao.com
## 游戏陀螺
youxituoluo.com
## 游研社
yystv.cn

View File

@@ -0,0 +1,3 @@
include:okko
include:rutube
include:wink

View File

@@ -12,6 +12,7 @@ include:itiger
include:longbridge
include:n26
include:schwab
include:standardchartered
include:wise
fxcorporate.com

View File

@@ -5,6 +5,7 @@ include:curseforge
include:cygames
include:ea
include:embark
include:eneba
include:epicgames
include:escapefromtarkov
include:faceit
@@ -24,12 +25,14 @@ include:pandanet
include:pinkcore
include:playstation
include:projectsekai
include:pubg
include:purikonejp
include:riot
include:roblox
include:rockstar
include:snk
include:steam
include:steaminventoryhelper
include:steamunlocked
include:supercell
include:ubisoft
@@ -38,6 +41,7 @@ include:wbgames
include:xbox
include:ynoproject
dinopoloclub.com
dodi-repacks.download
dodi-repacks.site
fabricmc.net
@@ -48,8 +52,10 @@ humblebundle.com
joinsquad.com
loverslab.com
minecraft.wiki
mobimon.com.tw
nexus-cdn.com
nexusmods.com
noxygames.com
offworldindustries.com
offworldindustries.net
papermc.io
@@ -57,5 +63,7 @@ planetminecraft.com
prismlauncher.org
protondb.com
quiltmc.org
rayark.download
rayark.net
speedrun.com
steamdb.info

View File

@@ -9,13 +9,15 @@ include:mihoyo-cn
include:tencent-games
include:tiancity
include:vrzwk
include:xd
include:xd @-!cn
include:yokaverse
# 北京奇客创想科技有限公司
7k7k.com
# 刀锋盒子 皖B2-20190103-4
9xgame.com
# 韵律谱面研究站 桂ICP备20001846号-3
arcaea.cn
# 《异象回声》游戏官网 沪ICP备2023010411号-1
astral-vector.com
# 九九互动 粤ICP备19068416号
@@ -26,14 +28,16 @@ fxt365.com
gameabc.com
# 游戏魅 合肥启云软件 皖B2-20160087-3
gamemei.com
# Enhance Gaming
heavenlywind.cc
# 乐都网 浙ICP备2024091002号-2
ledu.com
# 龙图游戏 京ICP备11023195号
longtugame.com
# 北京慕飞科技 京ICP备20006112号-2
morefreegame.com
# Enhance Gaming
heavenlywind.cc
# Phira
phira.cn
# 沪ICP备18041304号-1
tgpro.top
tgprocs.net

View File

@@ -10,3 +10,6 @@ yctdyy.com
# 南方医科大学深圳医院
smuszh.com
# 四川大学华西医院
cd120.com

View File

@@ -112,6 +112,7 @@ hkej.com
hkgpao.com
hongkongfp.com
inmediahk.net
inquirer.net
inside.com.tw
itmedia.co.jp
jfengtime.com
@@ -120,6 +121,7 @@ limedia.tw
localpresshk.com
ltsports.com.tw
macaodaily.com
maidonanews.jp
mdnkids.com
mirrormedia.com.tw
mirrormedia.mg
@@ -158,6 +160,7 @@ tnntoday.com
tvbs.com.tw
tvmost.com.hk
twgreatnews.com
twreporter.org
unwire.hk
upmedia.mg
vjmedia.com.hk

View File

@@ -16,6 +16,8 @@ include:ynet
21jingji.com
# 站长网
admin5.com
# 安徽新闻
anhuinews.com
# 锋潮科技
anzhuo.cn
# 鞭牛士
@@ -55,6 +57,8 @@ cztv.com
cztvcdn.com
cztvcloud.com
zjstv.com
# 读特新闻
dutenews.com
# 大智慧
dzh.com.cn
gw.com.cn
@@ -169,6 +173,9 @@ ssimg.cn
stockstar.com
# 证券时报网
stcn.com
# 深圳报业集团
sznews.com
szpgm.com
# 大公网/大公报
takungpao.com
# TechWeb

View File

@@ -2,6 +2,7 @@ include:agilebits # 1password
include:bitwarden
include:lastpass
authpass.app
authy.com
dashlane.com
enpass.io

View File

@@ -0,0 +1,3 @@
include:ngrok
include:pinggy
include:tailscale

View File

@@ -141,6 +141,9 @@ lemonhd.org
# 备胎
beitai.pt
# NexusHD
nexushd.org
bitpt.cn
hdarea.club
hdchina.org

View File

@@ -117,6 +117,7 @@ full:music-torrent.net
full:mvgforumtracker.mvgroup.org
full:mvgroup.org
full:new-line.net
full:nnmclub.to
full:nyaa.tracker.wf
full:odd-hd.fr
full:oh.fuuuuuck.com
@@ -410,34 +411,6 @@ full:udp.tracker.projectk.org
full:wepzone.net
full:wg.mortis.me
full:ws.peer.ooo
full:www.all4nothin.net
full:www.bit-hdtv.com
full:www.bitseduce.com
full:www.biztorrents.com
full:www.blackcats-games.net
full:www.elitezones.ro
full:www.freerainbowtables.com
full:www.genesis-sp.org
full:www.learnbits.me
full:www.legittorrents.info
full:www.megatorrents.kg
full:www.mvgroup.org
full:www.peckservers.com
full:www.shnflac.net
full:www.siambt.com
full:www.thegeeks.bz
full:www.theoccult.bz
full:www.theplace.bz
full:www.thetradersden.org
full:www.thevault.bz
full:www.torrent.eu.org
full:www.torrentsnipe.info
full:www.tribalmixes.com
full:www.tvnihon.com
full:www.worldboxingvideoarchive.com
full:www.xwt-classics.net
full:www.yuwabits.net
full:www.zone-torrent.net
full:xbtrutor.com
full:xtremewrestlingtorrents.net
full:y.paranoid.agency
@@ -446,3 +419,32 @@ full:yggtracker.i2p.rocks
full:yolo.liberbear.com
full:z.paranoid.agency
full:zupix.online
all4nothin.net
bit-hdtv.com
bitseduce.com
biztorrents.com
blackcats-games.net
elitezones.ro
freerainbowtables.com
genesis-sp.org
learnbits.me
legittorrents.info
megatorrents.kg
mvgroup.org
peckservers.com
shnflac.net
siambt.com
thegeeks.bz
theoccult.bz
theplace.bz
thetradersden.org
thevault.bz
torrent.eu.org
torrentsnipe.info
tribalmixes.com
tvnihon.com
worldboxingvideoarchive.com
xwt-classics.net
yuwabits.net
zone-torrent.net

6
data/category-retail-ru Normal file
View File

@@ -0,0 +1,6 @@
# Fix Price
fix-price.com
# Lenta
lenta.com
lenta.tech

View File

@@ -16,18 +16,31 @@ xn--p1ai
ru.com
ru.net
include:category-ecommerce-ru
include:category-entertainment-ru
include:category-gov-ru
include:category-retail-ru
# Public transportation
include:mosmetro
include:avito
include:mailru-group
include:okko
include:ozon
include:rutube
include:wildberries
include:wink
include:x5
include:yandex
# Anime
animevost.org
seasonvar.ru
# Dodo Pizza
dodopizza.ru
dodopizza.com
dodostatic.net
dodois.com
dodois.io
# Rostics
rostics.ru
uni.rest
unirest.tech
trbcdn.net
tbank-online.com
taxsee.com

View File

@@ -52,6 +52,7 @@ hwshu.com # 瀚文民国书库
hytung.cn # 瀚堂典藏古籍
incopat.com # incoPat 专利数据库
lawyee.org # 北大法意网 中国法律资料库
libvideo.com # 知识视界 武汉缘来文化
neohytung.com # 瀚堂近代报刊
nmrdata.com # 微谱数据
nssd.cn # 国家哲学社会科学学术期刊数据库
@@ -67,5 +68,3 @@ unihan.com.cn # 书同文
wenxin-ge.com # 文心阁古籍全文数据库
wind.com.cn # Wind 资讯金融
yiigle.com # 中华医学期刊全文数据库
full:www.libvideo.com # 武汉缘来文化-知识视界

View File

@@ -6,7 +6,7 @@ include:gracg
include:hupu
include:meipian
include:okjike
include:sina
include:sina @-!cn
include:xiaohongshu
include:yy
include:zhihu
@@ -21,3 +21,6 @@ dandanvoice.com
# 脉脉
maimai.cn
taou.com
# 知识星球
zsxq.com

View File

@@ -39,3 +39,5 @@ zggbdszt.cn
zggbdszt.com.cn
zggbdszt.net.cn
zygbdszt.net.cn
ad.cctv.com @ads

View File

@@ -13,11 +13,21 @@ migucloud.com
migufun.com
miguvideo.com
# 中移金科
cmft.com.cn
# 中移在线
cmcc-cs.cn
online-cmcc.cn
# 中移互联
andfx.cn
andfx.net
cmicapm.com
cmicrwx.cn
cmicvip.cn
cmpassport.com
cytxl.com.cn
fetion-portal.com
fetionpic.com
mmarket.com

View File

@@ -23,3 +23,4 @@ wo.com.cn
wo116114.com
wocloud.com.cn
woread.com.cn
wosms.cn

View File

@@ -2,33 +2,44 @@ include:cloudflare-cn
include:cloudflare-ipfs
argotunnel.com
browser.run
cfargotunnel.com
cfdata.org
cfl.re
cloudflare-dns.com
cloudflare-ech.com
cloudflare-esni.com
cloudflare-gateway.com
cloudflare-quic.com
cloudflare-terms-of-service-abuse.com
cloudflare.com
cloudflare.dev
cloudflare.net
cloudflare.tv
cloudflareaccess.com
cloudflareapps.com
cloudflarebolt.com
cloudflarebrowser.com
cloudflarechallenge.com
cloudflareclient.com
cloudflarecp.com
cloudflareinsights.com
cloudflareok.com
cloudflarepartners.com
cloudflareportal.com
cloudflarepreview.com
cloudflareregistrar.com
cloudflareresearch.com
cloudflareresolve.com
cloudflaressl.com
cloudflarestatus.com
cloudflarestorage.com
cloudflarestream.com
cloudflaresupport.com
cloudflaretest.com
cloudflarewarp.com
cloudflareworkers.com
encryptedsni.com
every1dns.net
imagedelivery.net
isbgpsafeyet.com

2
data/eneba Normal file
View File

@@ -0,0 +1,2 @@
eneba.com
eneba.games

View File

@@ -46,16 +46,20 @@ ntd.com
ntd.tv
ntdca.com
ntdimg.com
ntdtv-dc.com
ntdtv.ca
ntdtv.co.il
ntdtv.co.kr
ntdtv.com
ntdtv.com.tw
ntdtv.fr
ntdtv.jp
ntdtv.kr
ntdtv.org
ntdtv.ru
ntdtv-dc.com
ntdtv.se
ntdtvla.com
ntdvideo.tw
ntdvn.com
persianepochtimes.com
renminbao.com

View File

@@ -3,15 +3,13 @@
# AI Chat
include:category-ai-!cn
# Anime, Comics & Games
include:category-acg
# Advertisment & Analytics
include:pubmatic
include:taboola
# Anti-censorship & Anti-GFW & Privacy protection & VPN tools
include:category-anticensorship
include:category-proxy-tunnels
# Art & Design & Photography
include:artstation
@@ -104,6 +102,8 @@ include:w3schools
include:zotero
chemequations.com # 线上化学方程式!
geogebra.org
wolframalpha.com
# Entertainment & Games & Music & Podcasts & Videos
include:category-entertainment
@@ -246,29 +246,31 @@ include:zeplin
include:zoho
include:zoom
biliplus.com # BiliPlus
# Graphing for Science and Engineering
originlab.com
# Online LaTeX Editor
cloudlatex.io
overleaf.com
# Translator & Dictionary
include:linguee
collinsdictionary.com
ldoceonline.com
immersivetranslate.com # 沉浸式翻译 (国际版)
# Aurora Open Source Software (https://gitlab.com/AuroraOSS)
## Aurora Open Source Software (https://gitlab.com/AuroraOSS)
auroraoss.com
# CookiePro, provides cookies and tracking
## BiliPlus
biliplus.com
## CataBoom
cataboom.com
## Consent Management Platforms / Cookie service
consentpro.com
cookiepro.com
cookielaw.org
onetrust.com
osano.com
usercentrics.eu
## Greasy Fork
greasyfork.org
## Online LaTeX Editor
cloudlatex.io
overleaf.com
## Translator & Dictionary
include:linguee
collinsdictionary.com
ldoceonline.com
immersivetranslate.com # 沉浸式翻译 (国际版)
## OriginLab (Graphing for Science and Engineering)
originlab.com
# Software development
include:category-dev
@@ -284,9 +286,7 @@ include:nyaa
include:piratebay
include:rarbg
dmhy.org
# User scripts
greasyfork.org
rutor.info
# VPN services
include:category-vpnservices
@@ -302,6 +302,7 @@ include:wikimedia
atwiki.jp
touhouwiki.net
wiki.gg
# Others
include:avaxhome

View File

@@ -26,6 +26,9 @@ include:getui
include:jiguang
include:umeng
# 神策数据
sensorsdata.cn
# category-httpdns-cn is mainly for advertising purpose
include:category-httpdns-cn
@@ -35,9 +38,9 @@ include:category-httpdns-cn
# Bank & Finance & Insurance & Securities
include:category-bank-cn
include:category-securities-cn
include:eastmoney
include:eastmoney @-!cn
include:everbright
include:pingan
include:pingan @-!cn
include:taikang
## 航财通·校园付
@@ -89,11 +92,11 @@ pkoplink.com
# E-commerce
include:58tongcheng
include:ctrip
include:ctrip @-!cn
include:dangdang
include:dewu
include:dewu @-!cn
include:dongjiao
include:jd
include:jd @-!cn
include:lianjia
include:meituan
include:miaomiaozhe
@@ -108,6 +111,8 @@ include:ziroom
## 无忧易售
51selling.com
## 爱回收
aihuishou.com
## 唯品会
appsimg.com
appvipshop.com
@@ -176,6 +181,7 @@ znds.com # 智能电视网
423down.com # 423Down
acwifi.net # 路由器技术分享
appinn.com # 小众软件
chongdiantou.com # 充电头网
ghxi.com # 果核剥壳
iplaysoft.com # 异次元软件世界
@@ -227,8 +233,14 @@ xiamenair.com # 厦门航空
12306.cn
95306.cn
ccrgt.com
## 北京市政交通一卡通
bmac.com.cn
## 车来了
chelaile.net.cn
## 跨境巴士
kuajing84.com
## 掌上公交
mygolbs.com
## 宁停车
ningtingche.com
## 航旅纵横
@@ -312,27 +324,46 @@ include:zhubajie
## 容联七陌 客服 营销
7moor-fs1.com
7moor.com
## Alook 浏览器
alookweb.com
## 安兔兔
antutu.com
antutu.net
## 拓竹科技
bambulab.com
bblmw.com
## BOSS 直聘
bosszhipin.com
zhipin.com
## 下厨房
chuimg.com
xiachufang.com
## 天润融通 AI外呼 客服
clink.cn
## 当贝
dangbei.com
dangbei.net
## DCloud 数字天堂
dcloud.io
dcloud.net.cn
## 酷控
deepepg.com
kookong.com
## 滴答清单
dida365.com
## 兑吧
dui88.com
duiba.com.cn
## 快应用
hapjs.org
quickapp.cn
## 乐播投屏
hpplay.cn
lbtp.com
lebo.cn
lebo.com.cn
lebo.top
mirrorcast.cn
## 货拉拉
huolala.cn
## 火绒
@@ -370,6 +401,8 @@ soboten.com
tacool.com
## Via 浏览器
viayoo.com
## X 浏览器
xbext.com
## 印象笔记
yinxiang.com
## 智联招聘
@@ -378,19 +411,19 @@ zhaopin.cn
# Tech companies & Orginations
include:aisiku # 北京艾斯酷科技有限公司
include:akiko # 秋子酱科技
include:alibaba
include:alibaba @-!cn
include:baidu
include:beisen
include:bluepoch
include:bytedance
include:didi
include:bytedance @-!cn
include:didi @-!cn
include:dingdatech # 叮哒出行(杭州金通互联科技有限公司)
include:dji
include:gree
include:haier
include:hikvision
include:honor
include:huawei
include:huawei @-!cn
include:hupun # 杭州湖畔网络技术有限公司
include:iflytek
include:ishumei # 北京数美时代科技有限公司
@@ -402,14 +435,14 @@ include:meizu
include:midea
include:narwal # 云鲸科技
include:netease
include:oppo
include:oppo @-!cn
include:qihoo360
include:sumkoo #北京尚古创新科技有限公司
include:tcl
include:tencent
include:tencent @-!cn
include:tongfang
include:vivo
include:xiaomi
include:vivo @-!cn
include:xiaomi @-!cn
include:xunlei
include:youquan # 祐全科技
include:yuanbei # 上海圆贝信息科技有限公司
@@ -429,6 +462,10 @@ suzuki-china.com # 铃木中国官网
udesk.cn # 沃丰科技
ysjf.com # 影视飓风
# 飞牛
fnnas.com
fnnas.net
fnos.net
# 稿定(厦门)信息服务有限公司
## 花瓣网 闽ICP备2021013850号
huaban.com
@@ -442,13 +479,20 @@ xsbapp.cn
# Telecommunication
include:chinabroadnet
include:chinamobile
include:chinatelecom
include:chinamobile @-!cn
include:chinatelecom @-!cn
include:chinatower
include:chinaunicom
include:chinaunicom @-!cn
# 在线工具
include:ipip # IPIP ip地理位置数据库
## IPIP ip地理位置数据库
include:ipip @-!cn
## 白描
baimiao.tech
baimiaoapp.com
shinescan.tech
uzero.cn
chaziyu.com # 滇ICP备2024035496号
fofa.info # Fofa网站测绘华顺信安
@@ -645,7 +689,6 @@ apk3.com
apk8.com
aplaybox.com
appchina.com
appinn.com
arpun.com
asklib.com
babytree.com
@@ -1351,7 +1394,6 @@ xdqtech.com # 上邻 | 新渡桥科技 浙ICP备2020031247号-1
xdtool.com # 闽ICP备2024056202号-4
xdwan.com
xfdown.com
xiachufang.com
xiaobaixitong.com
xiaoe-tech.com
xiaogouh5.com

View File

@@ -544,11 +544,13 @@ full:google-ohttp-relay-safebrowsing.fastly-edge.com
# Domains and services below are available in China mainland
# Use in config file like this: "geosite:google@cn"
gvt1-cn.com @cn
gvt2-cn.com @cn
full:www.recaptcha.net @cn
full:safebrowsing-cache.google.com @cn
# The rules below are from https://github.com/felixonmars/dnsmasq-china-list/blob/master/google.china.conf
# Revision: 1f28a2d5789f411c13de69837bb354f4b21e58ff
# Revision: 1c2d107d4e7eaa0b192e08bb0beddde4aab247f6
# Duplicates removed
# Use in config file like this: "geosite:google@cn"
full:265.com @cn
full:2mdn-cn.net @cn
@@ -578,7 +580,6 @@ full:cnappinstall.googleadapis.com @cn
full:connectivitycheck.gstatic.com @cn
full:content.googleadapis.com @cn
full:crashlyticsreports-pa.googleapis.com @cn
full:crl.pki.goog @cn
full:csi.gstatic.com @cn
full:dartsearch-cn.net @cn
full:dg-meta.video.google.com @cn
@@ -590,7 +591,6 @@ full:download.mlcc.google.com @cn
full:download.qatp1.net @cn
full:download.tensorflow.google.com @cn
full:emmapplecodevice.googleapis.com @cn
full:firebase-settings.crashlytics.com @cn
full:fontfiles.googleapis.com @cn
full:fonts.googleapis.com @cn
full:fonts.gstatic.com @cn
@@ -629,10 +629,8 @@ full:logger-dev.corp.google.com @cn
full:logger.corp.google.com @cn
full:login.corp.google.com @cn
full:monitoring.qpdp1.net @cn
full:ocsp.pki.goog @cn
full:pagead-googlehosted.l.google.com @cn
full:performanceparameters.googleapis.com @cn
full:pki-goog.l.google.com @cn
full:prod-controlbe.floonet.goog @cn
full:prod-databe.floonet.goog @cn
full:prod.databe.floonet.goog @cn
@@ -651,7 +649,6 @@ full:redirector.bdn.dev @cn
full:redirector.c.chat.google.com @cn
full:redirector.c.mail.google.com @cn
full:redirector.c.pack.google.com @cn
full:redirector.c.play.google.com @cn
full:redirector.c.youtubeeducation.com @cn
full:redirector.gcpcdn.gvt1.com @cn
full:redirector.gvt1.com @cn
@@ -690,6 +687,3 @@ full:www.destinationurl.com @cn
full:www.gstatic.com @cn
full:www.pxcc.com @cn
full:xn--flw351e.com @cn
gvt1-cn.com @cn
gvt2-cn.com @cn

View File

@@ -16,12 +16,21 @@ full:webchannel-alkalimakersuite-pa.clients6.google.com
generativeai.google
makersuite.google.com
ai.studio
aistudio.google.com
bard.google.com
gemini.google
gemini.google.com
# Gemini Code Assist
# https://docs.cloud.google.com/gemini/docs/codeassist/set-up-gemini
full:cloudaicompanion.googleapis.com
full:cloudcode-pa.googleapis.com
full:daily-cloudcode-pa.googleapis.com
# NotebookLM
full:notebooklm-pa.googleapis.com
full:notebooklm.googleapis.com
notebooklm.google
notebooklm.google.com
@@ -31,6 +40,7 @@ jules.google.com
# Google AI Labs
labs.google
labs.google.com
aisandbox-pa.googleapis.com
# Android Studio Gemini Code Assist
@@ -39,3 +49,9 @@ aida.googleapis.com
# Opal
opal.google
opal.google.com
# Antigravity
full:antigravity-pa.googleapis.com
full:antigravity.googleapis.com
antigravity.google
antigravity-unleash.goog

View File

@@ -1,23 +1,23 @@
bisheng.cn @cn
bishengcompiler.cn @cn
devui.design @cn
gneec.com @cn
gneec.com.cn @cn
gneec3.com @cn
gneec4.com @cn
gneec7.com @cn
harmonyos.com @cn
hiascend.cn @cn
hiascend.com @cn
hiclc.com @cn
hikunpeng.cn @cn
hikunpeng.com @cn
hikunpeng.com.cn @cn
hikunpeng.net @cn
hisilicon.com @cn
hisilicon.com.cn @cn
huaweiapaas.com @cn
mindspore.cn @cn
owsgo.com @cn
teleows.com @cn
saasops.tech @cn
bisheng.cn
bishengcompiler.cn
devui.design
gneec.com
gneec.com.cn
gneec3.com
gneec4.com
gneec7.com
harmonyos.com
hiascend.cn
hiascend.com
hiclc.com
hikunpeng.cn
hikunpeng.com
hikunpeng.com.cn
hikunpeng.net
hisilicon.com
hisilicon.com.cn
huaweiapaas.com
mindspore.cn
owsgo.com
saasops.tech
teleows.com

View File

@@ -3,6 +3,7 @@
5566ua.com
aurorapush.cn
e0n.cn
easytomessage.com
japps.cn
jchat.io
jiguang.cn

View File

@@ -1,2 +1,2 @@
kechuang.org
full:kc.kexinshe.com @cn
kexinshe.com

View File

@@ -1,4 +1,4 @@
kurogames.com @cn
kurogames.com
# Wuthering Waves
aki-game.com @cn
aki-game.com

2
data/liveperson Normal file
View File

@@ -0,0 +1,2 @@
liveperson.net
lpsnmedia.net

View File

@@ -6,3 +6,4 @@ include:vk
boosty.to
donationalerts.com
memealerts.com
tamtam.chat

View File

@@ -1,3 +1,5 @@
include:github-ads
browser.events.data.msn.cn @ads
browser.events.data.msn.com @ads
clarity.ms @ads

2
data/mosmetro Normal file
View File

@@ -0,0 +1,2 @@
mosmetro.ru
mosmetro.tech

9
data/ngrok Normal file
View File

@@ -0,0 +1,9 @@
ngrok-free.app
ngrok-free.dev
ngrok-free.pizza
ngrok.app
ngrok.com
ngrok.dev
ngrok.io
ngrok.pizza
ngrok.pro

View File

@@ -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

View File

@@ -1,6 +1,7 @@
# Main domain
chatgpt.com
chat.com
chatgpt.com
crixet.com
oaistatic.com
oaiusercontent.com
openai.com
@@ -10,13 +11,13 @@ sora.com
openai.com.cdn.cloudflare.net
full:openaiapi-site.azureedge.net
full:openaicom-api-bdcpf8c6d2e9atf6.z01.azurefd.net
full:openaicom.imgix.net
full:openaicomproductionae4b.blob.core.windows.net
full:production-openaicom-storage.azureedge.net
regexp:^chatgpt-async-webps-prod-\S+-\d+\.webpubsub\.azure\.com$
# tracking
full:o33249.ingest.sentry.io @ads
full:openaicom.imgix.net @ads
full:browser-intake-datadoghq.com @ads
# Advanced Voice

View File

@@ -1,5 +1,3 @@
include:picacg-ads
bikaa.xyz
bikac.xyz
bikaios.xyz
@@ -14,3 +12,6 @@ wikawika.xyz
# Image Resource Domain like `img.diwodiwo.xyz` `s3.diwodiwo.xyz` `storage.diwodiwo.xyz` `storage-b.diwodiwo.xyz`
diwodiwo.xyz
# Ad Domain
full:ad-channel.diwodiwo.xyz @ads
full:ad-display.diwodiwo.xyz @ads

View File

@@ -1,2 +0,0 @@
full:ad-channel.diwodiwo.xyz @ads
full:ad-display.diwodiwo.xyz @ads

2
data/pinggy Normal file
View File

@@ -0,0 +1,2 @@
pinggy.io
pinggy.link

5
data/pubg Normal file
View File

@@ -0,0 +1,5 @@
kraftonde.com
playbattlegrounds.com
pubg.com
full:pubg1.battleye.com

View File

@@ -1,3 +1,4 @@
c.sayhi.360.cn @ads
fenxi.360.cn @ads
fenxi.com @ads
lianmeng.360.cn @ads

View File

@@ -8,6 +8,7 @@ galaxyappstore.com
galaxymobile.jp
game-platform.net
knoxemm.com
ospserver.net
samsung.com
samsungads.com @ads
samsungapps.com

4
data/schoopia Normal file
View File

@@ -0,0 +1,4 @@
# 翻转校园 河南昱荣教育科技有限公司 豫ICP备2021021028号
schoopia.com
# 同学派 翻转校园app内置服务
tongxuepie.com

View File

@@ -1 +0,0 @@
static.sensorsdata.cn @ads

4
data/standardchartered Normal file
View File

@@ -0,0 +1,4 @@
sc.com
standardchartered.com
full:standchartbank.sc.omtrdc.net
full:standchartbank.tt.omtrdc.net

View File

@@ -0,0 +1,3 @@
sih-db.com
sih.app
steaminventoryhelper.com

View File

@@ -1,3 +1,4 @@
tapapks.com
tapimg.com
tapimg.net
taptap.cn

9
data/technogym Normal file
View File

@@ -0,0 +1,9 @@
# data source: https://crt.sh/?id=17424181
letsmoveforabetterworld.com
technogym.bg
technogym.ch
technogym.com
technogym.com.br
technogym.ru
technogym.su
wellnessinstitute.com

View File

@@ -1,4 +1,5 @@
ad.hpplay.cn @ads
adc.hpplay.cn @ads
adeng.hpplay.cn @ads
ads-uo.api.leiniao.com @ads
ads-ut.api.leiniao.com @ads

View File

@@ -79,3 +79,14 @@ fymallqa3.com
fymallqa4.com
fymallqa7.com
fymallqa9.com
tdnsdl1.cn
tdnsdl1.com.cn
tdnsdl2.cn
tdnsdl2.com.cn
tdnsdl3.cn
tdnsdl3.com.cn
tdnsdl4.cn
tdnsdl4.com.cn
tdnsdl5.cn
tdnsdl5.com.cn

View File

@@ -1,6 +1,7 @@
ad.browser.qq.com @ads
ad.qq.com @ads
ad.qun.qq.com @ads
ad.tencentmusic.com @ads
ad.weixin.qq.com @ads
adfilter.imtt.qq.com @ads
adnet.qq.com @ads
@@ -33,18 +34,24 @@ isdspeed.qq.com @ads
log.tbs.qq.com @ads
mdt.qq.com @ads
monitor.music.qq.com @ads
monitor.uu.qq.com @ads
mpush.qq.com @ads
mtrace.qq.com @ads
pgdt.gtimg.cn @ads
pingjs.qq.com @ads
pmir.3g.qq.com @ads
push.qq.com @ads
qqdata.ab.qq.com @ads
report.qqweb.qq.com @ads
report.tencentmusic.com @ads
rmonitor.qq.com @ads
sngmta.qq.com @ads
stat.y.qq.com @ads
tajs.qq.com @ads
tcss.qq.com @ads
tmead.y.qq.com @ads
tmeadcomm.y.qq.com @ads
tpstelemetry.tencent.com @ads
trace.qq.com @ads
ugdtimg.com @ads
wit.qq.com @ads

View File

@@ -11,4 +11,4 @@ tencentcloud.com
tjstats.com
wegamedeveloper.com
weixinbridge.com
weui.io @cn
weui.io

View File

@@ -2,3 +2,5 @@ tendcloud.com
talkingdata.com
talkinggame.com
cpatrk.net
tdsdk.cpatrk.net @ads

View File

@@ -1,2 +1,7 @@
1024terabox.com
bestclouddrive.com
freeterabox.com
nephobox.com
terabox.com
terabox1024.com
teraboxcdn.com

View File

@@ -107,6 +107,7 @@ volcfcdnrd.com
volcfcdnsc.com
volcfxgjrtm.com
volcgroup.com
volcgslb-mlt.com
volcgslb.com
volcgtm.com
volciad.com

View File

@@ -6,4 +6,4 @@ wb.ru
wbbasket.ru
wbpay.ru
wibes.ru
wildberries.ru
wildberries.ru

View File

@@ -1,5 +1,6 @@
include:askdiandian
rednotecdn.com
xhscdn.com
xhscdn.net
xhslink.com

View File

@@ -1,5 +1,6 @@
include:xiaomi-ads
include:xiaomi-ai
include:xiaomi-iot
mgslb.com
mi-idc.com

View File

@@ -14,6 +14,8 @@ logupdate.avlyun.sec.miui.com @ads
misc.in.duokanbox.com @ads
sentry.d.mi.com @ads
sentry.d.xiaomi.net @ads
stats.music.xiaomi.com @ads
tjqonline.cn @ads
tracker.ai.xiaomi.com @ads
tracker.xiaomixiaoai.com @ads
tracking.miui.com @ads

5
data/xiaomi-iot Normal file
View File

@@ -0,0 +1,5 @@
# Xiaomi IoT Services
account.xiaomi.com
cn-ha.mqtt.io.mi.com
ha.api.io.mi.com
miot-spec.org

View File

@@ -1,2 +1,5 @@
xv-ru.com
xvideos-ar.com
xvideos-cdn.com
xvideos-india.com
xvideos.com

4
data/youmind Normal file
View File

@@ -0,0 +1,4 @@
# Youmind
youmind.ai
youmind.com
youmind.site

View File

@@ -1,3 +1,10 @@
# 掌淘
mob.com
dutils.com
sharesdk.cn
# 游昆
accuratead.cn
dutils.com
hiaiabc.com
mobsdks.com
yksdks.com

View File

@@ -1,4 +1,5 @@
include:zhihu-ads
zhihu.com
zhimg.com
crash2.zhihu.com @ads
zhihu-web-analytics.zhihu.com @ads

View File

@@ -1,2 +0,0 @@
crash2.zhihu.com @ads
zhihu-web-analytics.zhihu.com @ads

9
internal/dlc/dlc.go Normal file
View File

@@ -0,0 +1,9 @@
package dlc
const (
RuleTypeDomain string = "domain"
RuleTypeFullDomain string = "full"
RuleTypeKeyword string = "keyword"
RuleTypeRegexp string = "regexp"
RuleTypeInclude string = "include"
)

610
main.go
View File

@@ -7,9 +7,10 @@ import (
"os"
"path/filepath"
"regexp"
"sort"
"slices"
"strings"
"github.com/v2fly/domain-list-community/internal/dlc"
router "github.com/v2fly/v2ray-core/v5/app/router/routercommon"
"google.golang.org/protobuf/proto"
)
@@ -21,294 +22,361 @@ var (
exportLists = flag.String("exportlists", "", "Lists to be flattened and exported in plaintext format, separated by ',' comma")
)
const (
RuleTypeDomain string = "domain"
RuleTypeFullDomain string = "full"
RuleTypeKeyword string = "keyword"
RuleTypeRegexp string = "regexp"
RuleTypeInclude string = "include"
var (
refMap = make(map[string][]*Entry)
plMap = make(map[string]*ParsedList)
finalMap = make(map[string][]*Entry)
cirIncMap = make(map[string]bool) // Used for circular inclusion detection
)
type Entry struct {
Type string
Value string
Attrs []*router.Domain_Attribute
Attrs []string
Plain string
Affs []string
}
type List struct {
Name string
Entry []Entry
type Inclusion struct {
Source string
MustAttrs []string
BanAttrs []string
}
type ParsedList struct {
Name string
Inclusion map[string]bool
Entry []Entry
Name string
Inclusions []*Inclusion
Entries []*Entry
}
func (l *ParsedList) toPlainText(listName string) error {
var entryBytes []byte
for _, entry := range l.Entry {
var attrString string
if entry.Attrs != nil {
for _, attr := range entry.Attrs {
attrString += "@" + attr.GetKey() + ","
}
attrString = strings.TrimRight(":"+attrString, ",")
}
// Entry output format is: type:domain.tld:@attr1,@attr2
entryBytes = append(entryBytes, []byte(entry.Type+":"+entry.Value+attrString+"\n")...)
}
if err := os.WriteFile(filepath.Join(*outputDir, listName+".txt"), entryBytes, 0644); err != nil {
return err
}
return nil
}
func (l *ParsedList) toProto() (*router.GeoSite, error) {
func makeProtoList(listName string, entries []*Entry) (*router.GeoSite, error) {
site := &router.GeoSite{
CountryCode: l.Name,
CountryCode: listName,
Domain: make([]*router.Domain, 0, len(entries)),
}
for _, entry := range l.Entry {
switch entry.Type {
case RuleTypeDomain:
site.Domain = append(site.Domain, &router.Domain{
Type: router.Domain_RootDomain,
Value: entry.Value,
Attribute: entry.Attrs,
for _, entry := range entries {
pdomain := &router.Domain{Value: entry.Value}
for _, attr := range entry.Attrs {
pdomain.Attribute = append(pdomain.Attribute, &router.Domain_Attribute{
Key: attr,
TypedValue: &router.Domain_Attribute_BoolValue{BoolValue: true},
})
case RuleTypeRegexp:
// check regexp validity to avoid runtime error
_, err := regexp.Compile(entry.Value)
if err != nil {
return nil, fmt.Errorf("invalid regexp in list %s: %s", l.Name, entry.Value)
}
site.Domain = append(site.Domain, &router.Domain{
Type: router.Domain_Regex,
Value: entry.Value,
Attribute: entry.Attrs,
})
case RuleTypeKeyword:
site.Domain = append(site.Domain, &router.Domain{
Type: router.Domain_Plain,
Value: entry.Value,
Attribute: entry.Attrs,
})
case RuleTypeFullDomain:
site.Domain = append(site.Domain, &router.Domain{
Type: router.Domain_Full,
Value: entry.Value,
Attribute: entry.Attrs,
})
default:
return nil, fmt.Errorf("unknown domain type: %s", entry.Type)
}
switch entry.Type {
case dlc.RuleTypeDomain:
pdomain.Type = router.Domain_RootDomain
case dlc.RuleTypeRegexp:
pdomain.Type = router.Domain_Regex
case dlc.RuleTypeKeyword:
pdomain.Type = router.Domain_Plain
case dlc.RuleTypeFullDomain:
pdomain.Type = router.Domain_Full
}
site.Domain = append(site.Domain, pdomain)
}
return site, nil
}
func exportPlainTextList(list []string, refName string, pl *ParsedList) {
for _, listName := range list {
if strings.EqualFold(refName, listName) {
if err := pl.toPlainText(strings.ToLower(refName)); err != nil {
fmt.Println("Failed:", err)
continue
}
fmt.Printf("'%s' has been generated successfully.\n", listName)
}
func writePlainList(exportedName string) error {
targetList, exist := finalMap[strings.ToUpper(exportedName)]
if !exist || len(targetList) == 0 {
return fmt.Errorf("list %q does not exist or is empty.", exportedName)
}
}
func removeComment(line string) string {
idx := strings.Index(line, "#")
if idx == -1 {
return line
file, err := os.Create(filepath.Join(*outputDir, strings.ToLower(exportedName)+".txt"))
if err != nil {
return err
}
return strings.TrimSpace(line[:idx])
}
func parseDomain(domain string, entry *Entry) error {
kv := strings.Split(domain, ":")
if len(kv) == 1 {
entry.Type = RuleTypeDomain
entry.Value = strings.ToLower(kv[0])
return nil
defer file.Close()
w := bufio.NewWriter(file)
for _, entry := range targetList {
fmt.Fprintln(w, entry.Plain)
}
if len(kv) == 2 {
entry.Type = strings.ToLower(kv[0])
if strings.EqualFold(entry.Type, RuleTypeRegexp) {
entry.Value = kv[1]
} else {
entry.Value = strings.ToLower(kv[1])
}
return nil
}
return fmt.Errorf("invalid format: %s", domain)
}
func parseAttribute(attr string) (*router.Domain_Attribute, error) {
var attribute router.Domain_Attribute
if len(attr) == 0 || attr[0] != '@' {
return &attribute, fmt.Errorf("invalid attribute: %s", attr)
}
attribute.Key = strings.ToLower(attr[1:]) // Trim attribute prefix `@` character
attribute.TypedValue = &router.Domain_Attribute_BoolValue{BoolValue: true}
return &attribute, nil
return w.Flush()
}
func parseEntry(line string) (Entry, error) {
line = strings.TrimSpace(line)
parts := strings.Split(line, " ")
var entry Entry
parts := strings.Fields(line)
if len(parts) == 0 {
return entry, fmt.Errorf("empty entry")
return entry, fmt.Errorf("empty line: %q", line)
}
if err := parseDomain(parts[0], &entry); err != nil {
return entry, err
}
for i := 1; i < len(parts); i++ {
attr, err := parseAttribute(parts[i])
if err != nil {
return entry, err
// Parse type and value
v := parts[0]
colonIndex := strings.Index(v, ":")
if colonIndex == -1 {
entry.Type = dlc.RuleTypeDomain // Default type
entry.Value = strings.ToLower(v)
if !validateDomainChars(entry.Value) {
return entry, fmt.Errorf("invalid domain: %q", entry.Value)
}
entry.Attrs = append(entry.Attrs, attr)
} else {
typ := strings.ToLower(v[:colonIndex])
val := v[colonIndex+1:]
switch typ {
case dlc.RuleTypeRegexp:
if _, err := regexp.Compile(val); err != nil {
return entry, fmt.Errorf("invalid regexp %q: %w", val, err)
}
entry.Type = dlc.RuleTypeRegexp
entry.Value = val
case dlc.RuleTypeInclude:
entry.Type = dlc.RuleTypeInclude
entry.Value = strings.ToUpper(val)
if !validateSiteName(entry.Value) {
return entry, fmt.Errorf("invalid include list name: %q", entry.Value)
}
case dlc.RuleTypeDomain, dlc.RuleTypeFullDomain, dlc.RuleTypeKeyword:
entry.Type = typ
entry.Value = strings.ToLower(val)
if !validateDomainChars(entry.Value) {
return entry, fmt.Errorf("invalid domain: %q", entry.Value)
}
default:
return entry, fmt.Errorf("invalid type: %q", typ)
}
}
// Parse/Check attributes and affiliations
for _, part := range parts[1:] {
if strings.HasPrefix(part, "@") {
attr := strings.ToLower(part[1:]) // Trim attribute prefix `@` character
if !validateAttrChars(attr) {
return entry, fmt.Errorf("invalid attribute: %q", attr)
}
entry.Attrs = append(entry.Attrs, attr)
} else if strings.HasPrefix(part, "&") {
aff := strings.ToUpper(part[1:]) // Trim affiliation prefix `&` character
if !validateSiteName(aff) {
return entry, fmt.Errorf("invalid affiliation: %q", aff)
}
entry.Affs = append(entry.Affs, aff)
} else {
return entry, fmt.Errorf("invalid attribute/affiliation: %q", part)
}
}
// Sort attributes
slices.Sort(entry.Attrs)
// Formated plain entry: type:domain.tld:@attr1,@attr2
entry.Plain = entry.Type + ":" + entry.Value
if len(entry.Attrs) != 0 {
entry.Plain = entry.Plain + ":@" + strings.Join(entry.Attrs, ",@")
}
return entry, nil
}
func Load(path string) (*List, error) {
func validateDomainChars(domain string) bool {
for i := range domain {
c := domain[i]
if (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') || c == '.' || c == '-' {
continue
}
return false
}
return true
}
func validateAttrChars(attr string) bool {
for i := range attr {
c := attr[i]
if (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') || c == '!' || c == '-' {
continue
}
return false
}
return true
}
func validateSiteName(name string) bool {
for i := range name {
c := name[i]
if (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c == '!' || c == '-' {
continue
}
return false
}
return true
}
func loadData(path string) error {
file, err := os.Open(path)
if err != nil {
return nil, err
return err
}
defer file.Close()
list := &List{
Name: strings.ToUpper(filepath.Base(path)),
listName := strings.ToUpper(filepath.Base(path))
if !validateSiteName(listName) {
return fmt.Errorf("invalid list name: %s", listName)
}
scanner := bufio.NewScanner(file)
lineIdx := 0
for scanner.Scan() {
line := strings.TrimSpace(scanner.Text())
line = removeComment(line)
if len(line) == 0 {
line := scanner.Text()
lineIdx++
// Remove comments
if idx := strings.Index(line, "#"); idx != -1 {
line = line[:idx]
}
line = strings.TrimSpace(line)
if line == "" {
continue
}
entry, err := parseEntry(line)
if err != nil {
return nil, err
return fmt.Errorf("error in %s at line %d: %v", path, lineIdx, err)
}
list.Entry = append(list.Entry, entry)
refMap[listName] = append(refMap[listName], &entry)
}
return list, nil
return nil
}
func isMatchAttr(Attrs []*router.Domain_Attribute, includeKey string) bool {
isMatch := false
mustMatch := true
matchName := includeKey
if strings.HasPrefix(includeKey, "!") {
isMatch = true
mustMatch = false
matchName = strings.TrimLeft(includeKey, "!")
func parseList(refName string, refList []*Entry) error {
pl, _ := plMap[refName]
if pl == nil {
pl = &ParsedList{Name: refName}
plMap[refName] = pl
}
for _, Attr := range Attrs {
attrName := Attr.Key
if mustMatch {
if matchName == attrName {
isMatch = true
break
for _, entry := range refList {
if entry.Type == dlc.RuleTypeInclude {
if len(entry.Affs) != 0 {
return fmt.Errorf("affiliation is not allowed for include:%s", entry.Value)
}
} else {
if matchName == attrName {
isMatch = false
break
}
}
}
return isMatch
}
func createIncludeAttrEntrys(list *List, matchAttr *router.Domain_Attribute) []Entry {
newEntryList := make([]Entry, 0, len(list.Entry))
matchName := matchAttr.Key
for _, entry := range list.Entry {
matched := isMatchAttr(entry.Attrs, matchName)
if matched {
newEntryList = append(newEntryList, entry)
}
}
return newEntryList
}
func ParseList(list *List, ref map[string]*List) (*ParsedList, error) {
pl := &ParsedList{
Name: list.Name,
Inclusion: make(map[string]bool),
}
entryList := list.Entry
for {
newEntryList := make([]Entry, 0, len(entryList))
hasInclude := false
for _, entry := range entryList {
if entry.Type == RuleTypeInclude {
refName := strings.ToUpper(entry.Value)
if entry.Attrs != nil {
for _, attr := range entry.Attrs {
InclusionName := strings.ToUpper(refName + "@" + attr.Key)
if pl.Inclusion[InclusionName] {
continue
}
pl.Inclusion[InclusionName] = true
refList := ref[refName]
if refList == nil {
return nil, fmt.Errorf("list not found: %s", entry.Value)
}
attrEntrys := createIncludeAttrEntrys(refList, attr)
if len(attrEntrys) != 0 {
newEntryList = append(newEntryList, attrEntrys...)
}
}
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
} else {
InclusionName := refName
if pl.Inclusion[InclusionName] {
continue
}
pl.Inclusion[InclusionName] = true
refList := ref[refName]
if refList == nil {
return nil, fmt.Errorf("list not found: %s", entry.Value)
}
newEntryList = append(newEntryList, refList.Entry...)
inc.MustAttrs = append(inc.MustAttrs, attr)
}
hasInclude = true
} else {
newEntryList = append(newEntryList, entry)
}
}
entryList = newEntryList
if !hasInclude {
break
pl.Inclusions = append(pl.Inclusions, inc)
} else {
for _, aff := range entry.Affs {
apl, _ := plMap[aff]
if apl == nil {
apl = &ParsedList{Name: aff}
plMap[aff] = apl
}
apl.Entries = append(apl.Entries, entry)
}
pl.Entries = append(pl.Entries, entry)
}
}
pl.Entry = entryList
return nil
}
return pl, nil
func polishList(roughMap *map[string]*Entry) []*Entry {
finalList := make([]*Entry, 0, len(*roughMap))
queuingList := make([]*Entry, 0, len(*roughMap)) // Domain/full entries without attr
domainsMap := make(map[string]bool)
for _, entry := range *roughMap {
switch entry.Type { // Bypass regexp, keyword and "full/domain with attr"
case dlc.RuleTypeRegexp:
finalList = append(finalList, entry)
case dlc.RuleTypeKeyword:
finalList = append(finalList, entry)
case dlc.RuleTypeDomain:
domainsMap[entry.Value] = true
if len(entry.Attrs) != 0 {
finalList = append(finalList, entry)
} else {
queuingList = append(queuingList, entry)
}
case dlc.RuleTypeFullDomain:
if len(entry.Attrs) != 0 {
finalList = append(finalList, entry)
} else {
queuingList = append(queuingList, entry)
}
}
}
// Remove redundant subdomains for full/domain without attr
for _, qentry := range queuingList {
isRedundant := false
pd := qentry.Value // To be parent domain
if qentry.Type == dlc.RuleTypeFullDomain {
pd = "." + pd // So that `domain:example.org` overrides `full:example.org`
}
for {
idx := strings.Index(pd, ".")
if idx == -1 {
break
}
pd = pd[idx+1:] // Go for next parent
if !strings.Contains(pd, ".") {
break
} // Not allow tld to be a parent
if domainsMap[pd] {
isRedundant = true
break
}
}
if !isRedundant {
finalList = append(finalList, qentry)
}
}
// Sort final entries
slices.SortFunc(finalList, func(a, b *Entry) int {
return strings.Compare(a.Plain, b.Plain)
})
return finalList
}
func resolveList(pl *ParsedList) error {
if _, pldone := finalMap[pl.Name]; pldone {
return nil
}
if cirIncMap[pl.Name] {
return fmt.Errorf("circular inclusion in: %s", pl.Name)
}
cirIncMap[pl.Name] = true
defer delete(cirIncMap, pl.Name)
isMatchAttrFilters := func(entry *Entry, incFilter *Inclusion) bool {
if len(incFilter.MustAttrs) == 0 && len(incFilter.BanAttrs) == 0 {
return true
}
if len(entry.Attrs) == 0 {
return len(incFilter.MustAttrs) == 0
}
for _, m := range incFilter.MustAttrs {
if !slices.Contains(entry.Attrs, m) {
return false
}
}
for _, b := range incFilter.BanAttrs {
if slices.Contains(entry.Attrs, b) {
return false
}
}
return true
}
roughMap := make(map[string]*Entry) // Avoid basic duplicates
for _, dentry := range pl.Entries { // Add direct entries
roughMap[dentry.Plain] = dentry
}
for _, inc := range pl.Inclusions {
incPl, exist := plMap[inc.Source]
if !exist {
return fmt.Errorf("list %q includes a non-existent list: %q", pl.Name, inc.Source)
}
if err := resolveList(incPl); err != nil {
return err
}
for _, ientry := range finalMap[inc.Source] {
if isMatchAttrFilters(ientry, inc) { // Add included entries
roughMap[ientry.Plain] = ientry
}
}
}
finalMap[pl.Name] = polishList(&roughMap)
return nil
}
func main() {
@@ -317,7 +385,7 @@ func main() {
dir := *dataPath
fmt.Println("Use domain lists in", dir)
ref := make(map[string]*List)
// Generate refMap
err := filepath.Walk(dir, func(path string, info os.FileInfo, err error) error {
if err != nil {
return err
@@ -325,75 +393,77 @@ func main() {
if info.IsDir() {
return nil
}
list, err := Load(path)
if err != nil {
if err := loadData(path); err != nil {
return err
}
ref[list.Name] = list
return nil
})
if err != nil {
fmt.Println("Failed:", err)
fmt.Println("Failed to loadData:", err)
os.Exit(1)
}
// Generate plMap
for refName, refList := range refMap {
if err := parseList(refName, refList); err != nil {
fmt.Println("Failed to parseList:", err)
os.Exit(1)
}
}
// Generate finalMap
for _, pl := range plMap {
if err := resolveList(pl); err != nil {
fmt.Println("Failed to resolveList:", err)
os.Exit(1)
}
}
// Create output directory if not exist
if _, err := os.Stat(*outputDir); os.IsNotExist(err) {
if mkErr := os.MkdirAll(*outputDir, 0755); mkErr != nil {
fmt.Println("Failed:", mkErr)
fmt.Println("Failed to create output directory:", mkErr)
os.Exit(1)
}
}
protoList := new(router.GeoSiteList)
var existList []string
for refName, list := range ref {
pl, err := ParseList(list, ref)
if err != nil {
fmt.Println("Failed:", err)
os.Exit(1)
// Export plaintext list
var exportListSlice []string
for raw := range strings.SplitSeq(*exportLists, ",") {
if trimmed := strings.TrimSpace(raw); trimmed != "" {
exportListSlice = append(exportListSlice, trimmed)
}
site, err := pl.toProto()
}
for _, exportList := range exportListSlice {
if err := writePlainList(exportList); err != nil {
fmt.Println("Failed to write list:", err)
continue
}
fmt.Printf("list %q has been generated successfully.\n", exportList)
}
// Generate dat file
protoList := new(router.GeoSiteList)
for siteName, siteEntries := range finalMap {
site, err := makeProtoList(siteName, siteEntries)
if err != nil {
fmt.Println("Failed:", err)
fmt.Println("Failed to makeProtoList:", err)
os.Exit(1)
}
protoList.Entry = append(protoList.Entry, site)
// Flatten and export plaintext list
if *exportLists != "" {
if existList != nil {
exportPlainTextList(existList, refName, pl)
} else {
exportedListSlice := strings.Split(*exportLists, ",")
for _, exportedListName := range exportedListSlice {
fileName := filepath.Join(dir, exportedListName)
_, err := os.Stat(fileName)
if err == nil || os.IsExist(err) {
existList = append(existList, exportedListName)
} else {
fmt.Printf("'%s' list does not exist in '%s' directory.\n", exportedListName, dir)
}
}
if existList != nil {
exportPlainTextList(existList, refName, pl)
}
}
}
}
// Sort protoList so the marshaled list is reproducible
sort.SliceStable(protoList.Entry, func(i, j int) bool {
return protoList.Entry[i].CountryCode < protoList.Entry[j].CountryCode
slices.SortFunc(protoList.Entry, func(a, b *router.GeoSite) int {
return strings.Compare(a.CountryCode, b.CountryCode)
})
protoBytes, err := proto.Marshal(protoList)
if err != nil {
fmt.Println("Failed:", err)
fmt.Println("Failed to marshal:", err)
os.Exit(1)
}
if err := os.WriteFile(filepath.Join(*outputDir, *outputName), protoBytes, 0644); err != nil {
fmt.Println("Failed:", err)
fmt.Println("Failed to write output:", err)
os.Exit(1)
} else {
fmt.Println(*outputName, "has been generated successfully.")