luci-app-mosdns: Add TCP/DoT RFC 7766 new Query Pipelining support

* Test DNS Server Support: `mosdns probe pipeline tls/tcp://x.x.x.x`
This commit is contained in:
sbwml 2022-07-14 13:02:56 +08:00
parent 32d7851707
commit 5779f1413c
5 changed files with 52 additions and 11 deletions

View File

@ -39,22 +39,27 @@ remote_dns.default = "tls://8.8.8.8"
remote_dns:value("tls://1.1.1.1", "1.1.1.1 (CloudFlare DNS)")
remote_dns:value("tls://8.8.8.8", "8.8.8.8 (Google DNS)")
remote_dns:value("tls://8.8.4.4", "8.8.4.4 (Google DNS)")
remote_dns:value("tls://185.222.222.222", "185.222.222.222 (DNS.SB)")
remote_dns:value("tls://9.9.9.9", "9.9.9.9 (Quad9 DNS)")
remote_dns:value("tls://45.11.45.11", "45.11.45.11 (DNS.SB)")
remote_dns:value("208.67.222.222", "208.67.222.222 (Open DNS)")
remote_dns:value("208.67.220.220", "208.67.220.220 (Open DNS)")
remote_dns:value("tls://208.67.222.222", "208.67.222.222 (Open DNS)")
remote_dns:value("tls://208.67.220.220", "208.67.220.220 (Open DNS)")
remote_dns:depends( "configfile", "/etc/mosdns/config.yaml")
remote_dns = s:option(Value, "remote_dns2", " ")
remote_dns.default = "tls://1.1.1.1"
remote_dns:value("tls://1.1.1.1", "1.1.1.1 (CloudFlare DNS)")
remote_dns:value("tls://8.8.8.8", "8.8.8.8 (Google DNS)")
remote_dns:value("tls://8.8.4.4", "8.8.4.4 (Google DNS)")
remote_dns:value("tls://185.222.222.222", "185.222.222.222 (DNS.SB)")
remote_dns:value("tls://9.9.9.9", "9.9.9.9 (Quad9 DNS)")
remote_dns:value("tls://45.11.45.11", "45.11.45.11 (DNS.SB)")
remote_dns:value("208.67.222.222", "208.67.222.222 (Open DNS)")
remote_dns:value("208.67.220.220", "208.67.220.220 (Open DNS)")
remote_dns:value("tls://208.67.222.222", "208.67.222.222 (Open DNS)")
remote_dns:value("tls://208.67.220.220", "208.67.220.220 (Open DNS)")
remote_dns:depends( "configfile", "/etc/mosdns/config.yaml")
remote_dns_pipeline = s:option(Flag, "enable_pipeline", translate("Remote DNS Connection Multiplexing"), translate("Enable TCP/DoT RFC 7766 new Query Pipelining connection multiplexing mode"))
remote_dns_pipeline.rmempty = false
remote_dns_pipeline.default = false
remote_dns_pipeline:depends( "configfile", "/etc/mosdns/config.yaml")
cache_size = s:option(Value, "cache_size", translate("DNS Cache Size"))
cache_size.datatype = "and(uinteger,min(0))"
cache_size.default = "200000"

View File

@ -91,6 +91,12 @@ msgstr "日志文件"
msgid "Remote DNS"
msgstr "远程 DNS"
msgid "Remote DNS Connection Multiplexing"
msgstr "远程 DNS 连接复用"
msgid "Enable TCP/DoT RFC 7766 new Query Pipelining connection multiplexing mode"
msgstr "启用 TCP/DoT RFC 7766 新型 Query Pipelining 连接复用模式"
msgid "DNS Cache Size"
msgstr "DNS 缓存大小(条)"

View File

@ -16,4 +16,5 @@ config mosdns 'mosdns'
option cache_survival_time '259200'
option minimal_ttl '0'
option maximum_ttl '0'
option enable_pipeline '0'

View File

@ -1,8 +1,24 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2020 IrineSistiana
# shellcheck disable=SC2034
#
# Copyright (C) 2020-2022, IrineSistiana
#
# This file is part of mosdns.
#
# mosdns is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# mosdns is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
START=91
START=99
USE_PROCD=1
PROG=/usr/bin/mosdns
@ -27,7 +43,18 @@ init_yaml() {
remote_dns1=$(uci -q get mosdns.mosdns.remote_dns1)
remote_dns2=$(uci -q get mosdns.mosdns.remote_dns2)
adblock=$(/usr/share/mosdns/ad_domain.sh)
sed "s,log_level,$log_level,g;s,log_file,$log_file,g;s,listen_port,$listen_port,g;s,cache_size,$cache_size,g;s,cache_survival_time,$cache_survival_time,g;s,minimal_ttl_custom,$minimal_ttl_custom,g;s,maximum_ttl_custom,$maximum_ttl_custom,g;s,local_dns1,$local_dns1,g;s,local_dns2,$local_dns2,g;s,remote_dns1,$remote_dns1,g;s,remote_dns2,$remote_dns2,g;s,adblock,$adblock,g" /usr/share/mosdns/default.yaml > /etc/mosdns/config.yaml
enable_pipeline=$(uci -q get mosdns.mosdns.enable_pipeline)
[ $enable_pipeline = 0 ] && enable_pipeline=false
[ $enable_pipeline = 1 ] && enable_pipeline=true
sed "s,log_level,$log_level,g;s,log_file,$log_file,g; \
s,listen_port,$listen_port,g;s,cache_size,$cache_size,g; \
s,cache_survival_time,$cache_survival_time,g; \
s,minimal_ttl_custom,$minimal_ttl_custom,g; \
s,maximum_ttl_custom,$maximum_ttl_custom,g; \
s,local_dns1,$local_dns1,g;s,local_dns2,$local_dns2,g; \
s,remote_dns1,$remote_dns1,g;s,remote_dns2,$remote_dns2,g; \
s,adblock,$adblock,g;s,remote_dns_pipeline,$enable_pipeline,g" \
/usr/share/mosdns/default.yaml > $(uci -q get mosdns.mosdns.configfile)
}
service_triggers() {
@ -86,7 +113,7 @@ start_service() {
[ $enabled != 1 ] && return 1
delcron
setcron
init_yaml
[ "${CONF}" = "/etc/mosdns/config.yaml" ] && init_yaml
cat /dev/null > $(/usr/share/mosdns/log_path.sh)
procd_open_instance mosdns
procd_set_param command $PROG start -c "$CONF"

View File

@ -58,7 +58,9 @@ plugins:
args:
upstream:
- addr: remote_dns1
enable_pipeline: remote_dns_pipeline
- addr: remote_dns2
enable_pipeline: remote_dns_pipeline
- tag: query_is_whitelist_domain
type: query_matcher