浏览代码

luci-app-ssr-plus: Add `dnsproxy` disable `IPv6` resolved.

zxlhhyccc 6 月之前
父节点
当前提交
77cd2ef5e0

+ 7 - 0
luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/advanced.lua

@@ -180,6 +180,13 @@ if is_finded("dnsproxy") then
 	o:depends("shunt_parse_method", "parse_file")
 	o:depends("shunt_parse_method", "parse_file")
 	o.rmempty = true
 	o.rmempty = true
 	o.default = "load_balance"
 	o.default = "load_balance"
+
+	o = s:option(Flag, "shunt_dnsproxy_ipv6", translate("Disable IPv6 query mode"))
+	o.description = translate("When disabled, all AAAA requests are not resolved.")
+	o:depends("shunt_parse_method", "single_dns")
+	o:depends("shunt_parse_method", "parse_file")
+	o.rmempty = false
+	o.default = "1"
 end
 end
 
 
 o = s:option(Flag, "apple_optimization", translate("Apple domains optimization"), translate("For Apple domains equipped with Chinese mainland CDN, always responsive to Chinese CDN IP addresses"))
 o = s:option(Flag, "apple_optimization", translate("Apple domains optimization"), translate("For Apple domains equipped with Chinese mainland CDN, always responsive to Chinese CDN IP addresses"))

+ 7 - 0
luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/client.lua

@@ -201,6 +201,13 @@ if is_finded("dnsproxy") then
 	o:depends("parse_method", "parse_file")
 	o:depends("parse_method", "parse_file")
 	o.rmempty = true
 	o.rmempty = true
 	o.default = "load_balance"
 	o.default = "load_balance"
+
+	o = s:option(Flag, "dnsproxy_ipv6", translate("Disable IPv6 query mode"))
+	o.description = translate("When disabled, all AAAA requests are not resolved.")
+	o:depends("parse_method", "single_dns")
+	o:depends("parse_method", "parse_file")
+	o.rmempty = false
+	o.default = "1"
 end
 end
 
 
 if is_finded("chinadns-ng") then
 if is_finded("chinadns-ng") then

+ 6 - 0
luci-app-ssr-plus/po/zh_Hans/ssr-plus.po

@@ -648,6 +648,12 @@ msgstr "并行查询"
 msgid "fastest_addr"
 msgid "fastest_addr"
 msgstr "最快响应"
 msgstr "最快响应"
 
 
+msgid "Disable IPv6 query mode"
+msgstr "禁止返回 IPv6 记录"
+
+msgid "When disabled, all AAAA requests are not resolved."
+msgstr "当禁用时,不解析所有 AAAA 请求。"
+
 msgid "Defines the upstreams logic mode, possible values: load_balance, parallel, fastest_addr (default: load_balance)."
 msgid "Defines the upstreams logic mode, possible values: load_balance, parallel, fastest_addr (default: load_balance)."
 msgstr "定义上游逻辑模式,可选择值:负载均衡、并行查询、最快响应(默认值:负载均衡)。"
 msgstr "定义上游逻辑模式,可选择值:负载均衡、并行查询、最快响应(默认值:负载均衡)。"
 
 

+ 12 - 4
luci-app-ssr-plus/root/etc/init.d/shadowsocksr

@@ -249,8 +249,12 @@ start_dns() {
 			pdnsd_enable_flag=4
 			pdnsd_enable_flag=4
 			;;
 			;;
 		5)
 		5)
+			dnsproxy_ipv6="$(uci_get_by_type global dnsproxy_ipv6)"
+			if [ "$dnsproxy_ipv6" -eq "1" ]; then
+				disabled_ipv6="--ipv6-disabled"
+			fi
 			if [ "$dnsproxy_dnsserver" != "parse_file" ]; then
 			if [ "$dnsproxy_dnsserver" != "parse_file" ]; then
