action: update git action, patch files.

This commit is contained in:
Nick Peng
2023-03-11 22:06:03 +08:00
parent 8bf1108503
commit 69fd23d756
6 changed files with 84 additions and 76 deletions

View File

@@ -42,6 +42,12 @@ jobs:
cd /root cd /root
mkdocs build mkdocs build
mv /root/en/site /root/site/en 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 - name: Setup Pages
uses: actions/configure-pages@v3 uses: actions/configure-pages@v3
- name: Upload artifact - name: Upload artifact

View File

@@ -43,15 +43,15 @@ smartdns可以通过指定对应域名返回SOA用于广告屏蔽。
1. 下载配置文件到`/etc/smartdns`目录 1. 下载配置文件到`/etc/smartdns`目录
```shell ```shell
wget https://github.com/privacy-protection-tools/anti-AD/blob/master/anti-ad-smartdns.conf -o /etc/smartdns/anti-ad-smartdns.conf 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文件包含上述配置文件 1. 修改/etc/smartdns/smartdns.conf文件包含上述配置文件
```shell ```shell
conf-file /etc/smartdns/anti-ad-smartdns.conf conf-file /etc/smartdns/anti-ad-smartdns.conf
``` ```
## 广告列表 ## 广告列表

View File

@@ -46,58 +46,56 @@ smartdns过期缓存处理流程
%%{init: {'theme':'forest'}}%% %%{init: {'theme':'forest'}}%%
sequenceDiagram sequenceDiagram
autonumber
participant client as 客户端 participant client as 客户端
participant smartdns as SmartDNS participant smartdns as SmartDNS
participant Server as 上游DNS服务器 participant Server as 上游DNS服务器
client->>smartdns: DNS查询 client->>smartdns: DNS查询
alt 域名在缓存中 smartdns->>smartdns: 域名在缓存中,且已经过期。
smartdns->>+Server: 上游查询DNS smartdns->>client: 返回结果过期的域名结果TTL为3
Server-->>-smartdns: 返回查询结果 smartdns->>+Server: 上游查询DNS
smartdns->smartdns: 测速,并缓存结果 Server->>-smartdns: 返回查询结果
smartdns->client: 返回结果 smartdns->>smartdns: 测速,并缓存结果
else 域名在过期缓存中 client->>smartdns: 3s后客户端再次查询获取最佳结果。
rect rgb(160, 250, 140)
smartdns->smartdns: 域名在缓存中,且已经过期。
smartdns->client: 返回结果过期的域名结果TTL为3
smartdns->>+Server: 上游查询DNS
Server->-smartdns: 返回查询结果
smartdns->smartdns: 测速,并缓存结果
client->smartdns: 3s后客户端再次查询获取最佳结果。
end
end
``` ```
通过上述序列图可以看到当缓存过期时smartdns仍然将过期的IP地址发给客户端这样客户端就能很快的进行连接服务器这种机制的前提是服务器IP地址没有变化。
现实中大部分情况下修改域名IP地址后是不会立即生效到千家万户的因为一般IP变化域名后全球域名系统刷新完成最长可能要72小时。
即时出现过期缓存中的IP地址故障失效smartdns返回给客户端过期IP的TTL只有3s那么3s后客户端就会重新使用新的IP表现在客户端程序中可能就是要刷新页面重试一次。
并且针对实现场景smartdns可以设置预获取来尽量避免此问题发生。
所以,主要场景下开启过期缓存是比较好的实践。
## 配置步骤 ## 配置步骤
1. 开启过期缓存 1. 开启过期缓存
```shell ```shell
serve-expired yes serve-expired yes
``` ```
1. 配置过期缓存超时时间 1. 配置过期缓存超时时间
此时间表示过期缓存多长时间未访问,则从缓存中释放。 此时间表示过期缓存多长时间未访问,则从缓存中释放。
```shell ```shell
serve-expired-ttl 259200 serve-expired-ttl 259200
``` ```
1. 配置过期缓存响应TTL 1. 配置过期缓存响应TTL
此时间表示当缓存中域名TTL超时时返回给客户端的TTL时间让客户端在下列TTL时间后再次查询。 此时间表示当缓存中域名TTL超时时返回给客户端的TTL时间让客户端在下列TTL时间后再次查询。
```shell ```shell
serve-expired-reply-ttl 3 serve-expired-reply-ttl 3
``` ```
1. 过期缓存预获取时间 1. 过期缓存预获取时间
此时间表示过期缓存在多长时间未访问主动进行预先获取以避免IP无效开启过期缓存后prefetch的功能将和未开启不同。 此时间表示过期缓存在多长时间未访问主动进行预先获取以避免IP无效开启过期缓存后prefetch的功能将和未开启不同。
```shell ```shell
prefetch-domain yes prefetch-domain yes
serve-expired-prefetch-time 21600 serve-expired-prefetch-time 21600
``` ```

View File

