Merge Mainline

Signed-off-by: CN_SZTL <cnsztl@project-openwrt.eu.org>
This commit is contained in:
CN_SZTL 2021-02-07 16:59:21 +08:00
commit 8204815728
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
27 changed files with 341 additions and 537 deletions

View File

@ -280,7 +280,7 @@ generate_static_system() {
uci -q batch <<-EOF
delete system.@system[0]
add system system
set system.@system[-1].hostname='OpenWrt'
set system.@system[-1].hostname='ImmortalWrt'
set system.@system[-1].timezone='UTC'
set system.@system[-1].ttylogin='0'
set system.@system[-1].log_size='64'

View File

@ -22,7 +22,7 @@ end
function run()
local running = luci.sys.call("busybox ps -w | grep JD_DailyBonus.js | grep -v grep >/dev/null") == 0
if not running then
luci.sys.call('/usr/share/jd-dailybonus/newapp.sh -r')
luci.sys.call('sh /usr/share/jd-dailybonus/newapp.sh -r')
end
luci.http.write('')
end
@ -31,7 +31,7 @@ end
function check_update()
local jd = 'jd-dailybonus'
local e = {}
local new_version = luci.sys.exec('/usr/share/jd-dailybonus/newapp.sh -n')
local new_version = luci.sys.exec('sh /usr/share/jd-dailybonus/newapp.sh -n')
e.new_version = new_version
e.error = 0
luci.http.prepare_content('application/json')
@ -45,7 +45,7 @@ function update()
local uci = luci.model.uci.cursor()
local version = luci.http.formvalue('version')
--下载脚本
local code = luci.sys.exec('/usr/share/jd-dailybonus/newapp.sh -u')
local code = luci.sys.exec('sh /usr/share/jd-dailybonus/newapp.sh -u')
e.error = code
luci.http.prepare_content('application/json')
luci.http.write_json(e)

View File

@ -70,9 +70,9 @@
<div class="cbi-value-field">
<input type="button" data-rel="1" class="cbi-button cbi-input-reload cookie-button" value="<%= translate('获取第一Cookie') %>" />
<input type="button" data-rel="2" class="cbi-button cbi-input-reload cookie-button" value="<%= translate('获取第二Cookie') %>" />
<br>
<br />
<div class="cbi-value-description">
<span class="cbi-value-helpicon"><img src="/luci-static/resources/cbi/help.gif" alt="帮助"></span>
<span class="cbi-value-helpicon"><img src="/luci-static/resources/cbi/help.gif" alt="帮助" /></span>
<%= translate("点击上面按钮使用京东手机app扫码获取Cookie")%>
</div>
</div>

View File

@ -1,14 +1,12 @@
<%+cbi/valueheader%>
<label class="cbi-value-title"><%= translate("执行") %></label>
<div class="cbi-value-field">
<input class="cbi-button cbi-button-reload" id="update_service" type="button" size="0" onclick="run()"
value="<%= translate("手动执行签到") %>">
<input class="cbi-button cbi-button-reload" id="update_service" type="button" size="0" onclick="run()" value="<%= translate('手动执行签到') %>" />
</div>
<label class="cbi-value-title"><%= translate("更新脚本") %></label>
<div class="cbi-value-field">
<input class="cbi-button cbi-button-reload" id="update_script" type="button" size="0" onclick="check_version()" data-version="<%= self.version %>"
value="<%= translate("手动检查脚本更新当前版本v")..self.version %>">
<input class="cbi-button cbi-button-reload" id="update_script" type="button" size="0" onclick="check_version()" data-version="<%= self.version %>" value="<%= translate('手动检查脚本更新当前版本v')..self.version %>" />
</div>
<script type="text/javascript">

View File

@ -19,7 +19,7 @@ del_cron() {
}
start_service(){
/usr/share/jd-dailybonus/newapp.sh -s
sh /usr/share/jd-dailybonus/newapp.sh -s
}
stop_service() {

View File

@ -51,8 +51,8 @@ cancel() {
add_cron() {
sed -i '/jd-dailybonus/d' $CRON_FILE
[ $(uci_get_by_type global auto_run 0) -eq 1 ] && echo $(uci_get_by_type global auto_run_time_m)' '$(uci_get_by_type global auto_run_time_h)' * * * /usr/share/jd-dailybonus/newapp.sh -w' >>$CRON_FILE
[ $(uci_get_by_type global auto_update 0) -eq 1 ] && echo '1 '$(uci_get_by_type global auto_update_time)' * * * /usr/share/jd-dailybonus/newapp.sh -u' >>$CRON_FILE
[ $(uci_get_by_type global auto_run 0) -eq 1 ] && echo $(uci_get_by_type global auto_run_time_m)' '$(uci_get_by_type global auto_run_time_h)' * * * sh /usr/share/jd-dailybonus/newapp.sh -w' >>$CRON_FILE
[ $(uci_get_by_type global auto_update 0) -eq 1 ] && echo '1 '$(uci_get_by_type global auto_update_time)' * * * sh /usr/share/jd-dailybonus/newapp.sh -u' >>$CRON_FILE
crontab $CRON_FILE
/etc/init.d/cron restart
}

View File

@ -8,11 +8,10 @@ PKG_CONFIG_DEPENDS:= \
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Kcptun \
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR_Server \
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Trojan \
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_V2ray \
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_V2ray_plugin \
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Xray \
LUCI_TITLE:=LuCI support for PassWall
LUCI_TITLE:=A New SS/SSR/Xray/Trojan LuCI interface
LUCI_PKGARCH:=all
LUCI_DEPENDS:= \
+bash +coreutils +coreutils-base64 +dnsmasq-full +ip-full +ipset +iptables-mod-tproxy \
@ -22,7 +21,6 @@ LUCI_DEPENDS:= \
+PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR_Server:shadowsocksr-libev-ssr-server \
+PACKAGE_$(PKG_NAME)_INCLUDE_Trojan:trojan \
+PACKAGE_$(PKG_NAME)_INCLUDE_Trojan:ipt2socks \
+PACKAGE_$(PKG_NAME)_INCLUDE_V2ray:v2ray \
+PACKAGE_$(PKG_NAME)_INCLUDE_V2ray_plugin:v2ray-plugin \
+PACKAGE_$(PKG_NAME)_INCLUDE_Xray:xray-core
@ -40,10 +38,6 @@ config PACKAGE_$(PKG_NAME)_INCLUDE_Trojan
bool "Include Trojan"
default y if i386||x86_64||arm||aarch64
config PACKAGE_$(PKG_NAME)_INCLUDE_V2ray
bool "Include V2ray"
default n
config PACKAGE_$(PKG_NAME)_INCLUDE_V2ray_plugin
bool "Include Shadowsocks V2ray Plugin"
default y if i386||x86_64||arm||aarch64

View File

@ -15,7 +15,7 @@ function index()
entry({'admin', 'services', 'vssr', 'subscribe_config'}, cbi('vssr/subscribe-config', {hideapplybtn = true, hidesavebtn = true, hideresetbtn = true}), _('Subscribe'), 12).leaf = true -- 订阅设置
entry({'admin', 'services', 'vssr', 'control'}, cbi('vssr/control'), _('Access Control'), 13).leaf = true -- 访问控制
entry({'admin', 'services', 'vssr', 'router'}, cbi('vssr/router'), _('Router Config'), 14).leaf = true -- 访问控制
if nixio.fs.access('/usr/bin/v2ray/v2ray') or nixio.fs.access('/usr/bin/v2ray') or nixio.fs.access('/usr/bin/xray') or nixio.fs.access('/usr/bin/xray/xray') then
if nixio.fs.access('/usr/bin/xray') or nixio.fs.access('/usr/bin/xray/xray') then
entry({'admin', 'services', 'vssr', 'socks5'}, cbi('vssr/socks5'), _('Local Proxy'), 15).leaf = true -- Socks5代理
end
entry({'admin', 'services', 'vssr', 'advanced'}, cbi('vssr/advanced'), _('Advanced Settings'), 16).leaf = true -- 高级设置

View File

@ -62,7 +62,7 @@ local route_label = {
}
-- [[ Global Setting ]]--
s = m:section(TypedSection, 'global', translate('Basic Settings [SS|SSR|V2ray|Xray|Trojan]'))
s = m:section(TypedSection, 'global', translate('Basic Settings [SS|SSR|Xray|Trojan]'))
s.anonymous = true
o = s:option(ListValue, 'global_server', translate('Main Server'))
@ -79,11 +79,6 @@ o:value('same', translate('Same as Main Server'))
for _, key in pairs(server_table) do
o:value(key.name, key.gname)
end
if nixio.fs.access('/usr/bin/xray') or nixio.fs.access('/usr/bin/xray/xray') then
o = s:option(Flag, 'use_xray', translate('Use Xray instead of V2ray'))
o.rmempty = false
end
o = s:option(Flag, 'v2ray_flow', translate('Open v2ray route'))
o.rmempty = false

View File

@ -15,8 +15,8 @@ local sys = require 'luci.sys'
m = Map(vssr)
-- [[ SOCKS5 Proxy ]]--
if nixio.fs.access('/usr/bin/v2ray/v2ray') or nixio.fs.access('/usr/bin/v2ray') or nixio.fs.access('/usr/bin/xray') or nixio.fs.access('/usr/bin/xray/xray') then
s = m:section(TypedSection, 'socks5_proxy', translate('V2ray SOCKS5 Proxy'))
if nixio.fs.access('/usr/bin/xray') or nixio.fs.access('/usr/bin/xray/xray') then
s = m:section(TypedSection, 'socks5_proxy', translate('Xray SOCKS5 Proxy'))
s.anonymous = true
o = s:option(Flag, 'enable_server', translate('Enable Servers'))
@ -43,8 +43,8 @@ if nixio.fs.access('/usr/bin/v2ray/v2ray') or nixio.fs.access('/usr/bin/v2ray')
end
-- [[ Http Proxy ]]--
if nixio.fs.access('/usr/bin/v2ray/v2ray') or nixio.fs.access('/usr/bin/v2ray') or nixio.fs.access('/usr/bin/xray') or nixio.fs.access('/usr/bin/xray/xray') then
s = m:section(TypedSection, 'http_proxy', translate('V2ray HTTP Proxy'))
if nixio.fs.access('/usr/bin/xray') or nixio.fs.access('/usr/bin/xray/xray') then
s = m:section(TypedSection, 'http_proxy', translate('Xray HTTP Proxy'))
s.anonymous = true
o = s:option(Flag, 'enable_server', translate('Enable Servers'))

View File

@ -172,11 +172,11 @@ msgstr "编辑服务器配置"
msgid "Alias"
msgstr "别名"
msgid "V2ray SOCKS5 Proxy"
msgstr "V2ray SOCKS5 代理"
msgid "Xray SOCKS5 Proxy"
msgstr "Xray SOCKS5 代理"
msgid "V2ray HTTP Proxy"
msgstr "V2ray HTTP 代理"
msgid "Xray HTTP Proxy"
msgstr "Xray HTTP 代理"
msgid "Server"
msgstr "服务器"
@ -389,8 +389,8 @@ msgstr "通过代理更新"
msgid "GFW List"
msgstr "GFW列表"
msgid "Basic Settings [SS|SSR|V2ray|Xray|Trojan]"
msgstr "基本设置 [SS|SSR|V2ray|Xray|Trojan]"
msgid "Basic Settings [SS|SSR|Xray|Trojan]"
msgstr "基本设置 [SS|SSR|Xray|Trojan]"
msgid "Main Server"
msgstr "主服务器"

0
package/ctcgfw/luci-app-vssr/root/etc/config/vssr Executable file → Normal file
View File

View File

@ -62,7 +62,7 @@ find_bin() {
ssr) ret="ssr-redir" ;;
ssr-local) ret="ssr-local" ;;
ssr-server) ret="ssr-server" ;;
v2ray | vless) [[ $is_xray = "1" ]] && ret="xray" || ret="v2ray" ;;
v2ray | vless) ret="xray" ;;
trojan) ret="trojan" ;;
esac
echo $(find /usr -perm /+x -type f -name $ret)
@ -418,7 +418,7 @@ start_redir() {
ucmd=$(find_bin $utype)
gen_config_file $UDP_RELAY_SERVER 1 0
last_config_file=$CONFIG_UDP_FILE
case "$stype" in
case "$utype" in
ss | ssr)
case "$(uci_get_by_name $UDP_RELAY_SERVER auth_enable)" in
1 | on | true | yes | enabled) ARG_OTA="-A" ;;
@ -644,7 +644,7 @@ stop() {
if [ $(uci_get_by_type global monitor_enable) = 1 ]; then
kill -9 $(busybox ps -w | grep vssr-monitor | grep -v grep | awk '{print $1}') >/dev/null 2>&1
fi
killall -q -9 ss-redir ss-local obfs-local ssr-redir ssr-local ssr-server v2ray v2ray-plugin xray trojan microsocks ipt2socks dns2socks pdnsd
killall -q -9 ss-redir ss-local obfs-local ssr-redir ssr-local ssr-server v2ray-plugin xray trojan microsocks ipt2socks dns2socks pdnsd
if [ -f "/tmp/dnsmasq.d/dnsmasq-ssr.conf" ]; then
rm -rf /tmp/dnsmasq.d/dnsmasq-ssr.conf /tmp/dnsmasq.ssr /tmp/dnsmasq.oversea

View File

@ -520,7 +520,6 @@ footer.mobile-hide {
.modals-bg {
position: fixed;
z-index: 100000;
}
.modals {

View File

@ -1,12 +1,11 @@
┌─────────────────────────────────────────────────┐
│ │
│ mmmm m m m │
│ m" "m mmmm mmm m mm # # # m mm mm#mm │
│ # # #" "# #" # #" # " #"# # #" " # │
│ # # # # #"""" # # ## ##" # # │
│ #mm# ##m#" "#mm" # # # # # "mm │
│ # │
│ " │
│─────────────────────────────────────────────────│
│ OpenWrt 18.06 by Lean | Mod 21.02 By CTCGFW │
└─────────────────────────────────────────────────┘
┌─────────────────────────────────────────────┐
│ │
│ mmmmm m ""# │
│ # mmmmm mmmmm mmm mmm mm#mm mmm # │
│ # # # # # # # #" "# #" " # " # # │
│ # # # # # # # # # # # m"""# # │
│ mm#mm # # # # # # "#m#" # "mm "mm"# "mm │
│ │
│─────────────────────────────────────────────│
│ ImmortalWrt 18.06 | Mod 21.02 │
└─────────────────────────────────────────────┘

View File

@ -41,14 +41,14 @@ sed -i '/set wireless.radio${devidx}.disabled/d' /lib/wifi/mac80211.sh
# NEVER DROP THE EXISTING AUTHORS INFO | 禁止删除现有作者信息
sed -i '/DISTRIB_REVISION/d' /etc/openwrt_release
echo "DISTRIB_REVISION='| Mod 21.02 by CTCGFW'" >> /etc/openwrt_release
echo "DISTRIB_REVISION='| Mod 21.02'" >> /etc/openwrt_release
sed -i '/DISTRIB_DESCRIPTION/d' /etc/openwrt_release
echo "DISTRIB_DESCRIPTION='OpenWrt 18.06 by Lean '" >> /etc/openwrt_release
echo "DISTRIB_DESCRIPTION='ImmortalWrt 18.06 '" >> /etc/openwrt_release
# NEVER DROP THE EXISTING AUTHORS INFO | 禁止删除现有作者信息
sed -i 's/LuCI openwrt-18.06 branch/LuCI 18.06 by Lean/g' /usr/lib/lua/luci/version.lua
sed -i '/luciversion/d' /usr/lib/lua/luci/version.lua
echo 'luciversion = "Mod 21.01 by CTCGFW"' >> /usr/lib/lua/luci/version.lua
echo 'luciversion = "Mod 21.02 by ImmortalWrt"' >> /usr/lib/lua/luci/version.lua
sed -i '/log-facility/d' /etc/dnsmasq.conf
echo "log-facility=/dev/null" >> /etc/dnsmasq.conf

View File

@ -9,14 +9,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=microsocks
PKG_VERSION=1.0.1
PKG_RELEASE:=1
PKG_VERSION=1.0.2
PKG_RELEASE:=2
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/rofl0r/microsocks.git
PKG_SOURCE_DATE:=2020-10-25
PKG_SOURCE_VERSION:=31557857ccce5e4fdd2cfdae7ab640d589aa2b41
PKG_MIRROR_HASH:=fd914984fa8314d73630a31c2daad8d34de85597953669691e0c69d52f6a6010
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/rofl0r/microsocks/tar.gz/v$(PKG_VERSION)?
PKG_HASH:=5ece77c283e71f73b9530da46302fdb4f72a0ae139aa734c07fe532407a6211a
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=COPYING

View File

@ -7,8 +7,8 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-passwall
PKG_VERSION:=4
PKG_RELEASE:=12
PKG_DATE:=20210127
PKG_RELEASE:=13
PKG_DATE:=20210207
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)

View File

@ -57,6 +57,7 @@ end
function get_valid_nodes()
local nodes = {}
uci:foreach(appname, "nodes", function(e)
e.id = e[".name"]
if e.type and e.remarks then
if e.protocol and (e.protocol == "_balancing" or e.protocol == "_shunt") then
e.remarks_name = "%s[%s] " % {i18n.translatef(e.type .. e.protocol), e.remarks}
@ -158,7 +159,7 @@ function get_customed_path(e)
end
function is_finded(e)
return luci.sys.exec('type -t -p "%s/%s" "%s"' % {get_customed_path(e), e, e}) ~= "" and true or false
return luci.sys.exec('type -t -p "/bin/%s" -p "%s" "%s"' % {e, get_customed_path(e), e}) ~= "" and true or false
end
function get_xray_path()

View File

@ -30,6 +30,8 @@ function to_check(arch)
if file_tree == "amd64" then file_tree = "64" end
if file_tree == "386" then file_tree = "32" end
if file_tree == "mipsle" then file_tree = "mips32le" end
if file_tree == "mips" then file_tree = "mips32" end
local json = api.get_api_json(xray_api)

View File

@ -3,6 +3,8 @@ local appname = "passwall"
m = Map(appname)
local global_proxy_mode = (m.uci:get(appname, "@global[0]", "tcp_proxy_mode") or "") .. (m.uci:get(appname, "@global[0]", "udp_proxy_mode") or "")
-- [[ ACLs Settings ]]--
s = m:section(TypedSection, "acl_rule", translate("ACLs"), "<font color='red'>" .. translate("ACLs is a tools which used to designate specific IP proxy mode, IP or MAC address can be entered.") .. "</font>")
s.template = "cbi/tblsection"
@ -41,26 +43,32 @@ o.rmempty = true
sys.net.mac_hints(function(e, t) o:value(e, "%s (%s)" % {e, t}) end)
---- TCP Proxy Mode
o = s:option(ListValue, "tcp_proxy_mode", "TCP" .. translate("Proxy Mode"))
o.default = "default"
o.rmempty = false
o:value("default", translate("Default"))
o:value("disable", translate("No Proxy"))
o:value("global", translate("Global Proxy"))
o:value("gfwlist", translate("GFW List"))
o:value("chnroute", translate("Not China List"))
o:value("returnhome", translate("China List"))
tcp_proxy_mode = s:option(ListValue, "tcp_proxy_mode", "TCP" .. translate("Proxy Mode"))
tcp_proxy_mode.default = "default"
tcp_proxy_mode.rmempty = false
tcp_proxy_mode:value("default", translate("Default"))
tcp_proxy_mode:value("disable", translate("No Proxy"))
tcp_proxy_mode:value("global", translate("Global Proxy"))
if global_proxy_mode:find("returnhome") then
tcp_proxy_mode:value("returnhome", translate("China List"))
else
tcp_proxy_mode:value("gfwlist", translate("GFW List"))
tcp_proxy_mode:value("chnroute", translate("Not China List"))
end
---- UDP Proxy Mode
o = s:option(ListValue, "udp_proxy_mode", "UDP" .. translate("Proxy Mode"))
o.default = "default"
o.rmempty = false
o:value("default", translate("Default"))
o:value("disable", translate("No Proxy"))
o:value("global", translate("Global Proxy"))
o:value("gfwlist", translate("GFW List"))
o:value("chnroute", translate("Game Mode"))
o:value("returnhome", translate("China List"))
udp_proxy_mode = s:option(ListValue, "udp_proxy_mode", "UDP" .. translate("Proxy Mode"))
udp_proxy_mode.default = "default"
udp_proxy_mode.rmempty = false
udp_proxy_mode:value("default", translate("Default"))
udp_proxy_mode:value("disable", translate("No Proxy"))
udp_proxy_mode:value("global", translate("Global Proxy"))
if global_proxy_mode:find("returnhome") then
udp_proxy_mode:value("returnhome", translate("China List"))
else
udp_proxy_mode:value("gfwlist", translate("GFW List"))
udp_proxy_mode:value("chnroute", translate("Game Mode"))
end
---- TCP No Redir Ports
o = s:option(Value, "tcp_no_redir_ports", translate("TCP No Redir Ports"))

View File

@ -7,31 +7,20 @@ m = Map(appname)
local nodes_table = {}
for k, e in ipairs(api.get_valid_nodes()) do
nodes_table[#nodes_table + 1] = {
id = e[".name"],
remarks = e.remarks_name,
type = e["type"]
}
nodes_table[#nodes_table + 1] = e
end
local socks_table = {}
if tonumber(m:get("@global[0]", "tcp_node_socks") or 0) == 1 then
local id = "127.0.0.1" .. ":" .. m:get("@global[0]", "tcp_node_socks_port")
socks_table[#socks_table + 1] = {
id = id,
remarks = id .. " - " .. translate("TCP Node")
}
end
uci:foreach(appname, "socks", function(s)
if s.enabled == "1" and s.node then
local id, remarks
local same, i = s.node:match("^(tcp)([1-9])$")
local same, i = s.node:match("^(tcp)")
if same then
remarks = translatef("Same as the tcp %s node", i)
remarks = translatef("Same as the tcp node")
else
for k, n in pairs(nodes_table) do
if (s.node == n.id) then
remarks = n.remarks; break
remarks = n.remarks_name; break
end
end
end
@ -65,6 +54,20 @@ local doh_validate = function(self, value, t)
return nil, translate("DoH request address") .. " " .. translate("Format must be:") .. " URL,IP"
end
local redir_mode_validate = function(self, value, t)
local tcp_proxy_mode_v = tcp_proxy_mode:formvalue(t) or ""
local udp_proxy_mode_v = udp_proxy_mode:formvalue(t) or ""
local localhost_tcp_proxy_mode_v = localhost_tcp_proxy_mode:formvalue(t) or ""
local localhost_udp_proxy_mode_v = localhost_udp_proxy_mode:formvalue(t) or ""
local s = tcp_proxy_mode_v .. udp_proxy_mode_v .. localhost_tcp_proxy_mode_v .. localhost_udp_proxy_mode_v
if s:find("returnhome") then
if s:find("chnroute") or s:find("gfwlist") then
return nil, translate("China list or gfwlist cannot be used together with outside China list!")
end
end
return value
end
local status = m:get("@global_other[0]", "status") or ""
if status:find("big_icon") then
m:append(Template(appname .. "/global/status"))
@ -83,8 +86,7 @@ o = s:taboption("Main", Flag, "enabled", translate("Main switch"))
o.rmempty = false
---- TCP Node
tcp_node = s:taboption("Main", ListValue, "tcp_node", translate("TCP Node"))
tcp_node.title = translate("TCP Node")
tcp_node = s:taboption("Main", ListValue, "tcp_node", "<a style='color: red'>" .. translate("TCP Node") .. "</a>")
tcp_node.description = ""
--tcp_node.description = translate("For proxy specific list.")
--tcp_node.description = o.description .. "<br />"
@ -97,75 +99,84 @@ if current_node and current_node ~= "" and current_node ~= "nil" then
local url = api.url("node_config", current_node)
tcp_node.description = tcp_node.description .. translatef("Current node: %s", string.format('<a href="%s">%s</a>', url, remarks)) .. "<br />"
end
if n.protocol and n.protocol == "_shunt" then
uci:foreach(appname, "shunt_rules", function(e)
local id = e[".name"]
local remarks = translate(e.remarks)
if n[id] and n[id] ~= "nil" then
local url = api.url("node_config", n[id])
local r = api.get_full_node_remarks(uci:get_all(appname, n[id]))
tcp_node.description = tcp_node.description .. remarks .. "" .. string.format('<a href="%s">%s</a>', url, r) .. "<br />"
end
end)
local id = "default_node"
local remarks = translate("Default")
if n[id] and n[id] ~= "nil" then
local url = api.url("node_config", n[id])
local r = api.get_full_node_remarks(uci:get_all(appname, n[id]))
tcp_node.description = tcp_node.description .. remarks .. "" .. string.format('<a href="%s">%s</a>', url, r) .. "<br />"
end
local id = "main_node"
local remarks = translate("Default") .. translate("Preproxy")
if n[id] and n[id] ~= "nil" then
local url = api.url("node_config", n[id])
local r = api.get_full_node_remarks(uci:get_all(appname, n[id]))
tcp_node.description = tcp_node.description .. remarks .. "" .. string.format('<a href="%s">%s</a>', url, r) .. "<br />"
end
end
end
end
tcp_node:value("nil", translate("Close"))
udp_node = s:taboption("Main", ListValue, "udp_node", translate("UDP Node"))
-- 分流
if has_xray and #nodes_table > 0 then
local normal_list = {}
local shunt_list = {}
for k, v in pairs(nodes_table) do
if v.node_type == "normal" then
normal_list[#normal_list + 1] = v
end
if v.type == "Xray" and v.protocol == "_shunt" then
shunt_list[#shunt_list + 1] = v
end
end
if #normal_list > 0 and #shunt_list > 0 then
uci:foreach(appname, "shunt_rules", function(e)
local id = e[".name"]
o = s:taboption("Main", ListValue, id .. "_node", string.format('* <a href="%s">%s</a>', api.url("shunt_rules", id), translate(e.remarks)))
for k, v in pairs(shunt_list) do
o:depends("tcp_node", v.id)
o.cfgvalue = function(self, section)
return m:get(v.id, id) or "nil"
end
o.write = function(self, section, value)
m:set(v.id, id, value)
end
end
o:value("nil", translate("Close"))
for k, v in pairs(normal_list) do
o:value(v.id, v.remarks_name)
end
end)
local id = "default_node"
o = s:taboption("Main", ListValue, id, "* " .. translate("Default"))
for k, v in pairs(shunt_list) do
o:depends("tcp_node", v.id)
o.cfgvalue = function(self, section)
return m:get(v.id, id) or "nil"
end
o.write = function(self, section, value)
m:set(v.id, id, value)
end
end
o:value("nil", translate("Close"))
for k, v in pairs(normal_list) do
o:value(v.id, v.remarks_name)
end
local id = "main_node"
o = s:taboption("Main", ListValue, id, "* " .. translate("Default") .. translate("Preproxy"))
for k, v in pairs(shunt_list) do
o:depends("tcp_node", v.id)
o.cfgvalue = function(self, section)
return m:get(v.id, id) or "nil"
end
o.write = function(self, section, value)
m:set(v.id, id, value)
end
end
o:value("nil", translate("Close"))
for k, v in pairs(normal_list) do
o:value(v.id, v.remarks_name)
end
end
end
udp_node = s:taboption("Main", ListValue, "udp_node", "<a style='color: red'>" .. translate("UDP Node") .. "</a>")
udp_node:value("nil", translate("Close"))
udp_node.title = translate("UDP Node")
--udp_node.description = translate("For proxy game network, DNS hijack etc.") .. "<br />" .. translate("The selected server will not use Kcptun.")
udp_node:value("tcp_", translate("Same as the tcp node"))
--udp_node:value("tcp", translate("Same as the tcp node"))
--udp_node:value("tcp_", translate("Same as the tcp node") .. "" .. translate("New process") .. "")
tcp_node_socks = s:taboption("Main", Flag, "tcp_node_socks", translate("Enable") .. translate("TCP Node") .. "Socks")
o = s:taboption("Main", Value, "tcp_node_socks_port", "Socks" .. translate("Listen Port"))
o.default = 1080
o.datatype = "port"
o:depends("tcp_node_socks", true)
tcp_node_http = s:taboption("Main", Flag, "tcp_node_http", translate("Enable") .. translate("TCP Node") .. "Http")
o = s:taboption("Main", Value, "tcp_node_http_port", "HTTP" .. translate("Listen Port"))
o.default = 1180
o.datatype = "port"
o:depends("tcp_node_http", true)
s:tab("DNS", translate("DNS"))
if api.is_finded("chinadns-ng") then
o = s:taboption("DNS", Flag, "chinadns_ng", translate("Use ChinaDNS-NG"), translate("When checked, forced to be set to dnsmasq upstream DNS."))
o.default = "0"
o = s:taboption("DNS", Flag, "fair_mode", translate("ChinaDNS-NG Fair Mode"))
o.default = "1"
o:depends("chinadns_ng", "1")
end
if nixio.fs.access("/usr/share/" .. appname .. "/rules/chnlist") then
o = s:taboption("DNS", Flag, "use_chnlist", translate("Use ChinaList"), translate("Only useful in non-gfwlist mode.") .. "<br />" .. translate("When used, the domestic DNS will be used only when the chnlist rule is hit, and the domain name that misses the rule will be resolved by remote DNS."))
o.default = "0"
o:depends("tcp_proxy_mode", "chnroute")
o:depends("udp_proxy_mode", "chnroute")
o:depends("localhost_tcp_proxy_mode", "chnroute")
o:depends("localhost_udp_proxy_mode", "chnroute")
end
o = s:taboption("DNS", Value, "up_china_dns", translate("Local DNS") .. "(UDP)")
o.description = translate("IP:Port mode acceptable, multi value split with english comma.") .. "<br />" .. translate("When the selection is not the default, this DNS is forced to be set to dnsmasq upstream DNS.")
o.default = "default"
@ -273,47 +284,47 @@ end
s:tab("Proxy", translate("Mode"))
---- TCP Default Proxy Mode
o = s:taboption("Proxy", ListValue, "tcp_proxy_mode", "TCP" .. translate("Default") .. translate("Proxy Mode"))
tcp_proxy_mode = s:taboption("Proxy", ListValue, "tcp_proxy_mode", "TCP" .. translate("Default") .. translate("Proxy Mode"))
-- o.description = translate("If not available, try clearing the cache.")
o.default = "chnroute"
o.rmempty = false
o:value("disable", translate("No Proxy"))
o:value("global", translate("Global Proxy"))
o:value("gfwlist", translate("GFW List"))
o:value("chnroute", translate("Not China List"))
o:value("returnhome", translate("China List"))
tcp_proxy_mode:value("disable", translate("No Proxy"))
tcp_proxy_mode:value("global", translate("Global Proxy"))
tcp_proxy_mode:value("gfwlist", translate("GFW List"))
tcp_proxy_mode:value("chnroute", translate("Not China List"))
tcp_proxy_mode:value("returnhome", translate("China List"))
tcp_proxy_mode.default = "chnroute"
--tcp_proxy_mode.validate = redir_mode_validate
---- UDP Default Proxy Mode
o = s:taboption("Proxy", ListValue, "udp_proxy_mode", "UDP" .. translate("Default") .. translate("Proxy Mode"))
o.default = "chnroute"
o.rmempty = false
o:value("disable", translate("No Proxy"))
o:value("global", translate("Global Proxy"))
o:value("gfwlist", translate("GFW List"))
o:value("chnroute", translate("Game Mode"))
o:value("returnhome", translate("China List"))
udp_proxy_mode = s:taboption("Proxy", ListValue, "udp_proxy_mode", "UDP" .. translate("Default") .. translate("Proxy Mode"))
udp_proxy_mode:value("disable", translate("No Proxy"))
udp_proxy_mode:value("global", translate("Global Proxy"))
udp_proxy_mode:value("gfwlist", translate("GFW List"))
udp_proxy_mode:value("chnroute", translate("Game Mode"))
udp_proxy_mode:value("returnhome", translate("China List"))
udp_proxy_mode.default = "chnroute"
--udp_proxy_mode.validate = redir_mode_validate
---- Localhost TCP Proxy Mode
o = s:taboption("Proxy", ListValue, "localhost_tcp_proxy_mode", translate("Router Localhost") .. "TCP" .. translate("Proxy Mode"))
localhost_tcp_proxy_mode = s:taboption("Proxy", ListValue, "localhost_tcp_proxy_mode", translate("Router Localhost") .. "TCP" .. translate("Proxy Mode"))
-- o.description = translate("The server client can also use this rule to scientifically surf the Internet.")
o:value("default", translate("Default"))
o:value("global", translate("Global Proxy"))
o:value("gfwlist", translate("GFW List"))
o:value("chnroute", translate("Not China List"))
o:value("returnhome", translate("China List"))
o.default = "default"
o.rmempty = false
localhost_tcp_proxy_mode:value("default", translate("Default"))
localhost_tcp_proxy_mode:value("global", translate("Global Proxy"))
localhost_tcp_proxy_mode:value("gfwlist", translate("GFW List"))
localhost_tcp_proxy_mode:value("chnroute", translate("Not China List"))
localhost_tcp_proxy_mode:value("returnhome", translate("China List"))
localhost_tcp_proxy_mode.default = "default"
--localhost_tcp_proxy_mode.validate = redir_mode_validate
---- Localhost UDP Proxy Mode
o = s:taboption("Proxy", ListValue, "localhost_udp_proxy_mode", translate("Router Localhost") .. "UDP" .. translate("Proxy Mode"))
o:value("default", translate("Default"))
o:value("global", translate("Global Proxy"))
o:value("gfwlist", translate("GFW List"))
o:value("chnroute", translate("Game Mode"))
o:value("returnhome", translate("China List"))
o:value("disable", translate("No Proxy"))
o.default = "default"
o.rmempty = false
localhost_udp_proxy_mode = s:taboption("Proxy", ListValue, "localhost_udp_proxy_mode", translate("Router Localhost") .. "UDP" .. translate("Proxy Mode"))
localhost_udp_proxy_mode:value("default", translate("Default"))
localhost_udp_proxy_mode:value("global", translate("Global Proxy"))
localhost_udp_proxy_mode:value("gfwlist", translate("GFW List"))
localhost_udp_proxy_mode:value("chnroute", translate("Game Mode"))
localhost_udp_proxy_mode:value("returnhome", translate("China List"))
localhost_udp_proxy_mode:value("disable", translate("No Proxy"))
localhost_udp_proxy_mode.default = "default"
localhost_udp_proxy_mode.validate = redir_mode_validate
s:tab("log", translate("Log"))
o = s:taboption("log", Flag, "close_log_tcp", translate("Close") .. translate("Log") .. " " .. translate("TCP Node"))
@ -366,6 +377,7 @@ o.default = 1
o.rmempty = false
socks_node = s:option(ListValue, "node", translate("Socks Node"))
socks_node:value("tcp", translate("Same as the tcp node"))
o = s:option(Value, "port", "Socks" .. translate("Listen Port"))
o.default = 9050
@ -379,32 +391,17 @@ if has_xray then
end
for k, v in pairs(nodes_table) do
tcp_node:value(v.id, v.remarks)
tcp_node_socks:depends("tcp_node", v.id)
if v.type == "Xray" then
if has_xray then
tcp_node_http:depends("tcp_node", v.id)
end
else
tcp_node_http:depends("tcp_node_socks", true)
end
udp_node:value(v.id, v.remarks)
tcp_node:value(v.id, v.remarks_name)
udp_node:value(v.id, v.remarks_name)
if v.type == "Socks" then
if has_xray then
socks_node:value(v.id, v.remarks)
socks_node:value(v.id, v.remarks_name)
end
else
socks_node:value(v.id, v.remarks)
socks_node:value(v.id, v.remarks_name)
end
end
m:append(Template(appname .. "/global/footer"))
--[[
local apply = luci.http.formvalue("cbi.apply")
if apply then
os.execute("/etc/init.d/" .. appname .." restart")
end
--]]
return m

View File

@ -232,6 +232,9 @@ msgstr "DoH Bootstrap DNS"
msgid "The Bootstrap DNS server is used to resolve the IP address of the DoH resolver you specify as the upstream."
msgstr "Bootstrap DNS 服务器用于解析您指定为上游的 DoH 解析器的 IP 地址。"
msgid "China list or gfwlist cannot be used together with outside China list!"
msgstr "中国列表不能和中国列表外或防火墙表一起使用!"
msgid "Cache Resolved"
msgstr "缓存解析结果"

View File

@ -286,6 +286,8 @@ LOCALHOST_TCP_PROXY_MODE=$(config_t_get global localhost_tcp_proxy_mode default)
LOCALHOST_UDP_PROXY_MODE=$(config_t_get global localhost_udp_proxy_mode default)
[ "$LOCALHOST_TCP_PROXY_MODE" == "default" ] && LOCALHOST_TCP_PROXY_MODE=$TCP_PROXY_MODE
[ "$LOCALHOST_UDP_PROXY_MODE" == "default" ] && LOCALHOST_UDP_PROXY_MODE=$UDP_PROXY_MODE
RESOLVFILE=/tmp/resolv.conf.d/resolv.conf.auto
[ -f "${RESOLVFILE}" ] && [ -s "${RESOLVFILE}" ] || RESOLVFILE=/tmp/resolv.conf.auto
load_config() {
[ "$ENABLED" != 1 ] && NO_PROXY=1
@ -294,21 +296,21 @@ load_config() {
NO_PROXY=1
}
CHINADNS_NG=$(config_t_get global chinadns_ng 0)
global=$(echo "${TCP_PROXY_MODE}${LOCALHOST_TCP_PROXY_MODE}${UDP_PROXY_MODE}${LOCALHOST_UDP_PROXY_MODE}" | grep "global")
returnhome=$(echo "${TCP_PROXY_MODE}${LOCALHOST_TCP_PROXY_MODE}${UDP_PROXY_MODE}${LOCALHOST_UDP_PROXY_MODE}" | grep "returnhome")
chnlist=$(echo "${TCP_PROXY_MODE}${LOCALHOST_TCP_PROXY_MODE}${UDP_PROXY_MODE}${LOCALHOST_UDP_PROXY_MODE}" | grep "chnroute")
gfwlist=$(echo "${TCP_PROXY_MODE}${LOCALHOST_TCP_PROXY_MODE}${UDP_PROXY_MODE}${LOCALHOST_UDP_PROXY_MODE}" | grep "gfwlist")
DNS_MODE=$(config_t_get global dns_mode pdnsd)
DNS_FORWARD=$(config_t_get global dns_forward 8.8.4.4:53 | sed 's/:/#/g')
DNS_CACHE=$(config_t_get global dns_cache 0)
LOCAL_DNS=$(config_t_get global up_china_dns default | sed 's/:/#/g')
if [ "${LOCAL_DNS}" = "default" ]; then
DEFAULT_DNS=$(uci show dhcp | grep "@dnsmasq" | grep ".server=" | awk -F '=' '{print $2}' | sed "s/'//g" | tr ' ' ',')
if [ -n "${DEFAULT_DNS}" ]; then
IS_DEFAULT_DNS=1
else
RESOLVFILE=/tmp/resolv.conf.d/resolv.conf.auto
[ -f "${RESOLVFILE}" ] && [ -s "${RESOLVFILE}" ] || RESOLVFILE=/tmp/resolv.conf.auto
if [ -z "${DEFAULT_DNS}" ]; then
DEFAULT_DNS=$(echo -n $(sed -n 's/^nameserver[ \t]*\([^ ]*\)$/\1/p' "${RESOLVFILE}" | grep -v "0.0.0.0" | grep -v "127.0.0.1" | grep -v "^::$" | head -2) | tr ' ' ',')
fi
LOCAL_DNS="${DEFAULT_DNS:-119.29.29.29}"
IS_DEFAULT_DNS=1
fi
PROXY_IPV6=$(config_t_get global_forwarding proxy_ipv6 0)
mkdir -p /var/etc $TMP_PATH $TMP_BIN_PATH $TMP_ID_PATH $TMP_PORT_PATH
@ -501,13 +503,15 @@ run_redir() {
local proto="-proto tcp"
[ "$UDP_NODE" == "tcp" ] && proto="-proto tcp,udp"
local extra_param="${proto}"
[ "$(config_t_get global tcp_node_socks 0)" = "1" ] && {
local socks_param="-socks_proxy_port $(config_t_get global tcp_node_socks_port 1080)"
[ "$tcp_node_socks" = "1" ] && {
local socks_param="-socks_proxy_port $tcp_node_socks_port"
extra_param="${extra_param} ${socks_param}"
config_file=$(echo $config_file | sed "s/TCP/TCP_SOCKS_$tcp_node_socks_id/g")
}
[ "$(config_t_get global tcp_node_http 0)" = "1" ] && {
local http_param="-http_proxy_port $(config_t_get global tcp_node_http_port 1180)"
[ "$tcp_node_http" = "1" ] && {
local http_param="-http_proxy_port $tcp_node_http_port"
extra_param="${extra_param} ${http_param}"
config_file=$(echo $config_file | sed "s/TCP/TCP_HTTP_$tcp_node_http_id/g")
}
lua $API_GEN_XRAY -node $node -redir_port $local_port -loglevel $loglevel $extra_param > $config_file
ln_start_bin "$(first_type $(config_t_get global_app xray_file) xray)" xray $log_file -config="$config_file"
@ -566,14 +570,14 @@ run_redir() {
unset _socks_flag _socks_address _socks_port _socks_username _socks_password
[ "$type" != "xray" ] && {
[ "$(config_t_get global tcp_node_socks 0)" = "1" ] && {
local port=$(config_t_get global tcp_node_socks_port 1080)
local config_file=$TMP_PATH/SOCKS_TCP.json
local log_file=$TMP_PATH/SOCKS_TCP.log
[ "$tcp_node_socks" = "1" ] && {
local port=$tcp_node_socks_port
local config_file=$TMP_PATH/SOCKS_$tcp_node_socks_id.json
local log_file=$TMP_PATH/SOCKS_$tcp_node_socks_id.log
local http_port=0
local http_config_file=$TMP_PATH/HTTP2SOCKS_TCP.json
[ "$(config_t_get global tcp_node_http 0)" = "1" ] && {
http_port=$(config_t_get global tcp_node_http_port 1180)
local http_config_file=$TMP_PATH/HTTP2SOCKS_$tcp_node_http_id.json
[ "$tcp_node_http" = "1" ] && {
http_port=$tcp_node_http_port
}
run_socks TCP $TCP_NODE "0.0.0.0" $port $config_file $http_port $http_config_file
}
@ -629,6 +633,17 @@ start_socks() {
local log_file=$TMP_PATH/SOCKS_${id}.log
local http_port=$(config_n_get $id http_port 0)
local http_config_file=$TMP_PATH/HTTP2SOCKS_${id}.json
[ "$node" == "tcp" ] && {
tcp_node_socks=1
tcp_node_socks_port=$port
tcp_node_socks_id=$id
[ "$http_port" != "0" ] && {
tcp_node_http=1
tcp_node_http_port=$http_port
tcp_node_http_id=$id
}
continue
}
run_socks $id $node "0.0.0.0" $port $config_file $http_port $http_config_file
done
}
@ -726,80 +741,16 @@ start_dns() {
fi
local pdnsd_forward other_port msg
local global chnlist returnhome china_ng_chn china_ng_gfw chnlist_param gfwlist_param extra_mode
dns_listen_port=${DNS_PORT}
pdnsd_forward=${DNS_FORWARD}
other_port=$(expr $DNS_PORT + 1)
china_ng_gfw="127.0.0.1#${other_port}"
china_ng_chn="${LOCAL_DNS}"
returnhome=$(echo "${TCP_PROXY_MODE}${LOCALHOST_TCP_PROXY_MODE}${UDP_PROXY_MODE}${LOCALHOST_UDP_PROXY_MODE}" | grep "returnhome")
global=$(echo "${TCP_PROXY_MODE}${LOCALHOST_TCP_PROXY_MODE}${UDP_PROXY_MODE}${LOCALHOST_UDP_PROXY_MODE}" | grep "global")
chnlist=$(echo "${TCP_PROXY_MODE}${LOCALHOST_TCP_PROXY_MODE}${UDP_PROXY_MODE}${LOCALHOST_UDP_PROXY_MODE}" | grep "chnroute")
[ -n "${returnhome}" ] && china_ng_chn="${china_ng_gfw}" && china_ng_gfw="${LOCAL_DNS}"
sed -n 's/^ipset=\/\.\?\([^/]*\).*$/\1/p' "${RULES_PATH}/gfwlist.conf" | sort -u > "${TMP_PATH}/gfwlist.txt"
echolog "过滤服务配置:准备接管域名解析[$?]..."
USE_CHNLIST=$(config_t_get global use_chnlist 0)
[ "$USE_CHNLIST" = "1" ] && {
if [ -f "${RULES_PATH}/chnlist" ]; then
cp -a "${RULES_PATH}/chnlist" "${TMP_PATH}/chnlist"
else
USE_CHNLIST=0
fi
}
[ "$CHINADNS_NG" = "1" ] && {
echolog " | - (chinadns-ng) 只支持2~4级的域名过滤..."
[ -z "${global}${chnlist}" ] && echolog " | - (chinadns-ng) 此模式下列表外的域名查询会同时发送给本地DNS(可切换到Pdnsd + TCP节点模式解决)..."
[ -n "${returnhome}" ] && msg="本地" || msg="代理"
[ -z "${global}${chnlist}" ] && echolog " | - (chinadns-ng) 列表外域名查询的结果不在中国IP段内(chnroute/chnroute6)时,只采信${msg} DNS 的应答..."
echolog " | - (chinadns-ng) 上游 DNS (${china_ng_gfw}) 有一定概率会比 DNS (${china_ng_chn}) 先返回的话(比如 DNS 的本地查询缓存),启用 '公平模式' 可以优先接受${msg} DNS 的中国IP段内(chnroute/chnroute6)的应答..."
if [ "$DNS_MODE" = "pdnsd" ]; then
msg="pdnsd"
elif [ "$DNS_MODE" = "dns2socks" ]; then
#[ -n "${global}${chnlist}" ] && TUN_DNS=${china_ng_gfw}
msg="dns2socks"
elif [ "$DNS_MODE" = "xray_doh" ]; then
msg="Xray DNS(DoH)"
elif [ "$DNS_MODE" = "udp" ]; then
use_udp_node_resolve_dns=1
if [ -z "${returnhome}" ]; then
china_ng_gfw="${DNS_FORWARD}"
else
china_ng_chn="${DNS_FORWARD}"
fi
msg="udp"
elif [ "$DNS_MODE" = "custom" ]; then
custom_dns=$(config_t_get global custom_dns)
china_ng_gfw="$(echo ${custom_dns} | sed 's/:/#/g')"
msg="自定义DNS"
fi
chnlist_param="${TMP_PATH}/chnlist"
if [ -n "${returnhome}" ]; then
echolog " | - (chinadns-ng) 白名单不与中国域名表合并"
[ -f "${RULES_PATH}/proxy_host" ] && {
cat "${RULES_PATH}/proxy_host" >> "${chnlist_param}"
echolog " | - [$?](chinadns-ng) 忽略防火墙域名表,代理域名表合并到中国域名表"
}
else
[ -f "${RULES_PATH}/direct_host" ] && {
cat "${RULES_PATH}/direct_host" >> "${chnlist_param}"
echolog " | - [$?](chinadns-ng) 域名白名单合并到中国域名表"
}
[ -f "${RULES_PATH}/proxy_host" ] && {
gfwlist_param="${TMP_PATH}/gfwlist.txt"
cat "${RULES_PATH}/proxy_host" >> "${gfwlist_param}"
echolog " | - [$?](chinadns-ng) 代理域名表合并到防火墙域名表"
}
fi
chnlist_param=${chnlist_param:+-m "${chnlist_param}" -M}
[ "$(config_t_get global fair_mode 1)" = "1" ] && extra_mode="-f"
ln_start_bin "$(first_type chinadns-ng)" chinadns-ng "/dev/null" -l "${dns_listen_port}" ${china_ng_chn:+-c "${china_ng_chn}"} ${chnlist_param} ${china_ng_gfw:+-t "${china_ng_gfw}"} ${gfwlist_param:+-g "${gfwlist_param}"} $extra_mode
echolog " + 过滤服务ChinaDNS-NG(:${dns_listen_port}${extra_mode}) + ${msg}:中国域名列表:${china_ng_chn:-D114.114.114.114},防火墙域名列表:${china_ng_gfw:-D8.8.8.8}"
#[ -n "${global}${chnlist}" ] && [ -z "${returnhome}" ] && TUN_DNS="${china_ng_gfw}"
dns_listen_port=${other_port}
}
china_ng_listen_port=$(expr $dns_listen_port + 1)
china_ng_listen="127.0.0.1#${china_ng_listen_port}"
china_ng_chn=$(echo -n $(echo "${LOCAL_DNS}" | sed "s/,/\n/g" | head -n2) | tr " " ",")
china_ng_gfw="127.0.0.1#${dns_listen_port}"
[ -n "${returnhome}" ] && china_ng_chn="${china_ng_gfw}" && china_ng_gfw="${LOCAL_DNS}"
echolog "过滤服务配置:准备接管域名解析[$?]..."
case "$DNS_MODE" in
nonuse)
@ -849,7 +800,7 @@ start_dns() {
unset _dns _doh_bootstrap_dns
fi
unset _doh_url _doh_port _doh_bootstrap
echolog " - 域名解析 Xray DNS(DOH)..."
echolog " - 域名解析 Xray DNS(DoH)..."
;;
pdnsd)
gen_pdnsd_config "${dns_listen_port}" "${pdnsd_forward}"
@ -862,20 +813,60 @@ start_dns() {
echolog " - 域名解析直接使用UDP节点请求DNS$TUN_DNS"
;;
custom)
[ "$CHINADNS_NG" != "1" ] && {
custom_dns=$(config_t_get global custom_dns)
TUN_DNS="$(echo ${custom_dns} | sed 's/:/#/g')"
echolog " - 域名解析直接使用UDP协议自定义DNS$TUN_DNS)解析..."
}
custom_dns=$(config_t_get global custom_dns)
TUN_DNS="$(echo ${custom_dns} | sed 's/:/#/g')"
echolog " - 域名解析直接使用UDP协议自定义DNS$TUN_DNS)解析..."
;;
esac
[ -n "$chnlist" ] && [ "$DNS_MODE" != "custom" ] && {
[ -f "${RULES_PATH}/chnlist" ] && cp -a "${RULES_PATH}/chnlist" "${TMP_PATH}/chnlist"
[ -n "$(first_type chinadns-ng)" ] && {
echolog "发现ChinaDNS-NG将启动。"
CHINADNS_NG=1
}
[ -n "$CHINADNS_NG" ] && {
echolog " | - (chinadns-ng) 只支持2~4级的域名过滤..."
if [ "$DNS_MODE" = "pdnsd" ]; then
msg="pdnsd"
elif [ "$DNS_MODE" = "dns2socks" ]; then
msg="dns2socks"
elif [ "$DNS_MODE" = "xray_doh" ]; then
msg="Xray DNS(DoH)"
elif [ "$DNS_MODE" = "udp" ]; then
use_udp_node_resolve_dns=1
china_ng_gfw="${DNS_FORWARD}"
msg="udp"
elif [ "$DNS_MODE" = "custom" ]; then
custom_dns=$(config_t_get global custom_dns)
china_ng_gfw="$(echo ${custom_dns} | sed 's/:/#/g')"
msg="自定义DNS"
fi
local chnlist_param="${TMP_PATH}/chnlist"
[ -f "${RULES_PATH}/direct_host" ] && {
cat "${RULES_PATH}/direct_host" >> "${chnlist_param}"
echolog " | - [$?](chinadns-ng) 域名白名单合并到中国域名表"
}
sed -n 's/^ipset=\/\.\?\([^/]*\).*$/\1/p' "${RULES_PATH}/gfwlist.conf" | sort -u > "${TMP_PATH}/gfwlist.txt"
[ -f "${RULES_PATH}/proxy_host" ] && {
cat "${RULES_PATH}/proxy_host" >> "${TMP_PATH}/gfwlist.txt" && sort -u "${TMP_PATH}/gfwlist.txt" > "${TMP_PATH}/gfwlist2.txt" && mv -f "${TMP_PATH}/gfwlist2.txt" "${TMP_PATH}/gfwlist.txt"
local gfwlist_param="${TMP_PATH}/gfwlist.txt"
echolog " | - [$?](chinadns-ng) 代理域名表合并到防火墙域名表"
}
chnlist_param=${chnlist_param:+-m "${chnlist_param}" -M}
ln_start_bin "$(first_type chinadns-ng)" chinadns-ng "${TMP_PATH}/chinadns-ng.log" -v -b 0.0.0.0 -l "${china_ng_listen_port}" ${china_ng_chn:+-c "${china_ng_chn}"} ${chnlist_param} ${china_ng_gfw:+-t "${china_ng_gfw}"} ${gfwlist_param:+-g "${gfwlist_param}"} -f
echolog " + 过滤服务ChinaDNS-NG(:${china_ng_listen_port}) + ${msg}国内DNS${china_ng_chn:-D114.114.114.114}可信DNS${china_ng_gfw:-D8.8.8.8}"
#[ -n "${global}${chnlist}" ] && [ -z "${returnhome}" ] && TUN_DNS="${china_ng_gfw}"
}
}
[ "${use_udp_node_resolve_dns}" = "1" ] && echolog " * 要求代理 DNS 请求,如上游 DNS 非直连地址,确保 UDP 代理打开,并且已经正确转发!"
[ "${use_tcp_node_resolve_dns}" = "1" ] && echolog " * 请确认上游 DNS 支持 TCP 查询,如非直连地址,确保 TCP 代理打开,并且已经正确转发!"
}
add_dnsmasq() {
local global returnhome chnlist gfwlist fwd_dns items item servers msg
local fwd_dns items item servers msg
mkdir -p "${TMP_DNSMASQ_PATH}" "${DNSMASQ_PATH}" "/var/dnsmasq.d"
[ "$(config_t_get global_rules adblock 0)" = "1" ] && {
@ -886,15 +877,6 @@ add_dnsmasq() {
if [ "${DNS_MODE}" = "nonuse" ]; then
echolog " - 不对域名进行分流解析"
else
global=$(echo "${TCP_PROXY_MODE}${LOCALHOST_TCP_PROXY_MODE}${UDP_PROXY_MODE}${LOCALHOST_UDP_PROXY_MODE}" | grep "global")
returnhome=$(echo "${TCP_PROXY_MODE}${LOCALHOST_TCP_PROXY_MODE}${UDP_PROXY_MODE}${LOCALHOST_UDP_PROXY_MODE}" | grep "returnhome")
chnlist=$(echo "${TCP_PROXY_MODE}${LOCALHOST_TCP_PROXY_MODE}${UDP_PROXY_MODE}${LOCALHOST_UDP_PROXY_MODE}" | grep "chnroute")
gfwlist=$(echo "${TCP_PROXY_MODE}${LOCALHOST_TCP_PROXY_MODE}${UDP_PROXY_MODE}${LOCALHOST_UDP_PROXY_MODE}" | grep "gfwlist")
if [ "${USE_CHNLIST}" = "1" ] && [ -n "${gfwlist}" ]; then
USE_CHNLIST=0
fi
#始终用国内DNS解析节点域名
fwd_dns="${LOCAL_DNS}"
servers=$(uci show "${CONFIG}" | grep ".address=" | cut -d "'" -f 2)
@ -903,21 +885,26 @@ add_dnsmasq() {
#始终用国内DNS解析直连白名单列表
fwd_dns="${LOCAL_DNS}"
[ -n "$CHINADNS_NG" ] && unset fwd_dns
sort -u "${RULES_PATH}/direct_host" | gen_dnsmasq_items "whitelist" "${fwd_dns}" "${TMP_DNSMASQ_PATH}/01-direct_host.conf"
echolog " - [$?]域名白名单(whitelist)${fwd_dns:-默认}"
#当勾选使用chnlist仅当使用大陆白名单或回国模式
[ "${USE_CHNLIST}" = "1" ] && {
fwd_dns="${LOCAL_DNS}"
[ -n "${returnhome}" ] || [ -n "${chnlist}" ] && {
#[ -n "${global}" ] && unset fwd_dns
#如果使用Chinadns-NG直接交给它处理
[ "$CHINADNS_NG" = "1" ] && unset fwd_dns
#如果使用回国模式设置DNS为远程DNS。
[ -n "${returnhome}" ] && fwd_dns="${TUN_DNS}"
sort -u "${RULES_PATH}/chnlist" | gen_dnsmasq_items "chnroute" "${fwd_dns}" "${TMP_DNSMASQ_PATH}/02-chinalist_host.conf"
echolog " - [$?]中国域名表(chnroute)${fwd_dns:-默认}"
}
#始终使用远程DNS解析代理黑名单列表
fwd_dns="${TUN_DNS}"
[ -n "$CHINADNS_NG" ] && fwd_dns="${china_ng_gfw}"
[ -n "$CHINADNS_NG" ] && unset fwd_dns
sort -u "${RULES_PATH}/proxy_host" | gen_dnsmasq_items "blacklist" "${fwd_dns}" "${TMP_DNSMASQ_PATH}/99-proxy_host.conf"
echolog " - [$?]代理域名表(blacklist)${fwd_dns:-默认}"
#如果开启了通过代理订阅
[ "$(config_t_get global_subscribe subscribe_proxy 0)" = "1" ] && {
fwd_dns="${TUN_DNS}"
[ -n "$CHINADNS_NG" ] && fwd_dns="${china_ng_gfw}"
items=$(get_enabled_anonymous_secs "@subscribe_list")
for item in ${items}; do
host_from_url "$(config_n_get ${item} url)" | gen_dnsmasq_items "blacklist" "${fwd_dns}" "${TMP_DNSMASQ_PATH}/99-subscribe.conf"
done
echolog " - [$?]节点订阅域名(blacklist)${fwd_dns:-默认}"
}
#分流规则
@ -930,45 +917,32 @@ add_dnsmasq() {
[ "$shunt_node_id" = "nil" ] && continue
local shunt_node=$(config_n_get $shunt_node_id address nil)
[ "$shunt_node" = "nil" ] && continue
config_n_get $shunt_id domain_list | grep -v 'regexp:\|geosite:\|ext:' | sed 's/domain:\|full:\|//g' | tr -s "\r\n" "\n" | gen_dnsmasq_items "shuntlist" "${fwd_dns}" "${TMP_DNSMASQ_PATH}/99-shunt_host.conf"
echolog " - [$?]$shunt_id分流规则(shuntlist)${fwd_dns:-默认}"
config_n_get $shunt_id domain_list | grep -v 'regexp:\|geosite:\|ext:' | sed 's/domain:\|full:\|//g' | tr -s "\r\n" "\n" | sort -u | gen_dnsmasq_items "shuntlist" "${fwd_dns}" "${TMP_DNSMASQ_PATH}/998-shunt_host.conf"
done
echolog " - [$?]Xray分流规则(shuntlist)${fwd_dns:-默认}"
}
#始终使用远程DNS解析代理黑名单列表
fwd_dns="${TUN_DNS}"
#如果使用Chinadns-NG直接交给它处理
#[ "$CHINADNS_NG" = "1" ] && unset fwd_dns
sort -u "${RULES_PATH}/proxy_host" | gen_dnsmasq_items "blacklist" "${fwd_dns}" "${TMP_DNSMASQ_PATH}/99-proxy_host.conf"
echolog " - [$?]代理域名表(blacklist)${fwd_dns:-默认}"
#如果没有使用回国模式
[ -z "${returnhome}" ] && {
if [ -z "${returnhome}" ]; then
fwd_dns="${TUN_DNS}"
#如果使用Chinadns-NG直接交给它处理
#[ "$CHINADNS_NG" = "1" ] && unset fwd_dns
sort -u "${TMP_PATH}/gfwlist.txt" | gen_dnsmasq_items "gfwlist" "${fwd_dns}" "${TMP_DNSMASQ_PATH}/99-gfwlist.conf"
#sort -u "${TMP_PATH}/gfwlist.txt" | gen_dnsmasq_items "gfwlist,gfwlist6" "${fwd_dns}" "${TMP_DNSMASQ_PATH}/99-gfwlist.conf"
[ -n "$CHINADNS_NG" ] && fwd_dns="${china_ng_gfw}"
[ -n "$CHINADNS_NG" ] && unset fwd_dns
[ ! -f "${TMP_PATH}/gfwlist.txt" ] && sed -n 's/^ipset=\/\.\?\([^/]*\).*$/\1/p' "${RULES_PATH}/gfwlist.conf" | sort -u > "${TMP_PATH}/gfwlist.txt"
sort -u "${TMP_PATH}/gfwlist.txt" | gen_dnsmasq_items "gfwlist" "${fwd_dns}" "${TMP_DNSMASQ_PATH}/999-gfwlist.conf"
#sort -u "${TMP_PATH}/gfwlist.txt" | gen_dnsmasq_items "gfwlist,gfwlist6" "${fwd_dns}" "${TMP_DNSMASQ_PATH}/999-gfwlist.conf"
echolog " - [$?]防火墙域名表(gfwlist)${fwd_dns:-默认}"
}
#如果开启了通过代理订阅
[ "$(config_t_get global_subscribe subscribe_proxy 0)" = "1" ] && {
else
#回国模式
fwd_dns="${TUN_DNS}"
#如果使用Chinadns-NG直接交给它处理
#[ "$CHINADNS_NG" = "1" ] && unset fwd_dns
items=$(get_enabled_anonymous_secs "@subscribe_list")
for item in ${items}; do
host_from_url "$(config_n_get ${item} url)" | gen_dnsmasq_items "blacklist" "${fwd_dns}" "${TMP_DNSMASQ_PATH}/99-subscribe.conf"
echolog " - [$?]节点订阅域名,$(host_from_url $(config_n_get ${item} url))${fwd_dns:-默认}"
done
}
sort -u "${RULES_PATH}/chnlist" | gen_dnsmasq_items "chnroute" "${fwd_dns}" "${TMP_DNSMASQ_PATH}/02-chinalist_host.conf"
echolog " - [$?]中国域名表(chnroute)${fwd_dns:-默认}"
fi
fi
if [ "${DNS_MODE}" != "nouse" ]; then
echo "conf-dir=${TMP_DNSMASQ_PATH}" > "/var/dnsmasq.d/dnsmasq-${CONFIG}.conf"
if [ "${CHINADNS_NG}" = "0" ] && [ "${USE_CHNLIST}" = "0" ] && [ "${IS_DEFAULT_DNS}" = "1" ]; then
if [ -z "${CHINADNS_NG}" ] && [ "${IS_DEFAULT_DNS}" = "1" ]; then
echolog " - 不强制设置默认DNS"
return
else
@ -979,10 +953,9 @@ add_dnsmasq() {
[ -n "${returnhome}" ] && msg="中国列表"
[ -n "${global}" ] && msg="全局"
[ "${USE_CHNLIST}" = "1" ] && [ -z "${returnhome}" ] && [ -n "${chnlist}" ] && servers="${TUN_DNS}"
#直接交给Chinadns-ng处理
[ "$CHINADNS_NG" = "1" ] && {
servers="${TUN_DNS}" && msg="chinadns-ng"
#默认交给Chinadns-ng处理
[ -n "$CHINADNS_NG" ] && {
servers="${china_ng_listen}" && msg="chinadns-ng"
}
cat <<-EOF >> "/var/dnsmasq.d/dnsmasq-${CONFIG}.conf"

View File

@ -177,9 +177,9 @@ load_acl() {
msg2="${msg2}[$?]除${udp_no_redir_ports}外的"
}
msg2="${msg2}所有端口"
$ipt_m -A PSW $(comment "$remarks") -p udp $(factor $ip "-s") $(factor $mac "-m mac --mac-source") $(factor $UDP_REDIR_PORTS "-m multiport --dport") $(dst $IPSET_SHUNTLIST) $(REDIRECT $udp_port TPROXY)
$ipt_m -A PSW $(comment "$remarks") -p udp $(factor $ip "-s") $(factor $mac "-m mac --mac-source") $(factor $UDP_REDIR_PORTS "-m multiport --dport") $(dst $IPSET_BLACKLIST) $(REDIRECT $udp_port TPROXY)
$ipt_m -A PSW $(comment "$remarks") -p udp $(factor $ip "-s") $(factor $mac "-m mac --mac-source") $(factor $UDP_REDIR_PORTS "-m multiport --dport") $(get_redirect_ipt $udp_proxy_mode $udp_port TPROXY)
$ipt_m -A PSW $(comment "$remarks") -p udp $(factor $ip "-s") $(factor $mac "-m mac --mac-source") $(factor $udp_redir_ports "-m multiport --dport") $(dst $IPSET_SHUNTLIST) $(REDIRECT $udp_port TPROXY)
$ipt_m -A PSW $(comment "$remarks") -p udp $(factor $ip "-s") $(factor $mac "-m mac --mac-source") $(factor $udp_redir_ports "-m multiport --dport") $(dst $IPSET_BLACKLIST) $(REDIRECT $udp_port TPROXY)
$ipt_m -A PSW $(comment "$remarks") -p udp $(factor $ip "-s") $(factor $mac "-m mac --mac-source") $(factor $udp_redir_ports "-m multiport --dport") $(get_redirect_ipt $udp_proxy_mode $udp_port TPROXY)
}
echolog " - ${msg2}"
}
@ -190,8 +190,6 @@ load_acl() {
# 加载TCP默认代理模式
local ipt_tmp=$ipt_n
local is_tproxy msg
unset is_tproxy msg
if [ "$TCP_PROXY_MODE" != "disable" ]; then
[ "$TCP_NO_REDIR_PORTS" != "disable" ] && $ipt_tmp -A PSW $(comment "默认") -p tcp -m multiport --dport $TCP_NO_REDIR_PORTS -j RETURN
ipt_tmp=$ipt_n
@ -232,6 +230,7 @@ load_acl() {
}
fi
$ipt_m -A PSW $(comment "默认") -p udp -j RETURN
unset is_tproxy msg
}
filter_haproxy() {
@ -300,12 +299,12 @@ filter_node() {
msg2="直连代理"
}
$_ipt -I PSW_OUTPUT $ADD_INDEX $(comment "${address}:${port}") -p $stream -d $address --dport $port $dst_rule 2>/dev/null
#else
# msg2="已配置过的节点,"
else
msg2="已配置过的节点,"
fi
done
msg="[$?]$(echo ${2} | tr 'a-z' 'A-Z')${msg2}使用链${ADD_INDEX},节点(${type}${address}:${port}"
echolog " - ${msg}"
#echolog " - ${msg}"
}
local proxy_protocol=$(config_n_get $proxy_node protocol)
@ -397,16 +396,16 @@ add_firewall_rule() {
lan_ifname=$(uci -q -p /var/state get network.lan.ifname)
[ -n "$lan_ifname" ] && {
lan_ip=$(ip address show $lan_ifname | grep -w "inet" | awk '{print $2}')
echolog "本机网段互访直连:${lan_ip}"
#echolog "本机网段互访直连:${lan_ip}"
[ -n "$lan_ip" ] && ipset -! add $IPSET_LANIPLIST $lan_ip >/dev/null 2>&1 &
}
local ISP_DNS=$(cat $RESOLVFILE 2>/dev/null | grep -E -o "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+" | sort -u | grep -v 0.0.0.0 | grep -v 127.0.0.1)
[ -n "$ISP_DNS" ] && {
echolog "处理 ISP DNS 例外..."
#echolog "处理 ISP DNS 例外..."
for ispip in $ISP_DNS; do
ipset -! add $IPSET_WHITELIST $ispip >/dev/null 2>&1 &
echolog " - 追加到白名单:${ispip}"
#echolog " - 追加到白名单:${ispip}"
done
}
@ -517,7 +516,7 @@ add_firewall_rule() {
# 过滤Socks节点
[ "$SOCKS_ENABLED" = "1" ] && {
local ids=$(uci show $CONFIG | grep "=socks" | awk -F '.' '{print $2}' | awk -F '=' '{print $1}')
echolog "分析 Socks 服务所使用节点..."
#echolog "分析 Socks 服务所使用节点..."
local id enabled node port msg num
for id in $ids; do
enabled=$(config_n_get $id enabled 0)
@ -534,7 +533,7 @@ add_firewall_rule() {
filter_node $node TCP > /dev/null 2>&1 &
filter_node $node UDP > /dev/null 2>&1 &
fi
echolog " - ${msg}"
#echolog " - ${msg}"
done
}
@ -543,16 +542,13 @@ add_firewall_rule() {
for stream in TCP UDP; do
eval "node=\${${stream}_NODE}"
eval "port=\${${stream}_REDIR_PORT}"
echolog "分析 $stream 代理自动切换..."
#echolog "分析 $stream 代理自动切换..."
[ "$node" == "tcp" ] && [ "$stream" == "UDP" ] && {
eval "node=\${TCP_NODE}"
eval "port=\${TCP_REDIR_PORT}"
echolog " - 采用 TCP 代理的配置"
}
if [ "$node" != "nil" ]; then
filter_node $node $stream $port > /dev/null 2>&1 &
else
echolog " - 忽略无效的 $stream 代理自动切换"
fi
done

View File

@ -1,159 +0,0 @@
abc.com
abema.tv
acast.com
adblockplus.org
adswizz.com
agkn.com
akadns.net
akam.net
akamai.com
akamai.net
akamaiedge.net
akamaihd.net
akamaistream.net
akamaitech.net
akamaitechnologies.com
akamaitechnologies.fr
akamaized.net
amazon-adsystem.com
amazon.co.jp
amazon.co.uk
amazon.com
amazon.de
amazonvideo.com
amctv.com
bahamut.com.tw
beinsportsconnect.net
beinsportsconnect.tv
blinkbox.com
brightcove.com
caddyserver.com
cbs.com
cloudflare-dns.com
cloudfront.net
conviva.com
crackle.com
crunchyroll.com
crwdcntrl.net
cwtv.com
disney.com
disneyjunior.com
dns.google
dns.quad9.net
easylist-downloads.adblockplus.org
edgecastcdn.net
edgekey.net
edgesuite.net
fast.com
fig.bbc.co.uk
footprint.net
formyip.com
fox.com
gamer.com.tw
gandi.net
ggpht.com
github-production-release-asset-2e65be.s3.amazonaws.com
github.com
github.io
githubapp.com
githubassets.com
githubusercontent.com
gnews.org
go.com
google.com
google.com.hk
google.com.sg
google.com.tw
googleapis.com
googletagmanager.com
googleusercontent.com
googlevideo.com
gstatic.com
gvt2.com
happyon.jp
hbo.com
hbogo.com
hbonow.com
hinet.net
hulu.com
hulu.jp
huluad.com
huluim.com
hulustream.com
ifconfig.co
imrworldwide.com
ip2location.com
justmysocks.net
level3.net
line.me
llnwd.net
lovefilm.com
maxmind.com
mog.com
movetv.com
msi.com
mtv.com
mtvnservices.com
mytvsuper.com
naver.com
naver.jp
nbc.com
nbcuni.com
fast.com
netflix.com
netflix.com.edgesuite.net
netflixdnstest0.com
netflixdnstest1.com
netflixdnstest2.com
netflixdnstest3.com
netflixdnstest4.com
netflixdnstest5.com
netflixdnstest6.com
netflixdnstest7.com
netflixdnstest8.com
netflixdnstest9.com
netflix.net
nflxext.com
nflximg.com
nflximg.net
nflxso.net
nflxvideo.net
omtrdc.net
one.one.one.one
open.live.bbc.co.uk
openwrt.proxy.ustclug.org
openx.net
optus.com.au
optusnet.com.au
pandora.com
pbs.org
playstation.net
primevideo.com
pubmatic.com
pureapk.com
radiotime.com
sa.bbc.co.uk
sho.com
sling.com
southpark.cc.com
spike.com
srip.net
stripe.com
theplatform.com
tiktok.com
ttvnw.net
turner.com
turnin.com
tvb.com
twitch.tv
uplynk.com
v2fly.org
vudu.com
warnerbros.com
wdtvlive.com
www.bbc.co.uk
xboxlive.com
youtu.be
youtube.com
ytimg.com
zerotier.com

View File

@ -14,9 +14,9 @@ PKG_FLAGS:=essential
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://git.openwrt.org/project/opkg-lede.git
PKG_SOURCE_DATE:=2020-12-05
PKG_SOURCE_VERSION:=efb26a35e4e5446f135307c4ff7df9e9563c23a9
PKG_MIRROR_HASH:=9294140567f1b122a7229fc80ab1b70e167b478c1a3062e0b64631c189beeda5
PKG_SOURCE_DATE:=2020-12-24
PKG_SOURCE_VERSION:=9bbc7eae91edc3dbb020e2a50d51d9a3fbbf31ca
PKG_MIRROR_HASH:=baa32d1b381d0eb2e224f4742974581c6705c13814662442ebd1288a91c2d577
PKG_LICENSE:=GPL-2.0
PKG_LICENSE_FILES:=COPYING