action: update git action, patch files.
This commit is contained in:
6
.github/workflows/mkdocs.yaml
vendored
6
.github/workflows/mkdocs.yaml
vendored
@@ -42,6 +42,12 @@ jobs:
|
||||
cd /root
|
||||
mkdocs build
|
||||
mv /root/en/site /root/site/en
|
||||
# patch 404 page, remove absolute path
|
||||
sed 's@="/@="@g' -i /root/site/404.html
|
||||
sed 's@="/@="@g' -i /root/site/en/404.html
|
||||
# patch language change url
|
||||
find /root/site -name "*.htm*" -print0 | xargs -0 sed -i 's/href=" .."/href=".."/g'
|
||||
find /root/site -name "*.htm*" -print0 | xargs -0 sed -i 's@/ .."@/.."@g'
|
||||
- name: Setup Pages
|
||||
uses: actions/configure-pages@v3
|
||||
- name: Upload artifact
|
||||
|
||||
@@ -43,15 +43,15 @@ smartdns可以通过指定对应域名返回SOA用于广告屏蔽。
|
||||
|
||||
1. 下载配置文件到`/etc/smartdns`目录
|
||||
|
||||
```shell
|
||||
wget https://github.com/privacy-protection-tools/anti-AD/blob/master/anti-ad-smartdns.conf -o /etc/smartdns/anti-ad-smartdns.conf
|
||||
```
|
||||
```shell
|
||||
wget https://github.com/privacy-protection-tools/anti-AD/blob/master/anti-ad-smartdns.conf -o /etc/smartdns/anti-ad-smartdns.conf
|
||||
```
|
||||
|
||||
1. 修改/etc/smartdns/smartdns.conf文件,包含上述配置文件
|
||||
|
||||
```shell
|
||||
conf-file /etc/smartdns/anti-ad-smartdns.conf
|
||||
```
|
||||
```shell
|
||||
conf-file /etc/smartdns/anti-ad-smartdns.conf
|
||||
```
|
||||
|
||||
## 广告列表
|
||||
|
||||
|
||||
@@ -46,58 +46,56 @@ smartdns过期缓存处理流程
|
||||
|
||||
%%{init: {'theme':'forest'}}%%
|
||||
sequenceDiagram
|
||||
autonumber
|
||||
participant client as 客户端
|
||||
participant smartdns as SmartDNS
|
||||
participant Server as 上游DNS服务器
|
||||
client->>smartdns: DNS查询
|
||||
alt 域名不在缓存中
|
||||
smartdns->>+Server: 上游查询DNS
|
||||
Server-->>-smartdns: 返回查询结果
|
||||
smartdns->smartdns: 测速,并缓存结果
|
||||
smartdns->client: 返回结果
|
||||
else 域名在过期缓存中
|
||||
rect rgb(160, 250, 140)
|
||||
smartdns->smartdns: 域名在缓存中,且已经过期。
|
||||
smartdns->client: 返回结果过期的域名结果,TTL为3
|
||||
smartdns->>+Server: 上游查询DNS
|
||||
Server->-smartdns: 返回查询结果
|
||||
smartdns->smartdns: 测速,并缓存结果
|
||||
client->smartdns: 3s后客户端再次查询,获取最佳结果。
|
||||
end
|
||||
end
|
||||
smartdns->>smartdns: 域名在缓存中,且已经过期。
|
||||
smartdns->>client: 返回结果过期的域名结果,TTL为3
|
||||
smartdns->>+Server: 上游查询DNS
|
||||
Server->>-smartdns: 返回查询结果
|
||||
smartdns->>smartdns: 测速,并缓存结果
|
||||
client->>smartdns: 3s后客户端再次查询,获取最佳结果。
|
||||
|
||||
```
|
||||
|
||||
通过上述序列图可以看到,当缓存过期时,smartdns仍然将过期的IP地址发给客户端,这样客户端就能很快的进行连接服务器,这种机制的前提是服务器IP地址没有变化。
|
||||
|
||||
现实中,大部分情况下,修改域名IP地址后,是不会立即生效到千家万户的,因为一般IP变化域名后,全球域名系统刷新完成最长可能要72小时。
|
||||
即时出现过期缓存中的IP地址,故障失效,smartdns返回给客户端过期IP的TTL只有3s,那么3s后,客户端就会重新使用新的IP,表现在客户端程序中,可能就是要刷新页面重试一次。
|
||||
并且,针对实现场景,smartdns可以设置预获取来尽量避免此问题发生。
|
||||
|
||||
所以,主要场景下开启过期缓存是比较好的实践。
|
||||
|
||||
## 配置步骤
|
||||
|
||||
1. 开启过期缓存
|
||||
|
||||
```shell
|
||||
serve-expired yes
|
||||
```
|
||||
```shell
|
||||
serve-expired yes
|
||||
```
|
||||
|
||||
1. 配置过期缓存超时时间
|
||||
|
||||
此时间表示过期缓存多长时间未访问,则从缓存中释放。
|
||||
此时间表示过期缓存多长时间未访问,则从缓存中释放。
|
||||
|
||||
```shell
|
||||
serve-expired-ttl 259200
|
||||
```
|
||||
```shell
|
||||
serve-expired-ttl 259200
|
||||
```
|
||||
|
||||
1. 配置过期缓存响应TTL
|
||||
|
||||
此时间表示当缓存中域名TTL超时时,返回给客户端的TTL时间,让客户端在下列TTL时间后再次查询。
|
||||
此时间表示当缓存中域名TTL超时时,返回给客户端的TTL时间,让客户端在下列TTL时间后再次查询。
|
||||
|
||||
```shell
|
||||
serve-expired-reply-ttl 3
|
||||
```
|
||||
```shell
|
||||
serve-expired-reply-ttl 3
|
||||
```
|
||||
|
||||
1. 过期缓存预获取时间
|
||||
|
||||
此时间表示,过期缓存在多长时间未访问,主动进行预先获取,以避免IP无效;开启过期缓存后,prefetch的功能将和未开启不同。
|
||||
此时间表示,过期缓存在多长时间未访问,主动进行预先获取,以避免IP无效;开启过期缓存后,prefetch的功能将和未开启不同。
|
||||
|
||||
```shell
|
||||
prefetch-domain yes
|
||||
serve-expired-prefetch-time 21600
|
||||
```
|
||||
```shell
|
||||
prefetch-domain yes
|
||||
serve-expired-prefetch-time 21600
|
||||
```
|
||||
|
||||
@@ -16,58 +16,58 @@ hide:
|
||||
|
||||
1. 基本配置
|
||||
|
||||
通过如下参数可以配置指定域名的IPSet规则
|
||||
通过如下参数可以配置指定域名的IPSet规则
|
||||
|
||||
```shell
|
||||
nftset /domain/[#4:ip#table#set,#6:ipv6#table#setv6]
|
||||
```
|
||||
```shell
|
||||
nftset /domain/[#4:ip#table#set,#6:ipv6#table#setv6]
|
||||
```
|
||||
|
||||
1. 超时
|
||||
|
||||
SmartDNS设置IPSet,支持设置是否启用超时功能,这样可以避免IPSet中过多IP地址,网关性能下降。启用方式为
|
||||
SmartDNS设置IPSet,支持设置是否启用超时功能,这样可以避免IPSet中过多IP地址,网关性能下降。启用方式为
|
||||
|
||||
```shell
|
||||
nftset-timeout yes
|
||||
```
|
||||
```shell
|
||||
nftset-timeout yes
|
||||
```
|
||||
|
||||
1. 测速失败后,自动添加到IPSet
|
||||
|
||||
SmartDNS可以将测速失败的IP地址,加入IPSet,再由相关IP规则转发
|
||||
SmartDNS可以将测速失败的IP地址,加入IPSet,再由相关IP规则转发
|
||||
|
||||
```shell
|
||||
nftset-no-speed ipsetname
|
||||
```
|
||||
```shell
|
||||
nftset-no-speed ipsetname
|
||||
```
|
||||
|
||||
1. DEBUG调试
|
||||
|
||||
如需要Debug调试,可以开启nftset的调试功能。
|
||||
如需要Debug调试,可以开启nftset的调试功能。
|
||||
|
||||
```shell
|
||||
nftset-debug yes
|
||||
```
|
||||
```shell
|
||||
nftset-debug yes
|
||||
```
|
||||
|
||||
## nftset配置
|
||||
|
||||
1. 基本配置
|
||||
|
||||
通过如下参数可以配置指定域名的NFTSet规则
|
||||
通过如下参数可以配置指定域名的NFTSet规则
|
||||
|
||||
```shell
|
||||
ipset /domain/ipset
|
||||
```
|
||||
```shell
|
||||
ipset /domain/ipset
|
||||
```
|
||||
|
||||
1. 超时
|
||||
|
||||
SmartDNS设置IPSet,支持设置是否启用超时功能,这样可以避免NFTSet中过多IP地址,网关性能下降。启用方式为
|
||||
SmartDNS设置IPSet,支持设置是否启用超时功能,这样可以避免NFTSet中过多IP地址,网关性能下降。启用方式为
|
||||
|
||||
```shell
|
||||
ipset-timeout yes
|
||||
```
|
||||
```shell
|
||||
ipset-timeout yes
|
||||
```
|
||||
|
||||
1. 测速失败后,自动添加到IPSet
|
||||
|
||||
SmartDNS可以将测速失败的IP地址,加入IPSet,再由相关IP规则转发
|
||||
SmartDNS可以将测速失败的IP地址,加入IPSet,再由相关IP规则转发
|
||||
|
||||
```shell
|
||||
ipset-no-speed ipsetname
|
||||
```
|
||||
```shell
|
||||
ipset-no-speed ipsetname
|
||||
```
|
||||
|
||||
@@ -9,6 +9,8 @@ copyright: "Copyright © Nick Peng"
|
||||
|
||||
theme:
|
||||
name: material
|
||||
icon:
|
||||
repo: fontawesome/brands/github
|
||||
logo: assets/smartdns.png
|
||||
feature:
|
||||
tabs: true
|
||||
@@ -20,13 +22,13 @@ theme:
|
||||
primary: 'green'
|
||||
accent: 'green'
|
||||
toggle:
|
||||
icon: material/brightness-7
|
||||
icon: material/weather-sunny
|
||||
name: Switch to dark mode
|
||||
- scheme: slate
|
||||
primary: 'dark green'
|
||||
accent: 'dark green'
|
||||
primary: 'dark'
|
||||
accent: 'dark'
|
||||
toggle:
|
||||
icon: material/brightness-4
|
||||
icon: material/weather-night
|
||||
name: Switch to light mode
|
||||
features:
|
||||
- navigation.path
|
||||
|
||||
14
mkdocs.yml
14
mkdocs.yml
@@ -9,6 +9,8 @@ copyright: "Copyright © Nick Peng"
|
||||
|
||||
theme:
|
||||
name: material
|
||||
icon:
|
||||
repo: fontawesome/brands/github
|
||||
logo: assets/smartdns.png
|
||||
feature:
|
||||
tabs: true
|
||||
@@ -20,13 +22,13 @@ theme:
|
||||
primary: 'green'
|
||||
accent: 'green'
|
||||
toggle:
|
||||
icon: material/brightness-7
|
||||
icon: material/weather-sunny
|
||||
name: Switch to dark mode
|
||||
- scheme: slate
|
||||
primary: 'dark green'
|
||||
accent: 'dark green'
|
||||
primary: 'dark'
|
||||
accent: 'dark'
|
||||
toggle:
|
||||
icon: material/brightness-4
|
||||
icon: material/weather-night
|
||||
name: Switch to light mode
|
||||
features:
|
||||
- navigation.path
|
||||
@@ -74,7 +76,7 @@ nav:
|
||||
- 华硕固件 / 梅林固件: 'install/asus.md'
|
||||
- EntWare: 'install/entware.md'
|
||||
- WSL: 'install/wsl.md'
|
||||
- 配置示例:
|
||||
- 配置指导:
|
||||
- 屏蔽广告: 'config/ad-block.md'
|
||||
- DNS分流: 'config/domain-forwarding.md'
|
||||
- 工作模式: 'config/work-mode.md'
|
||||
@@ -87,9 +89,9 @@ nav:
|
||||
- 双栈优选: 'config/dualstack.md'
|
||||
- 禁用IPV6: 'config/block-ipv6.md'
|
||||
- DNS64: 'config/dns64.md'
|
||||
- cname别名查询: 'config/cname.md'
|
||||
- 安全相关: 'config/security.md'
|
||||
- 黑名单分流请求: 'config/forwarding-with-ipset.md'
|
||||
- cname别名查询: 'config/cname.md'
|
||||
- 配置选项: 'configuration.md'
|
||||
- 编译: 'compile.md'
|
||||
- 常见问题: 'faq.md'
|
||||
|
||||
Reference in New Issue
Block a user