update 2022-12-01 19:11:12
This commit is contained in:
parent
8cd574ea57
commit
cb26f14f16
|
@ -0,0 +1,44 @@
|
||||||
|
# SPDX-License-Identifier: GPL-3.0-only
|
||||||
|
#
|
||||||
|
# Copyright (C) 2020 jerryk <jerrykuku@qq.com>
|
||||||
|
# Copyright (C) 2021 ImmortalWrt.org
|
||||||
|
|
||||||
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
|
PKG_NAME:=lua-maxminddb
|
||||||
|
PKG_VERSION:=0.2
|
||||||
|
PKG_RELEASE:=$(AUTORELEASE)
|
||||||
|
|
||||||
|
PKG_SOURCE_PROTO:=git
|
||||||
|
PKG_SOURCE_URL:=https://github.com/fabled/lua-maxminddb.git
|
||||||
|
PKG_SOURCE_DATE:=2019-03-14
|
||||||
|
PKG_SOURCE_VERSION:=93da9f4e6c814c3a23044dd2cdd22d4a6b4f665b
|
||||||
|
PKG_MIRROR_HASH:=b99ef18516b705b3e73b15a9d5ddc99add359299b52639fe3c81dd761591d9d9
|
||||||
|
|
||||||
|
PKG_LICENSE:=MIT
|
||||||
|
PKG_LICENSE_FILE:=LICENSE
|
||||||
|
PKG_MAINTAINER:=fabled
|
||||||
|
|
||||||
|
PKG_BUILD_PARALLEL:=1
|
||||||
|
|
||||||
|
include $(INCLUDE_DIR)/package.mk
|
||||||
|
|
||||||
|
define Package/lua-maxminddb
|
||||||
|
SUBMENU:=Lua
|
||||||
|
SECTION:=lang
|
||||||
|
CATEGORY:=Languages
|
||||||
|
TITLE:=libmaxminddb bindings for lua
|
||||||
|
URL:=https://github.com/jerrykuku/lua-maxminddb
|
||||||
|
DEPENDS:=+lua +libmaxminddb
|
||||||
|
endef
|
||||||
|
|
||||||
|
TARGET_CFLAGS += $(FPIC)
|
||||||
|
|
||||||
|
MAKE_VARS += LUA_PKG=lua
|
||||||
|
|
||||||
|
define Package/lua-maxminddb/install
|
||||||
|
$(INSTALL_DIR) $(1)/usr/lib/lua
|
||||||
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/maxminddb.so $(1)/usr/lib/lua/
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call BuildPackage,lua-maxminddb))
|
|
@ -0,0 +1,3 @@
|
||||||
|
# MaxMind DB Reader for Lua
|
||||||
|
|
||||||
|
Embed in openwrt
|
|
@ -1,7 +1,7 @@
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"PO-Revision-Date: 2021-03-04 13:50+0000\n"
|
"PO-Revision-Date: 2022-11-30 14:48+0000\n"
|
||||||
"Last-Translator: Said Zakaria <said.zakaria@gmail.com>\n"
|
"Last-Translator: R-K <raouf9005@gmail.com>\n"
|
||||||
"Language-Team: Arabic <https://hosted.weblate.org/projects/openwrt/"
|
"Language-Team: Arabic <https://hosted.weblate.org/projects/openwrt/"
|
||||||
"luciapplicationsnft-qos/ar/>\n"
|
"luciapplicationsnft-qos/ar/>\n"
|
||||||
"Language: ar\n"
|
"Language: ar\n"
|
||||||
|
@ -9,12 +9,12 @@ msgstr ""
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 "
|
"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 "
|
||||||
"&& n%100<=10 ? 3 : n%100>=11 ? 4 : 5;\n"
|
"&& n%100<=10 ? 3 : n%100>=11 ? 4 : 5;\n"
|
||||||
"X-Generator: Weblate 4.5.1-dev\n"
|
"X-Generator: Weblate 4.15-dev\n"
|
||||||
|
|
||||||
#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:136
|
#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:136
|
||||||
#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:155
|
#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:155
|
||||||
msgid "Bytes Total"
|
msgid "Bytes Total"
|
||||||
msgstr ""
|
msgstr "مجموع البايت"
|
||||||
|
|
||||||
#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:141
|
#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:141
|
||||||
#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:160
|
#: applications/luci-app-nft-qos/luasrc/view/nft-qos/rate.htm:160
|
||||||
|
|
|
@ -9,9 +9,10 @@ PKG_CONFIG_DEPENDS:= \
|
||||||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_V2ray \
|
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_V2ray \
|
||||||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Xray \
|
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Xray \
|
||||||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_SagerNet_Core \
|
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_SagerNet_Core \
|
||||||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Kcptun \
|
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_ChinaDNS_NG \
|
||||||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Hysteria \
|
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Hysteria \
|
||||||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_IPT2Socks \
|
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_IPT2Socks \
|
||||||
|
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Kcptun \
|
||||||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_NaiveProxy \
|
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_NaiveProxy \
|
||||||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Redsocks2 \
|
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Redsocks2 \
|
||||||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_NONE_Client \
|
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_NONE_Client \
|
||||||
|
@ -39,9 +40,10 @@ LUCI_DEPENDS:= \
|
||||||
+PACKAGE_$(PKG_NAME)_INCLUDE_Xray:xray-core \
|
+PACKAGE_$(PKG_NAME)_INCLUDE_Xray:xray-core \
|
||||||
+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 \
|
||||||
+PACKAGE_$(PKG_NAME)_INCLUDE_Kcptun:kcptun-client \
|
+PACKAGE_$(PKG_NAME)_INCLUDE_ChinaDNS_NG:chinadns-ng \
|
||||||
+PACKAGE_$(PKG_NAME)_INCLUDE_Hysteria:hysteria \
|
+PACKAGE_$(PKG_NAME)_INCLUDE_Hysteria:hysteria \
|
||||||
+PACKAGE_$(PKG_NAME)_INCLUDE_IPT2Socks:ipt2socks \
|
+PACKAGE_$(PKG_NAME)_INCLUDE_IPT2Socks:ipt2socks \
|
||||||
|
+PACKAGE_$(PKG_NAME)_INCLUDE_Kcptun:kcptun-client \
|
||||||
+PACKAGE_$(PKG_NAME)_INCLUDE_NaiveProxy:naiveproxy \
|
+PACKAGE_$(PKG_NAME)_INCLUDE_NaiveProxy:naiveproxy \
|
||||||
+PACKAGE_$(PKG_NAME)_INCLUDE_Redsocks2:redsocks2 \
|
+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-local \
|
||||||
|
@ -112,9 +114,9 @@ choice
|
||||||
bool "SagerNet-core (An enhanced edition of v2ray-core)"
|
bool "SagerNet-core (An enhanced edition of v2ray-core)"
|
||||||
endchoice
|
endchoice
|
||||||
|
|
||||||
config PACKAGE_$(PKG_NAME)_INCLUDE_Kcptun
|
config PACKAGE_$(PKG_NAME)_INCLUDE_ChinaDNS_NG
|
||||||
bool "Include Kcptun"
|
bool "Include ChinaDNS-NG"
|
||||||
default n
|
default y
|
||||||
|
|
||||||
config PACKAGE_$(PKG_NAME)_INCLUDE_Hysteria
|
config PACKAGE_$(PKG_NAME)_INCLUDE_Hysteria
|
||||||
bool "Include Hysteria"
|
bool "Include Hysteria"
|
||||||
|
@ -124,6 +126,10 @@ config PACKAGE_$(PKG_NAME)_INCLUDE_IPT2Socks
|
||||||
bool "Include IPT2Socks"
|
bool "Include IPT2Socks"
|
||||||
default n
|
default n
|
||||||
|
|
||||||
|
config PACKAGE_$(PKG_NAME)_INCLUDE_Kcptun
|
||||||
|
bool "Include Kcptun"
|
||||||
|
default n
|
||||||
|
|
||||||
config PACKAGE_$(PKG_NAME)_INCLUDE_NaiveProxy
|
config PACKAGE_$(PKG_NAME)_INCLUDE_NaiveProxy
|
||||||
bool "Include NaiveProxy"
|
bool "Include NaiveProxy"
|
||||||
depends on !(arc||armeb||mips||mips64||powerpc||TARGET_gemini)
|
depends on !(arc||armeb||mips||mips64||powerpc||TARGET_gemini)
|
||||||
|
|
|
@ -5,6 +5,11 @@
|
||||||
local m, s, sec, o
|
local m, s, sec, o
|
||||||
local uci = luci.model.uci.cursor()
|
local uci = luci.model.uci.cursor()
|
||||||
|
|
||||||
|
local validation = require "luci.cbi.datatypes"
|
||||||
|
local function is_finded(e)
|
||||||
|
return luci.sys.exec('type -t -p "%s"' % e) ~= "" and true or false
|
||||||
|
end
|
||||||
|
|
||||||
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"
|
m:section(SimpleSection).template = "shadowsocksr/status"
|
||||||
|
|
||||||
|
@ -107,7 +112,34 @@ 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.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 = "ip4addrport"
|
||||||
|
|
||||||
|
if is_finded("chinadns-ng") then
|
||||||
|
o = s:option(Value, "chinadns_forward", translate("Domestic DNS Server"))
|
||||||
|
o:value("wan", translate("Use DNS from WAN"))
|
||||||
|
o:value("wan_114", translate("Use DNS from WAN and 114DNS"))
|
||||||
|
o:value("114.114.114.114:53", translate("Nanjing Xinfeng 114DNS (114.114.114.114)"))
|
||||||
|
o:value("119.29.29.29:53", translate("DNSPod Public DNS (119.29.29.29)"))
|
||||||
|
o:value("1.2.4.8:53", translate("CNNIC SDNS (1.2.4.8)"))
|
||||||
|
o:depends({pdnsd_enable = "1", run_mode = "router"})
|
||||||
|
o:depends({pdnsd_enable = "2", run_mode = "router"})
|
||||||
|
o.description = translate("Custom DNS Server format as IP:PORT (default: disabled)")
|
||||||
|
o.validate = function(self, value, section)
|
||||||
|
if (section and value) then
|
||||||
|
if value == "wan" or value == "wan_114" then
|
||||||
|
return value
|
||||||
|
end
|
||||||
|
|
||||||
|
if validation.ip4addrport(value) then
|
||||||
|
return value
|
||||||
|
end
|
||||||
|
|
||||||
|
return nil, translate("Expecting: %s"):format(translate("valid address:port"))
|
||||||
|
end
|
||||||
|
|
||||||
|
return value
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
return m
|
return m
|
||||||
|
|
||||||
|
|
|
@ -457,6 +457,18 @@ msgstr "使用 DNS2SOCKS 查询并缓存"
|
||||||
msgid "DNS Server IP:Port"
|
msgid "DNS Server IP:Port"
|
||||||
msgstr "DNS 服务器 IP:Port"
|
msgstr "DNS 服务器 IP:Port"
|
||||||
|
|
||||||
|
msgid "Domestic DNS Server"
|
||||||
|
msgstr "国内DNS服务器"
|
||||||
|
|
||||||
|
msgid "Use DNS from WAN"
|
||||||
|
msgstr "使用WAN下发的DNS"
|
||||||
|
|
||||||
|
msgid "Use DNS from WAN and 114DNS"
|
||||||
|
msgstr "使用WAN下发的DNS和114DNS"
|
||||||
|
|
||||||
|
msgid "Custom DNS Server format as IP:PORT (default: disabled)"
|
||||||
|
msgstr "格式为 IP:PORT (默认: 禁用)"
|
||||||
|
|
||||||
msgid "Update time (every day)"
|
msgid "Update time (every day)"
|
||||||
msgstr "更新时间(每天)"
|
msgstr "更新时间(每天)"
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@ shunt_dns_config_file=
|
||||||
tmp_local_port=
|
tmp_local_port=
|
||||||
ARG_UDP=
|
ARG_UDP=
|
||||||
dns_port="5335" #dns port
|
dns_port="5335" #dns port
|
||||||
|
china_dns_port="5333" #china_dns_port
|
||||||
tmp_dns_port="300" #dns2socks temporary port
|
tmp_dns_port="300" #dns2socks temporary port
|
||||||
tmp_udp_port="301" #udp temporary port
|
tmp_udp_port="301" #udp temporary port
|
||||||
tmp_udp_local_port="302" #udp socks temporary port
|
tmp_udp_local_port="302" #udp socks temporary port
|
||||||
|
@ -80,7 +81,15 @@ get_host_ip() {
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
[ -z "$ip" ] || uci_set_by_name $1 ip $ip
|
[ -z "$ip" ] || uci_set_by_name $1 ip $ip
|
||||||
echo ${ip:="$(uci_get_by_name $1 ip "ERROR")"}
|
[ -n "$ip" ] || ip="$(uci_get_by_name $1 ip "ERROR")"
|
||||||
|
|
||||||
|
local chinadns="$(uci_get_by_type global chinadns_forward)"
|
||||||
|
if [ -n "$chinadns" ] && [ "$ip" != "$host" ]; then
|
||||||
|
grep -q "$host" "$TMP_DNSMASQ_PATH/chinadns_fixed_server.conf" 2>"/dev/null" || \
|
||||||
|
echo -e "address=/$host/$ip" >> "$TMP_DNSMASQ_PATH/chinadns_fixed_server.conf"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo $ip
|
||||||
}
|
}
|
||||||
|
|
||||||
clean_log() {
|
clean_log() {
|
||||||
|
@ -165,27 +174,46 @@ ln_start_bin() {
|
||||||
|
|
||||||
start_dns() {
|
start_dns() {
|
||||||
local ssrplus_dns="$(uci_get_by_type global pdnsd_enable 0)"
|
local ssrplus_dns="$(uci_get_by_type global pdnsd_enable 0)"
|
||||||
local dnsstr="$(uci_get_by_type global tunnel_forward 8.8.4.4:53)"
|
local dnsserver="$(uci_get_by_type global tunnel_forward 8.8.4.4:53)"
|
||||||
local dnsserver=$(echo "$dnsstr" | awk -F ':' '{print $1}')
|
local run_mode="$(uci_get_by_type global run_mode)"
|
||||||
local dnsport=$(echo "$dnsstr" | awk -F ':' '{print $2}')
|
|
||||||
|
|
||||||
if [ "$ssrplus_dns" != "0" ]; then
|
if [ "$ssrplus_dns" != "0" ]; then
|
||||||
case "$(uci_get_by_type global run_mode)" in
|
case "$run_mode" in
|
||||||
gfw) ipset add gfwlist $dnsserver 2>/dev/null ;;
|
gfw) ipset add gfwlist ${dnsserver%:*} 2>/dev/null ;;
|
||||||
oversea) ipset add oversea $dnsserver 2>/dev/null ;;
|
oversea) ipset add oversea ${dnsserver%:*} 2>/dev/null ;;
|
||||||
*) ipset add ss_spec_wan_ac $dnsserver nomatch 2>/dev/null ;;
|
*) ipset add ss_spec_wan_ac ${dnsserver%:*} nomatch 2>/dev/null ;;
|
||||||
esac
|
esac
|
||||||
case "$ssrplus_dns" in
|
case "$ssrplus_dns" in
|
||||||
1)
|
1)
|
||||||
ln_start_bin $(first_type dns2tcp) dns2tcp -L "127.0.0.1#$dns_port" -R "$dnsserver#$dnsport"
|
ln_start_bin $(first_type dns2tcp) dns2tcp -L 127.0.0.1#$dns_port -R ${dnsserver/:/#}
|
||||||
pdnsd_enable_flag=1
|
pdnsd_enable_flag=1
|
||||||
;;
|
;;
|
||||||
2)
|
2)
|
||||||
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 127.0.0.1:$dns_port -q
|
||||||
pdnsd_enable_flag=2
|
pdnsd_enable_flag=2
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
if [ "$run_mode" = "router" ]; then
|
||||||
|
local chinadns="$(uci_get_by_type global chinadns_forward)"
|
||||||
|
if [ -n "$chinadns" ]; then
|
||||||
|
local wandns="$(ifstatus wan | jsonfilter -e '@["dns-server"][0]' || echo "119.29.29.29")"
|
||||||
|
case "$chinadns" in
|
||||||
|
"wan") chinadns="$wandns" ;;
|
||||||
|
"wan_114") chinadns="$wandns,114.114.114.114" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
ln_start_bin $(first_type chinadns-ng) chinadns-ng -l $china_dns_port -4 china -p 3 -c ${chinadns/:/#} -t 127.0.0.1#$dns_port -N -f -r
|
||||||
|
|
||||||
|
uci -q rename "dhcp.@dnsmasq[0].noresolv"="_orig_noresolv"
|
||||||
|
uci -q rename "dhcp.@dnsmasq[0].server"="_orig_server"
|
||||||
|
uci -q set "dhcp.@dnsmasq[0].noresolv"="1"
|
||||||
|
uci -q add_list "dhcp.@dnsmasq[0].server"="127.0.0.1#$china_dns_port"
|
||||||
|
uci -q set "dhcp.@dnsmasq[0]._unused_ssrp_changed"=1
|
||||||
|
uci -q commit "dhcp"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -877,6 +905,14 @@ stop() {
|
||||||
)
|
)
|
||||||
killall -q -9 v2ray-plugin obfs-local xray-plugin
|
killall -q -9 v2ray-plugin obfs-local xray-plugin
|
||||||
rm -f /var/lock/ssr-monitor.lock
|
rm -f /var/lock/ssr-monitor.lock
|
||||||
|
if [ "$(uci -q get "dhcp.@dnsmasq[0]._unused_ssrp_changed")" = "1" ]; then
|
||||||
|
uci -q del "dhcp.@dnsmasq[0].noresolv"
|
||||||
|
uci -q del_list "dhcp.@dnsmasq[0].server"="127.0.0.1#$china_dns_port"
|
||||||
|
uci -q rename "dhcp.@dnsmasq[0]._orig_noresolv"="noresolv"
|
||||||
|
uci -q rename "dhcp.@dnsmasq[0]._orig_server"="server"
|
||||||
|
uci -q del "dhcp.@dnsmasq[0]._unused_ssrp_changed"
|
||||||
|
uci -q commit "dhcp"
|
||||||
|
fi
|
||||||
if [ -f "/tmp/dnsmasq.d/dnsmasq-ssrplus.conf" ]; then
|
if [ -f "/tmp/dnsmasq.d/dnsmasq-ssrplus.conf" ]; then
|
||||||
rm -rf /tmp/dnsmasq.d/dnsmasq-ssrplus.conf $TMP_DNSMASQ_PATH $TMP_PATH/*-ssr-*.json $TMP_PATH/ssr-server*.json
|
rm -rf /tmp/dnsmasq.d/dnsmasq-ssrplus.conf $TMP_DNSMASQ_PATH $TMP_PATH/*-ssr-*.json $TMP_PATH/ssr-server*.json
|
||||||
/etc/init.d/dnsmasq restart >/dev/null 2>&1
|
/etc/init.d/dnsmasq restart >/dev/null 2>&1
|
||||||
|
|
|
@ -88,25 +88,37 @@ while [ "1" == "1" ]; do #死循环
|
||||||
if [ "$icount" -lt 1 ]; then #如果进程挂掉就重启它
|
if [ "$icount" -lt 1 ]; then #如果进程挂掉就重启它
|
||||||
logger -t "$NAME" "dns2tcp tunnel error.restart!"
|
logger -t "$NAME" "dns2tcp tunnel error.restart!"
|
||||||
echolog "dns2tcp tunnel error.restart!"
|
echolog "dns2tcp tunnel error.restart!"
|
||||||
dnsstr=$(uci_get_by_type global tunnel_forward 8.8.4.4:53)
|
dnsserver=$(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
|
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"
|
ln_start_bin $(first_type dns2tcp) dns2tcp -L "127.0.0.1#$dns_port" -R "${dnsserver/:/#}"
|
||||||
fi
|
fi
|
||||||
#dns2socks
|
#dns2socks
|
||||||
elif [ "$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)
|
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 #如果进程挂掉就重启它
|
if [ "$icount" -lt 2 ]; then #如果进程挂掉就重启它
|
||||||
logger -t "$NAME" "dns2socks $dnsstr tunnel error.restart!"
|
logger -t "$NAME" "dns2socks $dnsserver tunnel error.restart!"
|
||||||
echolog "dns2socks $dnsstr tunnel error.restart!"
|
echolog "dns2socks $dnsserver tunnel error.restart!"
|
||||||
dnsstr=$(uci_get_by_type global tunnel_forward 8.8.4.4:53)
|
dnsserver=$(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 ssrplus-dns | grep -v grep | awk '{print $1}') >/dev/null 2>&1
|
kill -9 $(busybox ps -w | grep ssrplus-dns | grep -v grep | awk '{print $1}') >/dev/null 2>&1
|
||||||
kill -9 $(busybox ps -w | grep "dns2socks 127.0.0.1 $tmp_dns_port" | grep -v grep | awk '{print $1}') >/dev/null 2>&1
|
kill -9 $(busybox ps -w | grep "dns2socks 127.0.0.1 $tmp_dns_port" | grep -v grep | awk '{print $1}') >/dev/null 2>&1
|
||||||
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 127.0.0.1:$dns_port -q
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
#chinadns-ng
|
||||||
|
if [ "$(uci -q get "dhcp.@dnsmasq[0]._unused_ssrp_changed")" = "1" ]; then
|
||||||
|
icount=$(busybox ps -w | grep $TMP_BIN_PATH/chinadns-ng | grep -v grep | wc -l)
|
||||||
|
if [ "$icount" -lt 1 ]; then #如果进程挂掉就重启它
|
||||||
|
logger -t "$NAME" "chinadns-ng tunnel error.restart!"
|
||||||
|
echolog "chinadns-ng tunnel error.restart!"
|
||||||
|
chinadns=$(uci_get_by_type global chinadns_forward)
|
||||||
|
wandns="$(ifstatus wan | jsonfilter -e '@["dns-server"][0]' || echo "119.29.29.29")"
|
||||||
|
case "$chinadns" in
|
||||||
|
"wan") chinadns="$wandns" ;;
|
||||||
|
""|"wan_114") chinadns="$wandns,114.114.114.114" ;;
|
||||||
|
esac
|
||||||
|
kill -9 $(busybox ps -w | grep $TMP_BIN_PATH/chinadns-ng | grep -v grep | awk '{print $1}') >/dev/null 2>&1
|
||||||
|
ln_start_bin $(first_type chinadns-ng) chinadns-ng -l $china_dns_port -4 china -p 3 -c ${chinadns/:/#} -t 127.0.0.1#$dns_port -N -f -r
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in New Issue