diff --git a/luci-app-ssr-plus/Makefile b/luci-app-ssr-plus/Makefile index 53aec9189..711267532 100644 --- a/luci-app-ssr-plus/Makefile +++ b/luci-app-ssr-plus/Makefile @@ -2,12 +2,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-ssr-plus PKG_VERSION:=185 -PKG_RELEASE:=3 +PKG_RELEASE:=4 PKG_CONFIG_DEPENDS:= \ + CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_DNS2TCP \ CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Kcptun \ - CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_NaiveProxy \ CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_IPT2Socks \ + CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_NaiveProxy \ CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Redsocks2 \ CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Libev_Client \ CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Libev_Server \ @@ -27,9 +28,10 @@ LUCI_DEPENDS:= \ +coreutils +coreutils-base64 +dns2socks +dnsmasq-full +ipset +kmod-ipt-nat +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 \ +PACKAGE_$(PKG_NAME)_INCLUDE_Kcptun:kcptun-client \ - +PACKAGE_$(PKG_NAME)_INCLUDE_NaiveProxy:naiveproxy \ +PACKAGE_$(PKG_NAME)_INCLUDE_IPT2Socks:ipt2socks \ + +PACKAGE_$(PKG_NAME)_INCLUDE_NaiveProxy:naiveproxy \ +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 \ @@ -46,6 +48,10 @@ 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 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 5ce044df9..37d482494 100644 --- a/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/client.lua +++ b/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/client.lua @@ -86,6 +86,9 @@ 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("2", translate("Use DNS2SOCKS query and cache")) +if nixio.fs.access('/usr/bin/dns2tcp') then + o:value("3", translate("Use DNS2TCP query")) +end o:value("0", translate("Use Local DNS Service listen port 5335")) o.default = 1 @@ -105,6 +108,7 @@ o:value("114.114.114.114:53", translate("Oversea Mode DNS-1 (114.114.114.114)")) o:value("114.114.115.115:53", translate("Oversea Mode DNS-2 (114.114.115.115)")) o:depends("pdnsd_enable", "1") o:depends("pdnsd_enable", "2") +o:depends("pdnsd_enable", "3") o.description = translate("Custom DNS Server format as IP:PORT (default: 8.8.4.4:53)") o.datatype = "hostport" diff --git a/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/status.lua b/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/status.lua index 64f9be4aa..6610fb2f6 100644 --- a/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/status.lua +++ b/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/status.lua @@ -88,7 +88,7 @@ if Process_list:find("ssr.server") then server_run = 1 end -if Process_list:find("ssrplus/bin/pdnsd") or (Process_list:find("ssrplus.dns") and Process_list:find("dns2socks.127.0.0.1.*127.0.0.1.5335")) then +if Process_list:find("ssrplus/bin/pdnsd") or Process_list:find("ssrplus/bin/dns2tcp") or (Process_list:find("ssrplus.dns") and Process_list:find("dns2socks.127.0.0.1.*127.0.0.1.5335")) then pdnsd_run = 1 end 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 b4f696062..d1b1e64c2 100644 --- a/luci-app-ssr-plus/po/zh-cn/ssr-plus.po +++ b/luci-app-ssr-plus/po/zh-cn/ssr-plus.po @@ -430,6 +430,9 @@ 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 a9e91ec21..14ce639bf 100755 --- a/luci-app-ssr-plus/root/etc/init.d/shadowsocksr +++ b/luci-app-ssr-plus/root/etc/init.d/shadowsocksr @@ -221,6 +221,10 @@ start_dns() { ln_start_bin $(first_type dns2socks) dns2socks 127.0.0.1:$tmp_dns_port $dnsserver:$dnsport 127.0.0.1:$dns_port -q pdnsd_enable_flag=2 ;; + 3) + ln_start_bin $(first_type dns2tcp) dns2tcp -L "127.0.0.1#$dns_port" -R "$dnsserver#$dnsport" + pdnsd_enable_flag=3 + ;; esac fi } diff --git a/luci-app-ssr-plus/root/usr/bin/ssr-monitor b/luci-app-ssr-plus/root/usr/bin/ssr-monitor index b84d85506..8517c18ea 100755 --- a/luci-app-ssr-plus/root/usr/bin/ssr-monitor +++ b/luci-app-ssr-plus/root/usr/bin/ssr-monitor @@ -85,7 +85,7 @@ while [ "1" == "1" ]; do #死循环 #pdnsd if [ "$pdnsd_process" -eq 1 ]; then icount=$(busybox ps -w | grep $TMP_BIN_PATH/pdnsd | grep -v grep | wc -l) - if [ "$icount" -lt "$pdnsd_process" ]; 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 @@ -95,9 +95,8 @@ while [ "1" == "1" ]; do #死循环 fi ln_start_bin $(first_type pdnsd) pdnsd -c $TMP_PATH/pdnsd.conf fi - fi #dns2socks - if [ "$pdnsd_process" -eq 2 ]; then + elif [ "$pdnsd_process" -eq 2 ]; then icount=$(busybox ps -w | grep -e ssrplus-dns -e "dns2socks 127.0.0.1 $tmp_dns_port" | grep -v grep | wc -l) if [ "$icount" -lt 2 ]; then #如果进程挂掉就重启它 logger -t "$NAME" "dns2socks $dnsstr tunnel error.restart!" @@ -110,5 +109,17 @@ 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 + elif [ "$pdnsd_process" -eq 3 ]; then + icount=$(busybox ps -w | grep $TMP_BIN_PATH/dns2tcp | 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" + fi fi done