|
| 1 | +# Domain list community |
| 2 | + |
| 3 | +This project manages a list of domains, to be used as geosites for routing purpose in Project V. |
| 4 | + |
| 5 | +## Purpose of this project |
| 6 | + |
| 7 | +This project is not opinionated. In other words, it does NOT endorse, claim or imply that a domain should be blocked or proxied. It can be used to generate routing rules on demand. |
| 8 | + |
| 9 | +## Download links |
| 10 | + |
| 11 | +- **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) |
| 12 | +- **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) |
| 13 | + |
| 14 | +## Usage example |
| 15 | + |
| 16 | +Each file in the `data` directory can be used as a rule in this format: `geosite:filename`. |
| 17 | + |
| 18 | +```json |
| 19 | +"routing": { |
| 20 | + "domainStrategy": "IPIfNonMatch", |
| 21 | + "rules": [ |
| 22 | + { |
| 23 | + "type": "field", |
| 24 | + "outboundTag": "Reject", |
| 25 | + "domain": [ |
| 26 | + "geosite:category-ads-all", |
| 27 | + "geosite:category-porn" |
| 28 | + ] |
| 29 | + }, |
| 30 | + { |
| 31 | + "type": "field", |
| 32 | + "outboundTag": "Direct", |
| 33 | + "domain": [ |
| 34 | + "domain:icloud.com", |
| 35 | + "domain:icloud-content.com", |
| 36 | + "domain:cdn-apple.com", |
| 37 | + "geosite:cn", |
| 38 | + "geosite:private" |
| 39 | + ] |
| 40 | + }, |
| 41 | + { |
| 42 | + "type": "field", |
| 43 | + "outboundTag": "Proxy-1", |
| 44 | + "domain": [ |
| 45 | + "geosite:category-anticensorship", |
| 46 | + "geosite:category-media", |
| 47 | + "geosite:category-vpnservices" |
| 48 | + ] |
| 49 | + }, |
| 50 | + { |
| 51 | + "type": "field", |
| 52 | + "outboundTag": "Proxy-2", |
| 53 | + "domain": [ |
| 54 | + "geosite:category-dev" |
| 55 | + ] |
| 56 | + }, |
| 57 | + { |
| 58 | + "type": "field", |
| 59 | + "outboundTag": "Proxy-3", |
| 60 | + "domain": [ |
| 61 | + "geosite:geolocation-!cn" |
| 62 | + ] |
| 63 | + } |
| 64 | + ] |
| 65 | +} |
| 66 | +``` |
| 67 | + |
| 68 | +## Generate `dlc.dat` manually |
| 69 | + |
| 70 | +- Install `golang` and `git` |
| 71 | +- Clone project code: `git clone https://github.com/v2fly/domain-list-community.git` |
| 72 | +- Navigate to project root directory: `cd domain-list-community` |
| 73 | +- Install project dependencies: `go mod download` |
| 74 | +- Generate `dlc.dat` (without `datapath` option means to use domain lists in `data` directory of current working directory): |
| 75 | + - `go run ./` |
| 76 | + - `go run ./ --datapath=/path/to/your/custom/data/directory` |
| 77 | + |
| 78 | +Run `go run ./ --help` for more usage information. |
| 79 | + |
| 80 | +## Structure of data |
| 81 | + |
| 82 | +All data are under `data` directory. Each file in the directory represents a sub-list of domains, named by the file name. File content is in the following format. |
| 83 | + |
| 84 | +``` |
| 85 | +# comments |
| 86 | +include:another-file |
| 87 | +domain:google.com @attr1 @attr2 |
| 88 | +keyword:google |
| 89 | +regexp:www\.google\.com$ |
| 90 | +full:www.google.com |
| 91 | +``` |
| 92 | + |
| 93 | +**Syntax:** |
| 94 | + |
| 95 | +> 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. |
| 96 | +
|
| 97 | +* Comment begins with `#`. It may begin anywhere in the file. The content in the line after `#` is treated as comment and ignored in production. |
| 98 | +* Inclusion begins with `include:`, followed by the file name of an existing file in the same directory. |
| 99 | +* Subdomain begins with `domain:`, followed by a valid domain name. The prefix `domain:` may be omitted. |
| 100 | +* Keyword begins with `keyword:`, followed by a string. |
| 101 | +* Regular expression begins with `regexp:`, followed by a valid regular expression (per Golang's standard). |
| 102 | +* Full domain begins with `full:`, followed by a complete and valid domain name. |
| 103 | +* 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. |
| 104 | + |
| 105 | +## How it works |
| 106 | + |
| 107 | +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. |
| 108 | + |
| 109 | +To generate a section: |
| 110 | + |
| 111 | +1. Remove all the comments in the file. |
| 112 | +2. Replace `include:` lines with the actual content of the file. |
| 113 | +3. Omit all empty lines. |
| 114 | +4. Generate each `domain:` line into a [sub-domain routing rule](https://github.com/v2fly/v2ray-core/blob/master/app/router/config.proto#L21). |
| 115 | +5. Generate each `keyword:` line into a [plain domain routing rule](https://github.com/v2fly/v2ray-core/blob/master/app/router/config.proto#L17). |
| 116 | +6. Generate each `regexp:` line into a [regex domain routing rule](https://github.com/v2fly/v2ray-core/blob/master/app/router/config.proto#L19). |
| 117 | +7. Generate each `full:` line into a [full domain routing rule](https://github.com/v2fly/v2ray-core/blob/master/app/router/config.proto#L23). |
| 118 | + |
| 119 | +## How to organize domains |
| 120 | + |
| 121 | +### File name |
| 122 | + |
| 123 | +Theoretically any string can be used as the name, as long as it is a valid file name. In practice, we prefer names for determinic group of domains, such as the owner (usually a company name) of the domains, e.g., "google", "netflix". Names with unclear scope are generally unrecommended, such as "evil", or "local". |
| 124 | + |
| 125 | +### Attributes |
| 126 | + |
| 127 | +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. |
| 128 | + |
| 129 | +## Contribution guideline |
| 130 | + |
| 131 | +* Fork this repo, make modifications to your own repo, file a PR. |
| 132 | +* Please begin with small size PRs, say modification in a single file. |
| 133 | +* A PR must be reviewed and approved by another member. |
| 134 | +* After a few successful PRs, you may apply for manager access to this repository. |
0 commit comments