@@ -16,58 +16,58 @@ hide:
1. 基本配置 1. 基本配置
通过如下参数可以配置指定域名的IPSet规则 通过如下参数可以配置指定域名的IPSet规则
```shell ```shell
nftset /domain/[#4:ip#table#set,#6:ipv6#table#setv6] nftset /domain/[#4:ip#table#set,#6:ipv6#table#setv6]
``` ```
1. 超时 1. 超时
SmartDNS设置IPSet支持设置是否启用超时功能这样可以避免IPSet中过多IP地址网关性能下降。启用方式为 SmartDNS设置IPSet支持设置是否启用超时功能这样可以避免IPSet中过多IP地址网关性能下降。启用方式为
```shell ```shell
nftset-timeout yes nftset-timeout yes
``` ```
1. 测速失败后自动添加到IPSet 1. 测速失败后自动添加到IPSet
SmartDNS可以将测速失败的IP地址加入IPSet再由相关IP规则转发 SmartDNS可以将测速失败的IP地址加入IPSet再由相关IP规则转发
```shell ```shell
nftset-no-speed ipsetname nftset-no-speed ipsetname
``` ```
1. DEBUG调试 1. DEBUG调试
如需要Debug调试可以开启nftset的调试功能。 如需要Debug调试可以开启nftset的调试功能。
```shell ```shell
nftset-debug yes nftset-debug yes
``` ```
## nftset配置 ## nftset配置
1. 基本配置 1. 基本配置
通过如下参数可以配置指定域名的NFTSet规则 通过如下参数可以配置指定域名的NFTSet规则
```shell ```shell
ipset /domain/ipset ipset /domain/ipset
``` ```
1. 超时 1. 超时
SmartDNS设置IPSet支持设置是否启用超时功能这样可以避免NFTSet中过多IP地址网关性能下降。启用方式为 SmartDNS设置IPSet支持设置是否启用超时功能这样可以避免NFTSet中过多IP地址网关性能下降。启用方式为
```shell ```shell
ipset-timeout yes ipset-timeout yes
``` ```
1. 测速失败后自动添加到IPSet 1. 测速失败后自动添加到IPSet
SmartDNS可以将测速失败的IP地址加入IPSet再由相关IP规则转发 SmartDNS可以将测速失败的IP地址加入IPSet再由相关IP规则转发
```shell ```shell
ipset-no-speed ipsetname ipset-no-speed ipsetname
``` ```

View File

@@ -9,6 +9,8 @@ copyright: "Copyright © Nick Peng"
theme: theme:
name: material name: material
icon:
repo: fontawesome/brands/github
logo: assets/smartdns.png logo: assets/smartdns.png
feature: feature:
tabs: true tabs: true
@@ -20,13 +22,13 @@ theme:
primary: 'green' primary: 'green'
accent: 'green' accent: 'green'
toggle: toggle:
icon: material/brightness-7 icon: material/weather-sunny
name: Switch to dark mode name: Switch to dark mode
- scheme: slate - scheme: slate
primary: 'dark green' primary: 'dark'
accent: 'dark green' accent: 'dark'
toggle: toggle:
icon: material/brightness-4 icon: material/weather-night
name: Switch to light mode name: Switch to light mode
features: features:
- navigation.path - navigation.path

View File

@@ -9,6 +9,8 @@ copyright: "Copyright © Nick Peng"
theme: theme:
name: material name: material
icon:
repo: fontawesome/brands/github
logo: assets/smartdns.png logo: assets/smartdns.png
feature: feature:
tabs: true tabs: true
@@ -20,13 +22,13 @@ theme:
primary: 'green' primary: 'green'
accent: 'green' accent: 'green'
toggle: toggle:
icon: material/brightness-7 icon: material/weather-sunny
name: Switch to dark mode name: Switch to dark mode
- scheme: slate - scheme: slate
primary: 'dark green' primary: 'dark'
accent: 'dark green' accent: 'dark'
toggle: toggle:
icon: material/brightness-4 icon: material/weather-night
name: Switch to light mode name: Switch to light mode
features: features:
- navigation.path - navigation.path
@@ -74,7 +76,7 @@ nav:
- 华硕固件 / 梅林固件: 'install/asus.md' - 华硕固件 / 梅林固件: 'install/asus.md'
- EntWare: 'install/entware.md' - EntWare: 'install/entware.md'
- WSL: 'install/wsl.md' - WSL: 'install/wsl.md'
- 配置示例: - 配置指导:
- 屏蔽广告: 'config/ad-block.md' - 屏蔽广告: 'config/ad-block.md'
- DNS分流: 'config/domain-forwarding.md' - DNS分流: 'config/domain-forwarding.md'
- 工作模式: 'config/work-mode.md' - 工作模式: 'config/work-mode.md'
@@ -87,9 +89,9 @@ nav:
- 双栈优选: 'config/dualstack.md' - 双栈优选: 'config/dualstack.md'
- 禁用IPV6: 'config/block-ipv6.md' - 禁用IPV6: 'config/block-ipv6.md'
- DNS64: 'config/dns64.md' - DNS64: 'config/dns64.md'
- cname别名查询: 'config/cname.md'
- 安全相关: 'config/security.md' - 安全相关: 'config/security.md'
- 黑名单分流请求: 'config/forwarding-with-ipset.md' - 黑名单分流请求: 'config/forwarding-with-ipset.md'
- cname别名查询: 'config/cname.md'
- 配置选项: 'configuration.md' - 配置选项: 'configuration.md'
- 编译: 'compile.md' - 编译: 'compile.md'
- 常见问题: 'faq.md' - 常见问题: 'faq.md'