-				ln_start_bin $(first_type dnsproxy) dnsproxy -l 127.0.0.1 -p $tmp_dns_port  -p $dns_port -u $dnsserver --cache --cache-min-ttl=3600
+				ln_start_bin $(first_type dnsproxy) dnsproxy -l 127.0.0.1 -p $tmp_dns_port  -p $dns_port -u $dnsserver $disabled_ipv6 --cache --cache-min-ttl=3600
 			else
 			else
 				dnsproxy_dnsserver_file="$TMP_PATH/dnsproxy_dns.list"
 				dnsproxy_dnsserver_file="$TMP_PATH/dnsproxy_dns.list"
 				cleaned_file="$TMP_PATH/cleaned_dns.list"
 				cleaned_file="$TMP_PATH/cleaned_dns.list"
@@ -297,7 +301,7 @@ start_dns() {
 
 
 				if [ -n "$dnsproxy_dnsserver_file" ] && [ -s "$dnsproxy_dnsserver_file" ]; then
 				if [ -n "$dnsproxy_dnsserver_file" ] && [ -s "$dnsproxy_dnsserver_file" ]; then
 					local upstreams_logic_mode="$(uci_get_by_type global upstreams_logic_mode)"
 					local upstreams_logic_mode="$(uci_get_by_type global upstreams_logic_mode)"
-					ln_start_bin $(first_type dnsproxy) dnsproxy -l 127.0.0.1 -p $tmp_dns_port  -p $dns_port -u $dnsproxy_dnsserver_file --cache --cache-min-ttl=3600 --upstream-mode=$upstreams_logic_mode
+					ln_start_bin $(first_type dnsproxy) dnsproxy -l 127.0.0.1 -p $tmp_dns_port  -p $dns_port -u $dnsproxy_dnsserver_file $disabled_ipv6 --cache --cache-min-ttl=3600 --upstream-mode=$upstreams_logic_mode
 				fi
 				fi
 			fi
 			fi
 			echolog "DNSPROXY query and cache Started!"
 			echolog "DNSPROXY query and cache Started!"
@@ -618,8 +622,12 @@ shunt_dns_command() {
 		ln_start_bin $(first_type mosdns) mosdns start -c $TMP_PATH/mosdns-config-shunt.yaml
 		ln_start_bin $(first_type mosdns) mosdns start -c $TMP_PATH/mosdns-config-shunt.yaml
 		;;
 		;;
 	4)
 	4)
+		shunt_dnsproxy_ipv6="$(uci_get_by_type global shunt_dnsproxy_ipv6)"
+		if [ "$shunt_dnsproxy_ipv6" -eq "1" ]; then
+			shunt_disabled_ipv6="--ipv6-disabled"
+		fi
 		if [ "$shunt_dnsproxy_dnsserver" != "parse_file" ]; then
 		if [ "$shunt_dnsproxy_dnsserver" != "parse_file" ]; then
-			ln_start_bin $(first_type dnsproxy) dnsproxy -l 127.0.0.1 -p $tmp_port -p $tmp_shunt_dns_port -u $shunt_dnsserver --cache --cache-min-ttl=3600
+			ln_start_bin $(first_type dnsproxy) dnsproxy -l 127.0.0.1 -p $tmp_port -p $tmp_shunt_dns_port -u $shunt_dnsserver $shunt_disabled_ipv6 --cache --cache-min-ttl=3600
 		else
 		else
 			shunt_dnsproxy_dnsserver_file="$TMP_PATH/dnsproxy_dns.list"
 			shunt_dnsproxy_dnsserver_file="$TMP_PATH/dnsproxy_dns.list"
 			cleaned_file="$TMP_PATH/cleaned_dns_servers.list"
 			cleaned_file="$TMP_PATH/cleaned_dns_servers.list"
