pymumu / smartdns

A local DNS server to obtain the fastest website IP for the best Internet experience, support DoT, DoH. 一个本地DNS服务器,获取最快的网站IP,获得最佳上网体验,支持DoH,DoT。
https://pymumu.github.io/smartdns/
GNU General Public License v3.0
8.33k stars 1.07k forks source link

开启缓存后,是否支持按列表分组 #1686

Open maojianyou opened 7 months ago

maojianyou commented 7 months ago

问题现象 简要描述问题出现的现象 看文档是针对单个域名不缓存,如 domain-rules /example.com/ -no-cache

但我这边需求是,针对特定组不缓存,这种配置是否支持 server 8.8.8.8 -group guowai -exclude-default-group -no-cache

运行环境

固件型号 xen虚拟机 运营商 电信 smartdns来源以及版本 smartdns 1.2023.08.11-1937 涉及的配置(注意去除个人相关信息)

重现步骤

上游DNS配置。

PikuZheng commented 7 months ago

server 8.8.8.8 -group guowai -exclude-default-group -no-cache

这个 guowai 是用什么定义的,bind定义可以在bind同时做 -no-cache,domain-rule或nameserver定义可以用domain-rule做-no-cache

maojianyou commented 7 months ago

server 8.8.8.8 -group guowai -exclude-default-group -no-cache

这个 guowai 是用什么定义的,bind定义可以在bind同时做 -no-cache,domain-rule或nameserver定义可以用domain-rule做-no-cache

conf-file /etc/smartdns/test.conf 加载这个,然后里面的文件是 image

因为test.conf里面可能非常多的域名,使用guowai这个组,那么我想直接应用到下面这个组上,就可以针对test文件里面的所有不做cache,这种支持不 server 8.8.8.8 -group guowai -exclude-default-group -no-cache

PikuZheng commented 7 months ago

建议用domain-rule做

pymumu commented 7 months ago

为什么要不厌其烦搞那么复杂,分流很简单。

方法1:

group-begin guowai
server x.x.x.x
domain-set -name guowai-domain -file path-to-guowai.list
group-match -domain domain-set:guowai-domain
address #6
speed-check-mode none
group-end

方法二:

server x.x.x.x -g guowai -e
domain-set -name guowai-domain -file path-to-guowai.list
domain-rules domain-set:guowai-domain -nameserver guowai -address #6 -c none
maojianyou commented 6 months ago

为什么要不厌其烦搞那么复杂,分流很简单。

方法1:

group-begin guowai
server x.x.x.x
domain-set -name guowai-domain -file path-to-guowai.list
group-match -domain domain-set:guowai-domain
address #6
speed-check-mode none
group-end

方法二:

server x.x.x.x -g guowai -e
domain-set -name guowai-domain -file path-to-guowai.list
domain-rules domain-set:guowai-domain -nameserver guowai -address #6 -c none

我大概意思,国外分组guowai的缺省域名不进行缓存,但国内的域名可以进行缓存,所以想通过分组名称是否进行缓存

pymumu commented 6 months ago
group-begin guowai
server x.x.x.x
domain-set -name guowai-domain -file path-to-guowai.list
group-match -domain domain-set:guowai-domain
address #6
speed-check-mode none
# 增加关闭所有域名缓存规则。
domain-rules /./ -no-cache
group-end
ixmu commented 5 months ago
group-begin guowai
server x.x.x.x
domain-set -name guowai-domain -file path-to-guowai.list
group-match -domain domain-set:guowai-domain
address #6
speed-check-mode none
# 增加关闭所有域名缓存规则。
domain-rules /./ -no-cache
group-end

我用的方法二,请问两种方式有什么区别或者问题

maojianyou commented 2 months ago
group-begin guowai
server x.x.x.x
domain-set -name guowai-domain -file path-to-guowai.list
group-match -domain domain-set:guowai-domain
address #6
speed-check-mode none
# 增加关闭所有域名缓存规则。
domain-rules /./ -no-cache
group-end

我用的方法二,请问两种方式有什么区别或者问题

方法二,看起来更加简洁,方便维护,结果应该是保持一致的