diff --git a/docs/configuration/dns/index.zh.md b/docs/configuration/dns/index.zh.md new file mode 100644 index 00000000..22714d1e --- /dev/null +++ b/docs/configuration/dns/index.zh.md @@ -0,0 +1,46 @@ +# DNS + +### 结构 + +```json +{ + "dns": { + "servers": [], + "rules": [], + "final": "", + "strategy": "", + "disable_cache": false, + "disable_expire": false + } +} + +``` + +### 字段 + +| 关键字 | 格式 | +|----------|---------------------------| +| `server` | 详见 [DNS Server](./server) | +| `rules` | 详见 [DNS Rule](./rule) | + +#### final + +默认 dns 服务器标签。 + +如果为空,将使用第一个 dns 服务器。 + +#### strategy + +默认域名解析域策略。 + +可选参数有:`prefer_ipv4` `prefer_ipv6` `ipv4_only` `ipv6_only`。 + +设置此字段后 `server.strategy` 将无效。 + +#### disable_cache + +禁用 dns 缓存。 + +#### disable_expire + +禁用 dns 缓存过期。 \ No newline at end of file diff --git a/docs/configuration/dns/rule.zh.md b/docs/configuration/dns/rule.zh.md new file mode 100644 index 00000000..7d0f7d58 --- /dev/null +++ b/docs/configuration/dns/rule.zh.md @@ -0,0 +1,243 @@ +### 结构 + +```json +{ + "dns": { + "rules": [ + { + "inbound": [ + "mixed-in" + ], + "ip_version": 6, + "network": "tcp", + "auth_user": [ + "usera", + "userb" + ], + "protocol": [ + "tls", + "http", + "quic" + ], + "domain": [ + "test.com" + ], + "domain_suffix": [ + ".cn" + ], + "domain_keyword": [ + "test" + ], + "domain_regex": [ + "^stun\\..+" + ], + "geosite": [ + "cn" + ], + "source_geoip": [ + "private" + ], + "source_ip_cidr": [ + "10.0.0.0/24" + ], + "source_port": [ + 12345 + ], + "source_port_range": [ + "1000:2000", + ":3000", + "4000:" + ], + "port": [ + 80, + 443 + ], + "port_range": [ + "1000:2000", + ":3000", + "4000:" + ], + "process_name": [ + "curl" + ], + "package_name": [ + "com.termux" + ], + "user": [ + "sekai" + ], + "user_id": [ + 1000 + ], + "invert": false, + "outbound": [ + "direct" + ], + "server": "local", + "disable_cache": false + }, + { + "type": "logical", + "mode": "and", + "rules": [], + "server": "local", + "disable_cache": false + } + ] + } +} + +``` + +!!! note "" + + 当内容只有一项时,可以忽略 JSON Array [] 标签。 + +### 默认字段 + +!!! note "" + + 默认规则使用以下逻辑关系词匹配: + (`domain` || `domain_suffix` || `domain_keyword` || `domain_regex` || `geosite`) && + (`source_geoip` || `source_ip_cidr`) && + `other fields` + +#### inbound + +[入站](../inbound)标签。 + +#### ip_version + +4 (A dns记录查询) or 6 (AAAA dns记录查询)。 + +如果为空则不受限制。 + +#### network + +`tcp` 或 `udp`。 + +#### user + +用户名,请参阅每个入站了解详情。 + +#### protocol + +协议探测, 详见 [Sniff](/configuration/route/sniff/)。 + +#### domain + +匹配完整域名。 + +#### domain_suffix + +匹配域后缀。 + +#### domain_keyword + +使用关键字匹配域。 + +#### domain_regex + +使用正则表达式匹配域。 + +#### geosite + +依据 geosite 匹配。 + +#### source_geoip + +匹配源 geoip。 + +#### source_ip_cidr + +匹配源 ip cidr。 + +#### source_port + +匹配源端口。 + +#### source_port_range + +匹配源端口范围。 + +#### port + +匹配端口。 + +#### port_range + +匹配端口范围。 + +#### process_name + +!!! error "" + + 仅支持 Linux, Windows, and macOS。 + +匹配进程名称。 + +#### package_name + +匹配 android 包名。 + +#### user + +!!! error "" + + 仅支持 Linux。 + +匹配用户名。 + +#### user_id + +!!! error "" + + 仅支持 Linux。 + +匹配用户 ID。 + +#### invert + +反转匹配结果。 + +#### outbound + +匹配出站。 + +#### server + +==必填== + +目标 DNS 服务器的标签。 + +#### disable_cache + +在此查询中禁用缓存。 + +### 逻辑字段 + +#### type + +`logical` + +#### mode + +`and` 或 `or` + +#### rules + +包括默认规则。 + +#### invert + +反转匹配结果。 + +#### server + +==必填== + +目标 DNS 服务器的标签。 + +#### disable_cache + +在此查询中禁用缓存。 \ No newline at end of file diff --git a/docs/configuration/dns/server.md b/docs/configuration/dns/server.md index 4861d2f4..3973c211 100644 --- a/docs/configuration/dns/server.md +++ b/docs/configuration/dns/server.md @@ -30,16 +30,16 @@ The tag of the dns server. The address of the dns server. -| Protocol | Format | -|----------|-----------------------------| -| `System` | `local` | -| `TCP` | `tcp://1.0.0.1` | -| `UDP` | `8.8.8.8` `udp://8.8.4.4` | -| `TLS` | `tls://dns.google` | -| `HTTPS` | `https://1.1.1.1/dns-query` | -| `QUIC` | `quic://dns.adguard.com` | -| `HTTP3` | `h3://8.8.8.8/dns-query` | -| `RCode` | `rcode://refused` | +| Protocol | Format | +|----------|------------------------------| +| `System` | `local` | +| `TCP` | `tcp://1.0.0.1` | +| `UDP` | `8.8.8.8` or `udp://8.8.4.4` | +| `TLS` | `tls://dns.google` | +| `HTTPS` | `https://1.1.1.1/dns-query` | +| `QUIC` | `quic://dns.adguard.com` | +| `HTTP3` | `h3://8.8.8.8/dns-query` | +| `RCode` | `rcode://refused` | !!! warning "" @@ -51,7 +51,7 @@ The address of the dns server. !!! info "" - the RCode transport is often used to block queries. Use with rules and the `disable_cache` rule option. + The RCode transport is often used to block queries. Use with rules and the `disable_cache` rule option. | RCode | Description | |-------------------|-----------------------| @@ -65,7 +65,7 @@ The address of the dns server. ==Required if address contains domain== -Tag of a another server to resolve the domain name in the address. +Tag of an another server to resolve the domain name in the address. #### address_strategy