Browse Source

luci-app-ssr-plus: use dns2tcp by default

Signed-off-by: Tianling Shen <[email protected]>
Tianling Shen 3 years ago
parent
commit
b4ede27bc2

+ 9 - 9
luci-app-ssr-plus/Makefile

@@ -2,13 +2,13 @@ include $(TOPDIR)/rules.mk
 
 
 PKG_NAME:=luci-app-ssr-plus
 PKG_NAME:=luci-app-ssr-plus
 PKG_VERSION:=185
 PKG_VERSION:=185
-PKG_RELEASE:=4
+PKG_RELEASE:=5
 
 
 PKG_CONFIG_DEPENDS:= \
 PKG_CONFIG_DEPENDS:= \
-	CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_DNS2TCP \
 	CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Kcptun \
 	CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Kcptun \
 	CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_IPT2Socks \
 	CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_IPT2Socks \
 	CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_NaiveProxy \
 	CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_NaiveProxy \
+	CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_PDNSD \
 	CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Redsocks2 \
 	CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Redsocks2 \
 	CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Libev_Client \
 	CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Libev_Client \
 	CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Libev_Server \
 	CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Libev_Server \
@@ -25,13 +25,13 @@ LUCI_TITLE:=SS/SSR/V2Ray/Trojan/NaiveProxy/Socks5/Tun LuCI interface
 LUCI_PKGARCH:=all
 LUCI_PKGARCH:=all
 LUCI_DEPENDS:= \
 LUCI_DEPENDS:= \
 	@(PACKAGE_libustream-mbedtls||PACKAGE_libustream-openssl||PACKAGE_libustream-wolfssl) \
 	@(PACKAGE_libustream-mbedtls||PACKAGE_libustream-openssl||PACKAGE_libustream-wolfssl) \
-	+coreutils +coreutils-base64 +dns2socks +dnsmasq-full +ipset +kmod-ipt-nat +ip-full \
-	+iptables +iptables-mod-tproxy +lua +libuci-lua +microsocks +pdnsd-alt +tcping \
+	+coreutils +coreutils-base64 +dns2socks +dns2tcp +dnsmasq-full +ipset +kmod-ipt-nat \
+	+ip-full +iptables +iptables-mod-tproxy +lua +libuci-lua +microsocks +tcping \
 	+resolveip +shadowsocksr-libev-ssr-check +uclient-fetch \
 	+resolveip +shadowsocksr-libev-ssr-check +uclient-fetch \
-	+PACKAGE_$(PKG_NAME)_INCLUDE_DNS2TCP:dns2tcp \
 	+PACKAGE_$(PKG_NAME)_INCLUDE_Kcptun:kcptun-client \
 	+PACKAGE_$(PKG_NAME)_INCLUDE_Kcptun:kcptun-client \
 	+PACKAGE_$(PKG_NAME)_INCLUDE_IPT2Socks:ipt2socks \
 	+PACKAGE_$(PKG_NAME)_INCLUDE_IPT2Socks:ipt2socks \
 	+PACKAGE_$(PKG_NAME)_INCLUDE_NaiveProxy:naiveproxy \
 	+PACKAGE_$(PKG_NAME)_INCLUDE_NaiveProxy:naiveproxy \
+	+PACKAGE_$(PKG_NAME)_INCLUDE_PDNSD:pdnsd-alt \
 	+PACKAGE_$(PKG_NAME)_INCLUDE_Redsocks2:redsocks2 \
 	+PACKAGE_$(PKG_NAME)_INCLUDE_Redsocks2:redsocks2 \
 	+PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Libev_Client:shadowsocks-libev-ss-local \
 	+PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Libev_Client:shadowsocks-libev-ss-local \
 	+PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Libev_Client:shadowsocks-libev-ss-redir \
 	+PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Libev_Client:shadowsocks-libev-ss-redir \
@@ -48,10 +48,6 @@ LUCI_DEPENDS:= \
 	+PACKAGE_$(PKG_NAME)_INCLUDE_Xray:xray-core
 	+PACKAGE_$(PKG_NAME)_INCLUDE_Xray:xray-core
 
 
 define Package/$(PKG_NAME)/config
 define Package/$(PKG_NAME)/config
-config PACKAGE_$(PKG_NAME)_INCLUDE_DNS2TCP
-	bool "Include DNS2TCP"
-	default n
-
 config PACKAGE_$(PKG_NAME)_INCLUDE_Kcptun
 config PACKAGE_$(PKG_NAME)_INCLUDE_Kcptun
 	bool "Include Kcptun"
 	bool "Include Kcptun"
 	default n
 	default n
@@ -65,6 +61,10 @@ config PACKAGE_$(PKG_NAME)_INCLUDE_IPT2Socks
 	bool "Include ipt2socks"
 	bool "Include ipt2socks"
 	default n
 	default n
 
 
+config PACKAGE_$(PKG_NAME)_INCLUDE_PDNSD
+	bool "Include PDNSD"
+	default n
+
 config PACKAGE_$(PKG_NAME)_INCLUDE_Redsocks2
 config PACKAGE_$(PKG_NAME)_INCLUDE_Redsocks2
 	bool "Include Redsocks2"
 	bool "Include Redsocks2"
 	default n
 	default n

