OSDN Git Service

luci-app-ssr-plus: use dns2tcp by default
authorTianling Shen <cnsztl@immortalwrt.org>
Sun, 5 Jun 2022 12:59:56 +0000 (20:59 +0800)
committerTianling Shen <cnsztl@immortalwrt.org>
Mon, 6 Jun 2022 10:29:49 +0000 (18:29 +0800)
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
applications/luci-app-ssr-plus/Makefile
applications/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/client.lua
applications/luci-app-ssr-plus/po/zh_Hans/ssr-plus.po
applications/luci-app-ssr-plus/root/etc/init.d/shadowsocksr
applications/luci-app-ssr-plus/root/usr/bin/ssr-monitor

index 6e3382c..3068ca8 100644 (file)
@@ -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/XRay/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 +ip-full \
-       +iptables +iptables-mod-tproxy +lua +libuci-lua +microsocks +pdnsd-alt \
-       +tcping +resolveip +shadowsocksr-libev-ssr-check +uclient-fetch \
-       +PACKAGE_$(PKG_NAME)_INCLUDE_DNS2TCP:dns2tcp \
+       +coreutils +coreutils-base64 +dns2socks +dns2tcp +dnsmasq-full +ipset +ip-full \
+       +iptables +iptables-mod-tproxy +lua +libuci-lua +microsocks +tcping +resolveip \
+       +shadowsocksr-libev-ssr-check +uclient-fetch \
        +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_NaiveProxy
        depends on !(arc||armeb||mips||mips64||powerpc||TARGET_gemini)
        default n
 
+config PACKAGE_$(PKG_NAME)_INCLUDE_PDNSD
+       bool "Include PDNSD"
+       default n
+
 config PACKAGE_$(PKG_NAME)_INCLUDE_Redsocks2
        bool "Include Redsocks2"
        default n
index 8f86ff6..89212f3 100644 (file)
@@ -1,10 +1,11 @@
 -- Copyright (C) 2017 yushi studio <ywb94@qq.com> github.com/ywb94
 -- Copyright (C) 2018 lean <coolsnowwolf@gmail.com> 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"), 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"
 
 local server_table = {}
@@ -84,10 +85,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
index d1b1e64..e1ee40d 100644 (file)
@@ -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"
 
index e5b3d1d..ef1dc5a 100755 (executable)
@@ -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
index 8517c18..6acf563 100755 (executable)
@@ -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