luci-app-ssr-plus: remove pdnsd support

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
Tianling Shen 2022-06-07 17:37:13 +08:00 committed by sbwml
parent eda4912535
commit 1dc9dfdf9f
9 changed files with 6 additions and 120 deletions

View File

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

View File

@ -26,7 +26,6 @@ function index()
entry({"admin", "services", "shadowsocksr", "reset"}, call("act_reset")) entry({"admin", "services", "shadowsocksr", "reset"}, call("act_reset"))
entry({"admin", "services", "shadowsocksr", "restart"}, call("act_restart")) entry({"admin", "services", "shadowsocksr", "restart"}, call("act_restart"))
entry({"admin", "services", "shadowsocksr", "delete"}, call("act_delete")) entry({"admin", "services", "shadowsocksr", "delete"}, call("act_delete"))
entry({"admin", "services", "shadowsocksr", "cache"}, call("act_cache"))
end end
function subscribe() function subscribe()
@ -134,10 +133,3 @@ function act_delete()
luci.sys.call("/etc/init.d/shadowsocksr restart &") luci.sys.call("/etc/init.d/shadowsocksr restart &")
luci.http.redirect(luci.dispatcher.build_url("admin", "services", "shadowsocksr", "servers")) luci.http.redirect(luci.dispatcher.build_url("admin", "services", "shadowsocksr", "servers"))
end 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

View File

@ -86,9 +86,6 @@ o.default = 1
o = s:option(ListValue, "pdnsd_enable", translate("Resolve Dns Mode")) o = s:option(ListValue, "pdnsd_enable", translate("Resolve Dns Mode"))
o:value("1", translate("Use DNS2TCP query")) o:value("1", translate("Use DNS2TCP query"))
o:value("2", translate("Use DNS2SOCKS query and cache")) 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:value("0", translate("Use Local DNS Service listen port 5335"))
o.default = 1 o.default = 1
@ -108,7 +105,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:value("114.114.115.115:53", translate("Oversea Mode DNS-2 (114.114.115.115)"))
o:depends("pdnsd_enable", "1") o:depends("pdnsd_enable", "1")
o:depends("pdnsd_enable", "2") 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.description = translate("Custom DNS Server format as IP:PORT (default: 8.8.4.4:53)")
o.datatype = "hostport" o.datatype = "hostport"

View File

@ -88,7 +88,7 @@ if Process_list:find("ssr.server") then
server_run = 1 server_run = 1
end 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 pdnsd_run = 1
end end
@ -183,11 +183,6 @@ if uci:get_first("shadowsocksr", 'global', 'adblock', '0') == '1' then
s.value = ad_count .. " " .. translate("Records") s.value = ad_count .. " " .. translate("Records")
end 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 = m:field(DummyValue, "check_port", translate("Check Server Port"))
s.template = "shadowsocksr/checkport" s.template = "shadowsocksr/checkport"
s.value = translate("No Check") s.value = translate("No Check")

View File

@ -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%>

View File

@ -370,9 +370,6 @@ msgstr "DNS解析方式"
msgid "Use SSR DNS Tunnel" msgid "Use SSR DNS Tunnel"
msgstr "使用SSR-DNS隧道" msgstr "使用SSR-DNS隧道"
msgid "Use Pdnsd"
msgstr "使用Pdnsd"
msgid "DNS Anti-pollution" msgid "DNS Anti-pollution"
msgstr "DNS 防污染服务" msgstr "DNS 防污染服务"
@ -433,9 +430,6 @@ msgstr "格式为 IP:PORT (默认: 8.8.4.4:53)"
msgid "Use DNS2TCP query" msgid "Use DNS2TCP query"
msgstr "使用 DNS2TCP 查询" msgstr "使用 DNS2TCP 查询"
msgid "Use Pdnsd tcp query and cache"
msgstr "使用PDNSD TCP查询并缓存"
msgid "Use DNS2SOCKS query and cache" msgid "Use DNS2SOCKS query and cache"
msgstr "使用 DNS2SOCKS 查询并缓存" msgstr "使用 DNS2SOCKS 查询并缓存"
@ -763,9 +757,6 @@ msgstr "重置完成"
msgid "Reset Error" msgid "Reset Error"
msgstr "重置错误" msgstr "重置错误"
msgid "Reset pdnsd cache"
msgstr "重置PDNSD缓存"
msgid "Finger Print" msgid "Finger Print"
msgstr "指纹伪造" msgstr "指纹伪造"

View File

@ -167,44 +167,7 @@ start_dns() {
local dnsstr="$(uci_get_by_type global tunnel_forward 8.8.4.4:53)" local dnsstr="$(uci_get_by_type global tunnel_forward 8.8.4.4:53)"
local dnsserver=$(echo "$dnsstr" | awk -F ':' '{print $1}') local dnsserver=$(echo "$dnsstr" | awk -F ':' '{print $1}')
local dnsport=$(echo "$dnsstr" | awk -F ':' '{print $2}') 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 if [ "$ssrplus_dns" != "0" ]; then
case "$(uci_get_by_type global run_mode)" in case "$(uci_get_by_type global run_mode)" in
gfw) ipset add gfwlist $dnsserver 2>/dev/null ;; 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 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 pdnsd_enable_flag=2
;; ;;
3)
start_pdnsd $dnsserver $dnsport
pdnsd_enable_flag=3
;;
esac esac
fi fi
} }

View File

@ -28,6 +28,7 @@ touch /etc/ssrplus/ad.conf
touch /etc/config/shadowsocksr touch /etc/config/shadowsocksr
[ -s "/etc/config/shadowsocksr" ] || /etc/init.d/shadowsocksr reset [ -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 '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 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 sed -i "s/option encrypt_method_v2ray_ss/option encrypt_method_ss/g" /etc/config/shadowsocksr

View File

@ -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 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 ln_start_bin $(first_type dns2socks) dns2socks 127.0.0.1:$tmp_dns_port $dnsserver:$dnsport 127.0.0.1:$dns_port -q
fi 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 fi
done done