+ 6 - 5
luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/client.lua

@@ -1,10 +1,11 @@
 -- Copyright (C) 2017 yushi studio <[email protected]> github.com/ywb94
 -- Copyright (C) 2017 yushi studio <[email protected]> github.com/ywb94
 -- Copyright (C) 2018 lean <[email protected]> github.com/coolsnowwolf
 -- Copyright (C) 2018 lean <[email protected]> github.com/coolsnowwolf
 -- Licensed to the public under the GNU General Public License v3.
 -- Licensed to the public under the GNU General Public License v3.
-local m, s, sec, o, kcp_enable
+
+local m, s, sec, o
 local uci = luci.model.uci.cursor()
 local uci = luci.model.uci.cursor()
-m = Map("shadowsocksr", translate("ShadowSocksR Plus+ Settings"), translate("<h3>Support SS/SSR/V2RAY/XRAY/TROJAN/NAIVEPROXY/SOCKS5/TUN etc.</h3>"))
 
 
+m = Map("shadowsocksr", translate("ShadowSocksR Plus+ Settings"), translate("<h3>Support SS/SSR/V2RAY/XRAY/TROJAN/NAIVEPROXY/SOCKS5/TUN etc.</h3>"))
 m:section(SimpleSection).template = "shadowsocksr/status"
 m:section(SimpleSection).template = "shadowsocksr/status"
 
 
 local server_table = {}
 local server_table = {}
@@ -84,10 +85,10 @@ o:value("2", translate("Only Common Ports"))
 o.default = 1
 o.default = 1
 
 
 o = s:option(ListValue, "pdnsd_enable", translate("Resolve Dns Mode"))
 o = s:option(ListValue, "pdnsd_enable", translate("Resolve Dns Mode"))
-o:value("1", translate("Use Pdnsd tcp query and cache"))
+o:value("1", translate("Use DNS2TCP query"))
 o:value("2", translate("Use DNS2SOCKS query and cache"))
 o:value("2", translate("Use DNS2SOCKS query and cache"))
-if nixio.fs.access('/usr/bin/dns2tcp') then
-	o:value("3", translate("Use DNS2TCP query"))
+if nixio.fs.access('/usr/sbin/pdnsd') then
+	o:value("3", translate("Use Pdnsd tcp query and cache"))
 end
 end
 o:value("0", translate("Use Local DNS Service listen port 5335"))
 o:value("0", translate("Use Local DNS Service listen port 5335"))
 o.default = 1
 o.default = 1

+ 3 - 3
luci-app-ssr-plus/po/zh-cn/ssr-plus.po

@@ -424,15 +424,15 @@ msgstr "访问国外域名DNS服务器"
 msgid "Custom DNS Server format as IP:PORT (default: 8.8.4.4:53)"
 msgid "Custom DNS Server format as IP:PORT (default: 8.8.4.4:53)"
 msgstr "格式为 IP:PORT (默认: 8.8.4.4:53)"
 msgstr "格式为 IP:PORT (默认: 8.8.4.4:53)"
 
 
+msgid "Use DNS2TCP query"
+msgstr "使用 DNS2TCP 查询"
+
 msgid "Use Pdnsd tcp query and cache"
 msgid "Use Pdnsd tcp query and cache"
 msgstr "使用PDNSD TCP查询并缓存"
 msgstr "使用PDNSD TCP查询并缓存"
 
 
 msgid "Use DNS2SOCKS query and cache"
 msgid "Use DNS2SOCKS query and cache"
 msgstr "使用 DNS2SOCKS 查询并缓存"
 msgstr "使用 DNS2SOCKS 查询并缓存"
 
 
-msgid "Use DNS2TCP query"
-msgstr "使用 DNS2TCP 查询"
-
 msgid "DNS Server IP:Port"
 msgid "DNS Server IP:Port"
 msgstr "DNS服务器 IP:Port"
 msgstr "DNS服务器 IP:Port"
 
 

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

@@ -213,7 +213,7 @@ start_dns() {
 		esac
 		esac
 		case "$ssrplus_dns" in
 		case "$ssrplus_dns" in
 		1)
 		1)
-			start_pdnsd $dnsserver $dnsport
+			ln_start_bin $(first_type dns2tcp) dns2tcp -L "127.0.0.1#$dns_port" -R "$dnsserver#$dnsport"
 			pdnsd_enable_flag=1
 			pdnsd_enable_flag=1
 			;;
 			;;
 		2)
 		2)
@@ -222,7 +222,7 @@ start_dns() {
 			pdnsd_enable_flag=2
 			pdnsd_enable_flag=2
 			;;
 			;;
 		3)
 		3)
-			ln_start_bin $(first_type dns2tcp) dns2tcp -L "127.0.0.1#$dns_port" -R "$dnsserver#$dnsport"
+			start_pdnsd $dnsserver $dnsport
 			pdnsd_enable_flag=3
 			pdnsd_enable_flag=3
 			;;
 			;;
 		esac
 		esac