@@ -666,7 +674,7 @@ shunt_dns_command() {
 			
 			
 			if [ -n "$shunt_dnsproxy_dnsserver_file" ] && [ -s "$shunt_dnsproxy_dnsserver_file" ]; then
 			if [ -n "$shunt_dnsproxy_dnsserver_file" ] && [ -s "$shunt_dnsproxy_dnsserver_file" ]; then
 				local shunt_upstreams_logic_mode="$(uci_get_by_type global shunt_upstreams_logic_mode)"
 				local shunt_upstreams_logic_mode="$(uci_get_by_type global shunt_upstreams_logic_mode)"
-				ln_start_bin $(first_type dnsproxy) dnsproxy -l 127.0.0.1 -p $tmp_port -p $tmp_shunt_dns_port -u $shunt_dnsproxy_dnsserver_file --cache --cache-min-ttl=3600 --upstream-mode=$shunt_upstreams_logic_mode
+				ln_start_bin $(first_type dnsproxy) dnsproxy -l 127.0.0.1 -p $tmp_port -p $tmp_shunt_dns_port -u $shunt_dnsproxy_dnsserver_file $shunt_disabled_ipv6 --cache --cache-min-ttl=3600 --upstream-mode=$shunt_upstreams_logic_mode
 			fi
 			fi
 		fi
 		fi
 		echolog "DNSPROXY shunt query and cache Started!"
 		echolog "DNSPROXY shunt query and cache Started!"

+ 5 - 2
luci-app-ssr-plus/root/usr/bin/ssr-monitor

@@ -136,8 +136,11 @@ while [ "1" == "1" ]; do #死循环
 				dnsserver="$(uci_get_by_type global dnsproxy_tunnel_forward 8.8.4.4:53)"
 				dnsserver="$(uci_get_by_type global dnsproxy_tunnel_forward 8.8.4.4:53)"
 			fi
 			fi
 			kill -9 $(busybox ps -w | grep "dnsproxy -l 127.0.0.1 -p $tmp_port" | grep -v grep | awk '{print $1}') >/dev/null 2>&1
 			kill -9 $(busybox ps -w | grep "dnsproxy -l 127.0.0.1 -p $tmp_port" | grep -v grep | awk '{print $1}') >/dev/null 2>&1
+			dnsproxy_ipv6="$(uci_get_by_type global dnsproxy_ipv6)"
+				disabled_ipv6="--ipv6-disabled"
+			fi
 			if [ "$dnsproxy_dnsserver" != "parse_file" ]; then
 			if [ "$dnsproxy_dnsserver" != "parse_file" ]; then
-				ln_start_bin $(first_type dnsproxy) dnsproxy -l 127.0.0.1 -p $tmp_dns_port  -p $dns_port -u $dnsserver --cache --cache-min-ttl=3600
+				ln_start_bin $(first_type dnsproxy) dnsproxy -l 127.0.0.1 -p $tmp_dns_port  -p $dns_port -u $dnsserver $disabled_ipv6 --cache --cache-min-ttl=3600
 			else
 			else
 				dnsproxy_dnsserver_file="$TMP_PATH/dnsproxy_dns.list"
 				dnsproxy_dnsserver_file="$TMP_PATH/dnsproxy_dns.list"
 				cleaned_file="$TMP_PATH/cleaned_dns.list"
 				cleaned_file="$TMP_PATH/cleaned_dns.list"
@@ -184,7 +187,7 @@ while [ "1" == "1" ]; do #死循环
 
 
 				if [ -n "$dnsproxy_dnsserver_file" ] && [ -s "$dnsproxy_dnsserver_file" ]; then
 				if [ -n "$dnsproxy_dnsserver_file" ] && [ -s "$dnsproxy_dnsserver_file" ]; then
 					local upstreams_logic_mode="$(uci_get_by_type global upstreams_logic_mode)"
 					local upstreams_logic_mode="$(uci_get_by_type global upstreams_logic_mode)"
-					ln_start_bin $(first_type dnsproxy) dnsproxy -l 127.0.0.1 -p $tmp_dns_port  -p $dns_port -u $dnsproxy_dnsserver_file --cache --cache-min-ttl=3600 --upstream-mode=$upstreams_logic_mode
+					ln_start_bin $(first_type dnsproxy) dnsproxy -l 127.0.0.1 -p $tmp_dns_port  -p $dns_port -u $dnsproxy_dnsserver_file $disabled_ipv6 --cache --cache-min-ttl=3600 --upstream-mode=$upstreams_logic_mode
 				fi
 				fi
 			fi
 			fi
 		fi
 		fi