From 50c4300cafab3fae91b06361905b81c299a593b3 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Sun, 5 Jun 2022 20:59:56 +0800 Subject: [PATCH] luci-app-ssr-plus: use dns2tcp by default Signed-off-by: Tianling Shen --- luci-app-ssr-plus/Makefile | 18 ++++----- .../luasrc/model/cbi/shadowsocksr/client.lua | 10 ++--- luci-app-ssr-plus/po/zh-cn/ssr-plus.po | 6 +-- .../root/etc/init.d/shadowsocksr | 4 +- luci-app-ssr-plus/root/usr/bin/ssr-monitor | 38 +++++++++---------- 5 files changed, 38 insertions(+), 38 deletions(-) diff --git a/luci-app-ssr-plus/Makefile b/luci-app-ssr-plus/Makefile index 711267532..e96872459 100644 --- a/luci-app-ssr-plus/Makefile +++ b/luci-app-ssr-plus/Makefile @@ -2,13 +2,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-ssr-plus PKG_VERSION:=185 -PKG_RELEASE:=4 +PKG_RELEASE:=5 PKG_CONFIG_DEPENDS:= \ - CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_DNS2TCP \ CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Kcptun \ CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_IPT2Socks \ CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_NaiveProxy \ + CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_PDNSD \ CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Redsocks2 \ CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Libev_Client \ 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_DEPENDS:= \ @(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 \ - +PACKAGE_$(PKG_NAME)_INCLUDE_DNS2TCP:dns2tcp \ +PACKAGE_$(PKG_NAME)_INCLUDE_Kcptun:kcptun-client \ +PACKAGE_$(PKG_NAME)_INCLUDE_IPT2Socks:ipt2socks \ +PACKAGE_$(PKG_NAME)_INCLUDE_NaiveProxy:naiveproxy \ + +PACKAGE_$(PKG_NAME)_INCLUDE_PDNSD:pdnsd-alt \ +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-redir \ @@ -48,10 +48,6 @@ LUCI_DEPENDS:= \ +PACKAGE_$(PKG_NAME)_INCLUDE_Xray:xray-core define Package/$(PKG_NAME)/config -config PACKAGE_$(PKG_NAME)_INCLUDE_DNS2TCP - bool "Include DNS2TCP" - default n - config PACKAGE_$(PKG_NAME)_INCLUDE_Kcptun bool "Include Kcptun" default n @@ -65,6 +61,10 @@ config PACKAGE_$(PKG_NAME)_INCLUDE_IPT2Socks bool "Include ipt2socks" default n +config PACKAGE_$(PKG_NAME)_INCLUDE_PDNSD + bool "Include PDNSD" + default n + config PACKAGE_$(PKG_NAME)_INCLUDE_Redsocks2 bool "Include Redsocks2" default n diff --git a/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/client.lua b/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/client.lua index 37d482494..516d5752f 100644 --- a/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/client.lua +++ b/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/client.lua @@ -1,10 +1,10 @@ -- Copyright (C) 2017 yushi studio github.com/ywb94 -- Copyright (C) 2018 lean github.com/coolsnowwolf -- 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() m = Map("shadowsocksr", translate("ShadowSocksR Plus+ Settings")) - m:section(SimpleSection).template = "shadowsocksr/status" local server_table = {} @@ -84,10 +84,10 @@ o:value("2", translate("Only Common Ports")) o.default = 1 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")) -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 o:value("0", translate("Use Local DNS Service listen port 5335")) o.default = 1 diff --git a/luci-app-ssr-plus/po/zh-cn/ssr-plus.po b/luci-app-ssr-plus/po/zh-cn/ssr-plus.po index d1b1e64c2..e1ee40dd5 100644 --- a/luci-app-ssr-plus/po/zh-cn/ssr-plus.po +++ b/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)" msgstr "格式为 IP:PORT (默认: 8.8.4.4:53)" +msgid "Use DNS2TCP query" +msgstr "使用 DNS2TCP 查询" + msgid "Use Pdnsd tcp query and cache" msgstr "使用PDNSD TCP查询并缓存" msgid "Use DNS2SOCKS query and cache" msgstr "使用 DNS2SOCKS 查询并缓存" -msgid "Use DNS2TCP query" -msgstr "使用 DNS2TCP 查询" - msgid "DNS Server IP:Port" msgstr "DNS服务器 IP:Port" diff --git a/luci-app-ssr-plus/root/etc/init.d/shadowsocksr b/luci-app-ssr-plus/root/etc/init.d/shadowsocksr index 14ce639bf..ee78c406b 100755 --- a/luci-app-ssr-plus/root/etc/init.d/shadowsocksr +++ b/luci-app-ssr-plus/root/etc/init.d/shadowsocksr @@ -213,7 +213,7 @@ start_dns() { esac case "$ssrplus_dns" in 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 ;; 2) @@ -222,7 +222,7 @@ start_dns() { pdnsd_enable_flag=2 ;; 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 ;; esac diff --git a/luci-app-ssr-plus/root/usr/bin/ssr-monitor b/luci-app-ssr-plus/root/usr/bin/ssr-monitor index 8517c18ea..6acf563ff 100755 --- a/luci-app-ssr-plus/root/usr/bin/ssr-monitor +++ b/luci-app-ssr-plus/root/usr/bin/ssr-monitor @@ -82,18 +82,17 @@ while [ "1" == "1" ]; do #死循环 exit 0 fi fi - #pdnsd + #dns2tcp 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 #如果进程挂掉就重启它 - 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 #dns2socks 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 dns2socks) dns2socks 127.0.0.1:$tmp_dns_port $dnsserver:$dnsport 127.0.0.1:$dns_port -q fi - #dns2tcp + #pdnsd 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 #如果进程挂掉就重启它 - 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 done