瀏覽代碼

luci-app-ssr-plus: remove pdnsd support

Signed-off-by: Tianling Shen <[email protected]>
Tianling Shen 3 年之前
父節點
當前提交
0b43bb1411

+ 0 - 1
README.md

@@ -77,7 +77,6 @@ If you want to use this repo with official OpenWrt source tree, the following pa
 - [dns2socks](https://github.com/immortalwrt/packages/tree/master/net/dns2socks)
 - [microsocks](https://github.com/immortalwrt/packages/tree/master/net/microsocks)
 - [ipt2socks](https://github.com/immortalwrt/packages/tree/master/net/ipt2socks)
-- [pdnsd-alt](https://github.com/immortalwrt/packages/tree/master/net/pdnsd-alt)
 - [redsocks2](https://github.com/immortalwrt/packages/tree/master/net/redsocks2)
 
 You may use `svn` to check them out, e.g.:

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

@@ -8,7 +8,6 @@ PKG_CONFIG_DEPENDS:= \
 	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_SagerNet_Core \
 	CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Libev_Client \
@@ -31,7 +30,6 @@ LUCI_DEPENDS:= \
 	+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_SagerNet_Core:curl \
 	+PACKAGE_$(PKG_NAME)_INCLUDE_SagerNet_Core:sagernet-core \
@@ -54,17 +52,13 @@ config PACKAGE_$(PKG_NAME)_INCLUDE_Kcptun
 	bool "Include Kcptun"
 	default n
 
-config PACKAGE_$(PKG_NAME)_INCLUDE_NaiveProxy
-	bool "Include NaiveProxy"
-	depends on !(arc||armeb||mips||mips64||powerpc||TARGET_gemini)
-	default n
-
 config PACKAGE_$(PKG_NAME)_INCLUDE_IPT2Socks
 	bool "Include ipt2socks"
 	default n
 
-config PACKAGE_$(PKG_NAME)_INCLUDE_PDNSD
-	bool "Include PDNSD"
+config PACKAGE_$(PKG_NAME)_INCLUDE_NaiveProxy
+	bool "Include NaiveProxy"
+	depends on !(arc||armeb||mips||mips64||powerpc||TARGET_gemini)
 	default n
 
 config PACKAGE_$(PKG_NAME)_INCLUDE_Redsocks2

+ 0 - 8
luci-app-ssr-plus/luasrc/controller/shadowsocksr.lua

@@ -26,7 +26,6 @@ function index()
 	entry({"admin", "services", "shadowsocksr", "reset"}, call("act_reset"))
 	entry({"admin", "services", "shadowsocksr", "restart"}, call("act_restart"))
 	entry({"admin", "services", "shadowsocksr", "delete"}, call("act_delete"))
-	entry({"admin", "services", "shadowsocksr", "cache"}, call("act_cache"))
 end
 
 function subscribe()
@@ -134,10 +133,3 @@ function act_delete()
 	luci.sys.call("/etc/init.d/shadowsocksr restart &")
 	luci.http.redirect(luci.dispatcher.build_url("admin", "services", "shadowsocksr", "servers"))
 end
-
-function act_cache()
-	local e = {}
-	e.ret = luci.sys.call("pdnsd-ctl -c /var/etc/ssrplus/pdnsd empty-cache >/dev/null")
-	luci.http.prepare_content("application/json")
-	luci.http.write_json(e)
-end

+ 0 - 4
luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/client.lua

@@ -87,9 +87,6 @@ o.default = 1
 o = s:option(ListValue, "pdnsd_enable", translate("Resolve Dns Mode"))
 o:value("1", translate("Use DNS2TCP query"))
 o:value("2", translate("Use DNS2SOCKS query and cache"))
-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
 
@@ -109,7 +106,6 @@ 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"
 

+ 1 - 6
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/bin/dns2tcp") 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/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
 
@@ -183,11 +183,6 @@ if uci:get_first("shadowsocksr", 'global', 'adblock', '0') == '1' then
 	s.value = ad_count .. " " .. translate("Records")
 end
 
-if uci:get_first("shadowsocksr", 'global', 'pdnsd_enable', '0') == '1' then
-	s = m:field(DummyValue, "cache", translate("Reset pdnsd cache"))
-	s.template = "shadowsocksr/cache"
-end
-
 s = m:field(DummyValue, "check_port", translate("Check Server Port"))
 s.template = "shadowsocksr/checkport"
 s.value = translate("No Check")

+ 0 - 29
luci-app-ssr-plus/luasrc/view/shadowsocksr/cache.htm

@@ -1,29 +0,0 @@
-<%+cbi/valueheader%>
-<script type="text/javascript">//<![CDATA[
-	function cache(btn,urlname)
-	{
-		btn.disabled = true;
-		btn.value    = '<%:Perform reset%>';
-		murl=urlname;
-		XHR.get('<%=luci.dispatcher.build_url("admin", "services", "shadowsocksr","cache")%>',
-			{ set:murl },
-			function(x,rv)
-			{
-			var s = document.getElementById(urlname+'-status');
-			if (s)
-			{
-				if (rv.ret=="0")
-				s.innerHTML ="<font color='green'>"+"<%:Reset complete%>"+"</font>";
-				else
-				s.innerHTML ="<font color='red'>"+"<%:Reset Error%>"+"</font>";
-			}
-				btn.disabled = false;
-				btn.value    = '<%:Perform reset%>';
-			}
-		);
-		return false;
-	}
-//]]></script>
-<input type="button" class="btn cbi-button cbi-button-reset" value="<%:Perform reset%>" onclick="return cache(this,'<%=self.option%>')" />
-<span id="<%=self.option%>-status"><em><%=self.value%></em></span>
-<%+cbi/valuefooter%>

+ 0 - 9
luci-app-ssr-plus/po/zh-cn/ssr-plus.po

@@ -370,9 +370,6 @@ msgstr "DNS解析方式"
 msgid "Use SSR DNS Tunnel"
 msgstr "使用SSR-DNS隧道"
 
-msgid "Use Pdnsd"
-msgstr "使用Pdnsd"
-
 msgid "DNS Anti-pollution"
 msgstr "DNS 防污染服务"
 
@@ -433,9 +430,6 @@ 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 查询并缓存"
 
@@ -763,9 +757,6 @@ msgstr "重置完成"
 msgid "Reset Error"
 msgstr "重置错误"
 
-msgid "Reset pdnsd cache"
-msgstr "重置PDNSD缓存"
-
 msgid "Finger Print"
 msgstr "指纹伪造"
 

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

@@ -167,44 +167,7 @@ start_dns() {
 	local dnsstr="$(uci_get_by_type global tunnel_forward 8.8.4.4:53)"
 	local dnsserver=$(echo "$dnsstr" | awk -F ':' '{print $1}')
 	local dnsport=$(echo "$dnsstr" | awk -F ':' '{print $2}')
-	start_pdnsd() {
-		local usr_dns="$1"
-		local usr_port="$2"
-		if [ ! -f "$TMP_PATH/pdnsd/pdnsd.cache" ]; then
-			mkdir -p $TMP_PATH/pdnsd
-			touch $TMP_PATH/pdnsd/pdnsd.cache
-			chown -R nobody:nogroup $TMP_PATH/pdnsd
-		fi
-		cat <<-EOF >$TMP_PATH/pdnsd.conf
-			global{
-			perm_cache=1024;
-			cache_dir="$TMP_PATH/pdnsd";
-			pid_file="/var/run/pdnsd.pid";
-			run_as="nobody";
-			server_ip=127.0.0.1;
-			server_port=$dns_port;
-			status_ctl=on;
-			query_method=tcp_only;
-			min_ttl=1h;
-			max_ttl=1w;
-			timeout=10;
-			neg_domain_pol=on;
-			proc_limit=2;
-			procq_limit=8;
-			par_queries=1;
-			}
-			server{
-			label="ssr-usrdns";
-			ip=$usr_dns;
-			port=$usr_port;
-			timeout=6;
-			uptest=none;
-			interval=10m;
-			purge_cache=off;
-			}
-		EOF
-		ln_start_bin $(first_type pdnsd) pdnsd -c $TMP_PATH/pdnsd.conf
-	}
+
 	if [ "$ssrplus_dns" != "0" ]; then
 		case "$(uci_get_by_type global run_mode)" in
 		gfw) ipset add gfwlist $dnsserver 2>/dev/null ;;
@@ -221,10 +184,6 @@ 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)
-			start_pdnsd $dnsserver $dnsport
-			pdnsd_enable_flag=3
-			;;
 		esac
 	fi
 }

+ 1 - 0
luci-app-ssr-plus/root/etc/uci-defaults/luci-ssr-plus

@@ -28,6 +28,7 @@ touch /etc/ssrplus/ad.conf
 touch /etc/config/shadowsocksr
 [ -s "/etc/config/shadowsocksr" ] || /etc/init.d/shadowsocksr reset
 
+sed -i "s/option pdnsd_enable '3'/option pdnsd_enable '1'/g" /etc/config/shadowsocksr
 sed -i "s/option type 'vmess'/option type 'v2ray'\n\toption v2ray_protocol 'vmess'/g" /etc/config/shadowsocksr
 sed -i "s/option type 'vless'/option type 'v2ray'\n\toption v2ray_protocol 'vless'/g" /etc/config/shadowsocksr
 sed -i "s/option encrypt_method_v2ray_ss/option encrypt_method_ss/g" /etc/config/shadowsocksr

+ 0 - 13
luci-app-ssr-plus/root/usr/bin/ssr-monitor

@@ -108,18 +108,5 @@ 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
-	#pdnsd
-	elif [ "$pdnsd_process" -eq 3 ]; then
-		icount=$(busybox ps -w | grep $TMP_BIN_PATH/pdnsd | 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
-		fi
 	fi
 done