+ 19 - 19
luci-app-ssr-plus/root/usr/bin/ssr-monitor

@@ -82,18 +82,17 @@ while [ "1" == "1" ]; do #死循环
 			exit 0
 			exit 0
 		fi
 		fi
 	fi
 	fi
-	#pdnsd
+	#dns2tcp
 	if [ "$pdnsd_process" -eq 1 ]; then
 	if [ "$pdnsd_process" -eq 1 ]; then
-		icount=$(busybox ps -w | grep $TMP_BIN_PATH/pdnsd | grep -v grep | wc -l)
+		icount=$(busybox ps -w | grep $TMP_BIN_PATH/dns2tcp | grep -v grep | wc -l)
 		if [ "$icount" -lt 1 ]; then #如果进程挂掉就重启它
 		if [ "$icount" -lt 1 ]; then #如果进程挂掉就重启它
-			logger -t "$NAME" "pdnsd tunnel error.restart!"
-			echolog "pdnsd tunnel error.restart!"
-			if [ -f /var/run/pdnsd.pid ]; then
-				kill $(cat /var/run/pdnsd.pid) >/dev/null 2>&1
-			else
-				kill -9 $(ps | grep $TMP_PATH/pdnsd.conf | grep -v grep | awk '{print $1}') >/dev/null 2>&1
-			fi
-			ln_start_bin $(first_type pdnsd) pdnsd -c $TMP_PATH/pdnsd.conf
+			logger -t "$NAME" "dns2tcp tunnel error.restart!"
+			echolog "dns2tcp tunnel error.restart!"
+			dnsstr=$(uci_get_by_type global tunnel_forward 8.8.4.4:53)
+			dnsserver=$(echo "$dnsstr" | awk -F ':' '{print $1}')
+			dnsport=$(echo "$dnsstr" | awk -F ':' '{print $2}')
+			kill -9 $(busybox ps -w | grep $TMP_BIN_PATH/dns2tcp | grep -v grep | awk '{print $1}') >/dev/null 2>&1
+			ln_start_bin $(first_type dns2tcp) dns2tcp -L "127.0.0.1#$dns_port" -R "$dnsserver#$dnsport"
 		fi
 		fi
 	#dns2socks
 	#dns2socks
 	elif [ "$pdnsd_process" -eq 2 ]; then
 	elif [ "$pdnsd_process" -eq 2 ]; then
@@ -109,17 +108,18 @@ while [ "1" == "1" ]; do #死循环
 			ln_start_bin $(first_type microsocks) microsocks -i 127.0.0.1 -p $tmp_dns_port ssrplus-dns
 			ln_start_bin $(first_type microsocks) microsocks -i 127.0.0.1 -p $tmp_dns_port ssrplus-dns
 			ln_start_bin $(first_type dns2socks) dns2socks 127.0.0.1:$tmp_dns_port $dnsserver:$dnsport 127.0.0.1:$dns_port -q
 			ln_start_bin $(first_type dns2socks) dns2socks 127.0.0.1:$tmp_dns_port $dnsserver:$dnsport 127.0.0.1:$dns_port -q
 		fi
 		fi
-	#dns2tcp
+	#pdnsd
 	elif [ "$pdnsd_process" -eq 3 ]; then
 	elif [ "$pdnsd_process" -eq 3 ]; then
-		icount=$(busybox ps -w | grep $TMP_BIN_PATH/dns2tcp | grep -v grep | wc -l)
+		icount=$(busybox ps -w | grep $TMP_BIN_PATH/pdnsd | grep -v grep | wc -l)
 		if [ "$icount" -lt 1 ]; then #如果进程挂掉就重启它
 		if [ "$icount" -lt 1 ]; then #如果进程挂掉就重启它
-			logger -t "$NAME" "dns2tcp tunnel error.restart!"
-			echolog "dns2tcp tunnel error.restart!"
-			dnsstr=$(uci_get_by_type global tunnel_forward 8.8.4.4:53)
-			dnsserver=$(echo "$dnsstr" | awk -F ':' '{print $1}')
-			dnsport=$(echo "$dnsstr" | awk -F ':' '{print $2}')
-			kill -9 $(busybox ps -w | grep $TMP_BIN_PATH/dns2tcp | grep -v grep | awk '{print $1}') >/dev/null 2>&1
-			ln_start_bin $(first_type dns2tcp) dns2tcp -L "127.0.0.1#$dns_port" -R "$dnsserver#$dnsport"
+			logger -t "$NAME" "pdnsd tunnel error.restart!"
+			echolog "pdnsd tunnel error.restart!"
+			if [ -f /var/run/pdnsd.pid ]; then
+				kill $(cat /var/run/pdnsd.pid) >/dev/null 2>&1
+			else
+				kill -9 $(ps | grep $TMP_PATH/pdnsd.conf | grep -v grep | awk '{print $1}') >/dev/null 2>&1
+			fi
+			ln_start_bin $(first_type pdnsd) pdnsd -c $TMP_PATH/pdnsd.conf
 		fi
 		fi
 	fi
 	fi
 done
 done