OSDN Git Service

luci-app-ssr-plus: sync with upstream source
authorTianling Shen <cnsztl@immortalwrt.org>
Fri, 3 Jun 2022 16:33:15 +0000 (00:33 +0800)
committerTianling Shen <cnsztl@immortalwrt.org>
Fri, 3 Jun 2022 16:33:15 +0000 (00:33 +0800)
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
applications/luci-app-ssr-plus/Makefile
applications/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/advanced.lua
applications/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/client.lua
applications/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/status.lua
applications/luci-app-ssr-plus/luasrc/view/shadowsocksr/ssrurl.htm
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
applications/luci-app-ssr-plus/root/usr/bin/ssr-rules

index ac61d40..6e3382c 100644 (file)
@@ -1,10 +1,11 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=luci-app-ssr-plus
-PKG_VERSION:=184
-PKG_RELEASE:=10
+PKG_VERSION:=185
+PKG_RELEASE:=4
 
 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 \
@@ -24,9 +25,10 @@ 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-mod-tproxy +lua +libuci-lua +microsocks +pdnsd-alt \
+       +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 \
        +PACKAGE_$(PKG_NAME)_INCLUDE_Kcptun:kcptun-client \
        +PACKAGE_$(PKG_NAME)_INCLUDE_IPT2Socks:ipt2socks \
        +PACKAGE_$(PKG_NAME)_INCLUDE_NaiveProxy:naiveproxy \
@@ -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
index 82b53fb..26e1db6 100644 (file)
@@ -45,11 +45,11 @@ o:depends("enable_switch", "1")
 o.default = 3
 
 o = s:option(Value, "gfwlist_url", translate("gfwlist Update url"))
-o:value("https://cdn.jsdelivr.net/gh/YW5vbnltb3Vz/domain-list-community@release/gfwlist.txt", translate("v2fly/domain-list-community"))
-o:value("https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/gfw.txt", translate("Loyalsoldier/v2ray-rules-dat"))
-o:value("https://cdn.jsdelivr.net/gh/Loukky/gfwlist-by-loukky/gfwlist.txt", translate("Loukky/gfwlist-by-loukky"))
-o:value("https://cdn.jsdelivr.net/gh/gfwlist/gfwlist/gfwlist.txt", translate("gfwlist/gfwlist"))
-o.default = "https://cdn.jsdelivr.net/gh/YW5vbnltb3Vz/domain-list-community@release/gfwlist.txt"
+o:value("https://fastly.jsdelivr.net/gh/YW5vbnltb3Vz/domain-list-community@release/gfwlist.txt", translate("v2fly/domain-list-community"))
+o:value("https://fastly.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/gfw.txt", translate("Loyalsoldier/v2ray-rules-dat"))
+o:value("https://fastly.jsdelivr.net/gh/Loukky/gfwlist-by-loukky/gfwlist.txt", translate("Loukky/gfwlist-by-loukky"))
+o:value("https://fastly.jsdelivr.net/gh/gfwlist/gfwlist/gfwlist.txt", translate("gfwlist/gfwlist"))
+o.default = "https://fastly.jsdelivr.net/gh/YW5vbnltb3Vz/domain-list-community@release/gfwlist.txt"
 
 o = s:option(Value, "chnroute_url", translate("Chnroute Update url"))
 o:value("https://ispip.clang.cn/all_cn.txt", translate("Clang.CN"))
@@ -60,9 +60,9 @@ o = s:option(Flag, "netflix_enable", translate("Enable Netflix Mode"))
 o.rmempty = false
 
 o = s:option(Value, "nfip_url", translate("nfip_url"))
-o:value("https://cdn.jsdelivr.net/gh/QiuSimons/Netflix_IP/NF_only.txt", translate("Netflix IP Only"))
-o:value("https://cdn.jsdelivr.net/gh/QiuSimons/Netflix_IP/getflix.txt", translate("Netflix and AWS"))
-o.default = "https://cdn.jsdelivr.net/gh/QiuSimons/Netflix_IP/NF_only.txt"
+o:value("https://fastly.jsdelivr.net/gh/QiuSimons/Netflix_IP/NF_only.txt", translate("Netflix IP Only"))
+o:value("https://fastly.jsdelivr.net/gh/QiuSimons/Netflix_IP/getflix.txt", translate("Netflix and AWS"))
+o.default = "https://fastly.jsdelivr.net/gh/QiuSimons/Netflix_IP/NF_only.txt"
 o.description = translate("Customize Netflix IP Url")
 o:depends("netflix_enable", "1")
 
index 6eef9db..8f86ff6 100644 (file)
@@ -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"
 
index 64f9be4..6610fb2 100644 (file)
@@ -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
 
index b971118..adc6003 100644 (file)
@@ -319,7 +319,7 @@ function import_ssr_url(btn, urlname, sid) {
                        }
                        switch (queryParam.type) {
                        case "ws":
-                               document.getElementsByName('cbid.shadowsocksr.' + sid + '.ws_host')[0].value = queryParam.host;
+                               //document.getElementsByName('cbid.shadowsocksr.' + sid + '.ws_host')[0].value = queryParam.host;
                                document.getElementsByName('cbid.shadowsocksr.' + sid + '.ws_path')[0].value = queryParam.path || "/";
                                break;
                        case "kcp":
index b4f6960..d1b1e64 100644 (file)
@@ -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"
 
index ab72836..e5b3d1d 100755 (executable)
@@ -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
 }
index b84d855..8517c18 100755 (executable)
@@ -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
index 06aa942..4a85173 100755 (executable)
@@ -191,6 +191,7 @@ ac_rule() {
        else
                for name in $Interface; do
                        local IFNAME=$(uci -P /var/state get network.$name.ifname 2>/dev/null)
+                       [ -z "$IFNAME" ] && IFNAME=$(uci -P /var/state get network.$name.device 2>/dev/null)
                        [ -n "$IFNAME" ] && $IPT -I PREROUTING 1 ${IFNAME:+-i $IFNAME} -p tcp $EXT_ARGS $MATCH_SET -m comment --comment "$TAG" -j SS_SPEC_WAN_AC
                done
        fi
@@ -262,6 +263,7 @@ tp_rule() {
        else
                for name in $Interface; do
                        local IFNAME=$(uci -P /var/state get network.$name.ifname 2>/dev/null)
+                       [ -z "$IFNAME" ] && IFNAME=$(uci -P /var/state get network.$name.device 2>/dev/null)
                        [ -n "$IFNAME" ] && $ipt -I PREROUTING 1 ${IFNAME:+-i $IFNAME} -p udp $EXT_ARGS $MATCH_SET -m comment --comment "$TAG" -j SS_SPEC_TPROXY
                done
        fi