Browse Source

ReadMe: move user guide to markdown website

Nick Peng 2 years ago
parent
commit
1ac2b2ad98
2 changed files with 20 additions and 1557 deletions
  1. 14 824
      ReadMe.md
  2. 6 733
      ReadMe_en.md

+ 14 - 824
ReadMe.md

@@ -4,35 +4,15 @@
 
 ![SmartDNS](doc/smartdns-banner.png)
 SmartDNS 是一个运行在本地的 DNS 服务器,它接受来自本地客户端的 DNS 查询请求,然后从多个上游 DNS 服务器获取 DNS 查询结果,并将访问速度最快的结果返回给客户端,以此提高网络访问速度。
-SmartDNS 同时支持指定特定域名 IP 地址,并高性匹配,可达到过滤广告的效果; 支持DOT(DNS over TLS)和DOH(DNS over HTTPS),更好的保护隐私。
-与 DNSmasq 的 all-servers 不同,SmartDNS 返回的是访问速度最快的解析结果。详细差异请看[常见问题](#常见问题)。
-
-支持树莓派、OpenWrt、华硕路由器原生固件和 Windows 系统等。  
-
-## 目录
-
-- [SmartDNS](#smartdns)
-  - [目录](#目录)
-  - [软件效果展示](#软件效果展示)
-  - [特性](#特性)
-  - [架构](#架构)
-  - [下载](#下载)
-    - [使用官方安装源](#使用官方安装源)
-    - [手工下载安装](#手工下载安装)
-  - [安装和使用](#安装和使用)
-    - [标准 Linux 系统 / 树莓派](#标准-linux-系统--树莓派)
-    - [OpenWrt](#openwrt)
-    - [华硕路由器原生固件 / 梅林固件](#华硕路由器原生固件--梅林固件)
-    - [Optware / Entware](#optware--entware)
-    - [WSL](#wsl)
-  - [配置文件说明](#配置文件说明)
-  - [常见问题](#常见问题)
-  - [编译](#编译)
-  - [捐赠](#捐赠)
-    - [PayPal 贝宝](#paypal-贝宝)
-    - [AliPay 支付宝](#alipay-支付宝)
-    - [WeChat Pay 微信支付](#wechat-pay-微信支付)
-  - [开源声明](#开源声明)
+SmartDNS 同时支持指定特定域名 IP 地址,并高性匹配,可达到过滤广告的效果; 支持DOT(DNS over TLS)和DOH(DNS over HTTPS),更好的保护隐私。  
+
+与 DNSmasq 的 all-servers 不同,SmartDNS 返回的是访问速度最快的解析结果。
+
+支持树莓派、OpenWrt、华硕路由器原生固件和 Windows 系统等。
+
+## 使用指导
+
+SmartDNS官网:[https://pymumu.github.io/smartdns](https://pymumu.github.io/smartdns)
 
 ## 软件效果展示
 
@@ -138,805 +118,15 @@ rtt min/avg/max/mdev = 5.954/6.133/6.313/0.195 ms
 1. 上游 DNS 服务器返回域名对应的服务器 IP 地址列表,SmartDNS 则会检测从本地网络访问速度最快的服务器 IP;
 1. 最后将访问速度最快的服务器 IP 返回给本地客户端。
 
-## 下载
-
-### 使用官方安装源
-
-smartdns已经合入主流系统的软件仓库,可以直接使用系统安装命令直接安装。
-
-系统|安装方式|说明|
---|--|--
-openwrt|opkg update<br />opkg install luci-app-smartdns<br />opkg install smartdns|22.03之后的系统。软件源路径:<https://downloads.openwrt.org/releases/>
-ddwrt|官方最新固件service页面->SmartDNS Resolver->启用。|选择界面参考:<https://forum.dd-wrt.com/demo/Services.html>
-debian|apt-get install smartdns|
-entware|ipkg update<br />ipkg install smartdns|软件源路径:<https://bin.entware.net/>
-
-### 手工下载安装
-
---------------
-
-下载对应系统或固件版本的 SmartDNS 安装包,对应关系如下。
-
-| 支持系统(架构) | 安装包 | 支持说明 |
-| :--- | :--- | :--- |
-| 标准 Linux 系统(ARM) | smartdns.1.yyyy.MM.dd-REL.arm-debian-all.deb | ARM 的树莓派 Raspbian Stretch 和 Debian 9 系统 |
-| 标准 Linux 系统(ARM64) | smartdns.1.yyyy.MM.dd-REL.aarch64-debian-all.deb | ARM64 的 Debian Stretch 和 Debian 9 系统 |
-| 标准 Linux 系统(x86_64) | smartdns.1.yyyy.MM.dd-REL.x86_64-linux-all.tar.gz | 64 位 Linux 系统 |
-| 标准 Linux 系统(x86) | smartdns.1.yyyy.MM.dd-REL.x86-linux-all.tar.gz | 32 位 Linux 系统 |
-| WSL | smartdns.1.yyyy.MM.dd-REL.x86_64-linux-all.tar.gz | WSL |
-| Optware | smartdns.1.yyyy.MM.dd-REL.mips-optware-all.ipk | MIPS 大端架构的 Optware 系统 |
-| Optware(MIPS Little Endian) | smartdns.1.yyyy.MM.dd-REL.mipsel-optware-all.ipk | MIPS 小端架构的 Optware 系统 |
-| Optware(ARM) | smartdns.1.yyyy.MM.dd-REL.arm-optware-all.ipk | ARM 小端架构的 Optware 系统 |
-| OpenWrt(MIPS) | smartdns.1.yyyy.MM.dd-REL.mips-openwrt-all.ipk | MIPS 大端架构的 OpenWrt 系统 |
-| OpenWrt(MIPS Little Endian) | smartdns.1.yyyy.MM.dd-REL.mipsel-openwrt-all.ipk | MIPS 小端架构的 OpenWrt 系统 |
-| OpenWrt(ARM) | smartdns.1.yyyy.MM.dd-REL.arm-openwrt-all.ipk | ARM 小端架构的 OpenWrt 系统 |
-| OpenWrt LuCI | luci-app-smartdns.1.yyyy.MM.dd-REL.all.ipk | OpenWrt 管理界面 |
-| OpenWrt LuCI | luci-app-smartdns.1.yyyy.MM.dd-REL.all-luci-compat-all.ipk | OpenWrt 管理界面、OpenWrt 18.xx 及之前版本 |
-| Windows | smartdns-rs https://github.com/mokeyish/smartdns-rs | Rust版本SmartDNS | [Rust版本SmartDNS](https://github.com/mokeyish/smartdns-rs) |
-| MacOS | smartdns-rs https://github.com/mokeyish/smartdns-rs | Rust版本SmartDNS |
-
-**[前往 Release 页面下载](https://github.com/pymumu/smartdns/releases)。**  
-
-**请注意:**
-
-- Release 释出的软件包采取静态编译,无外部依赖,但体积大。若需要小体积软件包,请自行编译或从 OpenWrt / Entware 仓库获取。
-
-- 静态编译的软件包未强制判断 CPU 架构,安装不正确的软件包将会导致服务无法启动,请确保正确安装对应的版本。
-
-## 安装和使用
-
-### 标准 Linux 系统 / 树莓派
-
---------------
-
-1. 安装
-
-    下载配套安装包,并上传到 Linux 系统中。
-
-    标准 Linux 系统(X86 / X86_64)请执行如下命令安装:
-
-    ```shell
-    tar zxf smartdns.1.yyyy.MM.dd-REL.x86_64-linux-all.tar.gz
-    cd smartdns
-    chmod +x ./install
-    ./install -i
-    ```
-
-    树莓派或其他 Debian 系系统(ARM / ARM64)请执行如下命令安装:
-
-    ```shell
-    dpkg -i smartdns.1.yyyy.MM.dd-REL.arm-debian-all.deb
-    ```
-
-    **对于Ubuntu系统:**
-    - `systemd-resolved`会占用TCP53和UDP53端口。你需要手动解决端口占用问题或者修改smartdns监听端口
-
-    - 日志文件在`/var/log/smartdns/smartdns.log`
-
-1. 修改配置
-
-    安装完成后,可配置 SmartDNS 的上游服务器信息。
-
-    一般情况下,只需要增加 `server`[`IP`]`:port` 和 `server-tcp`[`IP`]`:port` 配置项。
-
-    请尽可能配置多个上游 DNS 服务器,包括国内外的服务器。
-
-    具体配置参数请参考[配置文件说明](#配置文件说明)。  
-
-    ```shell
-    vi /etc/smartdns/smartdns.conf
-    ```
-
-    `/etc/smartdns/smartdns.conf`配置包含如下基本内容:
-
-    ```shell
-    # 指定监听的端口号
-    bind []:53 
-    # 指定上游服务器
-    server 1.1.1.1
-    server-tls 8.8.8.8
-    # 指定域名规则
-    address /example.com/1.2.3.4
-    domain-rule /example.com/ -address 1.2.3.4
-    ```
-
-1. 启动服务
-
-    ```shell
-    systemctl enable smartdns
-    systemctl start smartdns
-    ```
-
-1. 将 DNS 请求转发到 SmartDNS 解析
-
-    修改本地路由器的 DNS 服务器,将 DNS 服务器配置为 SmartDNS。
-
-   - 登录到本地网络的路由器中,配置树莓派,分配其静态 IP 地址。
-   - 修改 WAN 口或者 DHCP DNS 为树莓派 IP 地址。
-     **注意:**
-      I. 每款路由器配置方法不尽相同,请在网络上搜索对应配置方法。
-      II. 华为等路由器可能不支持配置 DNS 为本地 IP,可修改电脑端或手机端的 DNS 服务器为树莓派 IP。
-
-1. 检测服务是否配置成功
-
-    执行
-
-   ```shell
-   nslookup -querytype=ptr smartdns
-   ```
-
-    查看命令结果中的 `name` 是否为 `smartdns` 或你的主机名,如果是则表示生效
-
-   ```shell
-   $ nslookup -querytype=ptr smartdns
-   Server:         192.168.1.1
-   Address:        192.168.1.1#53
-   
-   Non-authoritative answer:
-   smartdns        name = smartdns.
-   ```
-
-### OpenWrt
-
---------------
-
-1. 安装
-
-    将软件包(使用 WinSCP 等)上传到路由器的 `/root` 目录,执行如下命令安装
-
-   ```shell
-   opkg install smartdns.1.yyyy.MM.dd-REL.xxxx.ipk
-   opkg install luci-app-smartdns.1.yyyy.MM.dd-REL.all.ipk
-   ```
-
-   - **注意:** 19.07 之前的版本,请务必安装 `luci-app-smartdns.1.yyyy.MM.dd-REL.all-luci-compat-all.ipk`。
-
-1. 修改配置
-
-    登录 OpenWrt 管理页面,打开 `Services` -> `SmartDNS` 进行配置。
-
-   - 在 `Upstream Servers` 增加上游 DNS 服务器配置,建议配置多个国内外 DNS 服务器。
-   - 在 `Domain Address` 指定特定域名的 IP 地址,可用于广告屏蔽。
-
-1. 启用服务
-
-   - 替换默认Dnsmasq为主DNS。
-
-     登录 OpenWrt 管理界面,点击 `Services` -> `SmartDNS` -> `port`,设置端口号为`53`,smartdns会自动接管主DNS服务器。
-
-   - 检测转发服务是否配置成功
-
-     执行
-
-     ```shell
-     nslookup -querytype=ptr smartdns
-     ```
-
-     查看命令结果中的 `name` 是否为 `smartdns` 或你的主机名,如果是则表示生效
-
-     ```shell
-     $ nslookup -querytype=ptr smartdns
-     Server:         192.168.1.1
-     Address:        192.168.1.1#53
-        
-     Non-authoritative answer:
-     smartdns        name = smartdns.
-     ```
-
-1. 启动服务
-
-    勾选配置页面中的 `Enable(启用)`来启动 SmartDNS。
-
-1. **注意:**
-
-   - 如已经安装 ChinaDNS,建议将 ChinaDNS 的上游配置为 SmartDNS。
-   - 当smartdns的端口为53时,将自动接管dnsmasq为主dns。配置其他端口时,会重新启用dnsmasq为主dns。
-   - 若在此过程中发生异常,可使用如下命令还原dnsmasq为主DNS
-
-   ```shell
-   uci delete dhcp.@dnsmasq[0].port
-   uci commit dhcp
-   /etc/init.d/dnsmasq restart
-   ```
-
-### 华硕路由器原生固件 / 梅林固件
-
---------------
-
-**说明:** 梅林固件派生自华硕固件,理论上可以直接使用华硕配套的安装包使用。但目前未经验证,如有问题,请提交 Issue。
-
-1. 准备
-
-    在使用此软件时,需要确认路由器是否支持 U 盘,并准备好 U 盘一个。
-
-1. 启用 SSH 登录
-
-    登录管理界面,点击 `系统管理` -> `系统设置`,配置 `Enable SSH` 为 `Lan Only`。  
-    SSH 登录用户名密码与管理界面相同。
-
-1. 下载 `Download Master`
-
-    在管理界面点击 `USB 相关应用` -> `Download Master` 下载。  
-    下载完成后,启用 `Download Master`,如果不需要下载功能,此时可以卸载 `Download Master`,但要保证卸载前 `Download Master` 是启用的。  
-
-1. 安装 SmartDNS
-
-    将软件包(使用 WinSCP 等)上传到路由器的 `/tmp/mnt/sda1` 目录(或网上邻居复制到 sda1 共享目录),执行如下命令安装
-
-   ```shell
-   ipkg install smartdns.1.yyyy.MM.dd-REL.mipsbig.ipk
-   ```
-
-1. 重启路由器使服务生效
-
-    待路由器启动后, 执行
-
-   ```shell
-   nslookup -querytype=ptr smartdns
-   ```
-
-    查看命令结果中的 `name` 是否为 `smartdns` 或你的主机名,如果是则表示生效
-
-   ```shell
-   $ nslookup -querytype=ptr smartdns
-   Server:         192.168.1.1
-   Address:        192.168.1.1#53
-   
-   Non-authoritative answer:
-   smartdns        name = smartdns.
-   ```
-
-1. **额外说明**
-
-    上述过程,SmartDNS 将安装到 U 盘根目录,采用 Optware 的模式运行。
-    其目录结构如下(此处仅列出 SmartDNS 相关文件):
-
-   ```shell
-   U 盘
-   └── asusware.mipsbig
-           ├── bin
-           ├── etc
-           |    ├── smartdns
-           |    |     └── smartdns.conf
-           |    └── init.d
-           |          └── S50smartdns
-           ├── lib
-           ├── sbin
-           ├── usr
-           |    └── sbin
-           |          └── smartdns
-           ....
-   ```
-
-    如要修改配置,可以 SSH 登录路由器,使用 vi 命令修改
-
-   ```shell
-   vi /opt/etc/smartdns/smartdns.conf
-   ```
-
-    `/opt/etc/smartdns/smartdns.conf`配置包含如下基本内容:
-
-    ```shell
-    # 指定监听的端口号
-    bind []:53 
-    # 指定上游服务器
-    server 1.1.1.1
-    server-tls 8.8.8.8
-    # 指定域名规则
-    address /example.com/1.2.3.4
-    domain-rule /example.com/ -address 1.2.3.4
-    ```
-
-   也可以通过网上邻居修改,网上邻居共享目录 `sda1` 看不到 `asusware.mipsbig` 目录,但可以直接在`文件管理器`中输入 `asusware.mipsbig\etc\init.d` 访问
-
-   ```shell
-   \\192.168.1.1\sda1\asusware.mipsbig\etc\init.d
-   ```
-
-### Optware / Entware
-
---------------
-
-1. 准备
-
-    在使用此软件时,需要确认路由器是否支持 U 盘,并准备好 U 盘一个。
-
-1. 安装 SmartDNS
-
-    将软件(使用 WinSCP 等)上传到路由器的 `/tmp` 目录,执行如下命令安装
-
-   ```shell
-   ipkg install smartdns.1.yyyy.MM.dd-REL.mipsbig.ipk
-   ```
-
-1. 修改 SmartDNS 配置
-
-   ```shell
-   vi /opt/etc/smartdns/smartdns.conf
-   ```
-
-   `/opt/etc/smartdns/smartdns.conf`配置包含如下基本内容:
-
-    ```shell
-    # 指定监听的端口号
-    bind []:53 
-    # 指定上游服务器
-    server 1.1.1.1
-    server-tls 8.8.8.8
-    # 指定域名规则
-    address /example.com/1.2.3.4
-    domain-rule /example.com/ -address 1.2.3.4
-    ```
-
-    另外,如需支持 IPv6,可设置工作模式为 `2`,将 DNSmasq 的 DNS 服务禁用,设置 SmartDNS 为主用 DNS 服务器。将文件 `/opt/etc/smartdns/smartdns-opt.conf` 中的 `SMARTDNS_WORKMODE` 的值修改为 `2`
-
-   ```shell
-   SMARTDNS_WORKMODE="2"
-   ```
-
-1. 重启路由器使服务生效
-
-    待路由器启动后, 执行
-
-   ```shell
-   nslookup -querytype=ptr smartdns
-   ```
-
-    查看命令结果中的 `name` 是否为 `smartdns` 或你的主机名,如果是则表示生效
-
-   ```shell
-   $ nslookup -querytype=ptr smartdns
-   Server:         192.168.1.1
-   Address:        192.168.1.1#53
-   
-   Non-authoritative answer:
-   smartdns        name = smartdns.
-   ```
-
-    **注意:** 若服务没有自动启动,则需要设置 Optware / Entware 自动启动,具体方法请参考 Optware/Entware 的文档。
-
-### WSL
-
---------------
-
-1. 安装 WSL
-
-    安装 WSL 运行环境,发行版本选择 Ubuntu 系统为例。安装步骤请参考 [WSL 安装说明](https://docs.microsoft.com/zh-CN/windows/wsl/install)
-
-1. 安装 SmartDNS
-
-    下载适用于 WSL 的安装包,并解压到如 D 盘根目录。解压后目录如下:
-
-   ```shell
-   D:\SMARTDNS
-   ├─etc
-   │  ├─default
-   │  ├─init.d
-   │  └─smartdns
-   ├─package
-   │  └─windows
-   ├─src
-   └─systemd
-   ```
-
-     双击 `D:\smartdns\package\windows` 目录下的 `install.bat` 进行安装。要求输入密码时,请输入 `WLS ubuntu` 的密码。
-
-1. 修改配置
-
-    用记事本等打开 `D:\smartdns\etc\smartdns` 目录中的 `smartdns.conf` 配置文件配置 SmartDNS。
-
-    一般情况下,只需要增加 `server [IP]:port` 和 `server-tcp [IP]:port` 配置项,
-    尽可能配置多个上游DNS服务器,包括国内外的服务器。
-
-    具体配置请参考[配置文件说明](#配置文件说明)。
-     `smartdns.conf` 配置包含如下基本内容:
-
-    ```shell
-    # 指定监听的端口号
-    bind []:53 
-    # 指定上游服务器
-    server 1.1.1.1
-    server-tls 8.8.8.8
-    # 指定域名规则
-    address /example.com/1.2.3.4
-    domain-rule /example.com/ -address 1.2.3.4
-    ```
-
-1. 重新加载配置
-
-    双击 `D:\smartdns\package\windows` 目录下的 `reload.bat` 进行重新加载。要求输入密码时,请输入 `WLS ubuntu` 的密码。
-
-1. 将 DNS 请求转发到 SmartDNS 解析
-
-    将 Windows 的默认 DNS 服务器修改为 `127.0.0.1`,具体步骤参考 Windows [更改 TCP/IP 设置](https://support.microsoft.com/zh-cn/help/15089/windows-change-tcp-ip-settings)。
-
-1. 检测服务是否配置成功
-
-    执行
-
-   ```shell
-   nslookup -querytype=ptr smartdns
-   ```
-
-    查看命令结果中的 `name` 是否为 `smartdns` 或你的主机名,如果是则表示生效
-
-   ```shell
-   $ nslookup -querytype=ptr smartdns
-   Server:         192.168.1.1
-   Address:        192.168.1.1#53
-   
-   Non-authoritative answer:
-   smartdns        name = smartdns.
-   ```
-
-## 配置文件说明
-
-配置建议:**smartdns默认已设置为最优模式,适合大部分场景的DNS查询体验改善,一般情况只需要增加上游服务器地址即可,无需做其他配置修改;如有其他配置修改,请务必了解其用途,避免修改后起到反作用。**
-
-| 键名 | 功能说明 | 默认值 | 可用值/要求 | 举例 |
-| :--- | :--- | :--- | :--- | :--- |
-| server-name | DNS 服务器名称 | 操作系统主机名 / smartdns | 符合主机名规格的字符串 | server-name smartdns |
-| bind | DNS 监听端口号  | [::]:53 | 可绑定多个端口。<br />IP:PORT@DEVICE: 服务器 IP:端口号@设备名<br />[-group]: 请求时使用的 DNS 服务器组<br />[-no-rule-addr]:跳过 address 规则<br />[-no-rule-nameserver]:跳过 Nameserver 规则<br />[-no-rule-ipset]:跳过 ipset 和 nftset 规则<br />[-no-rule-soa]:跳过 SOA(#) 规则<br />[-no-dualstack-selection]:停用双栈测速<br />[-no-speed-check]:停用测速<br />[-no-cache]:停止缓存 | bind :53@eth0 |
-| bind-tcp | DNS TCP 监听端口号 | [::]:53 | 可绑定多个端口。<br />IP:PORT@DEVICE: 服务器 IP:端口号@设备名<br />[-group]: 请求时使用的 DNS 服务器组<br />[-no-rule-addr]:跳过 address 规则<br />[-no-rule-nameserver]:跳过 nameserver 规则<br />[-no-rule-ipset]:跳过 ipset 和 nftset 规则。<br />[-no-rule-soa]:跳过 SOA(#) 规则<br />[-no-dualstack-selection]:停用双栈测速<br />[-no-speed-check]:停用测速<br />[-no-cache]:停止缓存 | bind-tcp :53 |
-| bind-tls | DNS Over TLS 监听端口号 | [::]:853 | 可绑定多个端口。<br />IP:PORT@DEVICE: 服务器 IP:端口号@设备名<br />[-group]: 请求时使用的 DNS 服务器组<br />[-no-rule-addr]:跳过 address 规则<br />[-no-rule-nameserver]:跳过 nameserver 规则<br />[-no-rule-ipset]:跳过 ipset 和 nftset 规则。<br />[-no-rule-soa]:跳过 SOA(#) 规则<br />[-no-dualstack-selection]:停用双栈测速<br />[-no-speed-check]:停用测速<br />[-no-cache]:停止缓存 | bind-tls :853 |
-| bind-cert-file | SSL证书文件路径 | smartdns-cert.pem | 合法路径字符串 | bind-cert-file cert.pem |
-| bind-cert-key-file | SSL证书KEY文件路径 | smartdns-key.pem | 合法路径字符串 | bind-cert-key-file key.pem |
-| bind-cert-key-pass | SSL证书KEY文件密码 | 无 | 字符串 | bind-cert-key-pass password |
-| cache-size | 域名结果缓存个数 | 512 | 大于等于 0 的数字 | cache-size 512 |
-| cache-persist | 是否持久化缓存 | 自动。<br />当 cache-file 所在的位置有超过 128 MB 的可用空间时启用,否则禁用。 | [yes\|no] | cache-persist yes |
-| cache-file | 缓存持久化文件路径 | /tmp/<br />smartdns.cache | 合法路径字符串 | cache-file /tmp/smartdns.cache |
-| tcp-idle-time | TCP 链接空闲超时时间 | 120 | 大于等于 0 的数字 | tcp-idle-time 120 |
-| rr-ttl | 域名结果 TTL | 远程查询结果 | 大于 0 的数字 | rr-ttl 600 |
-| rr-ttl-min | 允许的最小 TTL 值 | 远程查询结果 | 大于 0 的数字 | rr-ttl-min 60 |
-| rr-ttl-max | 允许的最大 TTL 值 | 远程查询结果 | 大于 0 的数字 | rr-ttl-max 600 |
-| rr-ttl-reply-max | 允许返回给客户端的最大 TTL 值 | 远程查询结果 | 大于 0 的数字 | rr-ttl-reply-max 60 |
-| local-ttl | 本地HOST,address的TTL值 | rr-ttl-min | 大于 0 的数字 | local-ttl  60 |
-| max-reply-ip-num | 允许返回给客户的最大IP数量 | IP数量 | 大于 0 的数字 | max-reply-ip-num 1 |
-| log-level | 设置日志级别 | error | fatal、error、warn、notice、info 或 debug | log-level error |
-| log-file | 日志文件路径 | /var/log/<br />smartdns/<br />smartdns.log | 合法路径字符串 | log-file /var/log/smartdns/smartdns.log |
-| log-size | 日志大小 | 128K | 数字 + K、M 或 G | log-size 128K |
-| log-num | 日志归档个数 | openwrt为2, 其他系统为8 | 大于等于 0 的数字,0表示禁用日志 | log-num 2 |
-| log-file-mode | 日志归档文件权限 | 0640 | 文件权限 | log-file-mode 644 |
-| audit-enable | 设置审计启用 | no | [yes\|no] | audit-enable yes |
-| audit-file | 审计文件路径 | /var/log/<br />smartdns/<br />smartdns-audit.log | 合法路径字符串 | audit-file /var/log/smartdns/smartdns-audit.log |
-| audit-size | 审计大小 | 128K | 数字 + K、M 或 G | audit-size 128K |
-| audit-num | 审计归档个数 | 2 | 大于等于 0 的数字 | audit-num 2 |
-| audit-file-mode | 审计归档文件权限 | 0640 | 文件权限 | log-file-mode 644 |
-| conf-file | 附加配置文件 | 无 | 合法路径字符串 | conf-file /etc/smartdns/smartdns.more.conf |
-| server | 上游 UDP DNS | 无 | 可重复。<br />[ip][:port]\|URL:服务器 IP:端口(可选)或 URL <br />[-blacklist-ip]:配置 IP 过滤结果。<br />[-whitelist-ip]:指定仅接受参数中配置的 IP 范围<br />[-group [group] ...]:DNS 服务器所属组,比如 office 和 foreign,和 nameserver 配套使用<br />[-exclude-default-group]:将 DNS 服务器从默认组中排除。<br />[-set-mark mark]:设置数据包标记so-mark。<br />[-proxy name]:设置代理服务器。 <br />[-bootstrap-dns]:标记此服务器为bootstrap服务器。| server 8.8.8.8:53 -blacklist-ip -group g1 -proxy proxy<br /> server tls://8.8.8.8|
-| server-tcp | 上游 TCP DNS | 无 | 可重复。<br />[ip][:port]:服务器 IP:端口(可选)<br />[-blacklist-ip]:配置 IP 过滤结果<br />[-whitelist-ip]:指定仅接受参数中配置的 IP 范围。<br />[-group [group] ...]:DNS 服务器所属组,比如 office 和 foreign,和 nameserver 配套使用<br />[-exclude-default-group]:将 DNS 服务器从默认组中排除。<br />[-set-mark mark]:设置数据包标记so-mark。<br />[-proxy name]:设置代理服务器。 <br />[-bootstrap-dns]:标记此服务器为bootstrap服务器。| server-tcp 8.8.8.8:53 |
-| server-tls | 上游 TLS DNS | 无 | 可重复。<br />[ip][:port]:服务器 IP:端口(可选)<br />[-spki-pin [sha256-pin]]:TLS 合法性校验 SPKI 值,base64 编码的 sha256 SPKI pin 值<br />[-host-name]:TLS SNI 名称, 名称设置为-,表示停用SNI名称<br />[-tls-host-verify]:TLS 证书主机名校验<br /> [-no-check-certificate]:跳过证书校验<br />[-blacklist-ip]:配置 IP 过滤结果<br />[-whitelist-ip]:仅接受参数中配置的 IP 范围<br />[-group [group] ...]:DNS 服务器所属组,比如 office 和 foreign,和 nameserver 配套使用<br />[-exclude-default-group]:将 DNS 服务器从默认组中排除。<br />[-set-mark mark]:设置数据包标记so-mark。<br />[-proxy name]:设置代理服务器。 <br />[-bootstrap-dns]:标记此服务器为bootstrap服务器。| server-tls 8.8.8.8:853 |
-| server-https | 上游 HTTPS DNS | 无 | 可重复。<br /><https://[host>][:port]/path:服务器 IP:端口(可选)<br />[-spki-pin [sha256-pin]]:TLS 合法性校验 SPKI 值,base64 编码的 sha256 SPKI pin 值<br />[-host-name]:TLS SNI 名称<br />[-http-host]:http 协议头主机名<br />[-tls-host-verify]:TLS 证书主机名校验<br /> [-no-check-certificate]:跳过证书校验<br />[-blacklist-ip]:配置 IP 过滤结果<br />[-whitelist-ip]:仅接受参数中配置的 IP 范围。<br />[-group [group] ...]:DNS 服务器所属组,比如 office 和 foreign,和 nameserver 配套使用<br />[-exclude-default-group]:将 DNS 服务器从默认组中排除。<br />[-set-mark]:设置数据包标记so-mark。<br />[-proxy name]:设置代理服务器。 <br />[-bootstrap-dns]:标记此服务器为bootstrap服务器。| server-https <https://cloudflare-dns.com/dns-query> |
-| proxy-server | 代理服务器 | 无 | 可重复。<br />proxy-server URL <br />[URL]: [socks5\|http]://[username:password@]host:port<br />[-name]: 代理服务器名称。 |proxy-server socks5://user:[email protected]:1080 -name proxy|
-| speed-check-mode | 测速模式选择 | 无 | [ping\|tcp:[80]\|none] | speed-check-mode ping,tcp:80,tcp:443 |
-| response-mode | 首次查询响应模式 | first-ping |模式:[first-ping\|fastest-ip\|fastest-response]<br /> [first-ping]: 最快ping响应地址模式,DNS上游最快查询时延+ping时延最短,查询等待与链接体验最佳;<br />[fastest-ip]: 最快IP地址模式,查询到的所有IP地址中ping最短的IP。需等待IP测速; <br />[fastest-response]: 最快响应的DNS结果,DNS查询等待时间最短,返回的IP地址可能不是最快。| response-mode first-ping |
-| address | 指定域名 IP 地址 | 无 | address /domain/[ip\|-\|-4\|-6\|#\|#4\|#6] <br />- 表示忽略 <br /># 表示返回 SOA <br />4 表示 IPv4 <br />6 表示 IPv6 | address /www.example.com/1.2.3.4 |
-| cname | 指定域名别名 | 无 | cname /domain/target <br />- 表示忽略 <br />指定对应域名的cname | cname /www.example.com/cdn.example.com |
-| dns64 | DNS64转换 | 无 | dns64 ip-prefix/mask <br /> ipv6前缀和掩码 | dns64 64:ff9b::/96 |
-| edns-client-subnet | DNS ECS | 无 | edns-client-subnet ip-prefix/mask <br /> 指定EDNS客户端子网 | ip-prefix/mask 1.2.3.4/23 |
-| nameserver | 指定域名使用 server 组解析 | 无 | nameserver /domain/[group\|-], group 为组名,- 表示忽略此规则,配套 server 中的 -group 参数使用 | nameserver /www.example.com/office |
-| ipset | 域名 ipset | 无 | ipset /domain/[ipset\|-\|#[4\|6]:[ipset\|-][,#[4\|6]:[ipset\|-]]],-表示忽略 | ipset /www.example.com/#4:dns4,#6:- <br />ipset /www.example.com/dns |
-| ipset-timeout | 设置 ipset 超时功能启用  | no | [yes\|no] | ipset-timeout yes |
-| ipset-no-speed | 当测速失败时,将域名结果设置到ipset集合中 | 无 | ipset \| #[4\|6]:ipset | ipset-no-speed #4:ipset4,#6:ipset6 <br /> ipset-no-speed ipset|
-| nftset | 域名 nftset | 无 | nftset /domain/[#4\|#6\|-]:[family#nftable#nftset\|-][,#[4\|6]:[family#nftable#nftset\|-]]],<br />-表示忽略;<br />ipv4 地址的 family 只支持 inet 和 ip;<br />ipv6 地址的 family 只支持 inet 和 ip6;<br />由于 nft 限制,两种地址只能分开存放于两个 set 中。| nftset /www.example.com/#4:inet#tab#dns4,#6:- |
-| nftset-timeout | 设置 nftset 超时功能启用  | no | [yes\|no] | nftset-timeout yes |
-| nftset-no-speed | 当测速失败时,将域名结果设置到nftset集合中 | 无 | nftset-no-speed [#4\|#6]:[family#nftable#nftset][,#[4\|6]:[family#nftable#nftset]]] <br />ipv4 地址的 family 只支持 inet 和 ip <br />ipv6 地址的 family 只支持 inet 和 ip6 <br />由于 nft 限制,两种地址只能分开存放于两个 set 中。| nftset-no-speed #4:inet#tab#set4|
-| nftset-debug | 设置 nftset 调试功能启用  | no | [yes\|no] | nftset-debug yes |
-| domain-rules | 设置域名规则 | 无 | domain-rules /domain/ [-rules...]<br />[-c\|-speed-check-mode]:测速模式,参考 speed-check-mode 配置<br />[-a\|-address]:参考 address 配置<br />[-n\|-nameserver]:参考 nameserver 配置<br />[-p\|-ipset]:参考ipset配置<br />[-t\|-nftset]:参考nftset配置<br />[-d\|-dualstack-ip-selection]:参考 dualstack-ip-selection<br /> [-no-serve-expired]:禁用过期缓存<br />[-rr-ttl\|-rr-ttl-min\|-rr-ttl-max]: 参考配置rr-ttl, rr-ttl-min, rr-ttl-max<br />[-delete]:删除对应的规则 | domain-rules /www.example.com/ -speed-check-mode none |
-| domain-set | 设置域名集合 | 无 | domain-set [options...]<br />[-n\|-name]:域名集合名称 <br />[-t\|-type]:域名集合类型,当前仅支持list,格式为域名列表,一行一个域名。<br />[-f\|-file]:域名集合文件路径。<br /> 选项需要配合address, nameserver, ipset, nftset等需要指定域名的地方使用,使用方式为 /domain-set:[name]/| domain-set -name set -type list -file /path/to/list <br /> address /domain-set:set/1.2.4.8 |
-| bogus-nxdomain | 假冒 IP 地址过滤 | 无 | [ip/subnet],可重复 | bogus-nxdomain 1.2.3.4/16 |
-| ignore-ip | 忽略 IP 地址 | 无 | [ip/subnet],可重复 | ignore-ip 1.2.3.4/16 |
-| whitelist-ip | 白名单 IP 地址 | 无 | [ip/subnet],可重复 | whitelist-ip 1.2.3.4/16 |
-| blacklist-ip | 黑名单 IP 地址 | 无 | [ip/subnet],可重复 | blacklist-ip 1.2.3.4/16 |
-| force-AAAA-SOA | 强制 AAAA 地址返回 SOA | no | [yes\|no] | force-AAAA-SOA yes |
-| force-qtype-SOA | 强制指定 qtype 返回 SOA | qtype id | [qtypeid\|...] | force-qtype-SOA 65 28
-| prefetch-domain | 域名预先获取功能 | no | [yes\|no] | prefetch-domain yes |
-| dnsmasq-lease-file | 支持读取dnsmasq dhcp文件解析本地主机名功能 | 无 | dnsmasq dhcp lease文件路径 | dnsmasq-lease-file /var/lib/misc/dnsmasq.leases |
-| serve-expired | 过期缓存服务功能 | yes | [yes\|no],开启此功能后,如果有请求时尝试回应 TTL 为 0 的过期记录,并发查询记录,以避免查询等待 |
-| serve-expired-ttl | 过期缓存服务最长超时时间 | 0 | 秒,0 表示停用超时,大于 0 表示指定的超时的秒数 | serve-expired-ttl 0 |
-| serve-expired-reply-ttl | 回应的过期缓存 TTL | 5 | 秒,0 表示停用超时,大于 0 表示指定的超时的秒数 | serve-expired-reply-ttl 30 |
-| serve-expired-prefetch-time | 过期缓存预查询时间 | 28800 | 秒,到达对应超时时间后预查询时间 | serve-expired-prefetch-time 86400 |
-| dualstack-ip-selection | 双栈 IP 优选 | yes | [yes\|no] | dualstack-ip-selection yes |
-| dualstack-ip-selection-threshold | 双栈 IP 优选阈值 | 10ms | 单位为毫秒(ms) | dualstack-ip-selection-threshold [0-1000] |
-| user | 进程运行用户 | root | user [username] | user nobody |
-| ca-file | 证书文件 | /etc/ssl/<br />certs/ca-certificates.crt | 合法路径字符串 | ca-file /etc/ssl/certs/ca-certificates.crt |
-| ca-path | 证书文件路径 | /etc/ssl/certs | 合法路径字符串 | ca-path /etc/ssl/certs |
-
-## 常见问题
-
-1. SmartDNS 和 DNSmasq 有什么区别?
-
-    SmartDNS 在设计上并不是 DNSmasq 的替代品,它的主要功能集中在 DNS 解析增强上,增强部分有:
-
-   - 多上游服务器并发请求,对结果进行测速后,返回最佳结果;
-   - address、ipset 域名匹配采用高效算法,查询匹配更加快速,即使是路由器设备也依然高效;
-   - 域名匹配支持忽略特定域名,可单独匹配 IPv4 和 IPv6,支持多样化定制;
-   - 针对广告屏蔽功能做增强,返回 SOA,屏蔽广告效果更佳;
-   - IPv4、IPv6 双栈 IP 优选机制,在双网情况下,选择最快的网络通讯;
-   - 支持最新的 TLS 和 HTTPS 协议,提供安全的 DNS 查询能力;
-   - ECS 支持,使查询结果更佳准确;
-   - IP 黑名单和忽略 IP 机制,使域名查询更佳准确;
-   - 域名预查询,访问常用网站更加快速;
-   - 域名 TTL 可指定,使访问更快速;
-   - 高速缓存机制,使访问更快速;
-   - 异步日志,审计机制,在记录信息的同时不影响 DNS 查询性能;
-   - 域名组(group)机制,特定域名使用特定上游服务器组查询,避免隐私泄漏;
-   - 第二 DNS 支持自定义更多行为。
-
-1. 如何配置上游服务器最佳?
-
-    SmartDNS 有测速机制,在配置上游服务器时,建议配置多个上游 DNS 服务器,包含多个不同区域的服务器,但总数建议在 10 个左右。推荐搭配
-
-   - 运营商 DNS。
-   - 国内公共 DNS,如 `119.29.29.29`, `223.5.5.5`。
-   - 国外公共 DNS,如 `8.8.8.8`, `8.8.4.4`。
-
-1. 如何启用审计日志?
-
-    审计日志记录客户端请求的域名,记录信息包括,请求时间,请求 IP,请求域名,请求类型,如果要启用审计日志,在配置界面配置 `audit-enable yes` 启用,`audit-size`、 `audit-file`、`audit-num` 分别配置审计日志文件大小,审计日志文件路径,和审计日志文件个数。审计日志文件将会压缩存储以节省空间。
-
-1. 如何避免隐私泄漏?
-
-    默认情况下,SmartDNS 会将请求发送到所有配置的DNS服务器,若上游 DNS 服务器使用DNS,或记录日志,将会导致隐私泄漏。为避免隐私泄漏,请尽量:  
-
-   - 配置使用可信的DNS服务器。
-   - 优先使用 TLS 查询。
-   - 设置上游 DNS 服务器组。
-
-1. 如何屏蔽广告?
-
-    SmartDNS 具备高性能域名匹配算法,通过域名方式过滤广告非常高效,如要屏蔽广告,只需要配置类似如下记录即可,如,屏蔽 `*.ad.com`,则配置:
-
-   ```shell
-   address /ad.com/#
-   ```
-
-    域名的使后缀模式,过滤 `*.ad.com`,`#` 表示返回 SOA,使屏蔽广告更加高效,如果要单独屏蔽 IPv4 或 IPv6, 在 `#` 后面增加数字,如 `#4` 表示对 IPv4 生效。若想忽略特定子域名的屏蔽,如忽略 `pass.ad.com`,可配置如下:
-
-   ```shell
-   address /pass.ad.com/-
-   ```
-
-1. 如何使用 DNS 查询分流?
-
-    某些情况下,需要将有些域名使用特定的 DNS 服务器来查询来做到 DNS 分流。比如
-
-   ```shell
-   .home -> 192.168.1.1 # .home 结尾的域名发送到 192.168.1.1 解析
-   .office -> 10.0.0.1  # .office 结尾的域名发送到 10.0.0.1 解析
-   ```
-
-    其他域名采用默认的模式解析。
-    这种情况的分流配置如下:
-
-   ```shell
-   # 配置上游,用 -group 指定组名,用 -exclude-default-group 将服务器从默认组中排除。
-   server 192.168.1.1 -group home -exclude-default-group
-   server 10.0.0.1 -group office -exclude-default-group
-   server 8.8.8.8
-   
-   # 配置解析的域名
-   nameserver /.home/home
-   nameserver /.office/office
-   ```
-
-    通过上述配置即可实现 DNS 解析分流,如果需要实现按请求端端口分流,可以配置第二 DNS 服务器,`bind` 配置增加 `--group` 参数指定分流名称。
-
-   ```shell
-   bind :7053 -group office
-   bind :8053 -group home
-   ```
-
-1. IPv4、IPv6 双栈 IP 优选功能如何使用?
-
-    目前 IPv6 已经开始普及,但 IPv6 网络在速度上,某些情况下还不如 IPv4。为在双栈网络下获得较好的体验,SmartDNS 提供来双栈IP优选机制,同一个域名,若 IPv4 的速度远快与 IPv6,那么 SmartDNS 就会阻止IPv6的解析、使用 IPv4 访问。可在配置文件中通过设置 `dualstack-ip-selection yes` 启用此功能,通过 `dualstack-ip-selection-threshold [time]` 来修改阈值。如果要完全禁止 IPv6 AAAA记录解析,可设置 `force-AAAA-SOA yes`。
-
-1. 如何提高缓存效率,加快访问速度?
-
-    SmartDNS 提供了域名缓存机制,对查询的域名,进行缓存,缓存时间符合 DNS TTL 规范。为提高缓存命中率,可采用如下措施:  
-
-   - 适当增大缓存的记录数
-
-     通过 `cache-size` 来设置缓存记录数。  
-
-     查询压力大的环境下,并且有内存大的机器的情况下,可适当调大。  
-
-   - 适当设置最小 TTL 值
-
-     通过 `rr-ttl-min` 将最低 DNS TTL 时间设置为一个合理值,延长缓存时间。
-
-     建议是超时时间设置在 10~30 分钟,避免服务器域名变化时,查询到失效域名。
-
-   - 开启域名预获取功能
-
-     通过 `prefetch-domain yes` 来启用域名预先获取功能,提高查询命中率。
-
-     配合上述 TTL 超时时间,SmartDNS 将在域名 TTL 即将超时时,再次发送查询请求,并缓存查询结果供后续使用。频繁访问的域名将会持续缓存。此功能将在空闲时消耗更多的 CPU。
-
-   - 过期缓存服务功能  
-
-     通过 `serve-expired` 来启用过期缓存服务功能,可提高缓存命中率的同时,降低CPU占用。
-
-     此功能会在TTL超时后,将返回 TTL=0 给客户端,并且同时再次发送查询请求,并缓存新的结果给后续使用。
-
-1. 第二 DNS 如何自定义更多行为?
-
-   第二 DNS 可以作为其他 DNS 服务器的上游,提供更多的查询行为,通过 bind 配置支持可以绑定多个端口,不同端口可设置不同的标志,实现不同的功能,如
-
-   ```shell
-   # 绑定 6053 端口,6053 端口的请求将采用配置 office 组的上游查询,且不对结果进行测速,忽略 address 的配置地址
-   bind [::]:6053 -no-speed-check -group office -no-rule-addr
-   ```
-
-1. DoT 的 SPKI 如何获取?
-
-    SPKI 可以通过 DNS 服务商发布的页面获取,如果没有发布,可以通过如下命令获取,其中将对应IP地址更换为要获取 SPKI 的 IP 地址。
-
-    ```shell
-    echo | openssl s_client -connect '1.0.0.1:853' 2>/dev/null | openssl x509 -pubkey -noout | openssl pkey -pubin -outform der | openssl dgst -sha256 -binary | openssl enc -base64
-    ```
-
-1. iOS系统解析缓慢问题怎么解决?  
-
-    IOS14开始,苹果支持了DNS HTTPS(TYPE65)记录的解析,此功能用于快速DNS查询和解决HTTPS链接相关的问题,但当前还是草案,另外会导致广告屏蔽等功能失效,建议通过如下配置关闭TYPE65记录查询。
-
-    ```shell
-    force-qtype-SOA 65
-    ```
-
-1. 如何解析本地主机名称?  
-
-    smartdns可以配合DNSMASQ的dhcp lease文件支持本地主机名->IP地址的解析,可以配置smartdns读取dnsmasq的lease文件,并支持解析。具体配置参数如下,(注意,DNSMASQ lease文件每个系统可能不一样,需要按实际情况配置)
-
-    ```shell
-    dnsmasq-lease-file /var/lib/misc/dnsmasq.leases
-    ```
-
-    配置完成后,可以直接使用主机名连接对应的机器。但需要注意:
-
-    - Windows系统默认使用mDNS解析地址,如需要在windows下用使用smartdns解析,则需要在主机名后面增加`.`,表示使用DNS解析。如`ping smartdns.`
-
-1. 域名集合如何使用?  
-
-    为方便按集合配置域名,对于有/domain/的配置,可以指定域名集合,方便维护。具体方法为:
-
-    - 使用`domain-set`配置集合文件,如
-
-    ```shell
-    domain-set -name ad -file /etc/smartdns/ad-list.conf
-    ```
-
-    ad-list.conf的格式为一个域名一行,如
-
-    ```shell
-    ad.com
-    site.com
-    ```
-
-    - 在有/domain/配置的选项使用域名集合,只需要将`/domain/`配置为`/domain-set:[集合名称]/`即可,如:
-
-    ```shell
-    address /domain-set:ad/#
-    domain-rules /domain-set:ad/ -a #
-    nameserver /domain-set:ad/server
-    ...
-    ```
-
-1. 如何使用ipset和nftset  
-
-    和Dnsmasq类似,smartdns支持ipset和nftset,可以将特定的域名通过TPROXY进行透明转发,透明转发涉工具模式对比如下:
-
-    1. 工具:iptable,nftable
-
-        iptable:成熟的路由规则配置工具。  
-        nftable:更加强大的规则配置工具,正在成为主流。
-
-    1. 模式:TPROXY,REDIRECT
-
-        TPROXY:支持UDP,TCP的转发,配置稍复杂。  
-        REDIRECT:仅支持TCP,配置简单。
-
-
-    1. 配置REDIRECT或TPROXY转发规则
-
-        在smartdns.conf中设置需要透明转发的域名列表,比如要将`example.com`进行透明转发。则使用ipset选项,设置`example.com`的ipset规则为`proxy`。
-
-        ```shell
-        # 设置规则
-        # -ipset proxy: 匹配的域名设置到ipset:tproxy中。
-        # -c none: 停用测速
-        # -address #6: 停用IPV6解析。
-        domain-rules /example.com/ -ipset proxy -c none -address #6
-        ```
-        1. 方式一: TCP REDIRECT转发
-
-            - 此方式配置简单,仅支持TCP的转发。  
-              执行shell命令,设置iptable规则,如果仅转发TCP则可以直接使用REDIRECT的规则,如果需要同时转发UDP和TCP,可以使用TPROXY的转发规则。如下规则按实际需求选择。具体配置如下:
-
-
-            ```shell
-            # 创建ipset集合
-            ipset create proxy hash:net
-            # 设置转发规则,将匹配的请求转发到本机的1081端口
-            iptables -t nat -I PREROUTING -p tcp -m set --match-set proxy dst -j REDIRECT --to-ports 1081
-            ```
-
-            - 在本机1081端口开启REDIRECT模式的转发程序。
-
-        1. 方式二:TCP/UDP TPROXY转发
-        
-            - 此方式可同时转发TCP和UDP。  
-              执行shell命令,设置iptable规则,将匹配的域名TCP/UDP请求进行TPROXY方式透明转发,规则参考如下:
-
-            ```shell
-            # 设置路由规则
-            ip rule add fwmark 1104 lookup 1104
-            ip route add local 0.0.0.0/0 dev lo table 1104
-
-            # 创建ipset集合
-            ipset create proxy hash:net
-
-            # 设置转发规则,UDP,TCP方式的TPROXY转发
-            iptables -t mangle -N SMARTDNS
-            iptables -t mangle -A SMARTDNS -p tcp -m set --match-set proxy dst -j TPROXY --on-ip 127.0.0.1 --on-port 1081 --tproxy-mark 1104
-            iptables -t mangle -A SMARTDNS -p udp -m set --match-set proxy dst -j TPROXY --on-ip 127.0.0.1 --on-port 1081 --tproxy-mark 1104
-            iptables -t mangle -A SMARTDNS -j ACCEPT
-            iptables -t mangle -A PREROUTING -j SMARTDNS
-            ```
-
-            - 在本机的1081端口启动IP透明转发程序。
-    
-
-    1. 额外说明  
-      
-        - 为保证DNS查询结果的位置亲和性,可以使用smartdns的`server`代理参数,将对应域名的查询请求,通过代理查询,使结果位置更好。如:
-
-        ```shell
-        # 增加DNS上游,并设置通过名称为proxy的代理查询,查询组为pass
-        server 1.2.3.4 -proxy proxy -group pass -exclude-default-group
-        # 设置代理服务器信息,代理的名称为proxy
-        proxy-server socks5://user:[email protected] -name proxy
-        # 设置域名规则,对匹配的域名使用代理查询结果,并将结果设置到ipset中。
-        domain-rules /example.com/ -ipset proxy -c none -address #6 -nameserver pass
-        ```
-
-        - 如需要配合测速自动完成ipset的设置,可增加如下配置参数
-
-        ```shell
-        ipset-no-speed proxy
-        ```
-
-    如果使用openwrt的luci界面,可以直接在界面配置相关的域名分流规则。
-
-1. BootStrap DNS  
-
-    对于域名类的上游服务器,SmartDNS会使用其他IP地址类的服务器进行解析,所以一般情况下无需配置BootStrap DNS,但如果有特殊需求,需要指定BootStrap DNS。则可以通过如下方式配置:
-    
-    1. nameserver指定上游服务器  
-    
-        使用nameserver参数指定特定域名使用指定DNS解析。
-        
-        ```
-        server dns.server # 此服务器将使用1.2.3.4解析。
-        server 1.2.3.4 -group bootstrap
-        nameserver /dns.server/bootstrap
-        ```
-
-    1. 对所有服务器指定bootstrap DNS。  
-
-        使用`-bootstrap-dns`参数,指定特定的server为bootstrap DNS。  
+## 编译
 
-        ```
-        server 1.2.3.4 -bootstrap-dns
-        server dns.server
-        ```
+- 代码编译:
 
-1. 更多问题  
-    如有更多问题,请查阅或提交issue: [https://github.com/pymumu/smartdns/issues](https://github.com/pymumu/smartdns/issues)
+  SmartDNS 提供了编译软件包的脚本(`package/build-pkg.sh`),支持编译 LuCI、Debian、OpenWrt 和 Optware 安装包。
 
-## 编译
+- 文档编译:
 
-  SmartDNS 提供了编译软件包的脚本(`package/build-pkg.sh`),支持编译 LuCI、Debian、OpenWrt 和 Optware 安装包
+  文档分支为`doc`,安装`mkdocs`工具后,执行`mkdocs build`编译。
 
 ## 捐赠
 

+ 6 - 733
ReadMe_en.md

@@ -2,34 +2,15 @@
 
 ![SmartDNS](doc/smartdns-banner.png)  
 SmartDNS is a local DNS server. SmartDNS accepts DNS query requests from local clients, obtains DNS query results from multiple upstream DNS servers, and returns the fastest access results to clients. supports secure DNS protocols like DoT (DNS over TLS), DoH (DNS over HTTPS), better protect privacy,  
-Avoiding DNS pollution and improving network access speed, supports high-performance ad filtering.  
-Unlike dnsmasq's all-servers, smartdns returns the fastest access resolution. ([read more](#faq))
+Avoiding DNS pollution and improving network access speed, supports high-performance ad filtering.
+
+Unlike dnsmasq's all-servers, smartdns returns the fastest access resolution.
 
 Support Raspberry Pi, openwrt, ASUS router, Windows and other devices.  
 
-## Table Of Content
-
-- [SmartDNS](#smartdns)
-  - [Table Of Content](#table-of-content)
-  - [Software Show](#software-show)
-  - [Features](#features)
-  - [Architecture](#architecture)
-  - [Usage](#usage)
-    - [Use official installation source](#use-official-installation-source)
-    - [Download the package](#download-the-package)
-    - [Standard Linux system installation/Raspberry Pi, X86\_64 system](#standard-linux-system-installationraspberry-pi-x86_64-system)
-    - [openwrt](#openwrt)
-    - [ASUS router native firmware / Merlin firmware](#asus-router-native-firmware--merlin-firmware)
-    - [optware/entware](#optwareentware)
-    - [Windows 10 WSL Installation/WSL ubuntu](#windows-10-wsl-installationwsl-ubuntu)
-  - [Configuration parameter](#configuration-parameter)
-  - [FAQ](#faq)
-  - [Compile](#compile)
-  - [Donate](#donate)
-    - [PayPal](#paypal)
-    - [Alipay](#alipay)
-    - [Wechat](#wechat)
-  - [Open Source License](#open-source-license)
+## Usage
+
+Please visit website: [https://pymumu.github.io/smartdns](https://pymumu.github.io/smartdns/en)
 
 ## Software Show
 
@@ -133,714 +114,6 @@ From the comparison, smartdns found the fastest IP address to visit www.baidu.co
 1. The upstream DNS server returns a list of Server IP addresses corresponding to the domain name. SmartDNS detects the fastest Server IP with local network access.
 1. Return the fastest accessed Server IP to the local client.
 
-## Usage
-
-### Use official installation source
-
-smartdns can already be installed using system package management tools.
-
-System|Installation|Instructions|
---|--|--
-openwrt|opkg update<br />opkg install luci-app-smartdns<br />opkg install smartdns|systems after 22.03. Software source: <https://downloads.openwrt.org/releases/>
-ddwrt|latest firmware. goto services page abd enable SmartDNS Resolver. |Demo: <https://forum.dd-wrt.com/demo/Services.html>
-debian|apt-get install smartdns|
-entware|ipkg update<br />ipkg install smartdns|Software source: <https://bin.entware.net/>
-
-### Download the package
-
---------------
-
-Download the matching version of the SmartDNS installation package. The corresponding installation package is as follows.
-
-|system |package|Description
-|-----|-----|-----
-|Standard Linux system (Raspberry Pi)| smartdns.xxxxxxxx.arm-debian-all.deb|Support Raspberry Pi Raspbian stretch, Debian 9 system.
-|Standard Linux system (Armbian arm64)| smartdns.xxxxxxxx.aarch64-debian-all.deb|Support Armbian debian stretch, Debian 9 system.
-|Standard Linux system (x86_64)| smartdns.xxxxxxxx.x86_64-linux-all.tar.gz|Support for x86_64 Linux systems.
-|Windows 10 WSL (ubuntu)| smartdns.xxxxxxxx.x86_64-linux-all.tar.gz|Windows 10 WSL ubuntu.
-|Standard Linux system (x86)| smartdns.xxxxxxxx.x86-linux-all.tar.gz|Support for x86_64 systems.
-|optware|smartdns.xxxxxxxx.mips-optware-all.ipk|Support the MIPS big-endian architecture for optware。
-|optware|smartdns.xxxxxxxx.mipsel-optware-all.ipk|Support the MIPS little-endian architecture for optware。
-|optware|smartdns.xxxxxxxx.arm-optware-all.ipk|Support the arm architecture for optware。
-|openwrt|smartdns.xxxxxxxx.mips-openwrt-all.ipk|Support the MIPS big-endian architecture for openwrt。
-|openwrt|smartdns.xxxxxxxx.mipsel-openwrt-all.ipk|Support the MIPS little-endian architecture for openwrt。
-|openwrt|smartdns.xxxxxxxx.arm-openwrt-all.ipk|Support the arm architecture for openwrt。
-|openwrt LUCI|luci-app-smartdns.xxxxxxxxx.all.ipk|Openwrt management interface.
-|openwrt LUCI|luci-app-smartdns.xxxxxxxxx.all-luci-compat-all|Compat Openwrt management interface for early openwrt.
-|Windows|smartdns-rs https://github.com/mokeyish/smartdns-rs| Rust Version SmartDNS |
-|MacOS|smartdns-rs https://github.com/mokeyish/smartdns-rs| Rust Version SmartDNS |
-
-- The released packages are statically compiled. If you need a small size package, please compile it yourself or obtain it from the openwrt / entware repository.
-
-- **Please download from the Release page: [Download here](https://github.com/pymumu/smartdns/releases)**   
-
-
-```shell
-https://github.com/pymumu/smartdns/releases
-```
-
-- For the installation procedure, please refer to the following sections.
-
-### Standard Linux system installation/Raspberry Pi, X86_64 system
-
---------------
-
-1. Installation
-
-    Download the installation package like `smartdns.xxxxxxxx.arm-debian-all.deb` and upload it to the Linux system. Run the following command to install
-
-    ```shell
-    dpkg -i smartdns.xxxxxxxx.arm-debian-all.deb
-    ```
-
-    For X86-64 system, download the installation package like `smartdns.xxxxxxxx.x86_64-linux-all.tar.gz` and upload it to the Linux system. Run the following command to install
-
-    ```shell
-    tar zxf smartdns.xxxxxxxx.x86_64-linux-all.tar.gz
-    cd smartdns
-    chmod +x ./install
-    ./install -i
-    ```
-
-    **For Ubuntu system:**
-    - `systemd-resolved` occupies TCP53 and UDP53 ports. You need to manually resolve the port occupancy problem or modify the SmartDNS listening port
-
-    - Log files in `/var/log/smartdns/smartdns.log`
-
-1. Configuration
-
-    After the installation is complete, you can configure the upstream server to  smartdns. Refer to the `Configuration Parameters` for specific configuration parameters.  
-    In general, you only need to add `server [IP]:port`, `server-tcp [IP]:port` configuration items.  
-    Configure as many upstream DNS servers as possible, including servers at home and abroad. Please refer to the `Configuration Parameters` section for configuration parameters.  
-
-    ```shell
-    vi /etc/smartdns/smartdns.conf
-    ```
-
-    `smartdns.conf` example:
-
-    ```shell
-    # set listen port
-    bind []:53 
-    # set upstream servers
-    server 1.1.1.1
-    server-tls 8.8.8.8
-    # set domain rules
-    address /example.com/1.2.3.4
-    domain-rule /example.com/ -address 1.2.3.4
-    ```
-
-1. Start Service
-
-    ```shell
-    systemctl enable smartdns
-    systemctl start smartdns
-    ```
-
-1. Forwarding DNS request to SmartDNS
-
-    Modify the DNS server of the local router and configure the DNS server as SmartDNS.
-    - Log in to the router on the local network and configure the Raspberry Pi to assign a static IP address.
-    - Modify the WAN port or DHCP DNS to the Raspberry Pi IP address.
-    Note:
-    I. Each router configuration method is different. Please search Baidu for related configuration methods.
-    II. some routers may not support configuring custom DNS server. in this case, please modify the PC's, mobile phone's DNS server to the ip of Raspberry Pi.
-
-1. Check if the service is configured successfully
-
-    Query domain name with `nslookup -querytype=ptr smartdns`  
-    Check if the `name` item in the command result is displayed as `smartdns` or `hostname`, such as `smartdns`
-
-    ```shell
-    pi@raspberrypi:~/code/smartdns_build $ nslookup -querytype=ptr smartdns
-    Server:         192.168.1.1
-    Address:        192.168.1.1#53
-
-    Non-authoritative answer:
-    smartdns         name = smartdns.
-    ```
-
-### openwrt
-
---------------
-
-1. Installation
-
-    Upload the software to the /root directory of the router with winscp or other tool, and execute the following command to install it.
-
-    ```shell
-    opkg install smartdns.xxxxxxxx.xxxx.ipk
-    opkg install luci-app-smartdns.xxxxxxxx.xxxx.all.ipk
-    ```
-
-    - Note: For versions before openwrt 19.07, please install `luci-app-smartdns.xxxxxxxxx.all-luci-compat-all` package.
-
-1. Configuration
-
-    Log in to the openwrt management page and open `Services`->`SmartDNS` to configure SmartDNS.
-    - Add upstream DNS server configuration to `Upstream Servers`. It is recommended to configure multiple DNS servers at home and abroad.
-    - Specify the IP address of a specific domain name in `Domain Address`, which can be used for ad blocking.
-
-1. Start Service
-
-   There are two ways to use the SmartDNS service, `one is directly as the primary DNS service`, `the other is as the upstream of dnsmasq`.  
-   By default, SmartDNS uses the first method. You can choose according to your needs in the following two ways.
-
-1. Method 1: SmartDNS as primary DNS Server
-
-    - **Enable SmartDNS as primary DNS Server**
-
-        Log in to the router, click on `Services`->`SmartDNS`->`port`, input port `53`, smartdns will run as primary DNS Server.
-
-    - **Check if the service is configured successfully**
-
-        Query domain name with `nslookup -querytype=ptr smartdns`
-        See if the `name` item in the command result is displayed as `smartdns` or `hostname`, such as `smartdns`
-
-        ```shell
-        pi@raspberrypi:~/code/smartdns_build $ nslookup -querytype=ptr smartdns
-        Server:         192.168.1.1
-        Address:        192.168.1.1#53
-
-        Non-authoritative answer:
-        smartdns         name = smartdns.
-        ```
-
-1. Start Service
-
-    Check the `Enable' in the configuration page to start SmartDNS server.
-
-1. Note
-
-   - When the port of smartdns is 53, it will automatically take over dnsmasq as the primary dns. When configuring other ports, dnsmasq is re-enabled as primary dns.
-   - If an exception occurs during this process, you can use the following command to restore dnsmasq as the primary DNS
-
-   ```shell
-   uci delete dhcp.@dnsmasq[0].port
-   uci commit dhcp
-   /etc/init.d/dnsmasq restart
-   ```
-
-### ASUS router native firmware / Merlin firmware
-
---------------
-
-Note: Merlin firmware is derived from ASUS firmware and can theoretically be used directly with the ASUS package. However, it is currently unverified. If you have any questions, please submit an issue.
-
-1. Prepare
-
-    When using this software, you need to confirm whether the router supports U disk and prepare a USB disk.
-
-1. Enable SSH login
-
-    Log in to the management interface, click `System Management`-> Click `System Settings` and configure `Enable SSH` to `Lan Only`.  
-    The SSH login username and password are the same as the management interface.
-
-1. Install `Download Master`
-
-    In the management interface, click `USB related application`-> click `Download Master` to download.  
-    After the download is complete, enable `Download Master`. If you do not need the download function, you can uninstall `Download Master` here, but make sure that Download Master is enabled before uninstalling.  
-
-1. Install SmartDNS
-
-    Upload the software to the router's `/tmp/mnt/sda1` directory using winscp. (or copy the network neighborhood to the sda1 shared directory)
-
-    ```shell
-    ipkg install smartdns.xxxxxxx.mipsbig.ipk
-    ```
-
-1. Restart router
-
-    After the router is started, use `nslookup -querytype=ptr smartdns` to query the domain name.  
-    See if the `name` item in the command result is displayed as `smartdns` or `hostname`, such as `smartdns`
-
-    ```shell
-    pi@raspberrypi:~/code/smartdns_build $ nslookup -querytype=ptr smartdns
-    Server:         192.168.1.1
-    Address:        192.168.1.1#53
-
-    Non-authoritative answer:
-    smartdns         name = smartdns.
-    ```
-
-1. Note
-
-    In the above process, smartdns will be installed to the root directory of the U disk and run in optware mode.  
-    Its directory structure is as follows: (only smartdns related files are listed here)
-
-    ```shell
-    USB DISK
-    └── asusware.mipsbig
-            ├── bin
-            ├── etc
-            |    ├── smartdns
-            |    |     └── smartdns.conf
-            |    └── init.d
-            |          └── S50smartdns
-            ├── lib
-            ├── sbin
-            ├── usr
-            |    └── sbin
-            |          └── smartdns
-            ....
-    ```
-
-    To modify the configuration, you can use ssh to login to the router and use the vi command to modify it.
-
-    ```shell
-    vi /opt/etc/smartdns/smartdns.conf
-    ```
-
-    `smartdns.conf` example:
-
-    ```shell
-    # set listen port
-    bind []:53 
-    # set upstream servers
-    server 1.1.1.1
-    server-tls 8.8.8.8
-    # set domain rules
-    address /example.com/1.2.3.4
-    domain-rule /example.com/ -address 1.2.3.4
-    ```
-
-    It can also be modified from Network Neighborhood. From the neighbor sharing directory `sda1` you can't see the `asusware.mipsbig` directory, but you can directly enter `asusware.mipsbig\etc\init.d` in `File Manager` to modify it.
-
-    ```shell
-    \\192.168.1.1\sda1\asusware.mipsbig\etc\init.d
-    ```
-
-### optware/entware
-
---------------
-
-1. Prepare
-
-    When using this software, you need to confirm whether the router supports USB disk and prepare a USB disk.
-
-1. Install SmartDNS
-
-    Upload the software to `/tmp` directory of the router using winscp, and run the following command to install.
-
-    ```shell
-    ipkg install smartdns.xxxxxxx.mipsbig.ipk
-    ```
-
-1. Modify the smartdns configuration
-
-    ```shell
-    Vi /opt/etc/smartdns/smartdns.conf
-    ```
-
-    `smartdns.conf` example:
-
-    ```shell
-    # set listen port
-    bind []:53 
-    # set upstream servers
-    server 1.1.1.1
-    server-tls 8.8.8.8
-    # set domain rules
-    address /example.com/1.2.3.4
-    domain-rule /example.com/ -address 1.2.3.4
-    ```
-
-    Note: if you need to support IPV6, you can set the work-mode to `2`, this will disable the DNS service of dnsmasq, and smartdns run as the primary DNS server. Change `SMARTDNS_WORKMODE` in the file `/opt/etc/smartdns/smartdns-opt.conf` to `2`.
-
-    ```shell
-    SMARTDNS_WORKMODE="2"
-    ```
-
-1. Restart the router to take effect
-
-    After the router is started, use `nslookup -querytype=ptr smartdns` to query the domain name.
-    See if the `name` item in the command result is displayed as `smartdns` or `hostname`, such as `smartdns`
-
-    ```shell
-    Pi@raspberrypi:~/code/smartdns_build $ nslookup -querytype=ptr smartdns
-    Server: 192.168.1.1
-    Address: 192.168.1.1#53
-
-    Non-authoritative answer:
-    smartdns        name = smartdns.
-    ```
-
-    Note: If the service does not start automatically, you need to set optware/entware to start automatically. For details, see the optware/entware documentation.
-
-### Windows 10 WSL Installation/WSL ubuntu
-
---------------
-
-1. Install Windows 10 WSL ubuntu
-
-   Install the Windows 10 WSL environment and select Ubuntu as default distribution. Please refer to [WSL installation instructions](https://docs.microsoft.com/en-us/windows/wsl/install-win10) for installation steps
-
-1. Install smartdns
-
-    download install package `smartdns.xxxxxxxx.x86_64-linux-all.tar.gz`, and unzip to the `D:\` directory, after decompression, the directory is as follows:
-
-    ```shell
-    D:\SMARTDNS
-    ├─etc
-    │  ├─default
-    │  ├─init.d
-    │  └─smartdns
-    ├─package
-    │  └─windows
-    ├─src
-    └─systemd
-
-    ```
-
-    Double-click `install.bat` in the `D:\smartdns\package\windows` directory for installation. Please enter the password for `WLS ubuntu` when input password.
-
-1. Configuration
-
-    Edit `smartdns.conf` configuration file in `D:\smartdns\etc\smartdns` directory, you can configure the upstream server to  smartdns. Refer to the `Configuration Parameters` for specific configuration parameters.  
-    In general, you only need to add `server [IP]:port`, `server-tcp [IP]:port` configuration items.  
-    Configure as many upstream DNS servers as possible, including servers at home and abroad. Please refer to the `Configuration Parameters` section for configuration parameters.  
-
-    `smartdns.conf` example:
-
-    ```shell
-    # set listen port
-    bind []:53 
-    # set upstream servers
-    server 1.1.1.1
-    server-tls 8.8.8.8
-    # set domain rules
-    address /example.com/1.2.3.4
-    domain-rule /example.com/ -address 1.2.3.4
-    ```
-
-1. Start Service
-
-    Double-click `reload.bat` in the `D:\smartdns\package\windows` directory for reload.
-
-1. Forwarding DNS request to SmartDNS
-
-    Modify the default DNS server for Windows to `127.0.0.1`, with these steps referred to [IP configuration](https://support.microsoft.com/en-us/help/15089/windows-change-tcp-ip-settings)
-
-1. Check if the service is configured successfully
-
-    Query domain name with `nslookup -querytype=ptr smartdns`  
-    Check if the `name` item in the command result is displayed as `smartdns` or `hostname`, such as `smartdns`
-
-    ```shell
-    pi@raspberrypi:~/code/smartdns_build $ nslookup -querytype=ptr smartdns
-    Server:         192.168.1.1
-    Address:        192.168.1.1#53
-
-    Non-authoritative answer:
-    smartdns         name = smartdns.
-    ```
-
-## Configuration parameter
-
-|parameter|Parameter function|Default value|Value type|Example|
-|--|--|--|--|--|
-|server-name|DNS name|host name/smartdns|any string like hostname|server-name smartdns
-|bind|DNS listening port number|[::]:53|Support binding multiple ports<br />`IP:PORT@DEVICE`: server IP, port number, and device. <br />`[-group]`: The DNS server group used when requesting. <br />`[-no-rule-addr]`: Skip the address rule. <br />`[-no-rule-nameserver]`: Skip the Nameserver rule. <br />`[-no-rule-ipset]`: Skip the Ipset or nftset rules. <br />`[-no-rule-soa]`: Skip address SOA(#) rules.<br />`[-no-dualstack-selection]`: Disable dualstack ip selection.<br />`[-no-speed-check]`: Disable speed measurement. <br />`[-no-cache]`: stop caching |bind :53@eth0
-|bind-tcp|TCP mode DNS listening port number|[::]:53|Support binding multiple ports<br />`IP:PORT@DEVICE`: server IP, port number and device. <br />`[-group]`: The DNS server group used when requesting. <br />`[-no-rule-addr]`: Skip the address rule. <br />`[-no-rule-nameserver]`: Skip the Nameserver rule. <br />`[-no-rule-ipset]`: Skip the ipset or nftset rules. <br />`[-no-rule-soa]`: Skip address SOA(#) rules.<br />`[-no-dualstack-selection]`: Disable dualstack ip selection.<br />`[-no-speed-check]`: Disable speed measurement. <br />`[-no-cache]`: stop caching |bind-tcp :53
-|bind-tls|DOT mode DNS listening port number|[::]:853|Support binding multiple ports<br />`IP:PORT@DEVICE`: server IP, port number and device. <br />`[-group]`: The DNS server group used when requesting. <br />`[-no-rule-addr]`: Skip the address rule. <br />`[-no-rule-nameserver]`: Skip the Nameserver rule. <br />`[-no-rule-ipset]`: Skip the ipset or nftset rules. <br />`[-no-rule-soa]`: Skip address SOA(#) rules.<br />`[-no-dualstack-selection]`: Disable dualstack ip selection.<br />`[-no-speed-check]`: Disable speed measurement. <br />`[-no-cache]`: stop caching |bind-tcp :853
-|bind-cert-file|SSL Certificate file path|smartdns-cert.pem|path| bind-cert-file cert.pem |
-|bind-cert-key-file|SSL Certificate key file path|none|smartdns-key.pem| bind-cert-key-file key.pem |
-|bind-cert-key-pass|SSL Certificate key file password|none|string| bind-cert-key-pass password |
-|cache-size|Domain name result cache number|512|integer|cache-size 512
-|cache-persist|enable persist cache|Auto: Enabled if the location of `cache-file` has more than 128MB of free space.|[yes\|no]|cache-persist yes
-|cache-file|cache persist file|/tmp/<br />smartdns.cache|path|cache-file /tmp/smartdns.cache
-|tcp-idle-time|TCP connection idle timeout|120|integer|tcp-idle-time 120
-|rr-ttl|Domain name TTL|Remote query result|number greater than 0|rr-ttl 600
-|rr-ttl-min|Domain name Minimum TTL|Remote query result|number greater than 0|rr-ttl-min 60
-|local-ttl|ttl for address and host|rr-ttl-min|number greater than 0|local-ttl 600
-|rr-ttl-reply-max|Domain name Minimum Reply TTL|Remote query result|number greater than 0|rr-ttl-reply-max 60
-|rr-ttl-max|Domain name Maximum TTL|Remote query result|number greater than 0|rr-ttl-max 600
-|max-reply-ip-num|Maximum number of IPs returned to the client|8|number of IPs, 1~16 |max-reply-ip-num 1
-|log-level|log level|error|fatal,error,warn,notice,info,debug|log-level error
-|log-file|log path|/var/log/<br />smartdns/<br />smartdns.log|File Pah|log-file /var/log/smartdns/smartdns.log
-|log-size|log size|128K|number+K,M,G|log-size 128K
-|log-num|archived log number|2 for openwrt, 8 for other system|Integer, 0 means turn off the log|log-num 2
-|log-file-mode|archived log file mode|0640|Integer|log-file-mode 644
-|audit-enable|audit log enable|no|[yes\|no]|audit-enable yes
-|audit-file|audit log file|/var/log/<br />smartdns/<br />smartdns-audit.log|File Path|audit-file /var/log/smartdns/smartdns-audit.log
-|audit-size|audit log size|128K|number+K,M,G|audit-size 128K
-|audit-num|archived audit log number|2|Integer, 0 means turn off the log|audit-num 2
-|audit-file-mode|archived audit log file mode|0640|Integer|audit-file-mode 644
-|conf-file|additional conf file|None|File path|conf-file /etc/smartdns/smartdns.more.conf
-|server|Upstream UDP DNS server|None|Repeatable <br />`[ip][:port]\|URL`: Server IP, port optional OR URL. <br />`[-blacklist-ip]`: The "-blacklist-ip" parameter is to filtering IPs which is configured by "blacklist-ip". <br />`[-whitelist-ip]`: whitelist-ip parameter specifies that only the IP range configured in whitelist-ip is accepted. <br />`[-group [group] ...]`: The group to which the DNS server belongs, such as office, foreign, use with nameserver. <br />`[-exclude-default-group]`: Exclude DNS servers from the default group. <br />`[-set-mark mark]`: set mark on packets <br /> `[-proxy name]`: set proxy server <br /> `[-bootstrap-dns]`: set as bootstrap dns server | server 8.8.8.8:53 -blacklist-ip<br />server tls://8.8.8.8
-|server-tcp|Upstream TCP DNS server|None|Repeatable <br />`[ip][:port]`: Server IP, port optional. <br />`[-blacklist-ip]`: The "-blacklist-ip" parameter is to filtering IPs which is configured by "blacklist-ip". <br />`[-whitelist-ip]`: whitelist-ip parameter specifies that only the IP range configured in whitelist-ip is accepted. <br />`[-group [group] ...]`: The group to which the DNS server belongs, such as office, foreign, use with nameserver. <br />`[-exclude-default-group]`: Exclude DNS servers from the default group <br />`[-set-mark mark]`: set mark on packets <br /> `[-proxy name]`: set proxy server <br /> `[-bootstrap-dns]`: set as bootstrap dns server | server-tcp 8.8.8.8:53
-|server-tls|Upstream TLS DNS server|None|Repeatable <br />`[ip][:port]`: Server IP, port optional. <br />`[-spki-pin [sha256-pin]]`: TLS verify SPKI value, a base64 encoded SHA256 hash<br />`[-host-name]`:TLS Server name. `-` to disable SNI name.<br />`[-tls-host-verify]`: TLS cert hostname to verify. <br />`-no-check-certificate:`: No check certificate. <br />`[-blacklist-ip]`: The "-blacklist-ip" parameter is to filtering IPs which is configured by "blacklist-ip". <br />`[-whitelist-ip]`: whitelist-ip parameter specifies that only the IP range configured in whitelist-ip is accepted. <br />`[-group [group] ...]`: The group to which the DNS server belongs, such as office, foreign, use with nameserver. <br />`[-exclude-default-group]`: Exclude DNS servers from the default group <br /> `[-set-mark mark]`: set mark on packets <br /> `[-proxy name]`: set proxy server <br /> `[-bootstrap-dns]`: set as bootstrap dns server | server-tls 8.8.8.8:853
-|server-https|Upstream HTTPS DNS server|None|Repeatable <br />`https://[host][:port]/path`: Server IP, port optional. <br />`[-spki-pin [sha256-pin]]`: TLS verify SPKI value, a base64 encoded SHA256 hash<br />`[-host-name]`:TLS Server name<br />`[-http-host]`: http header host. <br />`[-tls-host-verify]`: TLS cert hostname to verify. <br />`-no-check-certificate:`: No check certificate. <br />`[-blacklist-ip]`: The "-blacklist-ip" parameter is to filtering IPs which is configured by "blacklist-ip". <br />`[-whitelist-ip]`: whitelist-ip parameter specifies that only the IP range configured in whitelist-ip is accepted. <br />`[-group [group] ...]`: The group to which the DNS server belongs, such as office, foreign, use with nameserver. <br />`[-exclude-default-group]`: Exclude DNS servers from the default group <br /> `[-set-mark mark]`: set mark on packets <br /> `[-proxy name]`: set proxy server <br /> `[-bootstrap-dns]`: set as bootstrap dns server | server-https <https://cloudflare-dns.com/dns-query>
-|proxy-server| proxy server | None | Repeatable. <br />`proxy-server URL` <br />[URL]: `[socks5\|http]://[username:password@]host:port`<br />[-name]:  proxy server name. |proxy-server socks5://user:[email protected]:1080 -name proxy|
-|speed-check-mode|Speed ​​mode|None|[ping\|tcp:[80]\|none]|speed-check-mode ping,tcp:80,tcp:443
-|response-mode|First query response mode|first-ping|Mode: [first-ping\|fastest-ip\|fastest-response]<br /> [first-ping]: The fastest dns + ping response mode, DNS query delay + ping delay is the shortest;<br />[fastest-ip]: The fastest IP address mode, return the fastest ip address, may take some time to test speed. <br />[fastest-response]: The fastest response DNS result mode, the DNS query waiting time is the shortest. | response-mode first-ping |
-|address|Domain IP address|None|address /domain/[ip\|-\|-4\|-6\|#\|#4\|#6], `-` for ignore, `#` for return SOA, `4` for IPV4, `6` for IPV6| address /www.example.com/1.2.3.4
-|cname|set cname to domain| None | cname /domain/target <br />- for ignore <br />set cname to domain. | cname /www.example.com/cdn.example.com |
-|dns64|dns64 translation | None | dns64 ip-prefix/mask <br /> ipv6 prefix and mask. | dns64 64:ff9b::/96 |
-|edns-client-subnet| DNS ECS | None |edns-client-subnet ip-prefix/mask <br /> set EDNS client subnet | ip-prefix/mask 1.2.3.4/23 |
-|nameserver|To query domain with specific server group|None|nameserver /domain/[group\|-], `group` is the group name, `-` means ignore this rule, use the `-group` parameter in the related server|nameserver /www.example.com/office
-|ipset|Domain IPSet|None|ipset /domain/[ipset\|-\|#[4\|6]:[ipset\|-][,#[4\|6]:[ipset\|-]]], `-` for ignore|ipset /www.example.com/#4:dns4,#6:-
-|ipset-timeout|ipset timeout enable|no|[yes\|no]|ipset-timeout yes
-|ipset-no-speed|When speed check fails, set the ip address of the domain name to the ipset | None | ipset \| #[4\|6]:ipset | ipset-no-speed #4:ipset4,#6:ipset6 <br /> ipset-no-speed ipset|
-|nftset|Domain nftset|None|nftset /domain/[#4\|#6\|-]:[family#nftable#nftset\|-][,#[4\|6]:[family#nftable#nftset\|-]]]<br /> `-` to ignore<br />the valid families are inet and ip for ipv4 addresses while the valid ones are inet and ip6 for ipv6 addresses <br />due to the limitation of nftable <br />two types of addresses have to be stored in two sets|nftset /www.example.com/#4:inet#tab#dns4,#6:-
-|nftset-timeout|nftset timeout enable|no|[yes\|no]|nftset-timeout yes
-|nftset-no-speed|When speed check fails, set the ip address of the domain name to the nftset | None | nftset-no-speed [#4\|#6]:[family#nftable#nftset][,#[4\|6]:[family#nftable#nftset]]] <br />the valid families are inet and ip for ipv4 addresses while the valid ones are inet and ip6 for ipv6 addresses <br />due to the limitation of nftable <br />two types of addresses have to be stored in two sets| nftset-no-speed #4:inet#tab#set4|
-|nftset-debug|nftset debug enable|no|[yes\|no]|nftset-debug yes
-|domain-rules|set domain rules|None|domain-rules /domain/ [-rules...]<br />[-c\|-speed-check-mode]: set speed check mode, same as parameter speed-check-mode<br />[-a\|-address]: same as  parameter `address` <br />[-n\|-nameserver]: same as parameter `nameserver`<br />[-p\|-ipset]: same as parameter `nftset`<br />[-t\|-nftset]: same as parameter `nftset`<br />[-d\|-dualstack-ip-selection]: same as parameter `dualstack-ip-selection`<br />  [-no-serve-expired]: disable serve expired<br />[-rr-ttl\|-rr-ttl-min\|-rr-ttl-max]: same as parameter: rr-ttl, rr-ttl-min, rr-ttl-max<br />[-delete]: delete rule|domain-rules /www.example.com/ -speed-check-mode none
-| domain-set | collection of domains|None| domain-set [options...]<br />[-n\|-name]: name of set <br />[-t\|-type] [list]: set type, only support list, one domain per line <br />[-f\|-file]: file path of domain set<br /> used with address, nameserver, ipset, nftset, example: /domain-set:[name]/ | domain-set -name set -type list -file /path/to/list <br /> address /domain-set:set/1.2.4.8 |
-|bogus-nxdomain|bogus IP address|None|[IP/subnet], Repeatable| bogus-nxdomain 1.2.3.4/16
-|ignore-ip|ignore ip address|None|[ip/subnet], Repeatable| ignore-ip 1.2.3.4/16
-|whitelist-ip|ip whitelist|None|[ip/subnet], Repeatable, When the filtering server responds IPs in the IP whitelist, only result in whitelist will be accepted| whitelist-ip 1.2.3.4/16
-|blacklist-ip|ip blacklist|None|[ip/subnet], Repeatable, When the filtering server responds IPs in the IP blacklist, The result will be discarded directly| blacklist-ip 1.2.3.4/16
-|force-AAAA-SOA|force AAAA query return SOA|no|[yes\|no]|force-AAAA-SOA yes
-|force-qtype-SOA|force specific qtype return SOA|qtype id|[qtypeid \| ...]|force-qtype-SOA 65 28
-|prefetch-domain|domain prefetch feature|no|[yes\|no]|prefetch-domain yes
-|dnsmasq-lease-file|Support reading dnsmasq dhcp file to resolve local hostname|None|dnsmasq dhcp lease file| dnsmasq-lease-file /var/lib/misc/dnsmasq.leases
-|serve-expired|Cache serve expired feature|yes|[yes\|no], Attempts to serve old responses from cache with a TTL of 0 in the response without waiting for the actual resolution to finish.|serve-expired yes
-|serve-expired-ttl|Cache serve expired limit TTL|0|second, 0: disable, > 0  seconds after expiration|serve-expired-ttl 0
-|serve-expired-reply-ttl|TTL value to use when replying with expired data|5|second, 0: disable, > 0  seconds after expiration|serve-expired-reply-ttl 30
-|serve-expired-prefetch-time| Prefetch time when serve expired | 28800 | second,prefetch time | serve-expired-prefetch-time 86400 |
-|dualstack-ip-selection|Dualstack ip selection|yes|[yes\|no]|dualstack-ip-selection yes
-|dualstack-ip-selection-threshold|Dualstack ip select thresholds|10ms|millisecond|dualstack-ip-selection-threshold [0-1000]
-|user|run as user|root|user [username]|user nobody
-|ca-file|certificate file|/etc/ssl/certs/<br />ca-certificates.crt|path|ca-file /etc/ssl/certs/ca-certificates.crt
-|ca-path|certificates path|/etc/ssl/certs|path|ca-path /etc/ssl/certs
-
-## FAQ
-
-1. What is the difference between SmartDNS and DNSMASQ?  
-
-    Smartdns is not designed to replace DNSMASQ. The main function of Smartdns is focused on DNS resolution enhancement, the difference are:  
-    - Multiple upstream server concurrent requests, after the results are measured, return the best results;
-    - `address`, `ipset` domain name matching uses efficient algorithms, query matching is faster and more efficient, and router devices are still efficient.
-    - Domain name matching supports ignoring specific domain names, and can be individually matched to IPv4, IPV6, and supports diversified customization.
-    - Enhance the ad blocking feature, return SOA record, this block ads better;
-    - IPV4, IPV6 dual stack IP optimization mechanism, in the case of dual network, choose the fastest network.
-    - Supports the latest TLS, HTTPS protocol and provides secure DNS query capabilities.
-    - DNS anti-poison mechanism, and a variety of mechanisms to avoid DNS pollution.
-    - ECS support, the query results are better and more accurate.
-    - IP blacklist support, ignoring the blacklist IP to make domain name queries better and more accurate.
-    - Domain name pre-fetch, more faster to access popular websites.
-    - Domain name TTL can be specified to make access faster.
-    - Cache mechanism to make access faster.
-    - Asynchronous log, audit log mechanism, does not affect DNS query performance while recording information.
-    - Domain group mechanism, specific domain names use specific upstream server group queries to avoid privacy leakage.
-    - The second DNS supports customizing more behavior.
-
-1. What is the best practices for upstream server configuration?  
-
-    Smartdns has a speed measurement mechanism. When configuring an upstream server, it is recommended to configure multiple upstream DNS servers, including servers in different regions, but the total number is recommended to be around 10. Recommended configuration
-    - Carrier DNS.
-    - Public DNS, such as `8.8.8.8`, `8.8.4.4`, `1.1.1.1`.
-
-    For specific domain names, if there is a pollution, you can enable the anti-pollution mechanism.
-
-1. How to enable the audit log  
-
-    The audit log records the domain name requested by the client. The record information includes the request time, the request IP address, the request domain name, and the request type. If you want to enable the audit log, configure `audit-enable yes` in the configuration file, `audit-size`, `Audit-file`, `audit-num` configure the audit log file size, the audit log file path, and the number of audit log files. The audit log file will be compressed to save space.
-
-1. How to avoid DNS privacy leaks  
-
-    By default, smartdns will send requests to all configured DNS servers. If the upstream DNS servers record DNS logs, it will result in a DNS privacy leak. To avoid privacy leaks, try the following steps:
-    - Use trusted DNS servers.
-    - Use TLS servers.
-    - Set up an upstream DNS server group.
-
-1. How to block ads  
-
-    Smartdns has a high-performance domain name matching algorithm. It is very efficient to filter advertisements by domain name. To block ads, you only need to configure records like the following configure. For example, if you block `*.ad.com`, configure as follows:
-
-    ```shell
-    Address /ad.com/#
-    ```
-
-    The suffix mode of the domain name, filtering *.ad.com, `#` means returning SOA record. If you want to only block IPV4 or IPV6 separately, add a number after `#`, such as `#4` is for IPV4 blocking. If you want to ignore some specific subdomains, you can configure it as follows. e.g., if you ignore `pass.ad.com`, you can configure it as follows:
-
-    ```shell
-    Address /pass.ad.com/-
-    ```
-
-1. DNS query diversion  
-
-    In some cases, some domain names need to be queried using a specific DNS server to do DNS diversion. such as.
-
-    ```shell
-    .home -> 192.168.1.1
-    .office -> 10.0.0.1
-    ```
-
-    The domain name ending in .home is sent to 192.168.1.1 for resolving
-    The domain name ending in .office is sent to 10.0.0.1 for resolving
-    Other domain names are resolved using the default mode.
-    The diversion configuration for this case is as follows:
-
-    ```shell
-    # Upstream configuration, use -group to specify the group name, and -exclude-default-group to exclude the server from the default group.
-    Server 192.168.1.1 -group home -exclude-default-group
-    Server 10.0.0.1 -group office -exclude-default-group
-    Server 8.8.8.8
-
-    #Configure the resolved domain name with specific group
-    Nameserver /.home/home
-    Nameserver /.office/office
-    ```
-
-    You can use the above configuration to implement DNS resolution and offload. If you need to implement traffic distribution on the requesting port, you can configure the second DNS server. The bind configuration is added. The group parameter specifies the traffic distribution name.
-
-    ```shell
-    Bind :7053 -group office
-    Bind :8053 -group home
-    ```
-
-1. How to use the IPV4, IPV6 dual stack IP optimization feature  
-
-    At present, IPV6 network is not as fast as IPV4 in some cases. In order to get a better experience in the dual-stack network, SmartDNS provides a dual-stack IP optimization mechanism, the same domain name, and the speed of IPV4. Far faster than IPV6, then SmartDNS will block the resolution of IPV6, let the PC use IPV4, the feature is enabled by `dualstack-ip-selection yes`, `dualstack-ip-selection-threshold [time]` is for threshold. if you want to disable IPV6 AAAA record complete, please try `force-AAAA-SOA yes`.
-
-1. How to improve cache performance  
-
-    Smartdns provides a domain name caching mechanism to cache the queried domain name, and the caching time is in accordance with the DNS TTL specification. To increase the cache hit rate, the following configuration can be taken:
-    - Increase the number of cache records appropriately  
-    Set the number of cache records by `cache-size`.
-    In the case of a query with a high pressure environment and a machine with a large memory, it can be appropriately adjusted.
-
-    - Set the minimum TTL value as appropriate  
-    Set the minimum DNS TTL time to a appropriate value by `rr-ttl-min` to extend the cache time.
-    It is recommended that the timeout period be set to 10 to 30 minutes to avoid then invalid domain names when domain ip changes.
-
-    - Enable domain pre-acquisition  
-    Enable pre-fetching of domain names with `prefetch-domain yes` to improve query hit rate.
-    by default, Smartdns will send domain query request again before cache expire, and cache the result for the next query. Frequently accessed domain names will continue to be cached. This feature will consume more CPU when idle.
-
-    - Cache serve expired feature  
-    Enable cache serve expired feature with `serve-expired yes` to improve the cache hit rate and reduce the CPU consumption.
-    This feature will return TTL = 0 to the client after the TTL timeout, and send a new query request again at the same time, and cache the new results for later query.
-
-1. How does the second DNS customize more behavior?  
-
-    The second DNS can be used as the upstream of other DNS servers to provide more query behaviors. Bind configuration support can bind multiple ports. Different ports can be set with different flags to implement different functions, such as
-
-    ```shell
-    # Binding 6053 port, request for port 6053 will be configured with the upstream query of the office group, and the result will not be measured. The address configuration address is ignored.
-    bind [::]:6053 -no-speed-check -group office -no-rule-addr
-    ```
-
-1. How to get SPKI of DOT  
-
-    The SPKI can be obtained from the page published by the DNS service provider. If it is not published, it can be obtained by the following command, replace IP with your own IP.
-
-    ```shell
-    echo | openssl s_client -connect '1.0.0.1:853' 2>/dev/null | openssl x509 -pubkey -noout | openssl pkey -pubin -outform der | openssl dgst -sha256 -binary | openssl enc -base64
-    ```
-
-1. How to solve the problem of slow DNS resolution in iOS system?
-
-    Since iOS14, Apple has supported the resolution of DNS HTTPS (TYPE65) records. This function is used for solving problems related to HTTPS connections, but it is still a draft, and it will cause some functions such as adblocking fail. It is recommended to disable it through the following configuration.
-
-    ```shell
-    force-qtype-SOA 65
-    ```
-
-1. How to resolve localhost ip by hostname?  
-
-    smartdns can cooperate with the dhcp server of DNSMASQ to support the resolution of local host name to IP address. You can configure smartdns to read the lease file of dnsmasq and support the resolution. The specific configuration parameters are as follows, (note that the DNSMASQ lease file may be different for each system and needs to be configured according to the actual situation)
-
-    ```shell
-    dnsmasq-lease-file /var/lib/misc/dnsmasq.leases
-    ```
-
-    After the configuration is complete, you can directly use the host name to connect to the local machine. But need to pay attention:
-
-    - Windows system uses mDNS to resolve addresses by default. If you need to use smartdns to resolve addresses under Windows, you need to add `.` after the host name, indicating that DNS resolution is used. Such as `ping smartdns.`
-
-1. How to use the domain set?  
-
-    To facilitate configuring domain names by set, for configurations with /domain/, you can specify a domain name set for easy maintenance. The specific method is:
-
-    - Use `domain-set` configuration domain set file:
-
-    ````shell
-    domain-set -name ad -file /etc/smartdns/ad-list.conf
-    ````
-
-    The format of ad-list.conf is one domain per line:
-
-    ```shell
-    ad.com
-    site.com
-    ```
-
-    - To use the domain set, you only need to configure `/domain/` to `/domain-set:[collection name]/`, such as:
-
-    ````shell
-    address /domain-set:ad/#
-    domain-rules /domain-set:ad/ -a #
-    nameserver /domain-set:ad/server
-    ...
-    ````
-
-1. How to use ipset and nftset?  
-
-    Similar to Dnsmasq, smartdns supports ipset and nftset, and can transparently forward specific domain names through TPROXY. The comparison of transparent forwarding and tool modes is as follows:
-
-    1. Tools: iptable, nftable
-
-        iptable: a mature routing rule configuration tool.
-        nftable: A more powerful rule configuration tool that is becoming mainstream.
-
-    1. Mode: TPROXY, REDIRECT
-
-        TPROXY: supports UDP and TCP forwarding, and the configuration is a little complicated.
-        REDIRECT: only supports TCP, easy to configure.
-
-    Here we only take the configuration of the most commonly used iptable/REDIRECT with ipset as an example. The specific forwarding configuration is as follows:
-
-    - Set the list of domain names that need to be transparently forwarded in smartdns.conf, for example, `example.com` needs to be transparently forwarded. Then use the ipset option and set the ipset rule of `example.com` to `proxy`.
-
-    ```shell
-    # set rules
-    # -ipset proxy: The matching domain name is set to ipset:proxy.
-    # -c none: Disable speed check.
-    # -address #6: Filter IPV6 record.
-    domain-rules /example.com/ -ipset proxy -c none -address #6
-    ```
-
-    - Execute shell commands, set iptable rules, and transparently forward matching domain name requests. The rules are as follows:
-
-    ```shell
-    # create ipset
-    ipset create proxy hash:net
-    # Set forwarding rules to forward matching requests to port 1081 of this machine
-    iptables -t nat -I PREROUTING -p tcp -m set --match-set proxy dst -j REDIRECT --to-ports 1081
-    ```
-
-    - Open the forwarding program of REDIRECT mode on port 1081 of this machine.
-
-1. Bootstrap DNS  
-
-    For upstream servers with domain name, smartdns will use servers with IP address types for resolution, so there is no need to configure bootstrap DNS, but if there are special needs, you can specify bootstrap DNS . The steps are as follows:
-    
-    1. nameserver server upstream server  
-    
-        use nameserver set upstream server for domain name  
-        
-        ```
-        server dns.server # this domain name will be resolved by 1.2.3.4
-        server 1.2.3.4 -group bootstrap-dns
-        nameserver /dns.server/bootstrap-dns
-        ```
-
-    1. Set bootstrap DNS server  
-
-        use `-bootstrap-dns` option to set server as bootstrap DNS.
-
-        ```
-        server 1.2.3.4 -bootstrap-dns
-        server dns.server
-        ```
-    
-1. More questions  
-    More questions, please read issue: [https://github.com/pymumu/smartdns/issues](https://github.com/pymumu/smartdns/issues)
-
 ## Compile
 
 smartdns contains scripts for compiling packages, supports compiling luci, debian, openwrt, optware installation packages, and can execute `package/build-pkg.sh` compilation.