mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-09-14 20:34:19 +08:00
Compare commits
27
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9534d467e6 | ||
|
|
9cea2cda79 | ||
|
|
69677c3a2c | ||
|
|
9144781d4d | ||
|
|
21f112ec93 | ||
|
|
775ba09ce3 | ||
|
|
08894271d3 | ||
|
|
a634f22688 | ||
|
|
b4995a5406 | ||
|
|
d52488b5e4 | ||
|
|
927801e4d4 | ||
|
|
0e12dc7181 | ||
|
|
c0a27cf1c0 | ||
|
|
a1c990abb0 | ||
|
|
e2649ca068 | ||
|
|
be6c172c5c | ||
|
|
6d9fb15446 | ||
|
|
7c2a43f834 | ||
|
|
5a79bf68df | ||
|
|
03d753ac18 | ||
|
|
519574f670 | ||
|
|
19082ade16 | ||
|
|
892c31204e | ||
|
|
7746d18420 | ||
|
|
2e456e0234 | ||
|
|
26deccb203 | ||
|
|
0518f32579 |
@@ -251,7 +251,7 @@ new file mode 100644
|
||||
index 000000000000..a00fff9c79b3
|
||||
--- /dev/null
|
||||
+++ b/luci-app-passwall/luasrc/view/passwall/global/status_bottom.htm
|
||||
@@ -0,0 +1,126 @@
|
||||
@@ -0,0 +1,131 @@
|
||||
+<style>
|
||||
+.pure-img {
|
||||
+ max-height: 100%;
|
||||
@@ -329,10 +329,13 @@ index 000000000000..a00fff9c79b3
|
||||
+const _ASSETS = '/luci-static/passwall/';
|
||||
+const CHECK_IP_URL = '<%=url([[admin]], [[services]], [[passwall]], [[ip]])%>';
|
||||
+
|
||||
+let mainContent = document.getElementById("maincontent");
|
||||
+let statusBar = document.querySelector(".status-bar");
|
||||
+
|
||||
+function resize() {
|
||||
+ statusBar.style.width = document.getElementById("maincontent").offsetWidth + 'px';
|
||||
+ wW = window.innerWidth;
|
||||
+ let lw = document.querySelector(".main-left, :root[data-layout='sidebar'] .fs-sidebar")?.offsetWidth ?? 5;
|
||||
+ statusBar.style.width = (wW - lw) + 'px';
|
||||
+ let flagElement = statusBar.querySelector(".flag");
|
||||
+ flagElement.style.width = (flagElement.offsetHeight / 3 * 4) + 'px';
|
||||
+
|
||||
@@ -376,7 +379,9 @@ index 000000000000..a00fff9c79b3
|
||||
+});
|
||||
+
|
||||
+window.addEventListener('resize', resize);
|
||||
+if (mainContent && window.getComputedStyle(mainContent).getPropertyValue("contain")=== "paint") {
|
||||
+document.body.appendChild(statusBar);
|
||||
+}
|
||||
+</script>
|
||||
|
||||
--- a/luci-app-passwall/root/usr/share/passwall/0_default_config
|
||||
|
||||
@@ -128,7 +128,7 @@ new file mode 100644
|
||||
index 000000000000..a00fff9c79b3
|
||||
--- /dev/null
|
||||
+++ b/luci-app-passwall2/luasrc/view/passwall2/global/status_bottom.htm
|
||||
@@ -0,0 +1,129 @@
|
||||
@@ -0,0 +1,134 @@
|
||||
+<style>
|
||||
+.pure-img {
|
||||
+ max-height: 100%;
|
||||
@@ -209,10 +209,13 @@ index 000000000000..a00fff9c79b3
|
||||
+const _ASSETS = '/luci-static/passwall2/';
|
||||
+const CHECK_IP_URL = '<%=url([[admin]], [[services]], [[passwall2]], [[ip]])%>';
|
||||
+
|
||||
+let mainContent = document.getElementById("maincontent");
|
||||
+let statusBar = document.querySelector(".status-bar");
|
||||
+
|
||||
+function resize() {
|
||||
+ statusBar.style.width = document.getElementById("maincontent").offsetWidth + 'px';
|
||||
+ wW = window.innerWidth;
|
||||
+ let lw = document.querySelector(".main-left, :root[data-layout='sidebar'] .fs-sidebar")?.offsetWidth ?? 5;
|
||||
+ statusBar.style.width = (wW - lw) + 'px';
|
||||
+ let flagElement = statusBar.querySelector(".flag");
|
||||
+ flagElement.style.width = (flagElement.offsetHeight / 3 * 4) + 'px';
|
||||
+
|
||||
@@ -256,5 +259,7 @@ index 000000000000..a00fff9c79b3
|
||||
+});
|
||||
+
|
||||
+window.addEventListener('resize', resize);
|
||||
+if (mainContent && window.getComputedStyle(mainContent).getPropertyValue("contain")=== "paint") {
|
||||
+document.body.appendChild(statusBar);
|
||||
+}
|
||||
+</script>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/luci-theme-footstrap/root/etc/config/footstrap
|
||||
+++ b/luci-theme-footstrap/root/etc/config/footstrap
|
||||
@@ -1,2 +1,6 @@
|
||||
@@ -1,2 +1,7 @@
|
||||
|
||||
config footstrap 'settings'
|
||||
+ option pattern 'a583df0ec986a6b8454f7be514e8cb32'
|
||||
|
||||
@@ -129,7 +129,7 @@ new file mode 100644
|
||||
index 000000000000..a00fff9c79b3
|
||||
--- /dev/null
|
||||
+++ b/luci-app-ssr-plus/luasrc/view/shadowsocksr/status_bottom.htm
|
||||
@@ -0,0 +1,129 @@
|
||||
@@ -0,0 +1,134 @@
|
||||
+<style>
|
||||
+.pure-img {
|
||||
+ max-height: 100%;
|
||||
@@ -210,10 +210,13 @@ index 000000000000..a00fff9c79b3
|
||||
+const _ASSETS = '/luci-static/shadowsocksr/';
|
||||
+const CHECK_IP_URL = '<%=url([[admin]], [[services]], [[shadowsocksr]], [[ip]])%>';
|
||||
+
|
||||
+let mainContent = document.getElementById("maincontent");
|
||||
+let statusBar = document.querySelector(".status-bar");
|
||||
+
|
||||
+function resize() {
|
||||
+ statusBar.style.width = document.getElementById("maincontent").offsetWidth + 'px';
|
||||
+ wW = window.innerWidth;
|
||||
+ let lw = document.querySelector(".main-left, :root[data-layout='sidebar'] .fs-sidebar")?.offsetWidth ?? 5;
|
||||
+ statusBar.style.width = (wW - lw) + 'px';
|
||||
+ let flagElement = statusBar.querySelector(".flag");
|
||||
+ flagElement.style.width = (flagElement.offsetHeight / 3 * 4) + 'px';
|
||||
+
|
||||
@@ -257,7 +260,9 @@ index 000000000000..a00fff9c79b3
|
||||
+});
|
||||
+
|
||||
+window.addEventListener('resize', resize);
|
||||
+if (mainContent && window.getComputedStyle(mainContent).getPropertyValue("contain")=== "paint") {
|
||||
+document.body.appendChild(statusBar);
|
||||
+}
|
||||
+</script>
|
||||
|
||||
--- a/luci-app-ssr-plus/root/etc/uci-defaults/luci-ssr-plus
|
||||
|
||||
@@ -448,7 +448,7 @@ jobs:
|
||||
- name: Apply patches
|
||||
run: |
|
||||
find ".github/diy/patches" -type f -name '*.patch' -print0 | sort -z | xargs -I % -t -0 -n 1 sh -c "patch -d './' --no-backup-if-mismatch -p1 -F 1 -i '%'" || (curl -k --data chat_id="${{ secrets.TELEGRAM_CHAT_ID }}" --data "text=❌ 软件包更新失败 😂 https://github.com/kiddin9/openwrt-packages/actions" "https://api.telegram.org/bot${{ secrets.TELEGRAM_TOKEN }}/sendMessage";exit 1)
|
||||
|
||||
#find ".github/diy/patches" -type f -name '*.patch' -print0 | sort -z | xargs -0 -t -n 1 git apply -p1 --recount --ignore-whitespace --unsafe-paths --verbose
|
||||
- name: Modify
|
||||
run: |
|
||||
shopt -s extglob
|
||||
|
||||
+3
-3
@@ -5,10 +5,10 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=dae
|
||||
PKG_VERSION:=2026.08.13
|
||||
PKG_RELEASE:=36
|
||||
PKG_VERSION:=2026.08.21
|
||||
PKG_RELEASE:=37
|
||||
|
||||
PKG_SOURCE:=dae-src-2026.08.13-0d20959710a0.tar.gz
|
||||
PKG_SOURCE:=dae-src-2026.08.21-8138f66f2c6d.tar.gz
|
||||
PKG_SOURCE_URL:=https://github.com/kenzok8/openwrt-daede/releases/download/dae-src
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_HASH:=skip
|
||||
|
||||
+3
-3
@@ -5,10 +5,10 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=daed
|
||||
PKG_VERSION:=2026.08.13
|
||||
PKG_RELEASE:=47
|
||||
PKG_VERSION:=2026.08.21
|
||||
PKG_RELEASE:=48
|
||||
|
||||
PKG_SOURCE:=daed-src-2026.08.13-4a38e0f66b3d.tar.gz
|
||||
PKG_SOURCE:=daed-src-2026.08.21-aeef51da973f.tar.gz
|
||||
PKG_SOURCE_URL:=https://github.com/kenzok8/openwrt-daede/releases/download/daed-src
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_HASH:=skip
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=internet-detector-mod-email
|
||||
PKG_VERSION:=1.7.3
|
||||
PKG_RELEASE:=3
|
||||
PKG_VERSION:=1.7.4
|
||||
PKG_RELEASE:=4
|
||||
PKG_MAINTAINER:=gSpot <https://github.com/gSpotx2f/luci-app-internet-detector>
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=internet-detector-mod-modem-restart
|
||||
PKG_VERSION:=1.7.3
|
||||
PKG_RELEASE:=3
|
||||
PKG_VERSION:=1.7.4
|
||||
PKG_RELEASE:=4
|
||||
PKG_MAINTAINER:=gSpot <https://github.com/gSpotx2f/luci-app-internet-detector>
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=internet-detector-mod-telegram
|
||||
PKG_VERSION:=1.7.3
|
||||
PKG_RELEASE:=3
|
||||
PKG_VERSION:=1.7.4
|
||||
PKG_RELEASE:=4
|
||||
PKG_MAINTAINER:=gSpot <https://github.com/gSpotx2f/luci-app-internet-detector>
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=internet-detector
|
||||
PKG_VERSION:=1.7.3
|
||||
PKG_RELEASE:=5
|
||||
PKG_VERSION:=1.7.4
|
||||
PKG_RELEASE:=6
|
||||
PKG_MAINTAINER:=gSpot <https://github.com/gSpotx2f/luci-app-internet-detector>
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
@@ -12,8 +12,8 @@ local uci = require("uci")
|
||||
-- Default settings
|
||||
|
||||
local InternetDetector = {
|
||||
appName = "internet-detector",
|
||||
libDir = "/usr/lib/lua",
|
||||
appName = "internet-detector",
|
||||
libDir = "/usr/lib/lua",
|
||||
logLevels = {
|
||||
emerg = { level = syslog.LOG_EMERG, num = 0 },
|
||||
alert = { level = syslog.LOG_ALERT, num = 1 },
|
||||
@@ -24,18 +24,32 @@ local InternetDetector = {
|
||||
info = { level = syslog.LOG_INFO, num = 6 },
|
||||
debug = { level = syslog.LOG_DEBUG, num = 7 },
|
||||
},
|
||||
pingCmd = "/bin/ping",
|
||||
pingParams = "-c 1",
|
||||
curlExec = "/usr/bin/curl",
|
||||
curlParams = '-s -g --no-keepalive --head --user-agent "Mozilla/5.0 (X11; Linux x86_64; rv:142.0) Gecko/20100101 Firefox/142.0"',
|
||||
mode = 0, -- 0: disabled, 1: Service, 2: UI detector
|
||||
loggingLevel = 6,
|
||||
hostname = "OpenWrt",
|
||||
uiRunTime = 30,
|
||||
noModules = false,
|
||||
uiAvailModules = { mod_public_ip = true },
|
||||
debug = false,
|
||||
serviceConfig = {
|
||||
pingCmd = "/bin/ping",
|
||||
pingParams = "-c 1",
|
||||
curlExec = "/usr/bin/curl",
|
||||
curlParams = '-s -g --no-keepalive --head --user-agent "Mozilla/5.0 (X11; Linux x86_64; rv:153.0) Gecko/20100101 Firefox/153.0"',
|
||||
curlHttpOkCodes = {
|
||||
[200] = true,
|
||||
[202] = true,
|
||||
[203] = true,
|
||||
[204] = true,
|
||||
[206] = true,
|
||||
[300] = true,
|
||||
[301] = true,
|
||||
[302] = true,
|
||||
[303] = true,
|
||||
[304] = true,
|
||||
[307] = true,
|
||||
[308] = true,
|
||||
},
|
||||
mode = 0, -- 0: disabled, 1: Service, 2: UI detector
|
||||
loggingLevel = 6,
|
||||
hostname = "OpenWrt",
|
||||
uiRunTime = 30,
|
||||
noModules = false,
|
||||
uiAvailModules = { mod_public_ip = true },
|
||||
debug = false,
|
||||
serviceConfig = {
|
||||
hosts = {
|
||||
[1] = "8.8.8.8",
|
||||
[2] = "1.1.1.1",
|
||||
@@ -43,7 +57,7 @@ local InternetDetector = {
|
||||
urls = {
|
||||
[1] = "https://www.google.com",
|
||||
},
|
||||
check_type = 0, -- 0: TCP, 1: ICMP
|
||||
check_type = 0, -- 0: TCP, 1: ICMP, 2: URL test
|
||||
tcp_port = 53,
|
||||
icmp_packet_size = 56,
|
||||
interval_up = 30,
|
||||
@@ -58,13 +72,13 @@ local InternetDetector = {
|
||||
iface = nil,
|
||||
instance = nil,
|
||||
},
|
||||
modules = {},
|
||||
parsedHosts = {},
|
||||
proxyAuthString = "",
|
||||
proxyString = "",
|
||||
uiCounter = 0,
|
||||
pidFile = nil,
|
||||
statusFile = nil,
|
||||
modules = {},
|
||||
parsedHosts = {},
|
||||
proxyAuthString = "",
|
||||
proxyString = "",
|
||||
uiCounter = 0,
|
||||
pidFile = nil,
|
||||
statusFile = nil,
|
||||
}
|
||||
InternetDetector.configDir = string.format("/etc/%s", InternetDetector.appName)
|
||||
InternetDetector.modulesDir = string.format(
|
||||
@@ -280,7 +294,6 @@ function InternetDetector:TCPConnectionToHost(host, port)
|
||||
if not ok then
|
||||
self:debugOutput(string.format(
|
||||
"SOCKET ERROR: %s, %s", errMsg, errNum))
|
||||
|
||||
unistd.close(sock)
|
||||
return retCode
|
||||
end
|
||||
@@ -380,7 +393,7 @@ function InternetDetector:checkURL(url)
|
||||
if retCode == 0 and data then
|
||||
httpCode = self:getHTTPCode(data)
|
||||
end
|
||||
return (httpCode ~= 200) and 1 or 0
|
||||
return (not self.curlHttpOkCodes[httpCode]) and 1 or 0
|
||||
end
|
||||
|
||||
function InternetDetector:exit()
|
||||
|
||||
@@ -27,7 +27,7 @@ local Module = {
|
||||
requestAttempts = 2,
|
||||
timeout = 3,
|
||||
curlExec = "/usr/bin/curl",
|
||||
curlParams = '-s -g --no-keepalive --user-agent "Mozilla/5.0 (X11; Linux x86_64; rv:142.0) Gecko/20100101 Firefox/142.0"',
|
||||
curlParams = '-s -g --no-keepalive --user-agent "Mozilla/5.0 (X11; Linux x86_64; rv:153.0) Gecko/20100101 Firefox/153.0"',
|
||||
providers = {
|
||||
opendns1 = {
|
||||
name = "opendns1", type = "dns", host = "myip.opendns.com",
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-internet-detector
|
||||
PKG_VERSION:=1.7.3
|
||||
PKG_RELEASE:=3
|
||||
PKG_VERSION:=1.7.4
|
||||
PKG_RELEASE:=4
|
||||
LUCI_TITLE:=LuCI support for internet-detector
|
||||
LUCI_DEPENDS:=+internet-detector
|
||||
LUCI_PKGARCH:=all
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-mosdns
|
||||
PKG_VERSION:=1.7.6
|
||||
PKG_RELEASE:=13
|
||||
PKG_VERSION:=1.7.7
|
||||
PKG_RELEASE:=14
|
||||
|
||||
LUCI_TITLE:=LuCI Support for mosdns
|
||||
LUCI_PKGARCH:=all
|
||||
|
||||
@@ -320,6 +320,30 @@ return view.extend({
|
||||
o.default = 86400;
|
||||
o.depends('cache', '1');
|
||||
|
||||
o = s.taboption('advanced', form.Flag, 'prefetch', _('Cache Prefetching'),
|
||||
_('Proactively refresh hot cache entries in the background before they expire.'));
|
||||
o.rmempty = false;
|
||||
o.default = false;
|
||||
o.depends('cache', '1');
|
||||
|
||||
o = s.taboption('advanced', form.Value, 'prefetch_before_expire', _('Prefetch Before Expire'),
|
||||
_('Prefetch when the remaining TTL is less than this value (in seconds).'));
|
||||
o.datatype = 'and(uinteger,min(1))';
|
||||
o.default = 10;
|
||||
o.depends('prefetch', '1');
|
||||
|
||||
o = s.taboption('advanced', form.Value, 'prefetch_min_hits', _('Prefetch Min Hits'),
|
||||
_('Minimum cache hits required since the last refresh to trigger a prefetch.'));
|
||||
o.datatype = 'and(uinteger,min(1))';
|
||||
o.default = 3;
|
||||
o.depends('prefetch', '1');
|
||||
|
||||
o = s.taboption('advanced', form.Value, 'prefetch_scan_interval', _('Prefetch Scan Interval'),
|
||||
_('Interval for the background thread to scan the cache for prefetching (in seconds).'));
|
||||
o.datatype = 'and(uinteger,min(1))';
|
||||
o.default = 5;
|
||||
o.depends('prefetch', '1');
|
||||
|
||||
o = s.taboption('advanced', form.Flag, 'dump_file', _('Cache Dump'),
|
||||
_('Save the cache locally and reload the cache dump on the next startup'));
|
||||
o.rmempty = false;
|
||||
|
||||
@@ -5,11 +5,11 @@ msgstr "Content-Type: text/plain; charset=UTF-8"
|
||||
msgid "360 Public DNS (DNS over HTTPS)"
|
||||
msgstr ""
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:356
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:380
|
||||
msgid "ADblock Source"
|
||||
msgstr ""
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:395
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:419
|
||||
msgid "API Listen port"
|
||||
msgstr ""
|
||||
|
||||
@@ -82,7 +82,7 @@ msgstr ""
|
||||
msgid "Apple domains optimization"
|
||||
msgstr ""
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:330
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:354
|
||||
msgid "Auto Save Cache Interval"
|
||||
msgstr ""
|
||||
|
||||
@@ -105,7 +105,7 @@ msgstr ""
|
||||
msgid "Basic Setting"
|
||||
msgstr ""
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:348
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:372
|
||||
msgid ""
|
||||
"Block DNS RR Type 65 records (HTTPS/SVCB, used for HTTP/3, ECH, etc.), force "
|
||||
"using only A/AAAA records."
|
||||
@@ -129,10 +129,14 @@ msgid ""
|
||||
"resolvers you specify as upstreams"
|
||||
msgstr ""
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:323
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:347
|
||||
msgid "Cache Dump"
|
||||
msgstr ""
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:323
|
||||
msgid "Cache Prefetching"
|
||||
msgstr ""
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/update.js:150
|
||||
msgid "Check And Update"
|
||||
msgstr ""
|
||||
@@ -178,7 +182,7 @@ msgstr ""
|
||||
msgid "CloudFlare Public DNS (1.1.1.1)"
|
||||
msgstr ""
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:380
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:404
|
||||
msgid "Cloudflare IP Ranges"
|
||||
msgstr ""
|
||||
|
||||
@@ -198,7 +202,7 @@ msgstr ""
|
||||
msgid "Config File"
|
||||
msgstr ""
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:426
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:450
|
||||
msgid "Configuration Editor"
|
||||
msgstr ""
|
||||
|
||||
@@ -216,7 +220,7 @@ msgid ""
|
||||
"supports domain matching rules)."
|
||||
msgstr ""
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:375
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:399
|
||||
msgid "Custom IP"
|
||||
msgstr ""
|
||||
|
||||
@@ -258,7 +262,7 @@ msgstr ""
|
||||
msgid "Default Config"
|
||||
msgstr ""
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:347
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:371
|
||||
msgid "Disable RR Type 65 (HTTPS/SVCB)"
|
||||
msgstr ""
|
||||
|
||||
@@ -280,7 +284,7 @@ msgstr ""
|
||||
msgid "Enable Auto Database Update"
|
||||
msgstr ""
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:352
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:376
|
||||
msgid "Enable DNS ADblock"
|
||||
msgstr ""
|
||||
|
||||
@@ -302,15 +306,15 @@ msgid "Enable this option fallback policy forces forwarding to remote DNS"
|
||||
msgstr ""
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:142
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:368
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:392
|
||||
msgid "Enabled"
|
||||
msgstr ""
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:453
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:477
|
||||
msgid "Enter the GeoIP.dat category to be exported, Allow add multiple tags"
|
||||
msgstr ""
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:448
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:472
|
||||
msgid "Enter the GeoSite.dat category to be exported, Allow add multiple tags"
|
||||
msgstr ""
|
||||
|
||||
@@ -350,8 +354,8 @@ msgstr ""
|
||||
msgid "Every Wednesday"
|
||||
msgstr ""
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:449
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:454
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:473
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:478
|
||||
msgid "Export directory: /var/mosdns"
|
||||
msgstr ""
|
||||
|
||||
@@ -363,7 +367,7 @@ msgstr ""
|
||||
msgid "Failed to start update."
|
||||
msgstr ""
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:403
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:427
|
||||
msgid "Flush DNS Cache"
|
||||
msgstr ""
|
||||
|
||||
@@ -375,7 +379,7 @@ msgstr ""
|
||||
msgid "Flushing DNS Cache Success."
|
||||
msgstr ""
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:401
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:425
|
||||
msgid ""
|
||||
"Flushing DNS Cache will clear any IP addresses or DNS records from MosDNS "
|
||||
"cache."
|
||||
@@ -411,7 +415,7 @@ msgstr ""
|
||||
msgid "GeoData Export"
|
||||
msgstr ""
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:452
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:476
|
||||
msgid "GeoIP Tags"
|
||||
msgstr ""
|
||||
|
||||
@@ -419,7 +423,7 @@ msgstr ""
|
||||
msgid "GeoIP Type"
|
||||
msgstr ""
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:447
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:471
|
||||
msgid "GeoSite Tags"
|
||||
msgstr ""
|
||||
|
||||
@@ -458,7 +462,7 @@ msgstr ""
|
||||
msgid "IP Address"
|
||||
msgstr ""
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:381
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:405
|
||||
msgid ""
|
||||
"IPv4 CIDR: <a href=\"https://www.cloudflare.com/ips-v4\" target=\"_blank"
|
||||
"\">https://www.cloudflare.com/ips-v4</a> <br /> IPv6 CIDR: <a href=\"https://"
|
||||
@@ -486,6 +490,12 @@ msgstr ""
|
||||
msgid "Info"
|
||||
msgstr ""
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:342
|
||||
msgid ""
|
||||
"Interval for the background thread to scan the cache for prefetching (in "
|
||||
"seconds)."
|
||||
msgstr ""
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:317
|
||||
msgid "Lazy Cache TTL"
|
||||
msgstr ""
|
||||
@@ -527,28 +537,33 @@ msgstr ""
|
||||
msgid "Logs"
|
||||
msgstr ""
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:369
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:393
|
||||
msgid ""
|
||||
"Match the parsing result with the Cloudflare IP ranges, and when there is a "
|
||||
"successful match, use the 'Custom IP' as the parsing result (experimental "
|
||||
"feature)"
|
||||
msgstr ""
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:341
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:365
|
||||
msgid "Maximum TTL"
|
||||
msgstr ""
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:335
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:359
|
||||
msgid "Minimum TTL"
|
||||
msgstr ""
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:342
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:336
|
||||
msgid ""
|
||||
"Minimum cache hits required since the last refresh to trigger a prefetch."
|
||||
msgstr ""
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:366
|
||||
msgid ""
|
||||
"Modify the Maximum TTL value (seconds) for DNS answer results, 0 indicating "
|
||||
"no modification"
|
||||
msgstr ""
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:336
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:360
|
||||
msgid ""
|
||||
"Modify the Minimum TTL value (seconds) for DNS answer results, 0 indicating "
|
||||
"no modification"
|
||||
@@ -589,10 +604,31 @@ msgstr ""
|
||||
msgid "Please wait, this may take a few moments..."
|
||||
msgstr ""
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:329
|
||||
msgid "Prefetch Before Expire"
|
||||
msgstr ""
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:335
|
||||
msgid "Prefetch Min Hits"
|
||||
msgstr ""
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:341
|
||||
msgid "Prefetch Scan Interval"
|
||||
msgstr ""
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:330
|
||||
msgid "Prefetch when the remaining TTL is less than this value (in seconds)."
|
||||
msgstr ""
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:301
|
||||
msgid "Prevent DNS Leaks"
|
||||
msgstr ""
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:324
|
||||
msgid ""
|
||||
"Proactively refresh hot cache entries in the background before they expire."
|
||||
msgstr ""
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:227
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:244
|
||||
msgid "Quad9 Public DNS (149.112.112.112)"
|
||||
@@ -637,7 +673,7 @@ msgstr ""
|
||||
msgid "Rules"
|
||||
msgstr ""
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:324
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:348
|
||||
msgid "Save the cache locally and reload the cache dump on the next startup"
|
||||
msgstr ""
|
||||
|
||||
@@ -653,7 +689,7 @@ msgstr ""
|
||||
msgid "Streaming Media DNS server"
|
||||
msgstr ""
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:359
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:383
|
||||
msgid "Support for local files, such as: file:///var/mosdns/example.txt"
|
||||
msgstr ""
|
||||
|
||||
@@ -686,7 +722,7 @@ msgid ""
|
||||
"server)"
|
||||
msgstr ""
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:427
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:451
|
||||
msgid ""
|
||||
"This is the content of the file '/etc/mosdns/config_custom.yaml' from which "
|
||||
"your MosDNS configuration will be generated. Only accepts configuration "
|
||||
@@ -701,7 +737,7 @@ msgstr ""
|
||||
msgid "TrafficRoute Public DNS (180.184.2.2)"
|
||||
msgstr ""
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:442
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:466
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/rules.js:43
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/rules.js:48
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/rules.js:67
|
||||
@@ -765,7 +801,7 @@ msgid ""
|
||||
"domain matching rules)."
|
||||
msgstr ""
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:357
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:381
|
||||
msgid ""
|
||||
"When using custom rule sources, please use rule types supported by MosDNS "
|
||||
"(domain list or AdGuardHome rules)."
|
||||
|
||||
@@ -15,11 +15,11 @@ msgstr ""
|
||||
msgid "360 Public DNS (DNS over HTTPS)"
|
||||
msgstr "360 安全 DNS(DNS over HTTPS)"
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:356
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:380
|
||||
msgid "ADblock Source"
|
||||
msgstr "广告过滤规则来源"
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:395
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:419
|
||||
msgid "API Listen port"
|
||||
msgstr "API 监听端口"
|
||||
|
||||
@@ -97,7 +97,7 @@ msgstr "另一个更新正在进行中。"
|
||||
msgid "Apple domains optimization"
|
||||
msgstr "Apple 域名解析优化"
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:330
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:354
|
||||
msgid "Auto Save Cache Interval"
|
||||
msgstr "自动保存缓存间隔(秒)"
|
||||
|
||||
@@ -120,7 +120,7 @@ msgstr "基本选项"
|
||||
msgid "Basic Setting"
|
||||
msgstr "基本设置"
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:348
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:372
|
||||
msgid ""
|
||||
"Block DNS RR Type 65 records (HTTPS/SVCB, used for HTTP/3, ECH, etc.), force "
|
||||
"using only A/AAAA records."
|
||||
@@ -146,10 +146,14 @@ msgid ""
|
||||
"resolvers you specify as upstreams"
|
||||
msgstr "Bootstrap DNS 服务器用于解析您指定为上游的 DoH / DoT 解析器的 IP 地址"
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:323
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:347
|
||||
msgid "Cache Dump"
|
||||
msgstr "自动保存缓存"
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:323
|
||||
msgid "Cache Prefetching"
|
||||
msgstr "缓存预读"
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/update.js:150
|
||||
msgid "Check And Update"
|
||||
msgstr "检查并更新"
|
||||
@@ -195,7 +199,7 @@ msgstr "CloudFlare 公共 DNS(1.0.0.1)"
|
||||
msgid "CloudFlare Public DNS (1.1.1.1)"
|
||||
msgstr "CloudFlare 公共 DNS(1.1.1.1)"
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:380
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:404
|
||||
msgid "Cloudflare IP Ranges"
|
||||
msgstr "Cloudflare IP 范围"
|
||||
|
||||
@@ -215,7 +219,7 @@ msgstr "DNS 服务器并发数(默认 2)"
|
||||
msgid "Config File"
|
||||
msgstr "配置文件"
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:426
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:450
|
||||
msgid "Configuration Editor"
|
||||
msgstr "配置编辑器"
|
||||
|
||||
@@ -234,7 +238,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"自定义 Hosts 重写,如:baidu.com 10.0.0.1(每个规则一行,支持域名匹配规则)"
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:375
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:399
|
||||
msgid "Custom IP"
|
||||
msgstr "自选 IP"
|
||||
|
||||
@@ -276,7 +280,7 @@ msgstr "调试"
|
||||
msgid "Default Config"
|
||||
msgstr "内置预设"
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:347
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:371
|
||||
msgid "Disable RR Type 65 (HTTPS/SVCB)"
|
||||
msgstr "禁用 RR Type 65 (HTTPS/SVCB)"
|
||||
|
||||
@@ -299,7 +303,7 @@ msgstr "DoH/TCP/DoT 连接复用空闲保持时间(默认 30 秒)"
|
||||
msgid "Enable Auto Database Update"
|
||||
msgstr "启用自动更新"
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:352
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:376
|
||||
msgid "Enable DNS ADblock"
|
||||
msgstr "启用 DNS 广告过滤"
|
||||
|
||||
@@ -321,15 +325,15 @@ msgid "Enable this option fallback policy forces forwarding to remote DNS"
|
||||
msgstr "启用此选项 fallback 策略会强制转发到远程 DNS"
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:142
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:368
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:392
|
||||
msgid "Enabled"
|
||||
msgstr "启用"
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:453
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:477
|
||||
msgid "Enter the GeoIP.dat category to be exported, Allow add multiple tags"
|
||||
msgstr "输入需要导出的 GeoIP.dat 类别条目,允许添加多个标签"
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:448
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:472
|
||||
msgid "Enter the GeoSite.dat category to be exported, Allow add multiple tags"
|
||||
msgstr "填写需要导出的 GeoSite.dat 类别条目,允许添加多个标签"
|
||||
|
||||
@@ -369,8 +373,8 @@ msgstr "每周二"
|
||||
msgid "Every Wednesday"
|
||||
msgstr "每周三"
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:449
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:454
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:473
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:478
|
||||
msgid "Export directory: /var/mosdns"
|
||||
msgstr "导出目录:/var/mosdns"
|
||||
|
||||
@@ -382,7 +386,7 @@ msgstr "清理日志失败:%s"
|
||||
msgid "Failed to start update."
|
||||
msgstr "启动更新失败"
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:403
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:427
|
||||
msgid "Flush DNS Cache"
|
||||
msgstr "刷新 DNS 缓存"
|
||||
|
||||
@@ -394,7 +398,7 @@ msgstr "刷新 DNS 缓存失败,请检查 MosDNS 状态是否在运行中。"
|
||||
msgid "Flushing DNS Cache Success."
|
||||
msgstr "刷新 DNS 缓存成功"
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:401
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:425
|
||||
msgid ""
|
||||
"Flushing DNS Cache will clear any IP addresses or DNS records from MosDNS "
|
||||
"cache."
|
||||
@@ -430,7 +434,7 @@ msgstr "全量:包含所有国家和私有 IP 地址。"
|
||||
msgid "GeoData Export"
|
||||
msgstr "GeoData 导出"
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:452
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:476
|
||||
msgid "GeoIP Tags"
|
||||
msgstr "GeoIP 标签"
|
||||
|
||||
@@ -438,7 +442,7 @@ msgstr "GeoIP 标签"
|
||||
msgid "GeoIP Type"
|
||||
msgstr "GeoIP 类型"
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:447
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:471
|
||||
msgid "GeoSite Tags"
|
||||
msgstr "GeoSite 标签"
|
||||
|
||||
@@ -477,7 +481,7 @@ msgstr ""
|
||||
msgid "IP Address"
|
||||
msgstr "IP 地址"
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:381
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:405
|
||||
msgid ""
|
||||
"IPv4 CIDR: <a href=\"https://www.cloudflare.com/ips-v4\" target=\"_blank"
|
||||
"\">https://www.cloudflare.com/ips-v4</a> <br /> IPv6 CIDR: <a href=\"https://"
|
||||
@@ -505,6 +509,12 @@ msgstr "空闲超时"
|
||||
msgid "Info"
|
||||
msgstr "信息"
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:342
|
||||
msgid ""
|
||||
"Interval for the background thread to scan the cache for prefetching (in "
|
||||
"seconds)."
|
||||
msgstr "后台线程扫描缓存以进行预取的时间间隔(单位:秒)"
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:317
|
||||
msgid "Lazy Cache TTL"
|
||||
msgstr "乐观缓存 TTL"
|
||||
@@ -546,7 +556,7 @@ msgstr "日志等级"
|
||||
msgid "Logs"
|
||||
msgstr "日志"
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:369
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:393
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
"Match the parsing result with the Cloudflare IP ranges, and when there is a "
|
||||
@@ -556,21 +566,26 @@ msgstr ""
|
||||
"将解析结果与 Cloudflare IP 范围进行匹配,当匹配成功时,使用 “自选 IP” 作为解"
|
||||
"析结果(实验性功能)"
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:341
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:365
|
||||
msgid "Maximum TTL"
|
||||
msgstr "覆盖最大 TTL 值(默认 0)"
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:335
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:359
|
||||
msgid "Minimum TTL"
|
||||
msgstr "覆盖最小 TTL 值(默认 0)"
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:342
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:336
|
||||
msgid ""
|
||||
"Minimum cache hits required since the last refresh to trigger a prefetch."
|
||||
msgstr "触发预读所需的最小缓存命中次数(自上次刷新起)"
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:366
|
||||
msgid ""
|
||||
"Modify the Maximum TTL value (seconds) for DNS answer results, 0 indicating "
|
||||
"no modification"
|
||||
msgstr "修改 DNS 应答结果的最大 TTL 值(秒),0 表示不修改"
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:336
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:360
|
||||
msgid ""
|
||||
"Modify the Minimum TTL value (seconds) for DNS answer results, 0 indicating "
|
||||
"no modification"
|
||||
@@ -613,10 +628,31 @@ msgstr ""
|
||||
msgid "Please wait, this may take a few moments..."
|
||||
msgstr "请稍候,这可能需要一点时间..."
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:329
|
||||
msgid "Prefetch Before Expire"
|
||||
msgstr "预读触发阈值"
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:335
|
||||
msgid "Prefetch Min Hits"
|
||||
msgstr "预读最小命中次数"
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:341
|
||||
msgid "Prefetch Scan Interval"
|
||||
msgstr "预读扫描周期"
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:330
|
||||
msgid "Prefetch when the remaining TTL is less than this value (in seconds)."
|
||||
msgstr "当剩余 TTL 小于此值(秒)时触发预读"
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:301
|
||||
msgid "Prevent DNS Leaks"
|
||||
msgstr "防止 DNS 泄漏"
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:324
|
||||
msgid ""
|
||||
"Proactively refresh hot cache entries in the background before they expire."
|
||||
msgstr "在缓存到期前,后台主动预读并刷新高频访问的 DNS 记录"
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:227
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:244
|
||||
msgid "Quad9 Public DNS (149.112.112.112)"
|
||||
@@ -663,7 +699,7 @@ msgstr "自定义规则列表"
|
||||
msgid "Rules"
|
||||
msgstr "规则列表"
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:324
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:348
|
||||
msgid "Save the cache locally and reload the cache dump on the next startup"
|
||||
msgstr "保存缓存到本地文件,以供下次启动时重新载入使用"
|
||||
|
||||
@@ -679,7 +715,7 @@ msgstr "流媒体"
|
||||
msgid "Streaming Media DNS server"
|
||||
msgstr "流媒体 DNS 服务器"
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:359
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:383
|
||||
msgid "Support for local files, such as: file:///var/mosdns/example.txt"
|
||||
msgstr "支持本地文件,例如:file:///var/mosdns/example.txt"
|
||||
|
||||
@@ -714,7 +750,7 @@ msgstr ""
|
||||
"此功能通常在使用自建 DNS 服务器作为 远程 / 流媒体 DNS 上游时使用(需要上游服"
|
||||
"务器的支持)"
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:427
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:451
|
||||
msgid ""
|
||||
"This is the content of the file '/etc/mosdns/config_custom.yaml' from which "
|
||||
"your MosDNS configuration will be generated. Only accepts configuration "
|
||||
@@ -731,7 +767,7 @@ msgstr "火山引擎公共 DNS(180.184.1.1)"
|
||||
msgid "TrafficRoute Public DNS (180.184.2.2)"
|
||||
msgstr "火山引擎公共 DNS(180.184.2.2)"
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:442
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:466
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/rules.js:43
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/rules.js:48
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/rules.js:67
|
||||
@@ -797,7 +833,7 @@ msgstr ""
|
||||
"启用 “自定义流媒体 DNS” 时,加入的域名始终使用 “流媒体 DNS 服务器” 进行解析"
|
||||
"(每个域名一行,支持域名匹配规则)"
|
||||
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:357
|
||||
#: luci-app-mosdns/htdocs/luci-static/resources/view/mosdns/basic.js:381
|
||||
msgid ""
|
||||
"When using custom rule sources, please use rule types supported by MosDNS "
|
||||
"(domain list or AdGuardHome rules)."
|
||||
|
||||
@@ -22,6 +22,10 @@ get_config() {
|
||||
config_get lazy_cache_ttl $1 lazy_cache_ttl 86400
|
||||
config_get dump_file $1 dump_file 0
|
||||
config_get dump_interval $1 dump_interval 3600
|
||||
config_get prefetch $1 prefetch 0
|
||||
config_get prefetch_before_expire $1 prefetch_before_expire 10
|
||||
config_get prefetch_min_hits $1 prefetch_min_hits 3
|
||||
config_get prefetch_scan_interval $1 prefetch_scan_interval 5
|
||||
config_get enable_pipeline $1 enable_pipeline 0
|
||||
config_get geo_auto_update $1 geo_auto_update 0
|
||||
config_get geo_update_day_time $1 geo_update_day_time 2
|
||||
@@ -232,6 +236,12 @@ generate_config() {
|
||||
json_add_string "dump_file" "/etc/mosdns/cache.dump"
|
||||
json_add_int "dump_interval" "$dump_interval"
|
||||
}
|
||||
[ "$prefetch" -eq 1 ] && {
|
||||
json_add_boolean "prefetch" 1
|
||||
json_add_int "prefetch_before_expire" "$prefetch_before_expire"
|
||||
json_add_int "prefetch_min_hits" "$prefetch_min_hits"
|
||||
json_add_int "prefetch_scan_interval" "$prefetch_scan_interval"
|
||||
}
|
||||
json_close_object
|
||||
json_close_object
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-passwall
|
||||
PKG_VERSION:=26.8.19
|
||||
PKG_RELEASE:=233
|
||||
PKG_RELEASE:=238
|
||||
PKG_PO_VERSION:=$(PKG_VERSION)
|
||||
|
||||
PKG_CONFIG_DEPENDS:= \
|
||||
|
||||
@@ -250,57 +250,39 @@ end
|
||||
function get_now_use_node()
|
||||
local path = api.TMP_PATH .. "/acl/default"
|
||||
local e = {}
|
||||
local tcp_node = api.get_cache_var("ACL_GLOBAL_TCP_node")
|
||||
if tcp_node then
|
||||
e["TCP"] = tcp_node
|
||||
end
|
||||
local udp_node = api.get_cache_var("ACL_GLOBAL_UDP_node")
|
||||
if udp_node then
|
||||
e["UDP"] = udp_node
|
||||
local node = api.get_cache_var("ACL_GLOBAL_node")
|
||||
if node then
|
||||
e["global"] = node
|
||||
end
|
||||
http_write_json(e)
|
||||
end
|
||||
|
||||
function get_redir_log()
|
||||
local name = http.formvalue("name")
|
||||
local proto = http.formvalue("proto"):upper()
|
||||
local path = api.TMP_PATH .. "/acl/" .. name
|
||||
local id = http.formvalue("id")
|
||||
local path = api.TMP_PATH .. "/acl/" .. id
|
||||
|
||||
local function alert(msg)
|
||||
http.write(string.format("<script>alert('%s');window.close();</script>", i18n.translate(msg)))
|
||||
end
|
||||
|
||||
if name == "default" then
|
||||
if proto == "UDP" and (uci_get("@global[0]", "udp_node") or "nil") == "tcp" and not fs.access(path .. "/" .. proto .. ".log") then
|
||||
proto = "TCP"
|
||||
end
|
||||
else
|
||||
local global_tcp = uci_get("@global[0]", "tcp_node") or "nil"
|
||||
local global_udp = uci_get("@global[0]", "udp_node") or "nil"
|
||||
local acl_tcp = uci_get(name, "tcp_node") or "nil"
|
||||
local acl_udp = uci_get(name, "udp_node") or "nil"
|
||||
local name = "global"
|
||||
if id and id ~= "default" then
|
||||
local global_node = uci_get("@global[0]", "node") or "nil"
|
||||
local acl_node = uci_get(id, "node") or "nil"
|
||||
local global_enabled = uci_get("@global[0]", "enabled") == "1"
|
||||
if proto == "TCP" and acl_tcp == global_tcp and global_enabled then
|
||||
if acl_node == global_node and global_enabled then
|
||||
path = api.TMP_PATH .. "/acl/default"
|
||||
if uci_get("@global[0]", "log_tcp") ~= "1" then
|
||||
if uci_get("@global[0]", "log_node") ~= "1" then
|
||||
alert("The access control node is the same as the global node. Please enable global logging.")
|
||||
return
|
||||
end
|
||||
end
|
||||
if proto == "UDP" and acl_udp == global_udp and global_enabled then
|
||||
path = api.TMP_PATH .. "/acl/default"
|
||||
if uci_get("@global[0]", "log_udp") ~= "1" then
|
||||
alert("The access control node is the same as the global node. Please enable global logging.")
|
||||
return
|
||||
end
|
||||
end
|
||||
if proto == "UDP" and acl_udp == "tcp" and not fs.access(path .. "/" .. proto .. ".log") then
|
||||
proto = "TCP"
|
||||
else
|
||||
name = "node"
|
||||
end
|
||||
end
|
||||
|
||||
if fs.access(path .. "/" .. proto .. ".log") then
|
||||
local content = luci.sys.exec("tail -n 19999 ".. path .. "/" .. proto .. ".log")
|
||||
if fs.access(path .. "/" .. name .. ".log") then
|
||||
local content = luci.sys.exec("tail -n 5000 ".. path .. "/" .. name .. ".log")
|
||||
content = content:gsub("\n", "<br />")
|
||||
http.write(content)
|
||||
else
|
||||
@@ -312,7 +294,7 @@ function get_socks_log()
|
||||
local name = http.formvalue("name")
|
||||
local path = api.TMP_PATH .. "/" .. name .. ".log"
|
||||
if fs.access(path) then
|
||||
local content = luci.sys.exec("cat ".. path)
|
||||
local content = luci.sys.exec("tail -n 5000 ".. path)
|
||||
content = content:gsub("\n", "<br />")
|
||||
http.write(content)
|
||||
else
|
||||
@@ -324,9 +306,9 @@ function get_chinadns_log()
|
||||
local flag = http.formvalue("flag")
|
||||
local path = api.TMP_PATH .. "/acl/" .. flag .. "/chinadns_ng.log"
|
||||
if flag ~= "default" then
|
||||
local global_tcp = uci_get("@global[0]", "tcp_node") or "nil"
|
||||
local acl_tcp = uci_get(flag, "tcp_node") or "nil"
|
||||
if acl_tcp == global_tcp and uci_get("@global[0]", "enabled") == "1" then
|
||||
local global_node = uci_get("@global[0]", "node") or "nil"
|
||||
local acl_node = uci_get(flag, "node") or "nil"
|
||||
if acl_node == global_node and uci_get("@global[0]", "enabled") == "1" then
|
||||
path = api.TMP_PATH .. "/acl/default/chinadns_ng.log"
|
||||
if uci_get("@global[0]", "log_chinadns_ng") ~= "1" then
|
||||
http.write(string.format("<script>alert('%s');window.close();</script>", i18n.translate("The access control node is the same as the global node. Please enable global logging.")))
|
||||
@@ -334,7 +316,6 @@ function get_chinadns_log()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if fs.access(path) then
|
||||
local content = luci.sys.exec("tail -n 5000 ".. path)
|
||||
content = content:gsub("\n", "<br />")
|
||||
@@ -442,22 +423,29 @@ function index_status()
|
||||
|
||||
e.haproxy_status = "-1"
|
||||
if api.is_finded("haproxy") then
|
||||
e.haproxy_status = (luci.sys.call("/bin/busybox top -bn1 | grep -v grep | grep '%s/bin/' | grep haproxy >/dev/null" % appname) == 0) and "0" or "1"
|
||||
e.haproxy_status = (luci.sys.call("/bin/busybox top -bn1 | grep -v 'grep' | grep '%s/bin/' | grep haproxy >/dev/null" % appname) == 0) and "0" or "1"
|
||||
end
|
||||
|
||||
e["tcp_node_status"] = luci.sys.call("/bin/busybox top -bn1 | grep -v 'grep' | grep '%s/bin/' | grep 'default' | grep 'TCP' >/dev/null" % api.TMP_PATH) == 0
|
||||
|
||||
if (uci_get("@global[0]", "udp_node") or "nil") == "tcp" then
|
||||
e["udp_node_status"] = e["tcp_node_status"]
|
||||
else
|
||||
e["udp_node_status"] = luci.sys.call("/bin/busybox top -bn1 | grep -v 'grep' | grep '%s/bin/' | grep 'default' | grep 'UDP' >/dev/null" % api.TMP_PATH) == 0
|
||||
if api.get_cache_var("ENABLED_DEFAULT_ACL") == "1" then
|
||||
local has_tproxy = api.get_cache_var("HAS_TPROXY")
|
||||
if not has_tproxy then
|
||||
local handle = io.popen("lsmod")
|
||||
local mods = handle and handle:read("*a") or ""
|
||||
if handle then handle:close() end
|
||||
has_tproxy = (mods:find("TPROXY") or mods:find("nft_tproxy")) and "1" or "0"
|
||||
api.set_cache_var("HAS_TPROXY", has_tproxy)
|
||||
end
|
||||
e["tcp_status"] = luci.sys.call("/bin/busybox top -bn1 | grep -v 'grep' | grep '%s/bin/' | grep 'default' | grep 'global' >/dev/null" % api.TMP_PATH) == 0
|
||||
if has_tproxy == "1" then
|
||||
e["udp_status"] = luci.sys.call("/bin/busybox top -bn1 | grep -v -E 'grep|naive' | grep '%s/bin/' | grep 'default' | grep 'global' >/dev/null" % api.TMP_PATH) == 0
|
||||
end
|
||||
end
|
||||
http_write_json(e)
|
||||
end
|
||||
|
||||
function haproxy_status()
|
||||
local e = {}
|
||||
e["status"] = luci.sys.call("/bin/busybox top -bn1 | grep -v grep | grep '%s/bin/' | grep haproxy >/dev/null" % appname) == 0
|
||||
e["status"] = luci.sys.call("/bin/busybox top -bn1 | grep -v 'grep' | grep '%s/bin/' | grep haproxy >/dev/null" % appname) == 0
|
||||
http_write_json(e)
|
||||
end
|
||||
|
||||
@@ -485,7 +473,7 @@ function connect_status()
|
||||
local gfw_list = uci_get("@global[0]", "use_gfw_list") or "1"
|
||||
local proxy_mode = uci_get("@global[0]", "tcp_proxy_mode") or "proxy"
|
||||
local localhost_proxy = uci_get("@global[0]", "localhost_proxy") or "1"
|
||||
local socks_server = (localhost_proxy == "0") and api.get_cache_var("GLOBAL_TCP_SOCKS_server") or ""
|
||||
local socks_server = (localhost_proxy == "0") and api.get_cache_var("GLOBAL_SOCKS_server") or ""
|
||||
url = "-w %{http_code}:%{time_pretransfer} " .. url
|
||||
if socks_server and socks_server ~= "" then
|
||||
if (chn_list == "proxy" and gfw_list == "0" and proxy_mode ~= "proxy" and aliyun ~= nil) or (chn_list == "0" and gfw_list == "0" and proxy_mode == "proxy") then
|
||||
@@ -592,23 +580,24 @@ function add_node()
|
||||
end
|
||||
|
||||
function set_node()
|
||||
local protocol = http.formvalue("protocol")
|
||||
local type = http.formvalue("type")
|
||||
local config = http.formvalue("config")
|
||||
local section = http.formvalue("section")
|
||||
uci_set("@global[0]", protocol .. "_node", section)
|
||||
if protocol == "tcp" then
|
||||
if type == "@global[0]" then
|
||||
local node_protocol = uci_get(section, "protocol")
|
||||
if node_protocol == "_shunt" then
|
||||
local type = uci_get(section, "type")
|
||||
local dns_shunt = uci_get("@global[0]", "dns_shunt")
|
||||
local node_type = uci_get(section, "type")
|
||||
local dns_shunt = uci_get(type, "dns_shunt")
|
||||
local dns_key = (dns_shunt == "smartdns") and "smartdns_dns_mode" or "dns_mode"
|
||||
local dns_mode = uci_get("@global[0]", dns_key)
|
||||
local new_dns_mode = (type == "Xray") and "xray" or "sing-box"
|
||||
local dns_mode = uci_get(type, dns_key)
|
||||
local new_dns_mode = (node_type == "Xray") and "xray" or "sing-box"
|
||||
if dns_mode ~= new_dns_mode then
|
||||
uci_set("@global[0]", dns_key, new_dns_mode)
|
||||
uci_set("@global[0]", "v2ray_dns_mode", "tcp")
|
||||
uci_set(type, dns_key, new_dns_mode)
|
||||
uci_set(type, "v2ray_dns_mode", "tcp")
|
||||
end
|
||||
end
|
||||
end
|
||||
uci_set(type, config, section)
|
||||
uci_save(true, true)
|
||||
http.redirect(api.url("log"))
|
||||
end
|
||||
@@ -632,8 +621,7 @@ function clear_all_nodes()
|
||||
uci_set('@global[0]', "enabled", "0")
|
||||
uci_set('@global[0]', "socks_enabled", "0")
|
||||
uci_set('@global_haproxy[0]', "balancing_enable", "0")
|
||||
uci_del('@global[0]', "tcp_node")
|
||||
uci_del('@global[0]', "udp_node")
|
||||
uci_del('@global[0]', "node")
|
||||
uci_foreach("socks", function(t)
|
||||
uci_del(t[".name"])
|
||||
uci_set(t[".name"], "autoswitch_backup_node", {})
|
||||
@@ -642,8 +630,7 @@ function clear_all_nodes()
|
||||
uci_del(t[".name"])
|
||||
end)
|
||||
uci_foreach("acl_rule", function(t)
|
||||
uci_del(t[".name"], "tcp_node")
|
||||
uci_del(t[".name"], "udp_node")
|
||||
uci_del(t[".name"], "node")
|
||||
end)
|
||||
uci_foreach("nodes", function(node)
|
||||
uci_del(node['.name'])
|
||||
@@ -664,11 +651,8 @@ function delete_select_nodes()
|
||||
local ids_t = {}
|
||||
string.gsub(ids, '[^' .. "," .. ']+', function(w)
|
||||
ids_t[#ids_t + 1] = w
|
||||
if (uci_get("@global[0]", "tcp_node") or "") == w then
|
||||
uci_del('@global[0]', "tcp_node")
|
||||
end
|
||||
if (uci_get("@global[0]", "udp_node") or "") == w then
|
||||
uci_del('@global[0]', "udp_node")
|
||||
if (uci_get("@global[0]", "node") or "") == w then
|
||||
uci_del('@global[0]', "node")
|
||||
end
|
||||
uci_foreach("socks", function(t)
|
||||
local changed = false
|
||||
@@ -697,11 +681,8 @@ function delete_select_nodes()
|
||||
end
|
||||
end)
|
||||
uci_foreach("acl_rule", function(t)
|
||||
if t["tcp_node"] == w then
|
||||
uci_del(t[".name"], "tcp_node")
|
||||
end
|
||||
if t["udp_node"] == w then
|
||||
uci_del(t[".name"], "udp_node")
|
||||
if t["node"] == w then
|
||||
uci_del(t[".name"], "node")
|
||||
end
|
||||
end)
|
||||
uci_foreach("nodes", function(t)
|
||||
|
||||
@@ -128,31 +128,25 @@ sources.validate = function(self, value, t)
|
||||
flag = true
|
||||
end
|
||||
end
|
||||
|
||||
if flag == false and datatypes.macaddr(v) then
|
||||
flag = true
|
||||
end
|
||||
|
||||
if flag == false and datatypes.ip4addr(v) then
|
||||
flag = true
|
||||
end
|
||||
|
||||
if flag == false and api.iprange(v) then
|
||||
flag = true
|
||||
end
|
||||
|
||||
if flag == false then
|
||||
err[#err + 1] = v
|
||||
end
|
||||
end
|
||||
|
||||
if #err > 0 then
|
||||
self:add_error(t, "invalid", translate("Not true format, please re-enter!"))
|
||||
for _, v in ipairs(err) do
|
||||
self:add_error(t, "invalid", v)
|
||||
end
|
||||
end
|
||||
|
||||
return value
|
||||
end
|
||||
|
||||
@@ -195,57 +189,16 @@ o.default = "0"
|
||||
o.rmempty = false
|
||||
o:depends({ _hide_node_option = "1", ['!reverse'] = true })
|
||||
|
||||
o = s:option(ListValue, "tcp_node", "<a style='color: red'>" .. translate("TCP Node") .. "</a>")
|
||||
o = s:option(ListValue, "node", "<a style='color: red'>" .. translate("Proxy Node") .. "</a>")
|
||||
o.default = ""
|
||||
o:depends({ _hide_node_option = false, use_global_config = false })
|
||||
o.template = m:template_path("/cbi/nodes_listvalue")
|
||||
o.group = {}
|
||||
o.remove = function(self, section)
|
||||
m:del(section, self.option)
|
||||
m:del(section, "udp_node")
|
||||
end
|
||||
|
||||
o = s:option(DummyValue, "_tcp_node_bool", "")
|
||||
o = s:option(DummyValue, "_acl_node_bool", "")
|
||||
o.template = m:template_path("/cbi/hidevalue")
|
||||
o.value = "1"
|
||||
o:depends({ tcp_node = "", ['!reverse'] = true })
|
||||
|
||||
o = s:option(ListValue, "udp_node", "<a style='color: red'>" .. translate("UDP Node") .. "</a>")
|
||||
o.default = ""
|
||||
o:value("", translate("Close"))
|
||||
o:value("tcp", translate("Same as the tcp node"))
|
||||
o:depends({ _tcp_node_bool = "1", _node_sel_other = "1" })
|
||||
o.template = m:template_path("/cbi/nodes_listvalue")
|
||||
o.group = {"",""}
|
||||
o.remove = function(self, section)
|
||||
local v = s.fields["shunt_udp_node"]:formvalue(section)
|
||||
if not v or v == "close" then
|
||||
return m:del(section, self.option)
|
||||
else
|
||||
return m:set(section, self.option, "tcp")
|
||||
end
|
||||
end
|
||||
|
||||
o = s:option(ListValue, "shunt_udp_node", "<a style='color: red'>" .. translate("UDP Node") .. "</a>")
|
||||
o:value("close", translate("Close"))
|
||||
o:value("tcp", translate("Same as the tcp node"))
|
||||
o:depends({ _tcp_node_bool = "1", _node_sel_shunt = "1" })
|
||||
o.cfgvalue = function(self, section)
|
||||
local v = m:get(section, "udp_node") or ""
|
||||
if v == "" then v = "close" end
|
||||
if v ~= "close" and v ~= "tcp" then v = "tcp" end
|
||||
return v
|
||||
end
|
||||
o.write = function(self, section, value)
|
||||
if value == "close" then value = "" end
|
||||
return m:set(section, "udp_node", value)
|
||||
end
|
||||
|
||||
o = s:option(DummyValue, "_udp_node_bool", "")
|
||||
o.template = m:template_path("/cbi/hidevalue")
|
||||
o.value = "1"
|
||||
o:depends({ udp_node = "", ['!reverse'] = true })
|
||||
o:depends({ shunt_udp_node = "tcp" })
|
||||
o:depends({ node = "", ['!reverse'] = true })
|
||||
|
||||
---- Log
|
||||
o = s:option(Flag, "log", translate("Enable Node Log"))
|
||||
@@ -268,7 +221,7 @@ o:value("", translate("Use global config") .. "(" .. TCP_PROXY_DROP_PORTS .. ")"
|
||||
o:value("disable", translate("No patterns are used"))
|
||||
o.validate = port_validate
|
||||
o:depends({ use_global_config = true })
|
||||
o:depends({ _tcp_node_bool = "1" })
|
||||
o:depends({ _acl_node_bool = "1" })
|
||||
|
||||
---- UDP Proxy Drop Ports
|
||||
local UDP_PROXY_DROP_PORTS = m:get("@global_forwarding[0]", "udp_proxy_drop_ports")
|
||||
@@ -278,7 +231,7 @@ o:value("disable", translate("No patterns are used"))
|
||||
o:value("443", translate("QUIC"))
|
||||
o.validate = port_validate
|
||||
o:depends({ use_global_config = true })
|
||||
o:depends({ _tcp_node_bool = "1" })
|
||||
o:depends({ _acl_node_bool = "1" })
|
||||
|
||||
---- TCP Redir Ports
|
||||
local TCP_REDIR_PORTS = m:get("@global_forwarding[0]", "tcp_redir_ports")
|
||||
@@ -290,7 +243,7 @@ o:value("80:65535", "80 " .. translate("or more"))
|
||||
o:value("1:443", "443 " .. translate("or less"))
|
||||
o.validate = port_validate
|
||||
o:depends({ use_global_config = true })
|
||||
o:depends({ _tcp_node_bool = "1" })
|
||||
o:depends({ _acl_node_bool = "1" })
|
||||
|
||||
---- UDP Redir Ports
|
||||
local UDP_REDIR_PORTS = m:get("@global_forwarding[0]", "udp_redir_ports")
|
||||
@@ -300,7 +253,7 @@ o:value("1:65535", translate("All"))
|
||||
o:value("53", "53")
|
||||
o.validate = port_validate
|
||||
o:depends({ use_global_config = true })
|
||||
o:depends({ _udp_node_bool = "1" })
|
||||
o:depends({ _acl_node_bool = "1" })
|
||||
|
||||
o = s:option(DummyValue, "tips", " ")
|
||||
o.rawhtml = true
|
||||
@@ -309,24 +262,24 @@ o.cfgvalue = function(t, n)
|
||||
translate("The port settings support single ports and ranges.<br>Separate multiple ports with commas (,).<br>Example: 21,80,443,1000:2000."))
|
||||
end
|
||||
o:depends({ use_global_config = true })
|
||||
o:depends({ _tcp_node_bool = "1" })
|
||||
o:depends({ _acl_node_bool = "1" })
|
||||
|
||||
o = s:option(Flag, "use_direct_list", translatef("Use %s", translate("Direct List")))
|
||||
o.default = "1"
|
||||
o:depends({ _tcp_node_bool = "1" })
|
||||
o:depends({ _acl_node_bool = "1" })
|
||||
|
||||
o = s:option(Flag, "use_proxy_list", translatef("Use %s", translate("Proxy List")))
|
||||
o.default = "1"
|
||||
o:depends({ _tcp_node_bool = "1" })
|
||||
o:depends({ _acl_node_bool = "1" })
|
||||
|
||||
o = s:option(Flag, "use_block_list", translatef("Use %s", translate("Block List")))
|
||||
o.default = "1"
|
||||
o:depends({ _tcp_node_bool = "1" })
|
||||
o:depends({ _acl_node_bool = "1" })
|
||||
|
||||
if has_gfwlist then
|
||||
o = s:option(Flag, "use_gfw_list", translatef("Use %s", translate("GFW List")))
|
||||
o.default = "1"
|
||||
o:depends({ _tcp_node_bool = "1" })
|
||||
o:depends({ _acl_node_bool = "1" })
|
||||
end
|
||||
|
||||
if has_chnlist or has_chnroute then
|
||||
@@ -335,28 +288,28 @@ if has_chnlist or has_chnroute then
|
||||
o:value("direct", translate("Direct Connection"))
|
||||
o:value("proxy", translate("Proxy"))
|
||||
o.default = "direct"
|
||||
o:depends({ _tcp_node_bool = "1" })
|
||||
o:depends({ _acl_node_bool = "1" })
|
||||
end
|
||||
|
||||
o = s:option(ListValue, "tcp_proxy_mode", "TCP " .. translate("Proxy Mode"))
|
||||
o:value("disable", translate("No Proxy"))
|
||||
o:value("proxy", translate("Proxy"))
|
||||
o:depends({ _tcp_node_bool = "1" })
|
||||
o:depends({ _acl_node_bool = "1" })
|
||||
|
||||
o = s:option(ListValue, "udp_proxy_mode", "UDP " .. translate("Proxy Mode"))
|
||||
o:value("disable", translate("No Proxy"))
|
||||
o:value("proxy", translate("Proxy"))
|
||||
o:depends({ _udp_node_bool = "1" })
|
||||
o:depends({ _acl_node_bool = "1" })
|
||||
|
||||
o = s:option(DummyValue, "switch_mode", " ")
|
||||
o.template = m:template_path("/global/proxy")
|
||||
o:depends({ _tcp_node_bool = "1" })
|
||||
o:depends({ _acl_node_bool = "1" })
|
||||
|
||||
-- Node → DNS Depends Settings
|
||||
o = s:option(DummyValue, "_node_sel_shunt", "")
|
||||
o.template = m:template_path("/cbi/hidevalue")
|
||||
o.value = "1"
|
||||
o:depends({ tcp_node = "__always__" })
|
||||
o:depends({ node = "__always__" })
|
||||
|
||||
o = s:option(DummyValue, "_node_sel_other", "")
|
||||
o.template = m:template_path("/cbi/hidevalue")
|
||||
@@ -368,11 +321,11 @@ o = s:option(ListValue, "dns_shunt", "DNS " .. translate("Shunt"))
|
||||
o.default = "chinadns-ng"
|
||||
o:value("dnsmasq", "Dnsmasq")
|
||||
o:value("chinadns-ng", translate("ChinaDNS-NG (recommended)"))
|
||||
o:depends({ _tcp_node_bool = "1" })
|
||||
o:depends({ _acl_node_bool = "1" })
|
||||
|
||||
o = s:option(Flag, "filter_proxy_ipv6", translate("Filter Proxy Host IPv6"), translate("Experimental feature."))
|
||||
o.default = "0"
|
||||
o:depends({ _tcp_node_bool = "1" })
|
||||
o:depends({ _acl_node_bool = "1" })
|
||||
|
||||
---- DNS Forward Mode
|
||||
o = s:option(ListValue, "dns_mode", translate("Filter Mode"))
|
||||
@@ -385,7 +338,7 @@ end
|
||||
if has_xray then
|
||||
o:value("xray", "Xray")
|
||||
end
|
||||
o:depends({ _tcp_node_bool = "1", _node_sel_other = "1" })
|
||||
o:depends({ _acl_node_bool = "1", _node_sel_other = "1" })
|
||||
o.write = function(self, section, value)
|
||||
if value == "dns2socks" then
|
||||
m:del(section, "v2ray_dns_mode")
|
||||
@@ -393,7 +346,7 @@ o.write = function(self, section, value)
|
||||
return ListValue.write(self, section, value)
|
||||
end
|
||||
o.remove = function(self, section)
|
||||
local f = s.fields["tcp_node"]
|
||||
local f = s.fields["node"]
|
||||
local id_val = f and f:formvalue(section) or ""
|
||||
if id_val == "" then
|
||||
return m:del(section, self.option)
|
||||
@@ -517,10 +470,10 @@ o:depends({dns_mode = "xray"})
|
||||
o.validate = function(self, value, t)
|
||||
if value and value == "1" then
|
||||
local _dns_mode = s.fields["dns_mode"]:formvalue(t)
|
||||
local _tcp_node = s.fields["tcp_node"]:formvalue(t)
|
||||
if _dns_mode and _tcp_node then
|
||||
if (m:get(_tcp_node, "type") or ""):lower() ~= _dns_mode and not _tcp_node:find("socks_") then
|
||||
return nil, translatef("TCP node must be '%s' type to use FakeDNS.", _dns_mode)
|
||||
local _node = s.fields["node"]:formvalue(t)
|
||||
if _dns_mode and _node then
|
||||
if (m:get(_node, "type") or ""):lower() ~= _dns_mode and not _node:find("socks_") then
|
||||
return nil, translatef("Node must be '%s' type to use FakeDNS.", _dns_mode)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -562,44 +515,35 @@ o:value("direct", translate("Direct DNS"))
|
||||
o.description = desc .. "</ul>"
|
||||
o:depends({dns_shunt = "dnsmasq", tcp_proxy_mode = "proxy", chn_list = "direct"})
|
||||
|
||||
local tcp = s.fields["tcp_node"]
|
||||
local udp = s.fields["udp_node"]
|
||||
local o_node = s.fields["node"]
|
||||
for k, v in pairs(socks_list) do
|
||||
tcp:value(v.id, v["remark"])
|
||||
tcp.group[#tcp.group+1] = (v.group and v.group ~= "") and v.group or translate("default")
|
||||
udp:value(v.id, v["remark"])
|
||||
udp.group[#udp.group+1] = (v.group and v.group ~= "") and v.group or translate("default")
|
||||
o_node:value(v.id, v["remark"])
|
||||
o_node.group[#o_node.group+1] = (v.group and v.group ~= "") and v.group or translate("default")
|
||||
end
|
||||
for k, v in pairs(nodes_table) do
|
||||
if #normal_list == 0 then
|
||||
s.fields["dns_mode"]:depends({ _tcp_node_bool = "1" })
|
||||
s.fields["dns_mode"]:depends({ _acl_node_bool = "1" })
|
||||
break
|
||||
end
|
||||
if v.protocol == "_shunt" then
|
||||
if v.type == "Xray" and has_xray then
|
||||
tcp:value(v.id, v["remark"])
|
||||
tcp.group[#tcp.group+1] = (v.group and v.group ~= "") and v.group or translate("default")
|
||||
udp:value(v.id, v["remark"])
|
||||
udp.group[#udp.group+1] = (v.group and v.group ~= "") and v.group or translate("default")
|
||||
o_node:value(v.id, v["remark"])
|
||||
o_node.group[#o_node.group+1] = (v.group and v.group ~= "") and v.group or translate("default")
|
||||
|
||||
s.fields["xray_dns_mode"]:depends({ _tcp_node_bool = "1", tcp_node = v.id })
|
||||
s.fields["_node_sel_shunt"]:depends({ tcp_node = v.id })
|
||||
s.fields["xray_dns_mode"]:depends({ _acl_node_bool = "1", node = v.id })
|
||||
s.fields["_node_sel_shunt"]:depends({ node = v.id })
|
||||
end
|
||||
if v.type == "sing-box" and has_singbox then
|
||||
tcp:value(v.id, v["remark"])
|
||||
tcp.group[#tcp.group+1] = (v.group and v.group ~= "") and v.group or translate("default")
|
||||
udp:value(v.id, v["remark"])
|
||||
udp.group[#udp.group+1] = (v.group and v.group ~= "") and v.group or translate("default")
|
||||
o_node:value(v.id, v["remark"])
|
||||
o_node.group[#o_node.group+1] = (v.group and v.group ~= "") and v.group or translate("default")
|
||||
|
||||
s.fields["singbox_dns_mode"]:depends({ _tcp_node_bool = "1", tcp_node = v.id })
|
||||
s.fields["_node_sel_shunt"]:depends({ tcp_node = v.id })
|
||||
s.fields["remote_rewrite_ttl"]:depends({ _tcp_node_bool = "1", tcp_node = v.id })
|
||||
s.fields["singbox_dns_mode"]:depends({ _acl_node_bool = "1", node = v.id })
|
||||
s.fields["_node_sel_shunt"]:depends({ node = v.id })
|
||||
s.fields["remote_rewrite_ttl"]:depends({ _acl_node_bool = "1", node = v.id })
|
||||
end
|
||||
else
|
||||
tcp:value(v.id, v["remark"])
|
||||
tcp.group[#tcp.group+1] = (v.group and v.group ~= "") and v.group or translate("default")
|
||||
udp:value(v.id, v["remark"])
|
||||
udp.group[#udp.group+1] = (v.group and v.group ~= "") and v.group or translate("default")
|
||||
o_node:value(v.id, v["remark"])
|
||||
o_node.group[#o_node.group+1] = (v.group and v.group ~= "") and v.group or translate("default")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -43,11 +43,11 @@ end
|
||||
|
||||
local socks_list = {}
|
||||
|
||||
local tcp_socks_server = "127.0.0.1" .. ":" .. (m:get("@global[0]", "tcp_node_socks_port") or "1070")
|
||||
local socks_server = "127.0.0.1" .. ":" .. (m:get("@global[0]", "node_socks_port") or "1070")
|
||||
local socks_table = {}
|
||||
socks_table[#socks_table + 1] = {
|
||||
id = tcp_socks_server,
|
||||
remark = tcp_socks_server .. " - " .. translate("TCP Node")
|
||||
id = socks_server,
|
||||
remark = socks_server .. " - " .. translate("Proxy Node")
|
||||
}
|
||||
m:foreach("socks", function(s)
|
||||
if s.enabled == "1" and s.node then
|
||||
@@ -103,44 +103,13 @@ s:tab("Main", translate("Main"))
|
||||
o = s:taboption("Main", Flag, "enabled", translate("Main switch"))
|
||||
o.rmempty = false
|
||||
|
||||
---- TCP Node
|
||||
o = s:taboption("Main", ListValue, "tcp_node", "<a style='color: red'>" .. translate("TCP Node") .. "</a>")
|
||||
---- Node
|
||||
o = s:taboption("Main", ListValue, "node", "<a style='color: red'>" .. translate("Proxy Node") .. "</a>")
|
||||
o.template = m:template_path("/cbi/nodes_listvalue")
|
||||
o:value("", translate("Close"))
|
||||
o.group = {""}
|
||||
|
||||
---- UDP Node
|
||||
o = s:taboption("Main", ListValue, "udp_node", "<a style='color: red'>" .. translate("UDP Node") .. "</a>")
|
||||
o.template = m:template_path("/cbi/nodes_listvalue")
|
||||
o:value("", translate("Close"))
|
||||
o:value("tcp", translate("Same as the tcp node"))
|
||||
o.group = {"",""}
|
||||
o:depends("_node_sel_other", "1")
|
||||
o.remove = function(self, section)
|
||||
local v = s.fields["shunt_udp_node"]:formvalue(section)
|
||||
if not v or v == "close" then
|
||||
return m:del(section, self.option)
|
||||
else
|
||||
return m:set(section, self.option, "tcp")
|
||||
end
|
||||
end
|
||||
|
||||
o = s:taboption("Main", ListValue, "shunt_udp_node", "<a style='color: red'>" .. translate("UDP Node") .. "</a>")
|
||||
o:value("close", translate("Close"))
|
||||
o:value("tcp", translate("Same as the tcp node"))
|
||||
o:depends("_node_sel_shunt", "1")
|
||||
o.cfgvalue = function(self, section)
|
||||
local v = m:get(section, "udp_node") or ""
|
||||
if v == "" then v = "close" end
|
||||
if v ~= "close" and v ~= "tcp" then v = "tcp" end
|
||||
return v
|
||||
end
|
||||
o.write = function(self, section, value)
|
||||
if value == "close" then value = "" end
|
||||
return m:set(section, "udp_node", value)
|
||||
end
|
||||
|
||||
current_node_id = m:get(s.section, "tcp_node")
|
||||
current_node_id = m:get(s.section, "node")
|
||||
current_node = current_node_id and m:get(current_node_id) or {}
|
||||
|
||||
-- Shunt Start
|
||||
@@ -157,7 +126,7 @@ if (has_singbox or has_xray) and #nodes_table > 0 then
|
||||
balancing_list = balancing_list,
|
||||
iface_list = iface_list,
|
||||
normal_list = normal_list,
|
||||
verify_option = s.fields["tcp_node"],
|
||||
verify_option = s.fields["node"],
|
||||
tab = "Shunt",
|
||||
tab_desc = translate("Shunt Rule")
|
||||
})
|
||||
@@ -168,36 +137,36 @@ if (has_singbox or has_xray) and #nodes_table > 0 then
|
||||
tips.cfgvalue = function(t, n)
|
||||
return string.format('<a style="color: red">%s</a>', translate("There are no available nodes, please add or subscribe nodes first."))
|
||||
end
|
||||
tips:depends({ tcp_node = "", ["!reverse"] = true })
|
||||
tips:depends({ node = "", ["!reverse"] = true })
|
||||
for k, v in pairs(shunt_list) do
|
||||
tips:depends("tcp_node", v.id)
|
||||
tips:depends("node", v.id)
|
||||
end
|
||||
for k, v in pairs(balancing_list) do
|
||||
tips:depends("tcp_node", v.id)
|
||||
tips:depends("node", v.id)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
o = s:taboption("Main", Value, "tcp_node_socks_port", translate("TCP Node") .. " Socks " .. translate("Listen Port"))
|
||||
o = s:taboption("Main", Value, "node_socks_port", translate("Node") .. " Socks " .. translate("Listen Port"))
|
||||
o.default = 1070
|
||||
o.datatype = "port"
|
||||
o:depends({ tcp_node = "", ["!reverse"] = true })
|
||||
o:depends({ node = "", ["!reverse"] = true })
|
||||
--[[
|
||||
if has_singbox or has_xray then
|
||||
o = s:taboption("Main", Value, "tcp_node_http_port", translate("TCP Node") .. " HTTP " .. translate("Listen Port") .. " " .. translate("0 is not use"))
|
||||
o = s:taboption("Main", Value, "node_http_port", translate("Node") .. " HTTP " .. translate("Listen Port") .. " " .. translate("0 is not use"))
|
||||
o.default = 0
|
||||
o.datatype = "port"
|
||||
end
|
||||
]]--
|
||||
o = s:taboption("Main", Flag, "tcp_node_socks_bind_local", translate("TCP Node") .. " Socks " .. translate("Bind Local"), translate("When selected, it can only be accessed localhost."))
|
||||
o = s:taboption("Main", Flag, "node_socks_bind_local", translate("Node") .. " Socks " .. translate("Bind Local"), translate("When selected, it can only be accessed localhost."))
|
||||
o.default = "1"
|
||||
o:depends({ tcp_node = "", ["!reverse"] = true })
|
||||
o:depends({ node = "", ["!reverse"] = true })
|
||||
|
||||
-- Node → DNS Depends Settings
|
||||
o = s:taboption("Main", DummyValue, "_node_sel_shunt", "")
|
||||
o.template = m:template_path("/cbi/hidevalue")
|
||||
o.value = "1"
|
||||
o:depends({ tcp_node = "__always__" })
|
||||
o:depends({ node = "__always__" })
|
||||
|
||||
o = s:taboption("Main", DummyValue, "_node_sel_other", "")
|
||||
o.template = m:template_path("/cbi/hidevalue")
|
||||
@@ -256,9 +225,9 @@ o:depends("direct_dns_mode", "tcp")
|
||||
o = s:taboption("DNS", Flag, "filter_proxy_ipv6", translate("Filter Proxy Host IPv6"))
|
||||
o.default = "0"
|
||||
|
||||
-- TCP分流时dns过滤模式保存逻辑
|
||||
-- 分流时dns过滤模式保存逻辑
|
||||
function dns_mode_save(section)
|
||||
local f = s.fields["tcp_node"]
|
||||
local f = s.fields["node"]
|
||||
local id_val = f and f:formvalue(section) or ""
|
||||
if id_val == "" then
|
||||
return
|
||||
@@ -478,10 +447,10 @@ o.validate = function(self, value, t)
|
||||
if not _dns_mode and s.fields["smartdns_dns_mode"] then
|
||||
_dns_mode = s.fields["smartdns_dns_mode"]:formvalue(t)
|
||||
end
|
||||
local _tcp_node = s.fields["tcp_node"]:formvalue(t)
|
||||
if _dns_mode and _tcp_node then
|
||||
if (m:get(_tcp_node, "type") or ""):lower() ~= _dns_mode and not _tcp_node:find("socks_") then
|
||||
return nil, translatef("TCP node must be '%s' type to use FakeDNS.", _dns_mode)
|
||||
local _node = s.fields["node"]:formvalue(t)
|
||||
if _dns_mode and _node then
|
||||
if (m:get(_node, "type") or ""):lower() ~= _dns_mode and not _node:find("socks_") then
|
||||
return nil, translatef("Node must be '%s' type to use FakeDNS.", _dns_mode)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -665,11 +634,7 @@ o.cfgvalue = function(t, n)
|
||||
end
|
||||
|
||||
s:tab("log", translate("Log"))
|
||||
o = s:taboption("log", Flag, "log_tcp", translate("Enable") .. " " .. translatef("%s Node Log", "TCP"))
|
||||
o.default = "0"
|
||||
o.rmempty = false
|
||||
|
||||
o = s:taboption("log", Flag, "log_udp", translate("Enable") .. " " .. translatef("%s Node Log", "UDP"))
|
||||
o = s:taboption("log", Flag, "log_node", translate("Enable Node Log"))
|
||||
o.default = "0"
|
||||
o.rmempty = false
|
||||
|
||||
@@ -731,18 +696,12 @@ function s2.remove(e, t)
|
||||
if node0 then
|
||||
new_node = node0[".name"]
|
||||
end
|
||||
if (m:get("@global[0]", "tcp_node") or "") == t then
|
||||
m:set('@global[0]', "tcp_node", new_node)
|
||||
end
|
||||
if (m:get("@global[0]", "udp_node") or "") == t then
|
||||
m:set('@global[0]', "udp_node", new_node)
|
||||
if (m:get("@global[0]", "node") or "") == t then
|
||||
m:set('@global[0]', "node", new_node)
|
||||
end
|
||||
m:foreach("acl_rule", function(s)
|
||||
if s["tcp_node"] and s["tcp_node"] == t then
|
||||
m:set(s[".name"], "tcp_node", "default")
|
||||
end
|
||||
if s["udp_node"] and s["udp_node"] == t then
|
||||
m:set(s[".name"], "udp_node", "default")
|
||||
if s["node"] and s["node"] == t then
|
||||
m:set(s[".name"], "node", "default")
|
||||
end
|
||||
end)
|
||||
m:foreach("nodes", function(s)
|
||||
@@ -819,14 +778,11 @@ if has_singbox or has_xray then
|
||||
end
|
||||
]]--
|
||||
|
||||
local tcp = s.fields["tcp_node"]
|
||||
local udp = s.fields["udp_node"]
|
||||
local socks = s2.fields["node"]
|
||||
local o_node = s.fields["node"]
|
||||
local o_socks = s2.fields["node"]
|
||||
for k, v in pairs(socks_list) do
|
||||
tcp:value(v.id, v["remark"])
|
||||
tcp.group[#tcp.group+1] = (v.group and v.group ~= "") and v.group or translate("default")
|
||||
udp:value(v.id, v["remark"])
|
||||
udp.group[#udp.group+1] = (v.group and v.group ~= "") and v.group or translate("default")
|
||||
o_node:value(v.id, v["remark"])
|
||||
o_node.group[#o_node.group+1] = (v.group and v.group ~= "") and v.group or translate("default")
|
||||
end
|
||||
for k, v in pairs(nodes_table) do
|
||||
if #normal_list == 0 and #iface_list == 0 then
|
||||
@@ -834,33 +790,29 @@ for k, v in pairs(nodes_table) do
|
||||
end
|
||||
if v.protocol == "_shunt" then
|
||||
if has_singbox or has_xray then
|
||||
tcp:value(v.id, v["remark"])
|
||||
tcp.group[#tcp.group+1] = (v.group and v.group ~= "") and v.group or translate("default")
|
||||
udp:value(v.id, v["remark"])
|
||||
udp.group[#udp.group+1] = (v.group and v.group ~= "") and v.group or translate("default")
|
||||
o_node:value(v.id, v["remark"])
|
||||
o_node.group[#o_node.group+1] = (v.group and v.group ~= "") and v.group or translate("default")
|
||||
|
||||
s.fields["_node_sel_shunt"]:depends({ tcp_node = v.id })
|
||||
s.fields["_node_sel_shunt"]:depends({ node = v.id })
|
||||
if m:get(v.id, "type") == "Xray" then
|
||||
s.fields["xray_dns_mode"]:depends({ tcp_node = v.id })
|
||||
s.fields["xray_dns_mode"]:depends({ node = v.id })
|
||||
else
|
||||
s.fields["singbox_dns_mode"]:depends({ tcp_node = v.id })
|
||||
s.fields["remote_rewrite_ttl"]:depends({ tcp_node = v.id })
|
||||
s.fields["singbox_dns_mode"]:depends({ node = v.id })
|
||||
s.fields["remote_rewrite_ttl"]:depends({ node = v.id })
|
||||
end
|
||||
end
|
||||
else
|
||||
tcp:value(v.id, v["remark"])
|
||||
tcp.group[#tcp.group+1] = (v.group and v.group ~= "") and v.group or translate("default")
|
||||
udp:value(v.id, v["remark"])
|
||||
udp.group[#udp.group+1] = (v.group and v.group ~= "") and v.group or translate("default")
|
||||
o_node:value(v.id, v["remark"])
|
||||
o_node.group[#o_node.group+1] = (v.group and v.group ~= "") and v.group or translate("default")
|
||||
end
|
||||
if v.type == "Socks" then
|
||||
if has_singbox or has_xray then
|
||||
socks:value(v.id, v["remark"])
|
||||
socks.group[#socks.group+1] = (v.group and v.group ~= "") and v.group or translate("default")
|
||||
o_socks:value(v.id, v["remark"])
|
||||
o_socks.group[#o_socks.group+1] = (v.group and v.group ~= "") and v.group or translate("default")
|
||||
end
|
||||
else
|
||||
socks:value(v.id, v["remark"])
|
||||
socks.group[#socks.group+1] = (v.group and v.group ~= "") and v.group or translate("default")
|
||||
o_socks:value(v.id, v["remark"])
|
||||
o_socks.group[#o_socks.group+1] = (v.group and v.group ~= "") and v.group or translate("default")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -119,11 +119,8 @@ o:value("1", "Nftables")
|
||||
|
||||
---- Check the transparent proxy component
|
||||
local handle = io.popen("lsmod")
|
||||
local mods = ""
|
||||
if handle then
|
||||
mods = handle:read("*a") or ""
|
||||
handle:close()
|
||||
end
|
||||
local mods = handle and handle:read("*a") or ""
|
||||
if handle then handle:close() end
|
||||
|
||||
if (mods:find("REDIRECT") and mods:find("TPROXY")) or (mods:find("nft_redir") and mods:find("nft_tproxy")) then
|
||||
o = s:option(ListValue, "tcp_proxy_way", translate("TCP Proxy Way"))
|
||||
|
||||
@@ -258,7 +258,7 @@ end
|
||||
|
||||
function curl_proxy(url, file, args)
|
||||
--使用代理
|
||||
local socks_server = get_cache_var("GLOBAL_TCP_SOCKS_server")
|
||||
local socks_server = get_cache_var("GLOBAL_SOCKS_server")
|
||||
if socks_server and socks_server ~= "" then
|
||||
if not args then args = {} end
|
||||
local tmp_args = clone(args)
|
||||
|
||||
@@ -73,8 +73,7 @@ function gen_config(var)
|
||||
return
|
||||
end
|
||||
local node = api.uci_get_c(node_id)
|
||||
local local_tcp_redir_port = var["local_tcp_redir_port"]
|
||||
local local_udp_redir_port = var["local_udp_redir_port"]
|
||||
local local_redir_port = var["local_redir_port"]
|
||||
local local_socks_address = var["local_socks_address"] or "0.0.0.0"
|
||||
local local_socks_port = var["local_socks_port"]
|
||||
local local_socks_username = var["local_socks_username"]
|
||||
@@ -170,14 +169,14 @@ function gen_config(var)
|
||||
username = (local_http_username and local_http_password) and local_http_username or nil,
|
||||
password = (local_http_username and local_http_password) and local_http_password or nil,
|
||||
} or nil,
|
||||
tcpRedirect = ("redirect" == tcp_proxy_way and local_tcp_redir_port) and {
|
||||
listen = "0.0.0.0:" .. local_tcp_redir_port
|
||||
tcpRedirect = ("redirect" == tcp_proxy_way and local_redir_port) and {
|
||||
listen = "0.0.0.0:" .. local_redir_port
|
||||
} or nil,
|
||||
tcpTProxy = ("tproxy" == tcp_proxy_way and local_tcp_redir_port) and {
|
||||
listen = "0.0.0.0:" .. local_tcp_redir_port
|
||||
tcpTProxy = ("tproxy" == tcp_proxy_way and local_redir_port) and {
|
||||
listen = "0.0.0.0:" .. local_redir_port
|
||||
} or nil,
|
||||
udpTProxy = (local_udp_redir_port) and {
|
||||
listen = "0.0.0.0:" .. local_udp_redir_port
|
||||
udpTProxy = (local_redir_port) and {
|
||||
listen = "0.0.0.0:" .. local_redir_port
|
||||
} or nil
|
||||
}
|
||||
|
||||
|
||||
@@ -53,10 +53,8 @@ function gen_config(var)
|
||||
local local_http_port = var["local_http_port"]
|
||||
local local_http_username = var["local_http_username"]
|
||||
local local_http_password = var["local_http_password"]
|
||||
local local_tcp_redir_port = var["local_tcp_redir_port"]
|
||||
local local_tcp_redir_address = var["local_tcp_redir_address"] or "0.0.0.0"
|
||||
local local_udp_redir_port = var["local_udp_redir_port"]
|
||||
local local_udp_redir_address = var["local_udp_redir_address"] or "0.0.0.0"
|
||||
local local_redir_port = var["local_redir_port"]
|
||||
local local_redir_address = var["local_redir_address"] or "0.0.0.0"
|
||||
|
||||
if api.is_ipv6(server_host) then
|
||||
server_host = api.get_ipv6_only(server_host)
|
||||
@@ -118,21 +116,13 @@ function gen_config(var)
|
||||
local_port = tonumber(local_http_port)
|
||||
})
|
||||
end
|
||||
if local_tcp_redir_address and local_tcp_redir_port then
|
||||
if local_redir_address and local_redir_port then
|
||||
table.insert(config.locals, {
|
||||
protocol = "redir",
|
||||
mode = "tcp_only",
|
||||
mode = "tcp_and_udp",
|
||||
tcp_redir = var["tcp_tproxy"] and "tproxy" or nil,
|
||||
local_address = local_tcp_redir_address,
|
||||
local_port = tonumber(local_tcp_redir_port)
|
||||
})
|
||||
end
|
||||
if local_udp_redir_address and local_udp_redir_port then
|
||||
table.insert(config.locals, {
|
||||
protocol = "redir",
|
||||
mode = "udp_only",
|
||||
local_address = local_udp_redir_address,
|
||||
local_port = tonumber(local_udp_redir_port)
|
||||
local_address = local_redir_address,
|
||||
local_port = tonumber(local_redir_port)
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1087,8 +1087,7 @@ function gen_config(var)
|
||||
local server_host = var["server_host"]
|
||||
local server_port = var["server_port"]
|
||||
local tcp_proxy_way = var["tcp_proxy_way"]
|
||||
local tcp_redir_port = var["tcp_redir_port"]
|
||||
local udp_redir_port = var["udp_redir_port"]
|
||||
local redir_port = var["redir_port"]
|
||||
local local_socks_address = var["local_socks_address"] or "0.0.0.0"
|
||||
local local_socks_port = var["local_socks_port"]
|
||||
local local_socks_username = var["local_socks_username"]
|
||||
@@ -1237,43 +1236,34 @@ function gen_config(var)
|
||||
table.insert(inbounds, inbound)
|
||||
end
|
||||
|
||||
if tcp_redir_port then
|
||||
local inbound
|
||||
if redir_port then
|
||||
local inbound_tproxy = {
|
||||
type = "tproxy",
|
||||
tag = "tproxy",
|
||||
listen = "::",
|
||||
listen_port = tonumber(redir_port),
|
||||
}
|
||||
if tcp_proxy_way ~= "tproxy" then
|
||||
inbound = {
|
||||
local inbound = {
|
||||
type = "redirect",
|
||||
tag = "redirect_tcp",
|
||||
listen = "::",
|
||||
listen_port = tonumber(tcp_redir_port)
|
||||
listen_port = tonumber(redir_port),
|
||||
}
|
||||
else
|
||||
inbound = {
|
||||
type = "tproxy",
|
||||
tag = "tproxy_tcp",
|
||||
network = "tcp",
|
||||
listen = "::",
|
||||
listen_port = tonumber(tcp_redir_port)
|
||||
}
|
||||
end
|
||||
table.insert(inbounds, inbound)
|
||||
table.insert(route.rules, {
|
||||
action = "sniff",
|
||||
inbound = inbound.tag
|
||||
})
|
||||
end
|
||||
table.insert(inbounds, inbound)
|
||||
table.insert(route.rules, {
|
||||
action = "sniff",
|
||||
inbound = inbound.tag
|
||||
})
|
||||
|
||||
if udp_redir_port then
|
||||
local inbound = {
|
||||
type = "tproxy",
|
||||
tag = "tproxy_udp",
|
||||
network = "udp",
|
||||
listen = "::",
|
||||
listen_port = tonumber(udp_redir_port)
|
||||
}
|
||||
table.insert(inbounds, inbound)
|
||||
inbound_tproxy.tag = "tproxy_udp"
|
||||
inbound_tproxy.network = "udp"
|
||||
end
|
||||
|
||||
table.insert(inbounds, inbound_tproxy)
|
||||
table.insert(route.rules, {
|
||||
action = "sniff",
|
||||
inbound = inbound.tag
|
||||
inbound = inbound_tproxy.tag
|
||||
})
|
||||
end
|
||||
|
||||
@@ -1315,7 +1305,7 @@ function gen_config(var)
|
||||
ut_nodes = _node.urltest_node
|
||||
end
|
||||
|
||||
api.log(" - 加载 Sing-Box URLTest 节点【" .. (_node.remarks or "") .. "】,子节点数量:" .. #(ut_nodes or {}))
|
||||
-- api.log(" - 加载 Sing-Box URLTest 节点【" .. (_node.remarks or "") .. "】,子节点数量:" .. #(ut_nodes or {}))
|
||||
|
||||
local valid_nodes = {}
|
||||
for i = 1, #(ut_nodes or {}) do
|
||||
@@ -1620,16 +1610,14 @@ function gen_config(var)
|
||||
if e["inbound"] and e["inbound"] ~= "" then
|
||||
inboundTag = {}
|
||||
if e["inbound"]:find("tproxy") then
|
||||
if tcp_redir_port then
|
||||
if redir_port then
|
||||
if tcp_proxy_way == "tproxy" then
|
||||
table.insert(inboundTag, "tproxy_tcp")
|
||||
table.insert(inboundTag, "tproxy")
|
||||
else
|
||||
table.insert(inboundTag, "redirect_tcp")
|
||||
table.insert(inboundTag, "tproxy_udp")
|
||||
end
|
||||
end
|
||||
if udp_redir_port then
|
||||
table.insert(inboundTag, "tproxy_udp")
|
||||
end
|
||||
end
|
||||
if e["inbound"]:find("socks") then
|
||||
if local_socks_port then
|
||||
@@ -1987,7 +1975,7 @@ function gen_config(var)
|
||||
local default_dns_flag = "remote"
|
||||
if dns_socks_address and dns_socks_port then
|
||||
else
|
||||
if node_id and (tcp_redir_port or udp_redir_port) then
|
||||
if node_id and redir_port then
|
||||
local node = get_node_by_id(node_id)
|
||||
if node.protocol == "_shunt" then
|
||||
if node.default_node == "_direct" then
|
||||
|
||||
@@ -869,8 +869,7 @@ function gen_config(var)
|
||||
local server_host = var["server_host"]
|
||||
local server_port = var["server_port"]
|
||||
local tcp_proxy_way = var["tcp_proxy_way"] or "redirect"
|
||||
local tcp_redir_port = var["tcp_redir_port"]
|
||||
local udp_redir_port = var["udp_redir_port"]
|
||||
local redir_port = var["redir_port"]
|
||||
local local_socks_address = var["local_socks_address"] or "0.0.0.0"
|
||||
local local_socks_port = var["local_socks_port"]
|
||||
local local_socks_username = var["local_socks_username"]
|
||||
@@ -1068,7 +1067,7 @@ function gen_config(var)
|
||||
blc_nodes = _node.balancing_node
|
||||
end
|
||||
|
||||
api.log(" - 加载 Xray 负载均衡 节点【" .. (_node.remarks or "") .. "】,子节点数量:" .. #(blc_nodes or {}))
|
||||
-- api.log(" - 加载 Xray 负载均衡 节点【" .. (_node.remarks or "") .. "】,子节点数量:" .. #(blc_nodes or {}))
|
||||
|
||||
local valid_nodes = {}
|
||||
for i = 1, #(blc_nodes or {}) do
|
||||
@@ -1448,11 +1447,9 @@ function gen_config(var)
|
||||
if e["inbound"] and e["inbound"] ~= "" then
|
||||
inbound_tag = {}
|
||||
if e["inbound"]:find("tproxy") then
|
||||
if tcp_redir_port then
|
||||
table.insert(inbound_tag, "tcp_redir")
|
||||
end
|
||||
if udp_redir_port then
|
||||
table.insert(inbound_tag, "udp_redir")
|
||||
if redir_port then
|
||||
table.insert(inboundTag, "tcp_redir")
|
||||
table.insert(inboundTag, "udp_redir")
|
||||
end
|
||||
end
|
||||
if e["inbound"]:find("socks") then
|
||||
@@ -1585,13 +1582,14 @@ function gen_config(var)
|
||||
end
|
||||
end
|
||||
|
||||
if tcp_redir_port or udp_redir_port then
|
||||
if redir_port then
|
||||
local inbound = {
|
||||
port = tonumber(redir_port),
|
||||
protocol = "tunnel",
|
||||
settings = {allowedNetwork = "tcp,udp", followRedirect = true},
|
||||
streamSettings = {sockopt = {tproxy = "tproxy"}},
|
||||
sniffing = {
|
||||
enabled = (xray_settings.sniffing_override_dest == "1") or (node and node.protocol == "_shunt") or false
|
||||
enabled = xray_settings.sniffing_override_dest == "1" or node.protocol == "_shunt"
|
||||
}
|
||||
}
|
||||
if inbound.sniffing.enabled == true then
|
||||
@@ -1611,22 +1609,16 @@ function gen_config(var)
|
||||
end
|
||||
end
|
||||
|
||||
if tcp_redir_port then
|
||||
local tcp_inbound = api.clone(inbound)
|
||||
tcp_inbound.tag = "tcp_redir"
|
||||
tcp_inbound.settings.allowedNetwork = "tcp"
|
||||
tcp_inbound.port = tonumber(tcp_redir_port)
|
||||
tcp_inbound.streamSettings.sockopt.tproxy = tcp_proxy_way
|
||||
table.insert(inbounds, tcp_inbound)
|
||||
end
|
||||
local tcp_inbound = api.clone(inbound)
|
||||
tcp_inbound.tag = "tcp_redir"
|
||||
tcp_inbound.settings.allowedNetwork = "tcp"
|
||||
tcp_inbound.streamSettings.sockopt.tproxy = tcp_proxy_way
|
||||
table.insert(inbounds, tcp_inbound)
|
||||
|
||||
if udp_redir_port then
|
||||
local udp_inbound = api.clone(inbound)
|
||||
udp_inbound.tag = "udp_redir"
|
||||
udp_inbound.settings.allowedNetwork = "udp"
|
||||
udp_inbound.port = tonumber(udp_redir_port)
|
||||
table.insert(inbounds, udp_inbound)
|
||||
end
|
||||
local udp_inbound = api.clone(inbound)
|
||||
udp_inbound.tag = "udp_redir"
|
||||
udp_inbound.settings.allowedNetwork = "udp"
|
||||
table.insert(inbounds, udp_inbound)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ local sid = self.section
|
||||
if (!node) return false;
|
||||
let changed = false;
|
||||
const all_node = node.querySelectorAll("[id]");
|
||||
const reg1 = /^cbid\..*\.(tcp_node|udp_node)\.main$/;
|
||||
const reg1 = /^cbid\..*node\.main$/;
|
||||
|
||||
for (const el of all_node) {
|
||||
if (!reg1.test(el.id)) continue;
|
||||
@@ -43,15 +43,15 @@ local sid = self.section
|
||||
const cbid = el.id.replace(/\.main$/, "");
|
||||
const hidden_select = document.getElementById(cbid);
|
||||
const node_select_value = hidden_select?.options[0]?.value;
|
||||
if (!node_select_value || node_select_value.indexOf("tcp") === 0) {
|
||||
if (!node_select_value) {
|
||||
continue;
|
||||
}
|
||||
|
||||
let html = '<a href="#" onclick="return to_edit_node(this);"><%:Edit%></a>';
|
||||
|
||||
const m = cbid.match(/\.(tcp|udp)_node$/);
|
||||
if (m && (m[1] === "tcp" || m[1] === "udp")) {
|
||||
html += '<a href="#" onclick="window.open(\'' + '<%=api.url("get_redir_log") .. "?name=" .. sid%>&proto=' + m[1] + '\', \'_blank\')"><%:Log%></a>';
|
||||
const m = cbid.match(/\.node$/);
|
||||
if (m) {
|
||||
html += '<a href="#" onclick="window.open(\'' + '<%=api.url("get_redir_log") .. "?id=" .. sid%>' + '\', \'_blank\')"><%:Log%></a>';
|
||||
}
|
||||
|
||||
html = '<div class="node-actions" style="display:inline-flex; align-items:center; gap:4px; flex-wrap:wrap; margin-left:4px;">' + html + '</div>'
|
||||
|
||||
@@ -131,9 +131,9 @@ local sid = "@global[0]"
|
||||
|
||||
let html = '<a href="#" onclick="return to_edit_node(this, global_id);"><%:Edit%></a>';
|
||||
|
||||
const m = cbid.match(/\.(tcp|udp)_node$/);
|
||||
if (m && (m[1] === "tcp" || m[1] === "udp")) {
|
||||
html += '<a href="#" onclick="window.open(\'' + '<%=api.url("get_redir_log")%>?name=default&proto=' + m[1] + '\', \'_blank\')"><%:Log%></a>';
|
||||
const m = cbid.match(/\.node$/);
|
||||
if (m) {
|
||||
html += '<a href="#" onclick="window.open(\'' + '<%=api.url("get_redir_log")%>?id=default' + '\', \'_blank\')"><%:Log%></a>';
|
||||
}
|
||||
|
||||
html = '<div class="node-actions" style="display:inline-flex; align-items:center; gap:4px; flex-wrap:wrap; margin-left:4px;">' + html + '</div>'
|
||||
@@ -249,7 +249,7 @@ local sid = "@global[0]"
|
||||
})();
|
||||
|
||||
document.addEventListener("DOMContentLoaded", () => setTimeout(() => {
|
||||
const hiddenSelect = document.getElementById("cbid.<%=appname%>.<%=sid%>.tcp_node");
|
||||
const hiddenSelect = document.getElementById("cbid.<%=appname%>.<%=sid%>.node");
|
||||
let o_val = hiddenSelect.value
|
||||
const o_hasItem = shunt_list.find(element => element.id == o_val);
|
||||
hiddenSelect.addEventListener("change", function(el){
|
||||
@@ -259,7 +259,7 @@ local sid = "@global[0]"
|
||||
XHR.get('<%=api.url("update_config")%>', {
|
||||
id: "<%=sid%>",
|
||||
data: JSON.stringify({
|
||||
tcp_node: new_val
|
||||
node: new_val
|
||||
})
|
||||
},
|
||||
function(x, data) {
|
||||
|
||||
@@ -99,7 +99,7 @@ https://github.com/pure-css/pure/blob/master/LICENSE.md
|
||||
</div>
|
||||
</div>
|
||||
<div class="pure-u-2-3">
|
||||
<h4 id="status_tcp_node">TCP<br /><span class="red"><%:NOT RUNNING%></span></h4>
|
||||
<h4 id="status_tcp">TCP<br /><span class="red"><%:NOT RUNNING%></span></h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -111,7 +111,7 @@ https://github.com/pure-css/pure/blob/master/LICENSE.md
|
||||
</div>
|
||||
</div>
|
||||
<div class="pure-u-2-3">
|
||||
<h4 id="status_udp_node">UDP<br /><span class="red"><%:NOT RUNNING%></span></h4>
|
||||
<h4 id="status_udp">UDP<br /><span class="red"><%:NOT RUNNING%></span></h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -201,26 +201,26 @@ https://github.com/pure-css/pure/blob/master/LICENSE.md
|
||||
var status_haproxy = document.getElementById('status_haproxy');
|
||||
if (data) {
|
||||
if (true) {
|
||||
var status_tcp_node = document.getElementById('status_tcp_node');
|
||||
if (status_tcp_node) {
|
||||
var status_tcp = document.getElementById('status_tcp');
|
||||
if (status_tcp) {
|
||||
var text = 'TCP<br />';
|
||||
if (data["tcp_node_status"])
|
||||
if (data["tcp_status"])
|
||||
text += '<span class="green"><%:RUNNING%></span>';
|
||||
else
|
||||
text += '<span class="red"><%:NOT RUNNING%></span>';
|
||||
status_tcp_node.innerHTML = text;
|
||||
status_tcp.innerHTML = text;
|
||||
}
|
||||
}
|
||||
|
||||
if (true) {
|
||||
var status_udp_node = document.getElementById('status_udp_node');
|
||||
if (status_udp_node) {
|
||||
var status_udp = document.getElementById('status_udp');
|
||||
if (status_udp) {
|
||||
var text = 'UDP<br />';
|
||||
if (data["udp_node_status"])
|
||||
if (data["udp_status"])
|
||||
text += '<span class="green"><%:RUNNING%></span>';
|
||||
else
|
||||
text += '<span class="red"><%:NOT RUNNING%></span>';
|
||||
status_udp_node.innerHTML = text;
|
||||
status_udp.innerHTML = text;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -75,10 +75,13 @@ display:block !important;
|
||||
const _ASSETS = '/luci-static/passwall/';
|
||||
const CHECK_IP_URL = '<%=url([[admin]], [[services]], [[passwall]], [[ip]])%>';
|
||||
|
||||
let mainContent = document.getElementById("maincontent");
|
||||
let statusBar = document.querySelector(".status-bar");
|
||||
|
||||
function resize() {
|
||||
statusBar.style.width = document.getElementById("maincontent").offsetWidth + 'px';
|
||||
wW = window.innerWidth;
|
||||
let lw = document.querySelector(".main-left, :root[data-layout='sidebar'] .fs-sidebar")?.offsetWidth ?? 5;
|
||||
statusBar.style.width = (wW - lw) + 'px';
|
||||
let flagElement = statusBar.querySelector(".flag");
|
||||
flagElement.style.width = (flagElement.offsetHeight / 3 * 4) + 'px';
|
||||
|
||||
@@ -122,5 +125,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
});
|
||||
|
||||
window.addEventListener('resize', resize);
|
||||
if (mainContent && window.getComputedStyle(mainContent).getPropertyValue("contain")=== "paint") {
|
||||
document.body.appendChild(statusBar);
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -4,6 +4,23 @@ local api = map.api
|
||||
local appname = map.config
|
||||
local is_js_luci = api.is_js_luci()
|
||||
local section_tag = is_js_luci and "div" or "fieldset"
|
||||
|
||||
local default_node_type = ""
|
||||
local shunt_rule_list = {}
|
||||
local node = map:get("@global[0]", "node")
|
||||
if node then
|
||||
local node_type = map:get(node, "type")
|
||||
local node_protocol = map:get(node, "protocol")
|
||||
if (node_type == "Xray" or node_type == "sing-box") and node_protocol == "_shunt" then
|
||||
default_node_type = node_protocol
|
||||
local node_shunt_group = map:get(node, "shunt_group")
|
||||
map:foreach("shunt_rules", function(e)
|
||||
if e[".name"] and e.remarks and e.group == node_shunt_group then
|
||||
shunt_rule_list[#shunt_rule_list + 1] = e
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
-%>
|
||||
<script src="<%=resource%>/view/<%=appname%>/Sortable.min.js?v=1.15.7"></script>
|
||||
|
||||
@@ -22,12 +39,13 @@ table td, .table .td {
|
||||
display: none;
|
||||
width: 30rem;
|
||||
position: fixed;
|
||||
top:50%;
|
||||
padding-top: 30px;
|
||||
top:45%;
|
||||
z-index: 99;
|
||||
text-align: center;
|
||||
background: white;
|
||||
box-shadow: darkgrey 10px 10px 30px 5px;
|
||||
box-shadow: darkgrey 10px 10px 30px 5px;
|
||||
text-align: center;
|
||||
padding: 0.5em;
|
||||
}
|
||||
|
||||
._now_use_bg {
|
||||
@@ -669,13 +687,13 @@ table td, .table .td {
|
||||
function get_now_use_node() {
|
||||
XHR.get('<%=api.url("get_now_use_node")%>', null,
|
||||
function(x, result) {
|
||||
var id = result["TCP"];
|
||||
var id = result["global"];
|
||||
if (id) {
|
||||
var dom = document.getElementById("cbi-<%=appname%>-" + id);
|
||||
if (dom) {
|
||||
dom.title = '<%=api.i18n.translatef("Currently using %s node", "TCP")%>';
|
||||
dom.title = "<%:Currently using node%>";
|
||||
dom.classList.add("_now_use_bg");
|
||||
//var v = "<a style='color: red'>当前TCP节点:</a>" + document.getElementById("cbid.<%=appname%>." + id + ".remarks").value;
|
||||
//var v = "<a style='color: red'><%:Using...%>:</a>" + document.getElementById("cbid.<%=appname%>." + id + ".remarks").value;
|
||||
//document.getElementById("cbi-<%=appname%>-" + id + "-remarks").innerHTML = v;
|
||||
var dom_remarks = dom.querySelector("td.pw-remark");
|
||||
if (dom_remarks) {
|
||||
@@ -683,22 +701,6 @@ table td, .table .td {
|
||||
}
|
||||
}
|
||||
}
|
||||
id = result["UDP"];
|
||||
if (id) {
|
||||
var dom = document.getElementById("cbi-<%=appname%>-" + id);
|
||||
if (dom) {
|
||||
if (result["TCP"] == result["UDP"]) {
|
||||
dom.title = '<%=api.i18n.translatef("Currently using %s node", "TCP/UDP")%>';
|
||||
} else {
|
||||
dom.title = '<%=api.i18n.translatef("Currently using %s node", "UDP")%>';
|
||||
}
|
||||
dom.classList.add("_now_use_bg");
|
||||
var dom_remarks = dom.querySelector("td.pw-remark");
|
||||
if (dom_remarks) {
|
||||
dom_remarks.style.color = 'red';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
@@ -1223,10 +1225,10 @@ table td, .table .td {
|
||||
document.getElementById("set_node_div").style.display="none";
|
||||
document.getElementById("set_node_name").textContent = "";
|
||||
},
|
||||
set(protocol) {
|
||||
if (confirm('<%:Are you sure set to%> ' + protocol.toUpperCase() + ' <%:the server?%>') == true){
|
||||
set(type, config) {
|
||||
if (confirm('<%:Are you sure set this node?%>') == true){
|
||||
ajax.abortAll();
|
||||
window.location.href = '<%=api.url("set_node")%>?protocol=' + protocol + '§ion=' + this.section;
|
||||
window.location.href = '<%=api.url("set_node")%>?type=' + type + '&config=' + config + '§ion=' + this.section;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1617,14 +1619,22 @@ table td, .table .td {
|
||||
</div>
|
||||
|
||||
<div style="display: -webkit-flex; display: flex; -webkit-align-items: center; align-items: center; -webkit-justify-content: center; justify-content: center;">
|
||||
<div id="set_node_div" style="text-align: center;">
|
||||
<div class="cbi-value" style="display: flex; justify-content: center; align-items: center; margin: 8px 0;">
|
||||
<div id="set_node_div">
|
||||
<div class="cbi-value" style="display: flex; justify-content: center; align-items: center; margin: 1em 0; height: 2em;">
|
||||
<font color=#666><%:You choose node is:%></font><a style="color: red" id="set_node_name"></a>
|
||||
<div style="position:absolute; right:0.5em; top: 0.5em;"><input class="btn cbi-button" type="button" onclick="set_node_div.close()" value="X" /></div>
|
||||
</div>
|
||||
<div class="cbi-value" style="display: flex; justify-content: center; gap: 8px; margin: 8px 0;">
|
||||
<input class="btn cbi-button cbi-button-edit" type="button" onclick="set_node_div.set('tcp')" value="TCP" />
|
||||
<input class="btn cbi-button cbi-button-edit" type="button" onclick="set_node_div.set('udp')" value="UDP" />
|
||||
<input class="btn cbi-button cbi-button-remove" type="button" onclick="set_node_div.close()" value="<%:Close%>" />
|
||||
<div class="cbi-value" style="justify-content: center; gap: 8px; margin: 1em 0;">
|
||||
<%- if default_node_type == "_shunt" then
|
||||
for i, v in ipairs(shunt_rule_list) do
|
||||
-%>
|
||||
<input class="btn cbi-button" type="button" onclick="set_node_div.set('<%=node%>', '<%=v[".name"]%>')" value="<%=v.remarks%>" />
|
||||
<%-
|
||||
end
|
||||
-%>
|
||||
<% else %>
|
||||
<input class="btn cbi-button" type="button" onclick="set_node_div.set('@global[0]', 'node')" value="<%:Node%>" />
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -136,11 +136,8 @@ msgstr "清除"
|
||||
msgid "Main switch"
|
||||
msgstr "主开关"
|
||||
|
||||
msgid "TCP Node"
|
||||
msgstr "TCP 节点"
|
||||
|
||||
msgid "UDP Node"
|
||||
msgstr "UDP 节点"
|
||||
msgid "Proxy Node"
|
||||
msgstr "代理节点"
|
||||
|
||||
msgid "Edit Current Node"
|
||||
msgstr "编辑当前节点"
|
||||
@@ -181,8 +178,8 @@ msgstr "%s 不能为空。"
|
||||
msgid "Filter Mode"
|
||||
msgstr "过滤模式"
|
||||
|
||||
msgid "TCP node must be '%s' type to use FakeDNS."
|
||||
msgstr "TCP 节点必须是 '%s' 类型才能使用 FakeDNS。"
|
||||
msgid "Node must be '%s' type to use FakeDNS."
|
||||
msgstr "节点必须是 '%s' 类型才能使用 FakeDNS。"
|
||||
|
||||
msgid "Direct DNS"
|
||||
msgstr "直连 DNS"
|
||||
@@ -472,8 +469,8 @@ msgstr "你确定要删除选择的节点吗?"
|
||||
msgid "You no select nodes !"
|
||||
msgstr "你没有选择任何节点!"
|
||||
|
||||
msgid "Are you sure set to"
|
||||
msgstr "你确定要设为"
|
||||
msgid "Are you sure set this node?"
|
||||
msgstr "你确定要设置这个节点吗?"
|
||||
|
||||
msgid "the server?"
|
||||
msgstr "服务器吗?"
|
||||
@@ -1667,9 +1664,6 @@ msgstr "日志"
|
||||
msgid "Enable Node Log"
|
||||
msgstr "启用节点日志"
|
||||
|
||||
msgid "%s Node Log"
|
||||
msgstr "%s 节点日志"
|
||||
|
||||
msgid "Log Level"
|
||||
msgstr "日志等级"
|
||||
|
||||
@@ -2175,8 +2169,8 @@ msgstr "调整分组"
|
||||
msgid "Reassign Node Group"
|
||||
msgstr "调整节点分组"
|
||||
|
||||
msgid "Currently using %s node"
|
||||
msgstr "当前使用的 %s 节点"
|
||||
msgid "Currently using node"
|
||||
msgstr "当前使用的节点"
|
||||
|
||||
msgid "Search nodes..."
|
||||
msgstr "搜索节点…"
|
||||
|
||||
@@ -69,6 +69,31 @@ for sid in $(uci show passwall | grep "@subscribe_list" | cut -d '.' -sf 2 | cut
|
||||
unset sid new_id
|
||||
done
|
||||
|
||||
migrate_option() {
|
||||
local section="$1"
|
||||
local old="$2"
|
||||
local new="$3"
|
||||
local prefix="passwall.${section}"
|
||||
if uci -q show "${prefix}.${new}" >/dev/null; then
|
||||
uci -q delete "${prefix}.${old}"
|
||||
elif uci -q show "${prefix}.${old}" >/dev/null; then
|
||||
uci -q set "${prefix}.${new}=$(uci -q get "${prefix}.${old}")"
|
||||
uci -q delete "${prefix}.${old}"
|
||||
fi
|
||||
}
|
||||
|
||||
migrate_option "@global[0]" tcp_node node
|
||||
uci -q delete "passwall.@global[0].udp_node"
|
||||
migrate_option "@global[0]" tcp_node_socks_port node_socks_port
|
||||
migrate_option "@global[0]" tcp_node_socks_bind_local node_socks_bind_local
|
||||
migrate_option "@global[0]" log_tcp log_node
|
||||
uci -q delete "passwall.@global[0].log_udp"
|
||||
|
||||
for sid in $(uci show passwall | grep "=acl_rule" | cut -d '.' -sf 2 | cut -d '=' -sf 1); do
|
||||
migrate_option "${sid}" tcp_node node
|
||||
uci -q delete "passwall.${sid}.udp_node"
|
||||
done
|
||||
|
||||
uci -q commit passwall
|
||||
|
||||
sed -i "s#add_from#group#g" /etc/config/passwall 2>/dev/null
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
config global
|
||||
option enabled '0'
|
||||
option socks_enabled '0'
|
||||
option tcp_node_socks_port '1070'
|
||||
option node_socks_port '1070'
|
||||
option filter_proxy_ipv6 '1'
|
||||
option dns_shunt 'chinadns-ng'
|
||||
option dns_mode 'tcp'
|
||||
@@ -21,8 +21,7 @@ config global
|
||||
option localhost_proxy '1'
|
||||
option client_proxy '1'
|
||||
option acl_enable '0'
|
||||
option log_tcp '0'
|
||||
option log_udp '0'
|
||||
option log_node '0'
|
||||
option loglevel 'error'
|
||||
option log_chinadns_ng '0'
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -14,7 +14,7 @@ local NO_IPV6_TRUST = var["-NO_IPV6_TRUST"]
|
||||
local DEFAULT_MODE = var["-DEFAULT_MODE"]
|
||||
local DEFAULT_TAG = var["-DEFAULT_TAG"]
|
||||
local NO_LOGIC_LOG = var["-NO_LOGIC_LOG"]
|
||||
local TCP_NODE = var["-TCP_NODE"]
|
||||
local NODE = var["-NODE"]
|
||||
local NFTFLAG = var["-NFTFLAG"]
|
||||
local FILTER_HTTPS = var["-FILTER_HTTPS"]
|
||||
local LOG_FILE = var["-LOG_FILE"]
|
||||
@@ -30,7 +30,7 @@ local FLAG_PATH = TMP_ACL_PATH .. "/" .. FLAG
|
||||
local config_lines = {}
|
||||
local tmp_lines = {}
|
||||
local USE_GEOVIEW = api.uci_get_c("@global_rules[0]", "enable_geoview")
|
||||
local IS_SHUNT_NODE = api.uci_get_c(TCP_NODE, "protocol") == "_shunt"
|
||||
local IS_SHUNT_NODE = api.uci_get_c(NODE, "protocol") == "_shunt"
|
||||
|
||||
if not api.is_finded("geoview") then
|
||||
USE_GEOVIEW = "0"
|
||||
@@ -385,7 +385,7 @@ if IS_SHUNT_NODE then
|
||||
local file_shunt_host = FLAG_PATH .. "/shunt_proxy_host"
|
||||
local geosite_white_arg, geosite_shunt_arg = "", ""
|
||||
|
||||
local t = api.uci_get_c(TCP_NODE)
|
||||
local t = api.uci_get_c(NODE)
|
||||
local default_node_id = t["default_node"] or "_direct"
|
||||
api.uci_foreach_c("shunt_rules", function(s)
|
||||
local _node_id = t[s[".name"]]
|
||||
|
||||
@@ -163,7 +163,7 @@ function add_rule(var)
|
||||
local TUN_DNS = var["-TUN_DNS"]
|
||||
local USE_DEFAULT_DNS = var["-USE_DEFAULT_DNS"]
|
||||
local CHINADNS_DNS = var["-CHINADNS_DNS"]
|
||||
local TCP_NODE = var["-TCP_NODE"]
|
||||
local NODE = var["-NODE"]
|
||||
local USE_DIRECT_LIST = var["-USE_DIRECT_LIST"]
|
||||
local USE_PROXY_LIST = var["-USE_PROXY_LIST"]
|
||||
local USE_BLOCK_LIST = var["-USE_BLOCK_LIST"]
|
||||
@@ -178,7 +178,7 @@ function add_rule(var)
|
||||
local CACHE_DNS_PATH = CACHE_PATH .. "/" .. CACHE_FLAG
|
||||
local CACHE_TEXT_FILE = CACHE_DNS_PATH .. ".txt"
|
||||
local USE_CHINADNS_NG = "0"
|
||||
local IS_SHUNT_NODE = api.uci_get_c(TCP_NODE, "protocol") == "_shunt"
|
||||
local IS_SHUNT_NODE = api.uci_get_c(NODE, "protocol") == "_shunt"
|
||||
local USE_GEOVIEW = api.uci_get_c("@global_rules[0]", "enable_geoview")
|
||||
|
||||
local list1 = {}
|
||||
@@ -613,7 +613,7 @@ function add_rule(var)
|
||||
|
||||
--分流规则
|
||||
if IS_SHUNT_NODE and USE_CHINADNS_NG == "0" then
|
||||
local t = api.uci_get_c(TCP_NODE)
|
||||
local t = api.uci_get_c(NODE)
|
||||
local default_node_id = t["default_node"] or "_direct"
|
||||
api.uci_foreach_c("shunt_rules", function(s)
|
||||
local _node_id = t[s[".name"]]
|
||||
|
||||
@@ -10,7 +10,7 @@ local USE_DEFAULT_DNS = var["-USE_DEFAULT_DNS"]
|
||||
local REMOTE_DNS = var["-REMOTE_DNS"]
|
||||
local TUN_DNS = var["-TUN_DNS"]
|
||||
local DNS_MODE = var["-DNS_MODE"]
|
||||
local TCP_NODE = var["-TCP_NODE"]
|
||||
local NODE = var["-NODE"]
|
||||
local USE_DIRECT_LIST = var["-USE_DIRECT_LIST"]
|
||||
local USE_PROXY_LIST = var["-USE_PROXY_LIST"]
|
||||
local USE_BLOCK_LIST = var["-USE_BLOCK_LIST"]
|
||||
@@ -36,7 +36,7 @@ local TMP_CONF_FILE = FLAG_PATH .. "/smartdns.conf"
|
||||
local config_lines = {}
|
||||
local tmp_lines = {}
|
||||
local USE_GEOVIEW = api.uci_get_c("@global_rules[0]", "enable_geoview")
|
||||
local IS_SHUNT_NODE = api.uci_get_c(TCP_NODE, "protocol") == "_shunt"
|
||||
local IS_SHUNT_NODE = api.uci_get_c(NODE, "protocol") == "_shunt"
|
||||
|
||||
if not api.is_finded("geoview") then
|
||||
USE_GEOVIEW = "0"
|
||||
@@ -553,7 +553,7 @@ if IS_SHUNT_NODE then
|
||||
local file_shunt_host = FLAG_PATH .. "/shunt_proxy_host"
|
||||
local geosite_white_arg, geosite_shunt_arg = "", ""
|
||||
|
||||
local t = api.uci_get_c(TCP_NODE)
|
||||
local t = api.uci_get_c(NODE)
|
||||
local default_node_id = t["default_node"] or "_direct"
|
||||
api.uci_foreach_c("shunt_rules", function(s)
|
||||
local _node_id = t[s[".name"]]
|
||||
|
||||
@@ -25,9 +25,6 @@ IPSET_BLACK6="psw_black6"
|
||||
IPSET_WHITE6="psw_white6"
|
||||
IPSET_BLOCK6="psw_block6"
|
||||
|
||||
USE_SHUNT_TCP=0
|
||||
USE_SHUNT_UDP=0
|
||||
|
||||
# ASCII code for PSW1.Use whatever,just not the same.
|
||||
FWMARK="0x50535731"
|
||||
|
||||
@@ -231,42 +228,29 @@ load_acl() {
|
||||
[ "$tcp_redir_ports" = "default" ] && tcp_redir_ports=$TCP_REDIR_PORTS
|
||||
[ "$udp_redir_ports" = "default" ] && udp_redir_ports=$UDP_REDIR_PORTS
|
||||
|
||||
[ -n "$(get_cache_var "ACL_${sid}_tcp_node")" ] && tcp_node=$(get_cache_var "ACL_${sid}_tcp_node")
|
||||
[ -n "$(get_cache_var "ACL_${sid}_tcp_redir_port")" ] && tcp_port=$(get_cache_var "ACL_${sid}_tcp_redir_port")
|
||||
[ -n "$(get_cache_var "ACL_${sid}_udp_node")" ] && udp_node=$(get_cache_var "ACL_${sid}_udp_node")
|
||||
[ -n "$(get_cache_var "ACL_${sid}_udp_redir_port")" ] && udp_port=$(get_cache_var "ACL_${sid}_udp_redir_port")
|
||||
[ -n "$(get_cache_var "ACL_${sid}_node")" ] && node=$(get_cache_var "ACL_${sid}_node")
|
||||
[ -n "$(get_cache_var "ACL_${sid}_redir_port")" ] && {
|
||||
tcp_port=$(get_cache_var "ACL_${sid}_redir_port")
|
||||
udp_port=$tcp_port
|
||||
}
|
||||
[ -n "$(get_cache_var "ACL_${sid}_dns_port")" ] && dns_redirect_port=$(get_cache_var "ACL_${sid}_dns_port")
|
||||
[ -n "$(get_cache_var "ACL_${sid}_fakedns")" ] && use_fakedns=$(get_cache_var "ACL_${sid}_fakedns")
|
||||
[ -n "$tcp_node" ] && {
|
||||
if [ "$(config_get_type $tcp_node)" = "socks" ]; then
|
||||
tcp_node_remark="Socks 配置($(config_n_get $tcp_node port) 端口)"
|
||||
[ -n "$node" ] && {
|
||||
if [ "$(config_get_type $node)" = "socks" ]; then
|
||||
node_remark="Socks 配置($(config_n_get $node port) 端口)"
|
||||
else
|
||||
tcp_node_remark=$(config_n_get $tcp_node remarks)
|
||||
fi
|
||||
}
|
||||
[ -n "$udp_node" ] && {
|
||||
if [ "$(config_get_type $udp_node)" = "socks" ]; then
|
||||
udp_node_remark="Socks 配置($(config_n_get $udp_node port) 端口)"
|
||||
else
|
||||
udp_node_remark=$(config_n_get $udp_node remarks)
|
||||
node_remark=$(config_n_get $node remarks)
|
||||
fi
|
||||
}
|
||||
|
||||
use_shunt_tcp=0
|
||||
use_shunt_udp=0
|
||||
[ -n "$tcp_node" ] && [ "$(config_n_get $tcp_node protocol)" = "_shunt" ] && use_shunt_tcp=1
|
||||
[ -n "$udp_node" ] && [ "$(config_n_get $udp_node protocol)" = "_shunt" ] && use_shunt_udp=1
|
||||
use_shunt_node=0
|
||||
[ -n "$node" ] && [ "$(config_n_get $node protocol)" = "_shunt" ] && use_shunt_node=1
|
||||
|
||||
[ "${use_global_config}" = "1" ] && {
|
||||
if [ "$(config_get_type $TCP_NODE)" = "socks" ]; then
|
||||
tcp_node_remark="Socks 配置($(config_n_get $TCP_NODE} port) 端口)"
|
||||
if [ "$(config_get_type $NODE)" = "socks" ]; then
|
||||
node_remark="Socks 配置($(config_n_get $NODE} port) 端口)"
|
||||
else
|
||||
tcp_node_remark=$(config_n_get $TCP_NODE remarks)
|
||||
fi
|
||||
if [ "$(config_get_type $UDP_NODE)" = "socks" ]; then
|
||||
udp_node_remark="Socks 配置($(config_n_get $UDP_NODE port) 端口)"
|
||||
else
|
||||
udp_node_remark=$(config_n_get $UDP_NODE remarks)
|
||||
node_remark=$(config_n_get $NODE remarks)
|
||||
fi
|
||||
use_direct_list=${USE_DIRECT_LIST}
|
||||
use_proxy_list=${USE_PROXY_LIST}
|
||||
@@ -275,8 +259,7 @@ load_acl() {
|
||||
chn_list=${CHN_LIST}
|
||||
tcp_proxy_mode=${TCP_PROXY_MODE}
|
||||
udp_proxy_mode=${UDP_PROXY_MODE}
|
||||
use_shunt_tcp=${USE_SHUNT_TCP}
|
||||
use_shunt_udp=${USE_SHUNT_UDP}
|
||||
use_shunt_node=${USE_SHUNT_NODE}
|
||||
dns_redirect_port=${DNS_REDIRECT_PORT}
|
||||
black_set_name=${IPSET_BLACK}
|
||||
black6_set_name=${IPSET_BLACK6}
|
||||
@@ -388,7 +371,7 @@ load_acl() {
|
||||
ipset -! create $gfw6_set_name nethash family inet6 maxelem 1048576 timeout 172800
|
||||
}
|
||||
}
|
||||
[ "${use_shunt_tcp}" = "1" ] || [ "${use_shunt_udp}" = "1" ] && {
|
||||
[ "${use_shunt_node}" = "1" ] && {
|
||||
[ "${use_global_config}" = "0" ] && {
|
||||
shunt_set_name="psw_${sid}_shunt"
|
||||
shunt6_set_name="psw_${sid}_shunt6"
|
||||
@@ -397,12 +380,8 @@ load_acl() {
|
||||
# 预加载分流规则 ip 到 ipset
|
||||
local GEOIP_CODE=""
|
||||
local shunt_ids=$(uci show $CONFIG | grep "=shunt_rules" | awk -F '.' '{print $2}' | awk -F '=' '{print $1}')
|
||||
local shunt_group shunt_id
|
||||
if [ "${use_shunt_tcp}" = "1" ]; then
|
||||
shunt_group=$(config_n_get $tcp_node shunt_group)
|
||||
elif [ "${use_shunt_udp}" = "1" ]; then
|
||||
shunt_group=$(config_n_get $udp_node shunt_group)
|
||||
fi
|
||||
local shunt_group=$(config_n_get $node shunt_group)
|
||||
local shunt_id
|
||||
for shunt_id in $shunt_ids; do
|
||||
[ "${shunt_group}" != "$(config_n_get ${shunt_id} group)" ] && continue
|
||||
config_n_get $shunt_id ip_list | tr -s "\r\n" "\n" | grep -v "^#" | sed -e "/^$/d" | grep -E "(\.((2(5[0-5]|[0-4][0-9]))|[0-1]?[0-9]{1,2})){3}" | sed -e "s/^/add $shunt_set_name &/g" -e "s/$/ timeout 0/g" | ipset -! -R
|
||||
@@ -431,7 +410,7 @@ load_acl() {
|
||||
[ "$_ipv4" != "1" ] && $ip6t_n -A PSW_DNS $(comment "$remarks") -p udp ${_ipt_source} --dport 53 -j REDIRECT --to-ports ${dns_redirect} 2>/dev/null
|
||||
$ipt_n -A PSW_DNS $(comment "$remarks") -p tcp ${_ipt_source} --dport 53 -j REDIRECT --to-ports ${dns_redirect}
|
||||
[ "$_ipv4" != "1" ] && $ip6t_n -A PSW_DNS $(comment "$remarks") -p tcp ${_ipt_source} --dport 53 -j REDIRECT --to-ports ${dns_redirect} 2>/dev/null
|
||||
[ -z "$(get_cache_var "ACL_${sid}_tcp_default")" ] && echolog " - ${msg}使用与全局配置不相同节点,已将DNS强制重定向到专用 DNS 服务器。"
|
||||
[ -z "$(get_cache_var "ACL_${sid}_default")" ] && echolog " - ${msg}使用与全局配置不相同节点,已将DNS强制重定向到专用 DNS 服务器。"
|
||||
fi
|
||||
|
||||
[ -n "$tcp_port" ] || [ -n "$udp_port" ] && {
|
||||
@@ -448,14 +427,14 @@ load_acl() {
|
||||
[ "${use_proxy_list}" = "1" ] && add_port_rules "$ip6t_m -A PSW $(comment "$remarks") -p tcp ${_ipt_source}" $tcp_proxy_drop_ports "$(dst $black6_set_name) -j MARK --set-mark 88" 2>/dev/null
|
||||
[ "${use_gfw_list}" = "1" ] && add_port_rules "$ip6t_m -A PSW $(comment "$remarks") -p tcp ${_ipt_source}" $tcp_proxy_drop_ports "$(dst $gfw6_set_name) -j MARK --set-mark 88" 2>/dev/null
|
||||
[ "${chn_list}" != "0" ] && add_port_rules "$ip6t_m -A PSW $(comment "$remarks") -p tcp ${_ipt_source}" $tcp_proxy_drop_ports "$(dst $IPSET_CHN6) $(get_jump_ipt ${chn_list} "-j MARK --set-mark 88")" 2>/dev/null
|
||||
[ "${use_shunt_tcp}" = "1" ] && add_port_rules "$ip6t_m -A PSW $(comment "$remarks") -p tcp ${_ipt_source}" $tcp_proxy_drop_ports "$(dst $shunt6_set_name) -j MARK --set-mark 88" 2>/dev/null
|
||||
[ "${use_shunt_node}" = "1" ] && add_port_rules "$ip6t_m -A PSW $(comment "$remarks") -p tcp ${_ipt_source}" $tcp_proxy_drop_ports "$(dst $shunt6_set_name) -j MARK --set-mark 88" 2>/dev/null
|
||||
[ "${tcp_proxy_mode}" != "disable" ] && add_port_rules "$ip6t_m -A PSW $(comment "$remarks") -p tcp ${_ipt_source}" $tcp_proxy_drop_ports "-j MARK --set-mark 88" 2>/dev/null
|
||||
}
|
||||
[ "${use_fakedns}" = "1" ] && add_port_rules "$ipt_m -A PSW $(comment "$remarks") -p tcp ${_ipt_source}" $tcp_proxy_drop_ports "-d $FAKE_IP -j MARK --set-mark 88"
|
||||
[ "${use_proxy_list}" = "1" ] && add_port_rules "$ipt_m -A PSW $(comment "$remarks") -p tcp ${_ipt_source}" $tcp_proxy_drop_ports "$(dst $black_set_name) -j MARK --set-mark 88"
|
||||
[ "${use_gfw_list}" = "1" ] && add_port_rules "$ipt_m -A PSW $(comment "$remarks") -p tcp ${_ipt_source}" $tcp_proxy_drop_ports "$(dst $gfw_set_name) -j MARK --set-mark 88"
|
||||
[ "${chn_list}" != "0" ] && add_port_rules "$ipt_m -A PSW $(comment "$remarks") -p tcp ${_ipt_source}" $tcp_proxy_drop_ports "$(dst $IPSET_CHN) $(get_jump_ipt ${chn_list} "-j MARK --set-mark 88")"
|
||||
[ "${use_shunt_tcp}" = "1" ] && add_port_rules "$ipt_m -A PSW $(comment "$remarks") -p tcp ${_ipt_source}" $tcp_proxy_drop_ports "$(dst $shunt_set_name) -j MARK --set-mark 88"
|
||||
[ "${use_shunt_node}" = "1" ] && add_port_rules "$ipt_m -A PSW $(comment "$remarks") -p tcp ${_ipt_source}" $tcp_proxy_drop_ports "$(dst $shunt_set_name) -j MARK --set-mark 88"
|
||||
[ "${tcp_proxy_mode}" != "disable" ] && add_port_rules "$ipt_m -A PSW $(comment "$remarks") -p tcp ${_ipt_source}" $tcp_proxy_drop_ports "-j MARK --set-mark 88"
|
||||
echolog " - ${msg}屏蔽代理 TCP 端口[${tcp_proxy_drop_ports}]"
|
||||
}
|
||||
@@ -466,14 +445,14 @@ load_acl() {
|
||||
[ "${use_proxy_list}" = "1" ] && add_port_rules "$ip6t_m -A PSW $(comment "$remarks") -p udp ${_ipt_source}" $udp_proxy_drop_ports "$(dst $black6_set_name) -j MARK --set-mark 88" 2>/dev/null
|
||||
[ "${use_gfw_list}" = "1" ] && add_port_rules "$ip6t_m -A PSW $(comment "$remarks") -p udp ${_ipt_source}" $udp_proxy_drop_ports "$(dst $gfw6_set_name) -j MARK --set-mark 88" 2>/dev/null
|
||||
[ "${chn_list}" != "0" ] && add_port_rules "$ip6t_m -A PSW $(comment "$remarks") -p udp ${_ipt_source}" $udp_proxy_drop_ports "$(dst $IPSET_CHN6) $(get_jump_ipt ${chn_list} "-j MARK --set-mark 88")" 2>/dev/null
|
||||
[ "${use_shunt_udp}" = "1" ] && add_port_rules "$ip6t_m -A PSW $(comment "$remarks") -p udp ${_ipt_source}" $udp_proxy_drop_ports "$(dst $shunt6_set_name) -j MARK --set-mark 88" 2>/dev/null
|
||||
[ "${use_shunt_node}" = "1" ] && add_port_rules "$ip6t_m -A PSW $(comment "$remarks") -p udp ${_ipt_source}" $udp_proxy_drop_ports "$(dst $shunt6_set_name) -j MARK --set-mark 88" 2>/dev/null
|
||||
[ "${udp_proxy_mode}" != "disable" ] && add_port_rules "$ip6t_m -A PSW $(comment "$remarks") -p udp ${_ipt_source}" $udp_proxy_drop_ports "-j MARK --set-mark 88" 2>/dev/null
|
||||
}
|
||||
[ "${use_fakedns}" = "1" ] && add_port_rules "$ipt_m -A PSW $(comment "$remarks") -p udp ${_ipt_source}" $udp_proxy_drop_ports "-d $FAKE_IP -j MARK --set-mark 88"
|
||||
[ "${use_proxy_list}" = "1" ] && add_port_rules "$ipt_m -A PSW $(comment "$remarks") -p udp ${_ipt_source}" $udp_proxy_drop_ports "$(dst $black_set_name) -j MARK --set-mark 88"
|
||||
[ "${use_gfw_list}" = "1" ] && add_port_rules "$ipt_m -A PSW $(comment "$remarks") -p udp ${_ipt_source}" $udp_proxy_drop_ports "$(dst $gfw_set_name) -j MARK --set-mark 88"
|
||||
[ "${chn_list}" != "0" ] && add_port_rules "$ipt_m -A PSW $(comment "$remarks") -p udp ${_ipt_source}" $udp_proxy_drop_ports "$(dst $IPSET_CHN) $(get_jump_ipt ${chn_list} "-j MARK --set-mark 88")"
|
||||
[ "${use_shunt_udp}" = "1" ] && add_port_rules "$ipt_m -A PSW $(comment "$remarks") -p udp ${_ipt_source}" $udp_proxy_drop_ports "$(dst $shunt_set_name) -j MARK --set-mark 88"
|
||||
[ "${use_shunt_node}" = "1" ] && add_port_rules "$ipt_m -A PSW $(comment "$remarks") -p udp ${_ipt_source}" $udp_proxy_drop_ports "$(dst $shunt_set_name) -j MARK --set-mark 88"
|
||||
[ "${udp_proxy_mode}" != "disable" ] && add_port_rules "$ipt_m -A PSW $(comment "$remarks") -p udp ${_ipt_source}" $udp_proxy_drop_ports "-j MARK --set-mark 88"
|
||||
echolog " - ${msg}屏蔽代理 UDP 端口[${udp_proxy_drop_ports}]"
|
||||
}
|
||||
@@ -486,7 +465,7 @@ load_acl() {
|
||||
|
||||
[ -n "$tcp_port" ] && {
|
||||
if [ -n "${tcp_proxy_mode}" ]; then
|
||||
msg2="${msg}使用 TCP 节点[$tcp_node_remark]"
|
||||
msg2="${msg}代理 TCP 使用节点[$node_remark]"
|
||||
if [ -n "${is_tproxy}" ]; then
|
||||
msg2="${msg2}(TPROXY:${tcp_port})"
|
||||
ipt_tmp=$ipt_m
|
||||
@@ -501,7 +480,7 @@ load_acl() {
|
||||
[ "${use_proxy_list}" = "1" ] && $ipt_n -A PSW $(comment "$remarks") -p icmp ${_ipt_source} $(dst $black_set_name) $(REDIRECT)
|
||||
[ "${use_gfw_list}" = "1" ] && $ipt_n -A PSW $(comment "$remarks") -p icmp ${_ipt_source} $(dst $gfw_set_name) $(REDIRECT)
|
||||
[ "${chn_list}" != "0" ] && $ipt_n -A PSW $(comment "$remarks") -p icmp ${_ipt_source} $(dst $IPSET_CHN) $(get_jump_ipt ${chn_list})
|
||||
[ "${use_shunt_tcp}" = "1" ] && $ipt_n -A PSW $(comment "$remarks") -p icmp ${_ipt_source} $(dst $shunt_set_name) $(REDIRECT)
|
||||
[ "${use_shunt_node}" = "1" ] && $ipt_n -A PSW $(comment "$remarks") -p icmp ${_ipt_source} $(dst $shunt_set_name) $(REDIRECT)
|
||||
[ "${tcp_proxy_mode}" != "disable" ] && $ipt_n -A PSW $(comment "$remarks") -p icmp ${_ipt_source} $(REDIRECT)
|
||||
}
|
||||
|
||||
@@ -510,7 +489,7 @@ load_acl() {
|
||||
[ "${use_proxy_list}" = "1" ] && $ip6t_n -A PSW $(comment "$remarks") -p ipv6-icmp ${_ipt_source} $(dst $black6_set_name) $(REDIRECT) 2>/dev/null
|
||||
[ "${use_gfw_list}" = "1" ] && $ip6t_n -A PSW $(comment "$remarks") -p ipv6-icmp ${_ipt_source} $(dst $gfw6_set_name) $(REDIRECT) 2>/dev/null
|
||||
[ "${chn_list}" != "0" ] && $ip6t_n -A PSW $(comment "$remarks") -p ipv6-icmp ${_ipt_source} $(dst $IPSET_CHN6) $(get_jump_ipt ${chn_list}) 2>/dev/null
|
||||
[ "${use_shunt_tcp}" = "1" ] && $ip6t_n -A PSW $(comment "$remarks") -p ipv6-icmp ${_ipt_source} $(dst $shunt6_set_name) $(REDIRECT) 2>/dev/null
|
||||
[ "${use_shunt_node}" = "1" ] && $ip6t_n -A PSW $(comment "$remarks") -p ipv6-icmp ${_ipt_source} $(dst $shunt6_set_name) $(REDIRECT) 2>/dev/null
|
||||
[ "${tcp_proxy_mode}" != "disable" ] && $ip6t_n -A PSW $(comment "$remarks") -p ipv6-icmp ${_ipt_source} $(REDIRECT) 2>/dev/null
|
||||
}
|
||||
|
||||
@@ -518,7 +497,7 @@ load_acl() {
|
||||
[ "${use_proxy_list}" = "1" ] && add_port_rules "$ipt_tmp -A PSW $(comment "$remarks") -p tcp ${_ipt_source}" $tcp_redir_ports "$(dst $black_set_name) ${ipt_j}"
|
||||
[ "${use_gfw_list}" = "1" ] && add_port_rules "$ipt_tmp -A PSW $(comment "$remarks") -p tcp ${_ipt_source}" $tcp_redir_ports "$(dst $gfw_set_name) ${ipt_j}"
|
||||
[ "${chn_list}" != "0" ] && add_port_rules "$ipt_tmp -A PSW $(comment "$remarks") -p tcp ${_ipt_source}" $tcp_redir_ports "$(dst $IPSET_CHN) $(get_jump_ipt ${chn_list} "${ipt_j}")"
|
||||
[ "${use_shunt_tcp}" = "1" ] && add_port_rules "$ipt_tmp -A PSW $(comment "$remarks") -p tcp ${_ipt_source}" $tcp_redir_ports "$(dst $shunt_set_name) ${ipt_j}"
|
||||
[ "${use_shunt_node}" = "1" ] && add_port_rules "$ipt_tmp -A PSW $(comment "$remarks") -p tcp ${_ipt_source}" $tcp_redir_ports "$(dst $shunt_set_name) ${ipt_j}"
|
||||
[ "${tcp_proxy_mode}" != "disable" ] && add_port_rules "$ipt_tmp -A PSW $(comment "$remarks") -p tcp ${_ipt_source}" $tcp_redir_ports "${ipt_j}"
|
||||
[ -n "${is_tproxy}" ] && $ipt_m -A PSW $(comment "$remarks") -p tcp ${_ipt_source} $(REDIRECT $tcp_port TPROXY)
|
||||
|
||||
@@ -527,7 +506,7 @@ load_acl() {
|
||||
[ "${use_proxy_list}" = "1" ] && add_port_rules "$ip6t_m -A PSW $(comment "$remarks") -p tcp ${_ipt_source}" $tcp_redir_ports "$(dst $black6_set_name) -j PSW_RULE" 2>/dev/null
|
||||
[ "${use_gfw_list}" = "1" ] && add_port_rules "$ip6t_m -A PSW $(comment "$remarks") -p tcp ${_ipt_source}" $tcp_redir_ports "$(dst $gfw6_set_name) -j PSW_RULE" 2>/dev/null
|
||||
[ "${chn_list}" != "0" ] && add_port_rules "$ip6t_m -A PSW $(comment "$remarks") -p tcp ${_ipt_source}" $tcp_redir_ports "$(dst $IPSET_CHN6) $(get_jump_ipt ${chn_list} "-j PSW_RULE")" 2>/dev/null
|
||||
[ "${use_shunt_tcp}" = "1" ] && add_port_rules "$ip6t_m -A PSW $(comment "$remarks") -p tcp ${_ipt_source}" $tcp_redir_ports "$(dst $shunt6_set_name) -j PSW_RULE" 2>/dev/null
|
||||
[ "${use_shunt_node}" = "1" ] && add_port_rules "$ip6t_m -A PSW $(comment "$remarks") -p tcp ${_ipt_source}" $tcp_redir_ports "$(dst $shunt6_set_name) -j PSW_RULE" 2>/dev/null
|
||||
[ "${tcp_proxy_mode}" != "disable" ] && add_port_rules "$ip6t_m -A PSW $(comment "$remarks") -p tcp ${_ipt_source}" $tcp_redir_ports "-j PSW_RULE" 2>/dev/null
|
||||
$ip6t_m -A PSW $(comment "$remarks") -p tcp ${_ipt_source} $(REDIRECT $tcp_port TPROXY) 2>/dev/null
|
||||
}
|
||||
@@ -542,14 +521,14 @@ load_acl() {
|
||||
|
||||
[ -n "$udp_port" ] && {
|
||||
if [ -n "${udp_proxy_mode}" ]; then
|
||||
msg2="${msg}使用 UDP 节点[$udp_node_remark]"
|
||||
msg2="${msg}代理 UDP 使用节点[$node_remark]"
|
||||
msg2="${msg2}(TPROXY:${udp_port})"
|
||||
|
||||
[ "${use_fakedns}" = "1" ] && $ipt_m -A PSW $(comment "$remarks") -p udp ${_ipt_source} -d $FAKE_IP -j PSW_RULE
|
||||
[ "${use_proxy_list}" = "1" ] && add_port_rules "$ipt_m -A PSW $(comment "$remarks") -p udp ${_ipt_source}" $udp_redir_ports "$(dst $black_set_name) -j PSW_RULE"
|
||||
[ "${use_gfw_list}" = "1" ] && add_port_rules "$ipt_m -A PSW $(comment "$remarks") -p udp ${_ipt_source}" $udp_redir_ports "$(dst $gfw_set_name) -j PSW_RULE"
|
||||
[ "${chn_list}" != "0" ] && add_port_rules "$ipt_m -A PSW $(comment "$remarks") -p udp ${_ipt_source}" $udp_redir_ports "$(dst $IPSET_CHN) $(get_jump_ipt ${chn_list} "-j PSW_RULE")"
|
||||
[ "${use_shunt_udp}" = "1" ] && add_port_rules "$ipt_m -A PSW $(comment "$remarks") -p udp ${_ipt_source}" $udp_redir_ports "$(dst $shunt_set_name) -j PSW_RULE"
|
||||
[ "${use_shunt_node}" = "1" ] && add_port_rules "$ipt_m -A PSW $(comment "$remarks") -p udp ${_ipt_source}" $udp_redir_ports "$(dst $shunt_set_name) -j PSW_RULE"
|
||||
[ "${udp_proxy_mode}" != "disable" ] && add_port_rules "$ipt_m -A PSW $(comment "$remarks") -p udp ${_ipt_source}" $udp_redir_ports "-j PSW_RULE"
|
||||
$ipt_m -A PSW $(comment "$remarks") -p udp ${_ipt_source} $(REDIRECT $udp_port TPROXY)
|
||||
|
||||
@@ -558,7 +537,7 @@ load_acl() {
|
||||
[ "${use_proxy_list}" = "1" ] && add_port_rules "$ip6t_m -A PSW $(comment "$remarks") -p udp ${_ipt_source}" $udp_redir_ports "$(dst $black6_set_name) -j PSW_RULE" 2>/dev/null
|
||||
[ "${use_gfw_list}" = "1" ] && add_port_rules "$ip6t_m -A PSW $(comment "$remarks") -p udp ${_ipt_source}" $udp_redir_ports "$(dst $gfw6_set_name) -j PSW_RULE" 2>/dev/null
|
||||
[ "${chn_list}" != "0" ] && add_port_rules "$ip6t_m -A PSW $(comment "$remarks") -p udp ${_ipt_source}" $udp_redir_ports "$(dst $IPSET_CHN6) $(get_jump_ipt ${chn_list} "-j PSW_RULE")" 2>/dev/null
|
||||
[ "${use_shunt_udp}" = "1" ] && add_port_rules "$ip6t_m -A PSW $(comment "$remarks") -p udp ${_ipt_source}" $udp_redir_ports "$(dst $shunt6_set_name) -j PSW_RULE" 2>/dev/null
|
||||
[ "${use_shunt_node}" = "1" ] && add_port_rules "$ip6t_m -A PSW $(comment "$remarks") -p udp ${_ipt_source}" $udp_redir_ports "$(dst $shunt6_set_name) -j PSW_RULE" 2>/dev/null
|
||||
[ "${udp_proxy_mode}" != "disable" ] && add_port_rules "$ip6t_m -A PSW $(comment "$remarks") -p udp ${_ipt_source}" $udp_redir_ports "-j PSW_RULE" 2>/dev/null
|
||||
$ip6t_m -A PSW $(comment "$remarks") -p udp ${_ipt_source} $(REDIRECT $udp_port TPROXY) 2>/dev/null
|
||||
}
|
||||
@@ -571,8 +550,8 @@ load_acl() {
|
||||
$ipt_m -A PSW $(comment "$remarks") ${_ipt_source} -p udp -j RETURN
|
||||
unset ipt_tmp ipt_j _ipt_source msg msg2 _ipv4
|
||||
done
|
||||
unset enabled sid remarks sources use_global_config use_direct_list use_proxy_list use_block_list use_gfw_list chn_list tcp_proxy_mode udp_proxy_mode dns_redirect_port tcp_no_redir_ports udp_no_redir_ports tcp_proxy_drop_ports udp_proxy_drop_ports tcp_redir_ports udp_redir_ports tcp_node udp_node interface
|
||||
unset tcp_port udp_port tcp_node_remark udp_node_remark _acl_list use_shunt_tcp use_shunt_udp dns_redirect use_fakedns
|
||||
unset enabled sid remarks sources use_global_config use_direct_list use_proxy_list use_block_list use_gfw_list chn_list tcp_proxy_mode udp_proxy_mode dns_redirect_port tcp_no_redir_ports udp_no_redir_ports tcp_proxy_drop_ports udp_proxy_drop_ports tcp_redir_ports udp_redir_ports node interface
|
||||
unset tcp_port udp_port node_remark _acl_list use_shunt_node dns_redirect use_fakedns
|
||||
done
|
||||
}
|
||||
|
||||
@@ -605,7 +584,7 @@ load_acl() {
|
||||
|
||||
local DNS_REDIRECT
|
||||
[ $(config_t_get global dns_redirect "1") = "1" ] && DNS_REDIRECT=53
|
||||
if ([ -n "$TCP_NODE" ] && [ -n "${TCP_PROXY_MODE}" ]) || ([ -n "$UDP_NODE" ] && [ -n "${UDP_PROXY_MODE}" ]); then
|
||||
if [ -n "$NODE" ] && ([ -n "${TCP_PROXY_MODE}" ] || [ -n "${UDP_PROXY_MODE}" ]); then
|
||||
[ -n "${DNS_REDIRECT_PORT}" ] && DNS_REDIRECT=${DNS_REDIRECT_PORT}
|
||||
else
|
||||
[ -n "${DIRECT_DNSMASQ_PORT}" ] && DNS_REDIRECT=${DIRECT_DNSMASQ_PORT}
|
||||
@@ -636,14 +615,14 @@ load_acl() {
|
||||
[ "${USE_PROXY_LIST}" = "1" ] && add_port_rules "$ip6t_m -A PSW $(comment "默认") -p tcp" $TCP_PROXY_DROP_PORTS "$(dst $IPSET_BLACK6) -j MARK --set-mark 88"
|
||||
[ "${USE_GFW_LIST}" = "1" ] && add_port_rules "$ip6t_m -A PSW $(comment "默认") -p tcp" $TCP_PROXY_DROP_PORTS "$(dst $IPSET_GFW6) -j MARK --set-mark 88"
|
||||
[ "${CHN_LIST}" != "0" ] && add_port_rules "$ip6t_m -A PSW $(comment "默认") -p tcp" $TCP_PROXY_DROP_PORTS "$(dst $IPSET_CHN6) $(get_jump_ipt ${CHN_LIST} "-j MARK --set-mark 88")"
|
||||
[ "${USE_SHUNT_TCP}" = "1" ] && add_port_rules "$ip6t_m -A PSW $(comment "默认") -p tcp" $TCP_PROXY_DROP_PORTS "$(dst $IPSET_SHUNT6) -j MARK --set-mark 88"
|
||||
[ "${USE_SHUNT_NODE}" = "1" ] && add_port_rules "$ip6t_m -A PSW $(comment "默认") -p tcp" $TCP_PROXY_DROP_PORTS "$(dst $IPSET_SHUNT6) -j MARK --set-mark 88"
|
||||
[ "${TCP_PROXY_MODE}" != "disable" ] && add_port_rules "$ip6t_m -A PSW $(comment "默认") -p tcp" $TCP_PROXY_DROP_PORTS "-j MARK --set-mark 88"
|
||||
}
|
||||
[ "${USE_FAKEDNS}" = "1" ] && add_port_rules "$ipt_m -A PSW $(comment "默认") -p tcp" $TCP_PROXY_DROP_PORTS "-d $FAKE_IP -j MARK --set-mark 88"
|
||||
[ "${USE_PROXY_LIST}" = "1" ] && add_port_rules "$ipt_m -A PSW $(comment "默认") -p tcp" $TCP_PROXY_DROP_PORTS "$(dst $IPSET_BLACK) -j MARK --set-mark 88"
|
||||
[ "${USE_GFW_LIST}" = "1" ] && add_port_rules "$ipt_m -A PSW $(comment "默认") -p tcp" $TCP_PROXY_DROP_PORTS "$(dst $IPSET_GFW) -j MARK --set-mark 88"
|
||||
[ "${CHN_LIST}" != "0" ] && add_port_rules "$ipt_m -A PSW $(comment "默认") -p tcp" $TCP_PROXY_DROP_PORTS "$(dst $IPSET_CHN) $(get_jump_ipt ${CHN_LIST} "-j MARK --set-mark 88")"
|
||||
[ "${USE_SHUNT_TCP}" = "1" ] && add_port_rules "$ipt_m -A PSW $(comment "默认") -p tcp" $TCP_PROXY_DROP_PORTS $(dst $IPSET_SHUNT) "-j MARK --set-mark 88"
|
||||
[ "${USE_SHUNT_NODE}" = "1" ] && add_port_rules "$ipt_m -A PSW $(comment "默认") -p tcp" $TCP_PROXY_DROP_PORTS $(dst $IPSET_SHUNT) "-j MARK --set-mark 88"
|
||||
[ "${TCP_PROXY_MODE}" != "disable" ] && add_port_rules "$ipt_m -A PSW $(comment "默认") -p tcp" $TCP_PROXY_DROP_PORTS "-j MARK --set-mark 88"
|
||||
echolog " - ${msg}屏蔽代理 TCP 端口[${TCP_PROXY_DROP_PORTS}]"
|
||||
}
|
||||
@@ -654,14 +633,14 @@ load_acl() {
|
||||
[ "${USE_PROXY_LIST}" = "1" ] && add_port_rules "$ip6t_m -A PSW $(comment "默认") -p udp" $UDP_PROXY_DROP_PORTS "$(dst $IPSET_BLACK6) -j MARK --set-mark 88"
|
||||
[ "${USE_GFW_LIST}" = "1" ] && add_port_rules "$ip6t_m -A PSW $(comment "默认") -p udp" $UDP_PROXY_DROP_PORTS "$(dst $IPSET_GFW6) -j MARK --set-mark 88"
|
||||
[ "${CHN_LIST}" != "0" ] && add_port_rules "$ip6t_m -A PSW $(comment "默认") -p udp" $UDP_PROXY_DROP_PORTS "$(dst $IPSET_CHN6) $(get_jump_ipt ${CHN_LIST} "-j MARK --set-mark 88")"
|
||||
[ "${USE_SHUNT_UDP}" = "1" ] && add_port_rules "$ip6t_m -A PSW $(comment "默认") -p udp" $UDP_PROXY_DROP_PORTS "$(dst $IPSET_SHUNT6) -j MARK --set-mark 88"
|
||||
[ "${USE_SHUNT_NODE}" = "1" ] && add_port_rules "$ip6t_m -A PSW $(comment "默认") -p udp" $UDP_PROXY_DROP_PORTS "$(dst $IPSET_SHUNT6) -j MARK --set-mark 88"
|
||||
[ "${UDP_PROXY_MODE}" != "disable" ] && add_port_rules "$ip6t_m -A PSW $(comment "默认") -p udp" $UDP_PROXY_DROP_PORTS "-j MARK --set-mark 88"
|
||||
}
|
||||
[ "${USE_FAKEDNS}" = "1" ] && add_port_rules "$ipt_m -A PSW $(comment "默认") -p udp" $UDP_PROXY_DROP_PORTS "-d $FAKE_IP -j MARK --set-mark 88"
|
||||
[ "${USE_PROXY_LIST}" = "1" ] && add_port_rules "$ipt_m -A PSW $(comment "默认") -p udp" $UDP_PROXY_DROP_PORTS "$(dst $IPSET_BLACK) -j MARK --set-mark 88"
|
||||
[ "${USE_GFW_LIST}" = "1" ] && add_port_rules "$ipt_m -A PSW $(comment "默认") -p udp" $UDP_PROXY_DROP_PORTS "$(dst $IPSET_GFW) -j MARK --set-mark 88"
|
||||
[ "${CHN_LIST}" != "0" ] && add_port_rules "$ipt_m -A PSW $(comment "默认") -p udp" $UDP_PROXY_DROP_PORTS "$(dst $IPSET_CHN) $(get_jump_ipt ${CHN_LIST} "-j MARK --set-mark 88")"
|
||||
[ "${USE_SHUNT_UDP}" = "1" ] && add_port_rules "$ipt_m -A PSW $(comment "默认") -p udp" $UDP_PROXY_DROP_PORTS "$(dst $IPSET_SHUNT) -j MARK --set-mark 88"
|
||||
[ "${USE_SHUNT_NODE}" = "1" ] && add_port_rules "$ipt_m -A PSW $(comment "默认") -p udp" $UDP_PROXY_DROP_PORTS "$(dst $IPSET_SHUNT) -j MARK --set-mark 88"
|
||||
[ "${UDP_PROXY_MODE}" != "disable" ] && add_port_rules "$ipt_m -A PSW $(comment "默认") -p udp" $UDP_PROXY_DROP_PORTS "-j MARK --set-mark 88"
|
||||
echolog " - ${msg}屏蔽代理 UDP 端口[${UDP_PROXY_DROP_PORTS}]"
|
||||
}
|
||||
@@ -674,18 +653,18 @@ load_acl() {
|
||||
|
||||
# 加载TCP默认代理模式
|
||||
if [ -n "${TCP_PROXY_MODE}" ]; then
|
||||
[ -n "$TCP_NODE" ] && {
|
||||
if [ "$(config_get_type $TCP_NODE)" = "socks" ]; then
|
||||
msg2="${msg}使用 TCP 节点[Socks 配置($(config_n_get $TCP_NODE port) 端口)]"
|
||||
[ -n "$NODE" ] && {
|
||||
if [ "$(config_get_type $NODE)" = "socks" ]; then
|
||||
msg2="${msg}代理 TCP 使用节点[Socks 配置($(config_n_get $NODE port) 端口)]"
|
||||
else
|
||||
msg2="${msg}使用 TCP 节点[$(config_n_get $TCP_NODE remarks)]"
|
||||
msg2="${msg}代理 TCP 使用节点[$(config_n_get $NODE remarks)]"
|
||||
fi
|
||||
if [ -n "${is_tproxy}" ]; then
|
||||
msg2="${msg2}(TPROXY:${TCP_REDIR_PORT})"
|
||||
msg2="${msg2}(TPROXY:${REDIR_PORT})"
|
||||
ipt_j="-j PSW_RULE"
|
||||
else
|
||||
msg2="${msg2}(REDIRECT:${TCP_REDIR_PORT})"
|
||||
ipt_j="$(REDIRECT $TCP_REDIR_PORT)"
|
||||
msg2="${msg2}(REDIRECT:${REDIR_PORT})"
|
||||
ipt_j="$(REDIRECT $REDIR_PORT)"
|
||||
fi
|
||||
|
||||
[ "$accept_icmp" = "1" ] && {
|
||||
@@ -693,7 +672,7 @@ load_acl() {
|
||||
[ "${USE_PROXY_LIST}" = "1" ] && $ipt_n -A PSW $(comment "默认") -p icmp $(dst $IPSET_BLACK) $(REDIRECT)
|
||||
[ "${USE_GFW_LIST}" = "1" ] && $ipt_n -A PSW $(comment "默认") -p icmp $(dst $IPSET_GFW) $(REDIRECT)
|
||||
[ "${CHN_LIST}" != "0" ] && $ipt_n -A PSW $(comment "默认") -p icmp $(dst $IPSET_CHN) $(get_jump_ipt ${CHN_LIST})
|
||||
[ "${USE_SHUNT_TCP}" = "1" ] && $ipt_n -A PSW $(comment "默认") -p icmp $(dst $IPSET_SHUNT) $(REDIRECT)
|
||||
[ "${USE_SHUNT_NODE}" = "1" ] && $ipt_n -A PSW $(comment "默认") -p icmp $(dst $IPSET_SHUNT) $(REDIRECT)
|
||||
[ "${TCP_PROXY_MODE}" != "disable" ] && $ipt_n -A PSW $(comment "默认") -p icmp $(REDIRECT)
|
||||
}
|
||||
|
||||
@@ -702,7 +681,7 @@ load_acl() {
|
||||
[ "${USE_PROXY_LIST}" = "1" ] && $ip6t_n -A PSW $(comment "默认") -p ipv6-icmp $(dst $IPSET_BLACK6) $(REDIRECT)
|
||||
[ "${USE_GFW_LIST}" = "1" ] && $ip6t_n -A PSW $(comment "默认") -p ipv6-icmp $(dst $IPSET_GFW6) $(REDIRECT)
|
||||
[ "${CHN_LIST}" != "0" ] && $ip6t_n -A PSW $(comment "默认") -p ipv6-icmp $(dst $IPSET_CHN6) $(get_jump_ipt ${CHN_LIST})
|
||||
[ "${USE_SHUNT_TCP}" = "1" ] && $ip6t_n -A PSW $(comment "默认") -p ipv6-icmp $(dst $IPSET_SHUNT6) $(REDIRECT)
|
||||
[ "${USE_SHUNT_NODE}" = "1" ] && $ip6t_n -A PSW $(comment "默认") -p ipv6-icmp $(dst $IPSET_SHUNT6) $(REDIRECT)
|
||||
[ "${TCP_PROXY_MODE}" != "disable" ] && $ip6t_n -A PSW $(comment "默认") -p ipv6-icmp $(REDIRECT)
|
||||
}
|
||||
|
||||
@@ -710,18 +689,18 @@ load_acl() {
|
||||
[ "${USE_PROXY_LIST}" = "1" ] && add_port_rules "$ipt_tmp -A PSW $(comment "默认") -p tcp" $TCP_REDIR_PORTS "$(dst $IPSET_BLACK) ${ipt_j}"
|
||||
[ "${USE_GFW_LIST}" = "1" ] && add_port_rules "$ipt_tmp -A PSW $(comment "默认") -p tcp" $TCP_REDIR_PORTS "$(dst $IPSET_GFW) ${ipt_j}"
|
||||
[ "${CHN_LIST}" != "0" ] && add_port_rules "$ipt_tmp -A PSW $(comment "默认") -p tcp" $TCP_REDIR_PORTS "$(dst $IPSET_CHN) $(get_jump_ipt ${CHN_LIST} "${ipt_j}")"
|
||||
[ "${USE_SHUNT_TCP}" = "1" ] && add_port_rules "$ipt_tmp -A PSW $(comment "默认") -p tcp" $TCP_REDIR_PORTS "$(dst $IPSET_SHUNT) ${ipt_j}"
|
||||
[ "${USE_SHUNT_NODE}" = "1" ] && add_port_rules "$ipt_tmp -A PSW $(comment "默认") -p tcp" $TCP_REDIR_PORTS "$(dst $IPSET_SHUNT) ${ipt_j}"
|
||||
[ "${TCP_PROXY_MODE}" != "disable" ] && add_port_rules "$ipt_tmp -A PSW $(comment "默认") -p tcp" $TCP_REDIR_PORTS "${ipt_j}"
|
||||
[ -n "${is_tproxy}" ]&& $ipt_tmp -A PSW $(comment "默认") -p tcp $(REDIRECT $TCP_REDIR_PORT TPROXY)
|
||||
[ -n "${is_tproxy}" ]&& $ipt_tmp -A PSW $(comment "默认") -p tcp $(REDIRECT $REDIR_PORT TPROXY)
|
||||
|
||||
[ "$PROXY_IPV6" = "1" ] && {
|
||||
[ "${USE_FAKEDNS}" = "1" ] && $ip6t_m -A PSW $(comment "默认") -p tcp -d $FAKE_IP_6 -j PSW_RULE
|
||||
[ "${USE_PROXY_LIST}" = "1" ] && add_port_rules "$ip6t_m -A PSW $(comment "默认") -p tcp" $TCP_REDIR_PORTS "$(dst $IPSET_BLACK6) -j PSW_RULE"
|
||||
[ "${USE_GFW_LIST}" = "1" ] && add_port_rules "$ip6t_m -A PSW $(comment "默认") -p tcp" $TCP_REDIR_PORTS "$(dst $IPSET_GFW6) -j PSW_RULE"
|
||||
[ "${CHN_LIST}" != "0" ] && add_port_rules "$ip6t_m -A PSW $(comment "默认") -p tcp" $TCP_REDIR_PORTS "$(dst $IPSET_CHN6) $(get_jump_ipt ${CHN_LIST} "-j PSW_RULE")"
|
||||
[ "${USE_SHUNT_TCP}" = "1" ] && add_port_rules "$ip6t_m -A PSW $(comment "默认") -p tcp" $TCP_REDIR_PORTS "$(dst $IPSET_SHUNT6) -j PSW_RULE"
|
||||
[ "${USE_SHUNT_NODE}" = "1" ] && add_port_rules "$ip6t_m -A PSW $(comment "默认") -p tcp" $TCP_REDIR_PORTS "$(dst $IPSET_SHUNT6) -j PSW_RULE"
|
||||
[ "${TCP_PROXY_MODE}" != "disable" ] && add_port_rules "$ip6t_m -A PSW $(comment "默认") -p tcp" $TCP_REDIR_PORTS "-j PSW_RULE"
|
||||
$ip6t_m -A PSW $(comment "默认") -p tcp $(REDIRECT $TCP_REDIR_PORT TPROXY)
|
||||
$ip6t_m -A PSW $(comment "默认") -p tcp $(REDIRECT $REDIR_PORT TPROXY)
|
||||
}
|
||||
|
||||
echolog " - ${msg2}"
|
||||
@@ -733,29 +712,29 @@ load_acl() {
|
||||
|
||||
# 加载UDP默认代理模式
|
||||
if [ -n "${UDP_PROXY_MODE}" ]; then
|
||||
[ -n "$UDP_NODE" ] || [ "$TCP_UDP" = "1" ] && {
|
||||
if [ "$(config_get_type $UDP_NODE)" = "socks" ]; then
|
||||
msg2="${msg}使用 UDP 节点[Socks 配置($(config_n_get $UDP_NODE port) 端口)](TPROXY:${UDP_REDIR_PORT})"
|
||||
[ -n "$NODE" ] && {
|
||||
if [ "$(config_get_type $NODE)" = "socks" ]; then
|
||||
msg2="${msg}代理 UDP 使用节点[Socks 配置($(config_n_get $NODE port) 端口)](TPROXY:${REDIR_PORT})"
|
||||
else
|
||||
msg2="${msg}使用 UDP 节点[$(config_n_get $UDP_NODE remarks)](TPROXY:${UDP_REDIR_PORT})"
|
||||
msg2="${msg}代理 UDP 使用节点[$(config_n_get $NODE remarks)](TPROXY:${REDIR_PORT})"
|
||||
fi
|
||||
|
||||
[ "${USE_FAKEDNS}" = "1" ] && $ipt_m -A PSW $(comment "默认") -p udp -d $FAKE_IP -j PSW_RULE
|
||||
[ "${USE_PROXY_LIST}" = "1" ] && add_port_rules "$ipt_m -A PSW $(comment "默认") -p udp" $UDP_REDIR_PORTS "$(dst $IPSET_BLACK) -j PSW_RULE"
|
||||
[ "${USE_GFW_LIST}" = "1" ] && add_port_rules "$ipt_m -A PSW $(comment "默认") -p udp" $UDP_REDIR_PORTS "$(dst $IPSET_GFW) -j PSW_RULE"
|
||||
[ "${CHN_LIST}" != "0" ] && add_port_rules "$ipt_m -A PSW $(comment "默认") -p udp" $UDP_REDIR_PORTS "$(dst $IPSET_CHN) $(get_jump_ipt ${CHN_LIST} "-j PSW_RULE")"
|
||||
[ "${USE_SHUNT_UDP}" = "1" ] && add_port_rules "$ipt_m -A PSW $(comment "默认") -p udp" $UDP_REDIR_PORTS "$(dst $IPSET_SHUNT) -j PSW_RULE"
|
||||
[ "${USE_SHUNT_NODE}" = "1" ] && add_port_rules "$ipt_m -A PSW $(comment "默认") -p udp" $UDP_REDIR_PORTS "$(dst $IPSET_SHUNT) -j PSW_RULE"
|
||||
[ "${UDP_PROXY_MODE}" != "disable" ] && add_port_rules "$ipt_m -A PSW $(comment "默认") -p udp" $UDP_REDIR_PORTS "-j PSW_RULE"
|
||||
$ipt_m -A PSW $(comment "默认") -p udp $(REDIRECT $UDP_REDIR_PORT TPROXY)
|
||||
$ipt_m -A PSW $(comment "默认") -p udp $(REDIRECT $REDIR_PORT TPROXY)
|
||||
|
||||
[ "$PROXY_IPV6" = "1" ] && {
|
||||
[ "${USE_FAKEDNS}" = "1" ] && $ip6t_m -A PSW $(comment "默认") -p udp -d $FAKE_IP_6 -j PSW_RULE
|
||||
[ "${USE_PROXY_LIST}" = "1" ] && add_port_rules "$ip6t_m -A PSW $(comment "默认") -p udp" $UDP_REDIR_PORTS "$(dst $IPSET_BLACK6) -j PSW_RULE"
|
||||
[ "${USE_GFW_LIST}" = "1" ] && add_port_rules "$ip6t_m -A PSW $(comment "默认") -p udp" $UDP_REDIR_PORTS "$(dst $IPSET_GFW6) -j PSW_RULE"
|
||||
[ "${CHN_LIST}" != "0" ] && add_port_rules "$ip6t_m -A PSW $(comment "默认") -p udp" $UDP_REDIR_PORTS "$(dst $IPSET_CHN6) $(get_jump_ipt ${CHN_LIST} "-j PSW_RULE")"
|
||||
[ "${USE_SHUNT_UDP}" = "1" ] && add_port_rules "$ip6t_m -A PSW $(comment "默认") -p udp" $UDP_REDIR_PORTS "$(dst $IPSET_SHUNT6) -j PSW_RULE"
|
||||
[ "${USE_SHUNT_NODE}" = "1" ] && add_port_rules "$ip6t_m -A PSW $(comment "默认") -p udp" $UDP_REDIR_PORTS "$(dst $IPSET_SHUNT6) -j PSW_RULE"
|
||||
[ "${UDP_PROXY_MODE}" != "disable" ] && add_port_rules "$ip6t_m -A PSW $(comment "默认") -p udp" $UDP_REDIR_PORTS "-j PSW_RULE"
|
||||
$ip6t_m -A PSW $(comment "默认") -p udp $(REDIRECT $UDP_REDIR_PORT TPROXY)
|
||||
$ip6t_m -A PSW $(comment "默认") -p udp $(REDIRECT $REDIR_PORT TPROXY)
|
||||
}
|
||||
|
||||
echolog " - ${msg2}"
|
||||
@@ -909,18 +888,14 @@ add_firewall_rule() {
|
||||
cat $RULES_PATH/chnroute6 | tr -s '\n' | grep -v "^#" | sed -e "/^$/d" | sed -e "s/^/add $IPSET_CHN6 &/g" -e "s/$/ timeout 0/g" | ipset -! -R
|
||||
|
||||
#导入规则列表、分流规则中的IP列表
|
||||
local USE_SHUNT_NODE=0
|
||||
local USE_PROXY_LIST_ALL=${USE_PROXY_LIST}
|
||||
local USE_DIRECT_LIST_ALL=${USE_DIRECT_LIST}
|
||||
local USE_BLOCK_LIST_ALL=${USE_BLOCK_LIST}
|
||||
local _TCP_NODE=$(config_t_get global tcp_node)
|
||||
local _UDP_NODE=$(config_t_get global udp_node)
|
||||
USE_SHUNT_NODE=0
|
||||
USE_GEOVIEW=$(config_t_get global_rules enable_geoview)
|
||||
[ -z "$(first_type $(config_t_get global_app geoview_file) geoview)" ] && USE_GEOVIEW=0
|
||||
|
||||
[ -n "$_TCP_NODE" ] && [ "$(config_n_get $_TCP_NODE protocol)" = "_shunt" ] && USE_SHUNT_TCP=1 && USE_SHUNT_NODE=1
|
||||
[ -n "$_UDP_NODE" ] && [ "$(config_n_get $_UDP_NODE protocol)" = "_shunt" ] && USE_SHUNT_UDP=1 && USE_SHUNT_NODE=1
|
||||
[ "$_UDP_NODE" = "tcp" ] && USE_SHUNT_UDP=$USE_SHUNT_TCP
|
||||
[ -n "$NODE" ] && [ "$(config_n_get $NODE protocol)" = "_shunt" ] && USE_SHUNT_NODE=1
|
||||
|
||||
for acl_section in $(uci show ${CONFIG} | grep "=acl_rule" | cut -d '.' -sf 2 | cut -d '=' -sf 1); do
|
||||
[ "$(config_n_get $acl_section enabled)" != "1" ] && continue
|
||||
@@ -929,10 +904,6 @@ add_firewall_rule() {
|
||||
[ "$(config_n_get $acl_section use_proxy_list 1)" = "1" ] && USE_DIRECT_LIST_ALL=1
|
||||
[ "$(config_n_get $acl_section use_block_list 1)" = "1" ] && USE_BLOCK_LIST_ALL=1
|
||||
}
|
||||
for _node in $(config_n_get $acl_section tcp_node) $(config_n_get $acl_section udp_node); do
|
||||
local node_protocol=$(config_n_get $_node protocol)
|
||||
[ "$node_protocol" = "_shunt" ] && { USE_SHUNT_NODE=1; break; }
|
||||
done
|
||||
done
|
||||
|
||||
#直连列表
|
||||
@@ -981,12 +952,8 @@ add_firewall_rule() {
|
||||
[ "$USE_SHUNT_NODE" = "1" ] && {
|
||||
local GEOIP_CODE=""
|
||||
local shunt_ids=$(uci show $CONFIG | grep "=shunt_rules" | awk -F '.' '{print $2}' | awk -F '=' '{print $1}')
|
||||
local shunt_group shunt_id
|
||||
if [ "${USE_SHUNT_TCP}" = "1" ]; then
|
||||
shunt_group=$(config_n_get $_TCP_NODE shunt_group)
|
||||
elif [ "${USE_SHUNT_UDP}" = "1" ]; then
|
||||
shunt_group=$(config_n_get $_UDP_NODE shunt_group)
|
||||
fi
|
||||
local shunt_group=$(config_n_get $NODE shunt_group)
|
||||
local shunt_id
|
||||
for shunt_id in $shunt_ids; do
|
||||
[ "${shunt_group}" != "$(config_n_get ${shunt_id} group)" ] && continue
|
||||
config_n_get $shunt_id ip_list | tr -s "\r\n" "\n" | grep -v "^#" | sed -e "/^$/d" | grep -E "(\.((2(5[0-5]|[0-4][0-9]))|[0-1]?[0-9]{1,2})){3}" | sed -e "s/^/add $IPSET_SHUNT &/g" -e "s/$/ timeout 0/g" | ipset -! -R
|
||||
@@ -1197,15 +1164,13 @@ add_firewall_rule() {
|
||||
ip -6 rule add fwmark ${FWMARK} table 999 priority 999
|
||||
ip -6 route add local ::/0 dev lo table 999
|
||||
|
||||
[ "$TCP_UDP" = "1" ] && [ -z "$UDP_NODE" ] && UDP_NODE=$TCP_NODE
|
||||
|
||||
[ "$ENABLED_DEFAULT_ACL" = 1 ] && {
|
||||
local ipt_tmp=$ipt_n
|
||||
if [ -n "${is_tproxy}" ]; then
|
||||
ipt_tmp=$ipt_m
|
||||
ipt_j="-j PSW_RULE"
|
||||
else
|
||||
ipt_j="$(REDIRECT $TCP_REDIR_PORT)"
|
||||
ipt_j="$(REDIRECT $REDIR_PORT)"
|
||||
fi
|
||||
|
||||
msg="【路由器本机】,"
|
||||
@@ -1231,7 +1196,7 @@ add_firewall_rule() {
|
||||
fi
|
||||
}
|
||||
|
||||
if ([ -n "$TCP_NODE" ] && [ -n "${LOCALHOST_TCP_PROXY_MODE}" ]) || ([ -n "$UDP_NODE" ] && [ -n "${LOCALHOST_UDP_PROXY_MODE}" ]); then
|
||||
if [ -n "$NODE" ] && ([ -n "${LOCALHOST_TCP_PROXY_MODE}" ] || [ -n "${LOCALHOST_UDP_PROXY_MODE}" ]); then
|
||||
[ -n "$DNS_REDIRECT_PORT" ] && {
|
||||
$ipt_n -A OUTPUT $(comment "PSW_DNS") -p udp -o lo --dport 53 -j REDIRECT --to-ports $DNS_REDIRECT_PORT
|
||||
$ip6t_n -A OUTPUT $(comment "PSW_DNS") -p udp -o lo --dport 53 -j REDIRECT --to-ports $DNS_REDIRECT_PORT 2>/dev/null
|
||||
@@ -1246,7 +1211,7 @@ add_firewall_rule() {
|
||||
[ "${USE_PROXY_LIST}" = "1" ] && add_port_rules "$ipt_m -A PSW_OUTPUT -p tcp" $TCP_PROXY_DROP_PORTS "$(dst $IPSET_BLACK) -j MARK --set-mark 88"
|
||||
[ "${USE_GFW_LIST}" = "1" ] && add_port_rules "$ipt_m -A PSW_OUTPUT -p tcp" $TCP_PROXY_DROP_PORTS "$(dst $IPSET_GFW) -j MARK --set-mark 88"
|
||||
[ "${CHN_LIST}" != "0" ] && add_port_rules "$ipt_m -A PSW_OUTPUT -p tcp" $TCP_PROXY_DROP_PORTS "$(dst $IPSET_CHN) $(get_jump_ipt ${CHN_LIST} "-j MARK --set-mark 88")"
|
||||
[ "${USE_SHUNT_TCP}" = "1" ] && add_port_rules "$ipt_m -A PSW_OUTPUT -p tcp" $TCP_PROXY_DROP_PORTS "$(dst $IPSET_SHUNT) -j MARK --set-mark 88"
|
||||
[ "${USE_SHUNT_NODE}" = "1" ] && add_port_rules "$ipt_m -A PSW_OUTPUT -p tcp" $TCP_PROXY_DROP_PORTS "$(dst $IPSET_SHUNT) -j MARK --set-mark 88"
|
||||
[ "${LOCALHOST_TCP_PROXY_MODE}" != "disable" ] && add_port_rules "$ipt_m -A PSW_OUTPUT -p tcp" $TCP_PROXY_DROP_PORTS "-j MARK --set-mark 88"
|
||||
echolog " - ${msg}屏蔽代理 TCP 端口[${TCP_PROXY_DROP_PORTS}]"
|
||||
}
|
||||
@@ -1256,14 +1221,14 @@ add_firewall_rule() {
|
||||
[ "${USE_PROXY_LIST}" = "1" ] && add_port_rules "$ipt_m -A PSW_OUTPUT -p udp" $UDP_PROXY_DROP_PORTS "$(dst $IPSET_BLACK) -j MARK --set-mark 88"
|
||||
[ "${USE_GFW_LIST}" = "1" ] && add_port_rules "$ipt_m -A PSW_OUTPUT -p udp" $UDP_PROXY_DROP_PORTS "$(dst $IPSET_GFW) -j MARK --set-mark 88"
|
||||
[ "${CHN_LIST}" != "0" ] && add_port_rules "$ipt_m -A PSW_OUTPUT -p udp" $UDP_PROXY_DROP_PORTS "$(dst $IPSET_CHN) $(get_jump_ipt ${CHN_LIST} "-j MARK --set-mark 88")"
|
||||
[ "${USE_SHUNT_UDP}" = "1" ] && add_port_rules "$ipt_m -A PSW_OUTPUT -p udp" $UDP_PROXY_DROP_PORTS "$(dst $IPSET_SHUNT) -j MARK --set-mark 88"
|
||||
[ "${USE_SHUNT_NODE}" = "1" ] && add_port_rules "$ipt_m -A PSW_OUTPUT -p udp" $UDP_PROXY_DROP_PORTS "$(dst $IPSET_SHUNT) -j MARK --set-mark 88"
|
||||
[ "${LOCALHOST_UDP_PROXY_MODE}" != "disable" ] && add_port_rules "$ipt_m -A PSW_OUTPUT -p udp" $UDP_PROXY_DROP_PORTS "-j MARK --set-mark 88"
|
||||
echolog " - ${msg}屏蔽代理 UDP 端口[${UDP_PROXY_DROP_PORTS}]"
|
||||
}
|
||||
}
|
||||
|
||||
# 加载路由器自身代理 TCP
|
||||
if [ -n "$TCP_NODE" ]; then
|
||||
if [ -n "$NODE" ]; then
|
||||
_proxy_tcp_access() {
|
||||
[ -n "${2}" ] || return 0
|
||||
if echo "${2}" | grep -q -v ':'; then
|
||||
@@ -1273,10 +1238,10 @@ add_firewall_rule() {
|
||||
return 0
|
||||
}
|
||||
if [ -z "${is_tproxy}" ]; then
|
||||
$ipt_n -I PSW_OUTPUT -p tcp -d ${2} --dport ${3} $(REDIRECT $TCP_REDIR_PORT)
|
||||
$ipt_n -I PSW_OUTPUT -p tcp -d ${2} --dport ${3} $(REDIRECT $REDIR_PORT)
|
||||
else
|
||||
$ipt_m -I PSW_OUTPUT -p tcp -d ${2} --dport ${3} -j PSW_RULE
|
||||
$ipt_m -I PSW $(comment "本机") -p tcp -i lo -d ${2} --dport ${3} $(REDIRECT $TCP_REDIR_PORT TPROXY)
|
||||
$ipt_m -I PSW $(comment "本机") -p tcp -i lo -d ${2} --dport ${3} $(REDIRECT $REDIR_PORT TPROXY)
|
||||
fi
|
||||
echolog " - [$?]将上游 DNS 服务器 ${2}:${3} 加入到路由器自身代理的 TCP 转发链"
|
||||
else
|
||||
@@ -1286,7 +1251,7 @@ add_firewall_rule() {
|
||||
return 0
|
||||
}
|
||||
$ip6t_m -I PSW_OUTPUT -p tcp -d ${2} --dport ${3} -j PSW_RULE
|
||||
$ip6t_m -I PSW $(comment "本机") -p tcp -i lo -d ${2} --dport ${3} $(REDIRECT $TCP_REDIR_PORT TPROXY)
|
||||
$ip6t_m -I PSW $(comment "本机") -p tcp -i lo -d ${2} --dport ${3} $(REDIRECT $REDIR_PORT TPROXY)
|
||||
echolog " - [$?]将上游 DNS 服务器 [${2}]:${3} 加入到路由器自身代理的 TCP 转发链,请确保您的节点支持IPv6,并开启IPv6透明代理!"
|
||||
fi
|
||||
}
|
||||
@@ -1298,7 +1263,7 @@ add_firewall_rule() {
|
||||
[ "${USE_PROXY_LIST}" = "1" ] && $ipt_n -A PSW_OUTPUT -p icmp $(dst $IPSET_BLACK) $(REDIRECT)
|
||||
[ "${USE_GFW_LIST}" = "1" ] && $ipt_n -A PSW_OUTPUT -p icmp $(dst $IPSET_GFW) $(REDIRECT)
|
||||
[ "${CHN_LIST}" != "0" ] && $ipt_n -A PSW_OUTPUT -p icmp $(dst $IPSET_CHN) $(get_jump_ipt ${CHN_LIST})
|
||||
[ "${USE_SHUNT_TCP}" = "1" ] && $ipt_n -A PSW_OUTPUT -p icmp $(dst $IPSET_SHUNT) $(REDIRECT)
|
||||
[ "${USE_SHUNT_NODE}" = "1" ] && $ipt_n -A PSW_OUTPUT -p icmp $(dst $IPSET_SHUNT) $(REDIRECT)
|
||||
[ -n "${LOCALHOST_TCP_PROXY_MODE}" ] && [ "${LOCALHOST_TCP_PROXY_MODE}" != "disable" ] && $ipt_n -A PSW_OUTPUT -p icmp $(REDIRECT)
|
||||
}
|
||||
|
||||
@@ -1308,7 +1273,7 @@ add_firewall_rule() {
|
||||
[ "${USE_PROXY_LIST}" = "1" ] && $ip6t_n -A PSW_OUTPUT -p ipv6-icmp $(dst $IPSET_BLACK6) $(REDIRECT)
|
||||
[ "${USE_GFW_LIST}" = "1" ] && $ip6t_n -A PSW_OUTPUT -p ipv6-icmp $(dst $IPSET_GFW6) $(REDIRECT)
|
||||
[ "${CHN_LIST}" != "0" ] && $ip6t_n -A PSW_OUTPUT -p ipv6-icmp $(dst $IPSET_CHN6) $(get_jump_ipt ${CHN_LIST})
|
||||
[ "${USE_SHUNT_TCP}" = "1" ] && $ip6t_n -A PSW_OUTPUT -p ipv6-icmp $(dst $IPSET_SHUNT6) $(REDIRECT)
|
||||
[ "${USE_SHUNT_NODE}" = "1" ] && $ip6t_n -A PSW_OUTPUT -p ipv6-icmp $(dst $IPSET_SHUNT6) $(REDIRECT)
|
||||
[ -n "${LOCALHOST_TCP_PROXY_MODE}" ] && [ "${LOCALHOST_TCP_PROXY_MODE}" != "disable" ] && $ip6t_n -A PSW_OUTPUT -p ipv6-icmp $(REDIRECT)
|
||||
}
|
||||
|
||||
@@ -1317,9 +1282,9 @@ add_firewall_rule() {
|
||||
[ "${USE_PROXY_LIST}" = "1" ] && add_port_rules "$ipt_tmp -A PSW_OUTPUT -p tcp" $TCP_REDIR_PORTS "$(dst $IPSET_BLACK) ${ipt_j}"
|
||||
[ "${USE_GFW_LIST}" = "1" ] && add_port_rules "$ipt_tmp -A PSW_OUTPUT -p tcp" $TCP_REDIR_PORTS "$(dst $IPSET_GFW) ${ipt_j}"
|
||||
[ "${CHN_LIST}" != "0" ] && add_port_rules "$ipt_tmp -A PSW_OUTPUT -p tcp" $TCP_REDIR_PORTS "$(dst $IPSET_CHN) $(get_jump_ipt ${CHN_LIST} "${ipt_j}")"
|
||||
[ "${USE_SHUNT_TCP}" = "1" ] && add_port_rules "$ipt_tmp -A PSW_OUTPUT -p tcp" $TCP_REDIR_PORTS "$(dst $IPSET_SHUNT) ${ipt_j}"
|
||||
[ "${USE_SHUNT_NODE}" = "1" ] && add_port_rules "$ipt_tmp -A PSW_OUTPUT -p tcp" $TCP_REDIR_PORTS "$(dst $IPSET_SHUNT) ${ipt_j}"
|
||||
[ "${LOCALHOST_TCP_PROXY_MODE}" != "disable" ] && add_port_rules "$ipt_tmp -A PSW_OUTPUT -p tcp" $TCP_REDIR_PORTS "${ipt_j}"
|
||||
[ -n "${is_tproxy}" ] && $ipt_m -A PSW $(comment "本机") -p tcp -i lo $(REDIRECT $TCP_REDIR_PORT TPROXY)
|
||||
[ -n "${is_tproxy}" ] && $ipt_m -A PSW $(comment "本机") -p tcp -i lo $(REDIRECT $REDIR_PORT TPROXY)
|
||||
}
|
||||
[ -z "${is_tproxy}" ] && $ipt_n -A OUTPUT -p tcp -j PSW_OUTPUT
|
||||
[ -n "${is_tproxy}" ] && {
|
||||
@@ -1333,9 +1298,9 @@ add_firewall_rule() {
|
||||
[ "${USE_PROXY_LIST}" = "1" ] && add_port_rules "$ip6t_m -A PSW_OUTPUT -p tcp" $TCP_REDIR_PORTS "$(dst $IPSET_BLACK6) -j PSW_RULE"
|
||||
[ "${USE_GFW_LIST}" = "1" ] && add_port_rules "$ip6t_m -A PSW_OUTPUT -p tcp" $TCP_REDIR_PORTS "$(dst $IPSET_GFW6) -j PSW_RULE"
|
||||
[ "${CHN_LIST}" != "0" ] && add_port_rules "$ip6t_m -A PSW_OUTPUT -p tcp" $TCP_REDIR_PORTS "$(dst $IPSET_CHN6) $(get_jump_ipt ${CHN_LIST} "-j PSW_RULE")"
|
||||
[ "${USE_SHUNT_TCP}" = "1" ] && add_port_rules "$ip6t_m -A PSW_OUTPUT -p tcp" $TCP_REDIR_PORTS "$(dst $IPSET_SHUNT6) -j PSW_RULE"
|
||||
[ "${USE_SHUNT_NODE}" = "1" ] && add_port_rules "$ip6t_m -A PSW_OUTPUT -p tcp" $TCP_REDIR_PORTS "$(dst $IPSET_SHUNT6) -j PSW_RULE"
|
||||
[ "${LOCALHOST_TCP_PROXY_MODE}" != "disable" ] && add_port_rules "$ip6t_m -A PSW_OUTPUT -p tcp" $TCP_REDIR_PORTS "-j PSW_RULE"
|
||||
$ip6t_m -A PSW $(comment "本机") -p tcp -i lo $(REDIRECT $TCP_REDIR_PORT TPROXY)
|
||||
$ip6t_m -A PSW $(comment "本机") -p tcp -i lo $(REDIRECT $REDIR_PORT TPROXY)
|
||||
}
|
||||
$ip6t_m -A PSW $(comment "本机") -p tcp -i lo -j RETURN
|
||||
insert_rule_before "$ip6t_m" "OUTPUT" "mwan3" "$(comment mangle-OUTPUT-PSW) -p tcp -j PSW_OUTPUT"
|
||||
@@ -1343,7 +1308,7 @@ add_firewall_rule() {
|
||||
fi
|
||||
|
||||
# 加载路由器自身代理 UDP
|
||||
if [ -n "$UDP_NODE" ] || [ "$TCP_UDP" = "1" ]; then
|
||||
if [ -n "$NODE" ]; then
|
||||
_proxy_udp_access() {
|
||||
[ -n "${2}" ] || return 0
|
||||
if echo "${2}" | grep -q -v ':'; then
|
||||
@@ -1353,7 +1318,7 @@ add_firewall_rule() {
|
||||
return 0
|
||||
}
|
||||
$ipt_m -I PSW_OUTPUT -p udp -d ${2} --dport ${3} -j PSW_RULE
|
||||
$ipt_m -I PSW $(comment "本机") -p udp -i lo -d ${2} --dport ${3} $(REDIRECT $UDP_REDIR_PORT TPROXY)
|
||||
$ipt_m -I PSW $(comment "本机") -p udp -i lo -d ${2} --dport ${3} $(REDIRECT $REDIR_PORT TPROXY)
|
||||
echolog " - [$?]将上游 DNS 服务器 ${2}:${3} 加入到路由器自身代理的 UDP 转发链"
|
||||
else
|
||||
ipset -q test $IPSET_LAN6 ${2}
|
||||
@@ -1362,7 +1327,7 @@ add_firewall_rule() {
|
||||
return 0
|
||||
}
|
||||
$ip6t_m -I PSW_OUTPUT -p udp -d ${2} --dport ${3} -j PSW_RULE
|
||||
$ip6t_m -I PSW $(comment "本机") -p udp -i lo -d ${2} --dport ${3} $(REDIRECT $UDP_REDIR_PORT TPROXY)
|
||||
$ip6t_m -I PSW $(comment "本机") -p udp -i lo -d ${2} --dport ${3} $(REDIRECT $REDIR_PORT TPROXY)
|
||||
echolog " - [$?]将上游 DNS 服务器 [${2}]:${3} 加入到路由器自身代理的 UDP 转发链,请确保您的节点支持IPv6,并开启IPv6透明代理!"
|
||||
fi
|
||||
}
|
||||
@@ -1372,9 +1337,9 @@ add_firewall_rule() {
|
||||
[ "${USE_PROXY_LIST}" = "1" ] && add_port_rules "$ipt_m -A PSW_OUTPUT -p udp" $UDP_REDIR_PORTS "$(dst $IPSET_BLACK) -j PSW_RULE"
|
||||
[ "${USE_GFW_LIST}" = "1" ] && add_port_rules "$ipt_m -A PSW_OUTPUT -p udp" $UDP_REDIR_PORTS "$(dst $IPSET_GFW) -j PSW_RULE"
|
||||
[ "${CHN_LIST}" != "0" ] && add_port_rules "$ipt_m -A PSW_OUTPUT -p udp" $UDP_REDIR_PORTS "$(dst $IPSET_CHN) $(get_jump_ipt ${CHN_LIST} "-j PSW_RULE")"
|
||||
[ "${USE_SHUNT_UDP}" = "1" ] && add_port_rules "$ipt_m -A PSW_OUTPUT -p udp" $UDP_REDIR_PORTS "$(dst $IPSET_SHUNT) -j PSW_RULE"
|
||||
[ "${USE_SHUNT_NODE}" = "1" ] && add_port_rules "$ipt_m -A PSW_OUTPUT -p udp" $UDP_REDIR_PORTS "$(dst $IPSET_SHUNT) -j PSW_RULE"
|
||||
[ "${LOCALHOST_UDP_PROXY_MODE}" != "disable" ] && add_port_rules "$ipt_m -A PSW_OUTPUT -p udp" $UDP_REDIR_PORTS "-j PSW_RULE"
|
||||
$ipt_m -A PSW $(comment "本机") -p udp -i lo $(REDIRECT $UDP_REDIR_PORT TPROXY)
|
||||
$ipt_m -A PSW $(comment "本机") -p udp -i lo $(REDIRECT $REDIR_PORT TPROXY)
|
||||
}
|
||||
$ipt_m -A PSW $(comment "本机") -p udp -i lo -j RETURN
|
||||
insert_rule_before "$ipt_m" "OUTPUT" "mwan3" "$(comment mangle-OUTPUT-PSW) -p udp -j PSW_OUTPUT"
|
||||
@@ -1385,9 +1350,9 @@ add_firewall_rule() {
|
||||
[ "${USE_PROXY_LIST}" = "1" ] && add_port_rules "$ip6t_m -A PSW_OUTPUT -p udp" $UDP_REDIR_PORTS "$(dst $IPSET_BLACK6) -j PSW_RULE"
|
||||
[ "${USE_GFW_LIST}" = "1" ] && add_port_rules "$ip6t_m -A PSW_OUTPUT -p udp" $UDP_REDIR_PORTS "$(dst $IPSET_GFW6) -j PSW_RULE"
|
||||
[ "${CHN_LIST}" != "0" ] && add_port_rules "$ip6t_m -A PSW_OUTPUT -p udp" $UDP_REDIR_PORTS "$(dst $IPSET_CHN6) $(get_jump_ipt ${CHN_LIST} "-j PSW_RULE")"
|
||||
[ "${USE_SHUNT_UDP}" = "1" ] && add_port_rules "$ip6t_m -A PSW_OUTPUT -p udp" $UDP_REDIR_PORTS "$(dst $IPSET_SHUNT6) -j PSW_RULE"
|
||||
[ "${USE_SHUNT_NODE}" = "1" ] && add_port_rules "$ip6t_m -A PSW_OUTPUT -p udp" $UDP_REDIR_PORTS "$(dst $IPSET_SHUNT6) -j PSW_RULE"
|
||||
[ "${LOCALHOST_UDP_PROXY_MODE}" != "disable" ] && add_port_rules "$ip6t_m -A PSW_OUTPUT -p udp" $UDP_REDIR_PORTS "-j PSW_RULE"
|
||||
$ip6t_m -A PSW $(comment "本机") -p udp -i lo $(REDIRECT $UDP_REDIR_PORT TPROXY)
|
||||
$ip6t_m -A PSW $(comment "本机") -p udp -i lo $(REDIRECT $REDIR_PORT TPROXY)
|
||||
}
|
||||
$ip6t_m -A PSW $(comment "本机") -p udp -i lo -j RETURN
|
||||
insert_rule_before "$ip6t_m" "OUTPUT" "mwan3" "$(comment mangle-OUTPUT-PSW) -p udp -j PSW_OUTPUT"
|
||||
|
||||
@@ -42,9 +42,6 @@ NFTSET_WHITE6_STATIC="${NFTSET_WHITE6}_static"
|
||||
NFTSET_BLOCK6_STATIC="${NFTSET_BLOCK6}_static"
|
||||
NFTSET_SHUNT6_STATIC="${NFTSET_SHUNT6}_static"
|
||||
|
||||
USE_SHUNT_TCP=0
|
||||
USE_SHUNT_UDP=0
|
||||
|
||||
# ASCII code for PSW1.Use whatever,just not the same.
|
||||
FWMARK="0x50535731"
|
||||
|
||||
@@ -291,41 +288,28 @@ load_acl() {
|
||||
[ "$tcp_redir_ports" = "default" ] && tcp_redir_ports=$TCP_REDIR_PORTS
|
||||
[ "$udp_redir_ports" = "default" ] && udp_redir_ports=$UDP_REDIR_PORTS
|
||||
|
||||
[ -n "$(get_cache_var "ACL_${sid}_tcp_node")" ] && tcp_node=$(get_cache_var "ACL_${sid}_tcp_node")
|
||||
[ -n "$(get_cache_var "ACL_${sid}_tcp_redir_port")" ] && tcp_port=$(get_cache_var "ACL_${sid}_tcp_redir_port")
|
||||
[ -n "$(get_cache_var "ACL_${sid}_udp_node")" ] && udp_node=$(get_cache_var "ACL_${sid}_udp_node")
|
||||
[ -n "$(get_cache_var "ACL_${sid}_udp_redir_port")" ] && udp_port=$(get_cache_var "ACL_${sid}_udp_redir_port")
|
||||
[ -n "$(get_cache_var "ACL_${sid}_node")" ] && node=$(get_cache_var "ACL_${sid}_node")
|
||||
[ -n "$(get_cache_var "ACL_${sid}_redir_port")" ] && {
|
||||
tcp_port=$(get_cache_var "ACL_${sid}_redir_port")
|
||||
udp_port=$tcp_port
|
||||
}
|
||||
[ -n "$(get_cache_var "ACL_${sid}_dns_port")" ] && dns_redirect_port=$(get_cache_var "ACL_${sid}_dns_port")
|
||||
[ -n "$(get_cache_var "ACL_${sid}_fakedns")" ] && use_fakedns=$(get_cache_var "ACL_${sid}_fakedns")
|
||||
[ -n "$tcp_node" ] && {
|
||||
if [ "$(config_get_type $tcp_node)" = "socks" ]; then
|
||||
tcp_node_remark="Socks 配置($(config_n_get $tcp_node port) 端口)"
|
||||
[ -n "$node" ] && {
|
||||
if [ "$(config_get_type $node)" = "socks" ]; then
|
||||
node_remark="Socks 配置($(config_n_get $node port) 端口)"
|
||||
else
|
||||
tcp_node_remark=$(config_n_get $tcp_node remarks)
|
||||
node_remark=$(config_n_get $node remarks)
|
||||
fi
|
||||
}
|
||||
[ -n "$udp_node" ] && {
|
||||
if [ "$(config_get_type $udp_node)" = "socks" ]; then
|
||||
udp_node_remark="Socks 配置($(config_n_get $udp_node port) 端口)"
|
||||
else
|
||||
udp_node_remark=$(config_n_get $udp_node remarks)
|
||||
fi
|
||||
}
|
||||
use_shunt_tcp=0
|
||||
use_shunt_udp=0
|
||||
[ -n "$tcp_node" ] && [ "$(config_n_get $tcp_node protocol)" = "_shunt" ] && use_shunt_tcp=1
|
||||
[ -n "$udp_node" ] && [ "$(config_n_get $udp_node protocol)" = "_shunt" ] && use_shunt_udp=1
|
||||
use_shunt_node=0
|
||||
[ -n "$node" ] && [ "$(config_n_get $node protocol)" = "_shunt" ] && use_shunt_node=1
|
||||
|
||||
[ "${use_global_config}" = "1" ] && {
|
||||
if [ "$(config_get_type $TCP_NODE)" = "socks" ]; then
|
||||
tcp_node_remark="Socks 配置($(config_n_get $TCP_NODE port) 端口)"
|
||||
if [ "$(config_get_type $NODE)" = "socks" ]; then
|
||||
node_remark="Socks 配置($(config_n_get $NODE port) 端口)"
|
||||
else
|
||||
tcp_node_remark=$(config_n_get $TCP_NODE remarks)
|
||||
fi
|
||||
if [ "$(config_get_type $UDP_NODE)" = "socks" ]; then
|
||||
udp_node_remark="Socks 配置($(config_n_get $UDP_NODE port) 端口)"
|
||||
else
|
||||
udp_node_remark=$(config_n_get $UDP_NODE remarks)
|
||||
node_remark=$(config_n_get $NODE remarks)
|
||||
fi
|
||||
use_direct_list=${USE_DIRECT_LIST}
|
||||
use_proxy_list=${USE_PROXY_LIST}
|
||||
@@ -334,8 +318,7 @@ load_acl() {
|
||||
chn_list=${CHN_LIST}
|
||||
tcp_proxy_mode=${TCP_PROXY_MODE}
|
||||
udp_proxy_mode=${UDP_PROXY_MODE}
|
||||
use_shunt_tcp=${USE_SHUNT_TCP}
|
||||
use_shunt_udp=${USE_SHUNT_UDP}
|
||||
use_shunt_node=${USE_SHUNT_NODE}
|
||||
dns_redirect_port=${DNS_REDIRECT_PORT}
|
||||
black_set_name=${NFTSET_BLACK}
|
||||
black_set_name_static=${NFTSET_BLACK_STATIC}
|
||||
@@ -445,7 +428,7 @@ load_acl() {
|
||||
gen_nftset $gfw6_set_name ipv6_addr "2d"
|
||||
}
|
||||
}
|
||||
[ "${use_shunt_tcp}" = "1" ] || [ "${use_shunt_udp}" = "1" ] && {
|
||||
[ "${use_shunt_node}" = "1" ] && {
|
||||
[ "${use_global_config}" = "0" ] && {
|
||||
shunt_set_name="psw_${sid}_shunt"
|
||||
shunt_set_name_static="psw_${sid}_shunt_static"
|
||||
@@ -458,12 +441,8 @@ load_acl() {
|
||||
# 预加载分流规则 ip 到 nftset
|
||||
local GEOIP_CODE=""
|
||||
local shunt_ids=$(uci show $CONFIG | grep "=shunt_rules" | awk -F '.' '{print $2}' | awk -F '=' '{print $1}')
|
||||
local shunt_group shunt_id
|
||||
if [ "${use_shunt_tcp}" = "1" ]; then
|
||||
shunt_group=$(config_n_get $tcp_node shunt_group)
|
||||
elif [ "${use_shunt_udp}" = "1" ]; then
|
||||
shunt_group=$(config_n_get $udp_node shunt_group)
|
||||
fi
|
||||
local shunt_group=$(config_n_get $node shunt_group)
|
||||
local shunt_id
|
||||
for shunt_id in $shunt_ids; do
|
||||
[ "${shunt_group}" != "$(config_n_get ${shunt_id} group)" ] && continue
|
||||
config_n_get $shunt_id ip_list | sed 's/#.*//' | grep -E "(\.((2(5[0-5]|[0-4][0-9]))|[0-1]?[0-9]{1,2})){3}" | insert_nftset $shunt_set_name_static
|
||||
@@ -492,7 +471,7 @@ load_acl() {
|
||||
#nft "add rule $NFTABLE_NAME PSW_DNS ip protocol tcp ${_ipt_source} tcp dport 53 counter redirect to :${dns_redirect} comment \"$remarks\""
|
||||
nft "add rule $NFTABLE_NAME PSW_DNS meta l4proto udp ${_ipt_source} udp dport 53 counter redirect to :${dns_redirect} comment \"$remarks\""
|
||||
nft "add rule $NFTABLE_NAME PSW_DNS meta l4proto tcp ${_ipt_source} tcp dport 53 counter redirect to :${dns_redirect} comment \"$remarks\""
|
||||
[ -z "$(get_cache_var "ACL_${sid}_tcp_default")" ] && echolog " - ${msg}使用与全局配置不相同节点,已将DNS强制重定向到专用 DNS 服务器。"
|
||||
[ -z "$(get_cache_var "ACL_${sid}_default")" ] && echolog " - ${msg}使用与全局配置不相同节点,已将DNS强制重定向到专用 DNS 服务器。"
|
||||
fi
|
||||
|
||||
[ -n "$tcp_port" ] || [ -n "$udp_port" ] && {
|
||||
@@ -511,14 +490,14 @@ load_acl() {
|
||||
[ "${use_proxy_list}" = "1" ] && nft_rule_dual "PSW_MANGLE_V6" "meta l4proto tcp ${_ipt_source} $(factor $tcp_proxy_drop_ports "tcp dport") ip6 daddr" "$black6_set_name" "counter reject comment \"$remarks\"" 2>/dev/null
|
||||
[ "${use_gfw_list}" = "1" ] && nft "add rule $NFTABLE_NAME PSW_MANGLE_V6 meta l4proto tcp ${_ipt_source} $(factor $tcp_proxy_drop_ports "tcp dport") ip6 daddr @$gfw6_set_name counter reject comment \"$remarks\"" 2>/dev/null
|
||||
[ "${chn_list}" != "0" ] && nft_rule_dual "PSW_MANGLE_V6" "meta l4proto tcp ${_ipt_source} $(factor $tcp_proxy_drop_ports "tcp dport") ip6 daddr" "$NFTSET_CHN6" "$(get_jump_nft ${chn_list} "counter reject") comment \"$remarks\"" 2>/dev/null
|
||||
[ "${use_shunt_tcp}" = "1" ] && nft_rule_dual "PSW_MANGLE_V6" "meta l4proto tcp ${_ipt_source} $(factor $tcp_proxy_drop_ports "tcp dport") ip6 daddr" "$shunt6_set_name" "counter reject comment \"$remarks\"" 2>/dev/null
|
||||
[ "${use_shunt_node}" = "1" ] && nft_rule_dual "PSW_MANGLE_V6" "meta l4proto tcp ${_ipt_source} $(factor $tcp_proxy_drop_ports "tcp dport") ip6 daddr" "$shunt6_set_name" "counter reject comment \"$remarks\"" 2>/dev/null
|
||||
[ "${tcp_proxy_mode}" != "disable" ] && nft "add rule $NFTABLE_NAME PSW_MANGLE_V6 meta l4proto tcp ${_ipt_source} $(factor $tcp_proxy_drop_ports "tcp dport") counter reject comment \"$remarks\"" 2>/dev/null
|
||||
}
|
||||
[ "${use_fakedns}" = "1" ] && nft "add rule $NFTABLE_NAME $nft_prerouting_chain ip protocol tcp ${_ipt_source} $(factor $tcp_proxy_drop_ports "tcp dport") ip daddr $FAKE_IP counter reject comment \"$remarks\""
|
||||
[ "${use_proxy_list}" = "1" ] && nft_rule_dual "$nft_prerouting_chain" "ip protocol tcp ${_ipt_source} $(factor $tcp_proxy_drop_ports "tcp dport") ip daddr" "$black_set_name" "counter reject comment \"$remarks\""
|
||||
[ "${use_gfw_list}" = "1" ] && nft "add rule $NFTABLE_NAME $nft_prerouting_chain ip protocol tcp ${_ipt_source} $(factor $tcp_proxy_drop_ports "tcp dport") ip daddr @$gfw_set_name counter reject comment \"$remarks\""
|
||||
[ "${chn_list}" != "0" ] && nft_rule_dual "$nft_prerouting_chain" "ip protocol tcp ${_ipt_source} $(factor $tcp_proxy_drop_ports "tcp dport") ip daddr" "$NFTSET_CHN" "$(get_jump_nft ${chn_list} "counter reject") comment \"$remarks\""
|
||||
[ "${use_shunt_tcp}" = "1" ] && nft_rule_dual "$nft_prerouting_chain" "ip protocol tcp ${_ipt_source} $(factor $tcp_proxy_drop_ports "tcp dport") ip daddr" "$shunt_set_name" "counter reject comment \"$remarks\""
|
||||
[ "${use_shunt_node}" = "1" ] && nft_rule_dual "$nft_prerouting_chain" "ip protocol tcp ${_ipt_source} $(factor $tcp_proxy_drop_ports "tcp dport") ip daddr" "$shunt_set_name" "counter reject comment \"$remarks\""
|
||||
[ "${tcp_proxy_mode}" != "disable" ] && nft "add rule $NFTABLE_NAME $nft_prerouting_chain ip protocol tcp ${_ipt_source} $(factor $tcp_proxy_drop_ports "tcp dport") counter reject comment \"$remarks\""
|
||||
echolog " - ${msg}屏蔽代理 TCP 端口[${tcp_proxy_drop_ports}]"
|
||||
}
|
||||
@@ -529,14 +508,14 @@ load_acl() {
|
||||
[ "${use_proxy_list}" = "1" ] && nft_rule_dual "PSW_MANGLE_V6" "meta l4proto udp ${_ipt_source} $(factor $udp_proxy_drop_ports "udp dport") ip6 daddr" "$black6_set_name" "counter reject comment \"$remarks\"" 2>/dev/null
|
||||
[ "${use_gfw_list}" = "1" ] && nft "add rule $NFTABLE_NAME PSW_MANGLE_V6 meta l4proto udp ${_ipt_source} $(factor $udp_proxy_drop_ports "udp dport") ip6 daddr @$gfw6_set_name counter reject comment \"$remarks\"" 2>/dev/null
|
||||
[ "${chn_list}" != "0" ] && nft_rule_dual "PSW_MANGLE_V6" "meta l4proto udp ${_ipt_source} $(factor $udp_proxy_drop_ports "udp dport") ip6 daddr" "$NFTSET_CHN6" "$(get_jump_nft ${chn_list} "counter reject") comment \"$remarks\"" 2>/dev/null
|
||||
[ "${use_shunt_udp}" = "1" ] && nft_rule_dual "PSW_MANGLE_V6" "meta l4proto udp ${_ipt_source} $(factor $udp_proxy_drop_ports "udp dport") ip6 daddr" "$shunt6_set_name" "counter reject comment \"$remarks\"" 2>/dev/null
|
||||
[ "${use_shunt_node}" = "1" ] && nft_rule_dual "PSW_MANGLE_V6" "meta l4proto udp ${_ipt_source} $(factor $udp_proxy_drop_ports "udp dport") ip6 daddr" "$shunt6_set_name" "counter reject comment \"$remarks\"" 2>/dev/null
|
||||
[ "${udp_proxy_mode}" != "disable" ] && nft "add rule $NFTABLE_NAME PSW_MANGLE_V6 meta l4proto udp ${_ipt_source} $(factor $udp_proxy_drop_ports "udp dport") counter reject comment \"$remarks\"" 2>/dev/null
|
||||
}
|
||||
[ "${use_fakedns}" = "1" ] && nft "add rule $NFTABLE_NAME PSW_MANGLE ip protocol udp ${_ipt_source} $(factor $udp_proxy_drop_ports "udp dport") ip daddr $FAKE_IP counter reject comment \"$remarks\"" 2>/dev/null
|
||||
[ "${use_proxy_list}" = "1" ] && nft_rule_dual "PSW_MANGLE" "ip protocol udp ${_ipt_source} $(factor $udp_proxy_drop_ports "udp dport") ip daddr" "$black_set_name" "counter reject comment \"$remarks\"" 2>/dev/null
|
||||
[ "${use_gfw_list}" = "1" ] && nft "add rule $NFTABLE_NAME PSW_MANGLE ip protocol udp ${_ipt_source} $(factor $udp_proxy_drop_ports "udp dport") ip daddr @$gfw_set_name counter reject comment \"$remarks\"" 2>/dev/null
|
||||
[ "${chn_list}" != "0" ] && nft_rule_dual "PSW_MANGLE" "ip protocol udp ${_ipt_source} $(factor $udp_proxy_drop_ports "udp dport") ip daddr" "$NFTSET_CHN" "$(get_jump_nft ${chn_list} "counter reject") comment \"$remarks\"" 2>/dev/null
|
||||
[ "${use_shunt_udp}" = "1" ] && nft_rule_dual "PSW_MANGLE" "ip protocol udp ${_ipt_source} $(factor $udp_proxy_drop_ports "udp dport") ip daddr" "$shunt_set_name" "counter reject comment \"$remarks\"" 2>/dev/null
|
||||
[ "${use_shunt_node}" = "1" ] && nft_rule_dual "PSW_MANGLE" "ip protocol udp ${_ipt_source} $(factor $udp_proxy_drop_ports "udp dport") ip daddr" "$shunt_set_name" "counter reject comment \"$remarks\"" 2>/dev/null
|
||||
[ "${udp_proxy_mode}" != "disable" ] && nft "add rule $NFTABLE_NAME PSW_MANGLE ip protocol udp ${_ipt_source} $(factor $udp_proxy_drop_ports "udp dport") counter reject comment \"$remarks\"" 2>/dev/null
|
||||
echolog " - ${msg}屏蔽代理 UDP 端口[${udp_proxy_drop_ports}]"
|
||||
}
|
||||
@@ -544,7 +523,7 @@ load_acl() {
|
||||
|
||||
[ -n "$tcp_port" ] && {
|
||||
if [ -n "${tcp_proxy_mode}" ]; then
|
||||
msg2="${msg}使用 TCP 节点[$tcp_node_remark]"
|
||||
msg2="${msg}代理 TCP 使用节点[$node_remark]"
|
||||
if [ -n "${is_tproxy}" ]; then
|
||||
msg2="${msg2}(TPROXY:${tcp_port})"
|
||||
nft_chain="PSW_MANGLE"
|
||||
@@ -561,7 +540,7 @@ load_acl() {
|
||||
[ "${use_proxy_list}" = "1" ] && nft_rule_dual "PSW_ICMP_REDIRECT" "ip protocol icmp ${_ipt_source} ip daddr" "$black_set_name" "$(REDIRECT) comment \"$remarks\""
|
||||
[ "${use_gfw_list}" = "1" ] && nft "add rule $NFTABLE_NAME PSW_ICMP_REDIRECT ip protocol icmp ${_ipt_source} ip daddr @$gfw_set_name $(REDIRECT) comment \"$remarks\""
|
||||
[ "${chn_list}" != "0" ] && nft_rule_dual "PSW_ICMP_REDIRECT" "ip protocol icmp ${_ipt_source} ip daddr" "$NFTSET_CHN" "$(get_jump_nft ${chn_list}) comment \"$remarks\""
|
||||
[ "${use_shunt_tcp}" = "1" ] && nft_rule_dual "PSW_ICMP_REDIRECT" "ip protocol icmp ${_ipt_source} ip daddr" "$shunt_set_name" "$(REDIRECT) comment \"$remarks\""
|
||||
[ "${use_shunt_node}" = "1" ] && nft_rule_dual "PSW_ICMP_REDIRECT" "ip protocol icmp ${_ipt_source} ip daddr" "$shunt_set_name" "$(REDIRECT) comment \"$remarks\""
|
||||
[ "${tcp_proxy_mode}" != "disable" ] && nft "add rule $NFTABLE_NAME PSW_ICMP_REDIRECT ip protocol icmp ${_ipt_source} $(REDIRECT) comment \"$remarks\""
|
||||
nft "add rule $NFTABLE_NAME PSW_ICMP_REDIRECT ip protocol icmp ${_ipt_source} return comment \"$remarks\""
|
||||
}
|
||||
@@ -572,7 +551,7 @@ load_acl() {
|
||||
[ "${use_proxy_list}" = "1" ] && nft_rule_dual "PSW_ICMP_REDIRECT" "meta l4proto icmpv6 ${_ipt_source} ip6 daddr" "$black6_set_name" "$(REDIRECT) comment \"$remarks\"" 2>/dev/null
|
||||
[ "${use_gfw_list}" = "1" ] && nft "add rule $NFTABLE_NAME PSW_ICMP_REDIRECT meta l4proto icmpv6 ${_ipt_source} ip6 daddr @$gfw6_set_name $(REDIRECT) comment \"$remarks\"" 2>/dev/null
|
||||
[ "${chn_list}" != "0" ] && nft_rule_dual "PSW_ICMP_REDIRECT" "meta l4proto icmpv6 ${_ipt_source} ip6 daddr" "$NFTSET_CHN6" "$(get_jump_nft ${chn_list}) comment \"$remarks\"" 2>/dev/null
|
||||
[ "${use_shunt_tcp}" = "1" ] && nft_rule_dual "PSW_ICMP_REDIRECT" "meta l4proto icmpv6 ${_ipt_source} ip6 daddr" "$shunt6_set_name" "$(REDIRECT) comment \"$remarks\"" 2>/dev/null
|
||||
[ "${use_shunt_node}" = "1" ] && nft_rule_dual "PSW_ICMP_REDIRECT" "meta l4proto icmpv6 ${_ipt_source} ip6 daddr" "$shunt6_set_name" "$(REDIRECT) comment \"$remarks\"" 2>/dev/null
|
||||
[ "${tcp_proxy_mode}" != "disable" ] && nft "add rule $NFTABLE_NAME PSW_ICMP_REDIRECT meta l4proto icmpv6 ${_ipt_source} $(REDIRECT) comment \"$remarks\"" 2>/dev/null
|
||||
nft "add rule $NFTABLE_NAME PSW_ICMP_REDIRECT meta l4proto icmpv6 ${_ipt_source} return comment \"$remarks\"" 2>/dev/null
|
||||
}
|
||||
@@ -581,7 +560,7 @@ load_acl() {
|
||||
[ "${use_proxy_list}" = "1" ] && nft_rule_dual "$nft_chain" "ip protocol tcp ${_ipt_source} $(factor $tcp_redir_ports "tcp dport") ip daddr" "$black_set_name" "${nft_j} comment \"$remarks\""
|
||||
[ "${use_gfw_list}" = "1" ] && nft "add rule $NFTABLE_NAME $nft_chain ip protocol tcp ${_ipt_source} $(factor $tcp_redir_ports "tcp dport") ip daddr @$gfw_set_name ${nft_j} comment \"$remarks\""
|
||||
[ "${chn_list}" != "0" ] && nft_rule_dual "$nft_chain" "ip protocol tcp ${_ipt_source} $(factor $tcp_redir_ports "tcp dport") ip daddr" "$NFTSET_CHN" "$(get_jump_nft ${chn_list} "${nft_j}") comment \"$remarks\""
|
||||
[ "${use_shunt_tcp}" = "1" ] && nft_rule_dual "$nft_chain" "ip protocol tcp ${_ipt_source} $(factor $tcp_redir_ports "tcp dport") ip daddr" "$shunt_set_name" "${nft_j} comment \"$remarks\""
|
||||
[ "${use_shunt_node}" = "1" ] && nft_rule_dual "$nft_chain" "ip protocol tcp ${_ipt_source} $(factor $tcp_redir_ports "tcp dport") ip daddr" "$shunt_set_name" "${nft_j} comment \"$remarks\""
|
||||
[ "${tcp_proxy_mode}" != "disable" ] && nft "add rule $NFTABLE_NAME $nft_chain ip protocol tcp ${_ipt_source} $(factor $tcp_redir_ports "tcp dport") ${nft_j} comment \"$remarks\""
|
||||
[ -n "${is_tproxy}" ] && nft "add rule $NFTABLE_NAME $nft_chain ip protocol tcp ${_ipt_source} $(REDIRECT $tcp_port TPROXY4) comment \"$remarks\""
|
||||
|
||||
@@ -590,7 +569,7 @@ load_acl() {
|
||||
[ "${use_proxy_list}" = "1" ] && nft_rule_dual "PSW_MANGLE_V6" "meta l4proto tcp ${_ipt_source} $(factor $tcp_redir_ports "tcp dport") ip6 daddr" "$black6_set_name" "counter jump PSW_RULE comment \"$remarks\"" 2>/dev/null
|
||||
[ "${use_gfw_list}" = "1" ] && nft "add rule $NFTABLE_NAME PSW_MANGLE_V6 meta l4proto tcp ${_ipt_source} $(factor $tcp_redir_ports "tcp dport") ip6 daddr @$gfw6_set_name counter jump PSW_RULE comment \"$remarks\"" 2>/dev/null
|
||||
[ "${chn_list}" != "0" ] && nft_rule_dual "PSW_MANGLE_V6" "meta l4proto tcp ${_ipt_source} $(factor $tcp_redir_ports "tcp dport") ip6 daddr" "$NFTSET_CHN6" "$(get_jump_nft ${chn_list} "counter jump PSW_RULE") comment \"$remarks\"" 2>/dev/null
|
||||
[ "${use_shunt_tcp}" = "1" ] && nft_rule_dual "PSW_MANGLE_V6" "meta l4proto tcp ${_ipt_source} $(factor $tcp_redir_ports "tcp dport") ip6 daddr" "$shunt6_set_name" "counter jump PSW_RULE comment \"$remarks\"" 2>/dev/null
|
||||
[ "${use_shunt_node}" = "1" ] && nft_rule_dual "PSW_MANGLE_V6" "meta l4proto tcp ${_ipt_source} $(factor $tcp_redir_ports "tcp dport") ip6 daddr" "$shunt6_set_name" "counter jump PSW_RULE comment \"$remarks\"" 2>/dev/null
|
||||
[ "${tcp_proxy_mode}" != "disable" ] && nft "add rule $NFTABLE_NAME PSW_MANGLE_V6 meta l4proto tcp ${_ipt_source} $(factor $tcp_redir_ports "tcp dport") counter jump PSW_RULE comment \"$remarks\"" 2>/dev/null
|
||||
nft "add rule $NFTABLE_NAME PSW_MANGLE_V6 meta l4proto tcp ${_ipt_source} $(REDIRECT $tcp_port TPROXY) comment \"$remarks\"" 2>/dev/null
|
||||
}
|
||||
@@ -605,14 +584,14 @@ load_acl() {
|
||||
|
||||
[ -n "$udp_port" ] && {
|
||||
if [ -n "${udp_proxy_mode}" ]; then
|
||||
msg2="${msg}使用 UDP 节点[$udp_node_remark]"
|
||||
msg2="${msg}代理 UDP 使用节点[$node_remark]"
|
||||
msg2="${msg2}(TPROXY:${udp_port})"
|
||||
|
||||
[ "${use_fakedns}" = "1" ] && nft "add rule $NFTABLE_NAME PSW_MANGLE ip protocol udp ${_ipt_source} ip daddr $FAKE_IP counter jump PSW_RULE comment \"$remarks\""
|
||||
[ "${use_proxy_list}" = "1" ] && nft_rule_dual "PSW_MANGLE" "ip protocol udp ${_ipt_source} $(factor $udp_redir_ports "udp dport") ip daddr" "$black_set_name" "counter jump PSW_RULE comment \"$remarks\""
|
||||
[ "${use_gfw_list}" = "1" ] && nft "add rule $NFTABLE_NAME PSW_MANGLE ip protocol udp ${_ipt_source} $(factor $udp_redir_ports "udp dport") ip daddr @$gfw_set_name counter jump PSW_RULE comment \"$remarks\""
|
||||
[ "${chn_list}" != "0" ] && nft_rule_dual "PSW_MANGLE" "ip protocol udp ${_ipt_source} $(factor $udp_redir_ports "udp dport") ip daddr" "$NFTSET_CHN" "$(get_jump_nft ${chn_list} "counter jump PSW_RULE") comment \"$remarks\""
|
||||
[ "${use_shunt_udp}" = "1" ] && nft_rule_dual "PSW_MANGLE" "ip protocol udp ${_ipt_source} $(factor $udp_redir_ports "udp dport") ip daddr" "$shunt_set_name" "counter jump PSW_RULE comment \"$remarks\""
|
||||
[ "${use_shunt_node}" = "1" ] && nft_rule_dual "PSW_MANGLE" "ip protocol udp ${_ipt_source} $(factor $udp_redir_ports "udp dport") ip daddr" "$shunt_set_name" "counter jump PSW_RULE comment \"$remarks\""
|
||||
[ "${udp_proxy_mode}" != "disable" ] && nft "add rule $NFTABLE_NAME PSW_MANGLE ip protocol udp ${_ipt_source} $(factor $udp_redir_ports "udp dport") counter jump PSW_RULE comment \"$remarks\""
|
||||
nft "add rule $NFTABLE_NAME PSW_MANGLE ip protocol udp ${_ipt_source} $(REDIRECT $udp_port TPROXY4) comment \"$remarks\""
|
||||
|
||||
@@ -621,7 +600,7 @@ load_acl() {
|
||||
[ "${use_proxy_list}" = "1" ] && nft_rule_dual "PSW_MANGLE_V6" "meta l4proto udp ${_ipt_source} $(factor $udp_redir_ports "udp dport") ip6 daddr" "$black6_set_name" "counter jump PSW_RULE comment \"$remarks\"" 2>/dev/null
|
||||
[ "${use_gfw_list}" = "1" ] && nft "add rule $NFTABLE_NAME PSW_MANGLE_V6 meta l4proto udp ${_ipt_source} $(factor $udp_redir_ports "udp dport") ip6 daddr @$gfw6_set_name counter jump PSW_RULE comment \"$remarks\"" 2>/dev/null
|
||||
[ "${chn_list}" != "0" ] && nft_rule_dual "PSW_MANGLE_V6" "meta l4proto udp ${_ipt_source} $(factor $udp_redir_ports "udp dport") ip6 daddr" "$NFTSET_CHN6" "$(get_jump_nft ${chn_list} "counter jump PSW_RULE") comment \"$remarks\"" 2>/dev/null
|
||||
[ "${use_shunt_udp}" = "1" ] && nft_rule_dual "PSW_MANGLE_V6" "meta l4proto udp ${_ipt_source} $(factor $udp_redir_ports "udp dport") ip6 daddr" "$shunt6_set_name" "counter jump PSW_RULE comment \"$remarks\"" 2>/dev/null
|
||||
[ "${use_shunt_node}" = "1" ] && nft_rule_dual "PSW_MANGLE_V6" "meta l4proto udp ${_ipt_source} $(factor $udp_redir_ports "udp dport") ip6 daddr" "$shunt6_set_name" "counter jump PSW_RULE comment \"$remarks\"" 2>/dev/null
|
||||
[ "${udp_proxy_mode}" != "disable" ] && nft "add rule $NFTABLE_NAME PSW_MANGLE_V6 meta l4proto udp ${_ipt_source} $(factor $udp_redir_ports "udp dport") counter jump PSW_RULE comment \"$remarks\"" 2>/dev/null
|
||||
nft "add rule $NFTABLE_NAME PSW_MANGLE_V6 meta l4proto udp ${_ipt_source} $(REDIRECT $udp_port TPROXY) comment \"$remarks\"" 2>/dev/null
|
||||
}
|
||||
@@ -634,8 +613,8 @@ load_acl() {
|
||||
[ "$_ipv4" != "1" ] && nft "add rule $NFTABLE_NAME PSW_MANGLE_V6 meta l4proto udp ${_ipt_source} counter return comment \"$remarks\"" 2>/dev/null
|
||||
unset nft_chain nft_j _ipt_source msg msg2 _ipv4
|
||||
done
|
||||
unset enabled sid remarks sources use_global_config use_direct_list use_proxy_list use_block_list use_gfw_list chn_list tcp_proxy_mode udp_proxy_mode dns_redirect_port tcp_no_redir_ports udp_no_redir_ports tcp_proxy_drop_ports udp_proxy_drop_ports tcp_redir_ports udp_redir_ports tcp_node udp_node interface
|
||||
unset tcp_port udp_port tcp_node_remark udp_node_remark _acl_list use_shunt_tcp use_shunt_udp dns_redirect use_fakedns
|
||||
unset enabled sid remarks sources use_global_config use_direct_list use_proxy_list use_block_list use_gfw_list chn_list tcp_proxy_mode udp_proxy_mode dns_redirect_port tcp_no_redir_ports udp_no_redir_ports tcp_proxy_drop_ports udp_proxy_drop_ports tcp_redir_ports udp_redir_ports node interface
|
||||
unset tcp_port udp_port node_remark _acl_list use_shunt_node dns_redirect use_fakedns
|
||||
done
|
||||
}
|
||||
|
||||
@@ -665,7 +644,7 @@ load_acl() {
|
||||
|
||||
local DNS_REDIRECT
|
||||
[ $(config_t_get global dns_redirect "1") = "1" ] && DNS_REDIRECT=53
|
||||
if ([ -n "$TCP_NODE" ] && [ -n "${TCP_PROXY_MODE}" ]) || ([ -n "$UDP_NODE" ] && [ -n "${UDP_PROXY_MODE}" ]); then
|
||||
if [ -n "$NODE" ] && ([ -n "${TCP_PROXY_MODE}" ] || [ -n "${UDP_PROXY_MODE}" ]); then
|
||||
[ -n "${DNS_REDIRECT_PORT}" ] && DNS_REDIRECT=${DNS_REDIRECT_PORT}
|
||||
else
|
||||
[ -n "${DIRECT_DNSMASQ_PORT}" ] && DNS_REDIRECT=${DIRECT_DNSMASQ_PORT}
|
||||
@@ -698,7 +677,7 @@ load_acl() {
|
||||
[ "${USE_PROXY_LIST}" = "1" ] && nft_rule_dual "PSW_MANGLE_V6" "meta l4proto tcp $(factor $TCP_PROXY_DROP_PORTS "tcp dport") ip6 daddr" "$NFTSET_BLACK6" "counter reject comment \"默认\""
|
||||
[ "${USE_GFW_LIST}" = "1" ] && nft "add rule $NFTABLE_NAME PSW_MANGLE_V6 meta l4proto tcp $(factor $TCP_PROXY_DROP_PORTS "tcp dport") ip6 daddr @$NFTSET_GFW6 counter reject comment \"默认\""
|
||||
[ "${CHN_LIST}" != "0" ] && nft_rule_dual "PSW_MANGLE_V6" "meta l4proto tcp $(factor $TCP_PROXY_DROP_PORTS "tcp dport") ip6 daddr" "$NFTSET_CHN6" "$(get_jump_nft ${CHN_LIST} "counter reject") comment \"默认\""
|
||||
[ "${USE_SHUNT_TCP}" = "1" ] && nft_rule_dual "PSW_MANGLE_V6" "meta l4proto tcp $(factor $TCP_PROXY_DROP_PORTS "tcp dport") ip6 daddr" "$NFTSET_SHUNT6" "counter reject comment \"默认\""
|
||||
[ "${USE_SHUNT_NODE}" = "1" ] && nft_rule_dual "PSW_MANGLE_V6" "meta l4proto tcp $(factor $TCP_PROXY_DROP_PORTS "tcp dport") ip6 daddr" "$NFTSET_SHUNT6" "counter reject comment \"默认\""
|
||||
[ "${TCP_PROXY_MODE}" != "disable" ] && nft "add rule $NFTABLE_NAME PSW_MANGLE_V6 meta l4proto tcp $(factor $TCP_PROXY_DROP_PORTS "tcp dport") counter reject comment \"默认\""
|
||||
}
|
||||
|
||||
@@ -706,7 +685,7 @@ load_acl() {
|
||||
[ "${USE_PROXY_LIST}" = "1" ] && nft_rule_dual "$nft_prerouting_chain" "ip protocol tcp $(factor $TCP_PROXY_DROP_PORTS "tcp dport") ip daddr" "$NFTSET_BLACK" "counter reject comment \"默认\""
|
||||
[ "${USE_GFW_LIST}" = "1" ] && nft "add rule $NFTABLE_NAME $nft_prerouting_chain ip protocol tcp $(factor $TCP_PROXY_DROP_PORTS "tcp dport") ip daddr @$NFTSET_GFW counter reject comment \"默认\""
|
||||
[ "${CHN_LIST}" != "0" ] && nft_rule_dual "$nft_prerouting_chain" "ip protocol tcp $(factor $TCP_PROXY_DROP_PORTS "tcp dport") ip daddr" "$NFTSET_CHN" "$(get_jump_nft ${CHN_LIST} "counter reject") comment \"默认\""
|
||||
[ "${USE_SHUNT_TCP}" = "1" ] && nft_rule_dual "$nft_prerouting_chain" "ip protocol tcp $(factor $TCP_PROXY_DROP_PORTS "tcp dport") ip daddr" "$NFTSET_SHUNT" "counter reject comment \"默认\""
|
||||
[ "${USE_SHUNT_NODE}" = "1" ] && nft_rule_dual "$nft_prerouting_chain" "ip protocol tcp $(factor $TCP_PROXY_DROP_PORTS "tcp dport") ip daddr" "$NFTSET_SHUNT" "counter reject comment \"默认\""
|
||||
[ "${TCP_PROXY_MODE}" != "disable" ] && nft "add rule $NFTABLE_NAME $nft_prerouting_chain ip protocol tcp $(factor $TCP_PROXY_DROP_PORTS "tcp dport") counter reject comment \"默认\""
|
||||
echolog " - ${msg}屏蔽代理 TCP 端口[${TCP_PROXY_DROP_PORTS}]"
|
||||
}
|
||||
@@ -717,14 +696,14 @@ load_acl() {
|
||||
[ "${USE_PROXY_LIST}" = "1" ] && nft_rule_dual "PSW_MANGLE_V6" "meta l4proto udp $(factor $UDP_PROXY_DROP_PORTS "udp dport") ip6 daddr" "$NFTSET_BLACK6" "counter reject comment \"默认\""
|
||||
[ "${USE_GFW_LIST}" = "1" ] && nft "add rule $NFTABLE_NAME PSW_MANGLE_V6 meta l4proto udp $(factor $UDP_PROXY_DROP_PORTS "udp dport") ip6 daddr @$NFTSET_GFW6 counter reject comment \"默认\""
|
||||
[ "${CHN_LIST}" != "0" ] && nft_rule_dual "PSW_MANGLE_V6" "meta l4proto udp $(factor $UDP_PROXY_DROP_PORTS "udp dport") ip6 daddr" "$NFTSET_CHN6" "$(get_jump_nft ${CHN_LIST} "counter reject") comment \"默认\""
|
||||
[ "${USE_SHUNT_UDP}" = "1" ] && nft_rule_dual "PSW_MANGLE_V6" "meta l4proto udp $(factor $UDP_PROXY_DROP_PORTS "udp dport") ip6 daddr" "$NFTSET_SHUNT6" "counter reject comment \"默认\""
|
||||
[ "${USE_SHUNT_NODE}" = "1" ] && nft_rule_dual "PSW_MANGLE_V6" "meta l4proto udp $(factor $UDP_PROXY_DROP_PORTS "udp dport") ip6 daddr" "$NFTSET_SHUNT6" "counter reject comment \"默认\""
|
||||
[ "${UDP_PROXY_MODE}" != "disable" ] && nft "add rule $NFTABLE_NAME PSW_MANGLE_V6 meta l4proto udp $(factor $UDP_PROXY_DROP_PORTS "udp dport") counter reject comment \"默认\""
|
||||
}
|
||||
[ "${USE_FAKEDNS}" = "1" ] && nft "add rule $NFTABLE_NAME PSW_MANGLE ip protocol udp $(factor $UDP_PROXY_DROP_PORTS "udp dport") ip daddr $FAKE_IP counter reject comment \"默认\""
|
||||
[ "${USE_PROXY_LIST}" = "1" ] && nft_rule_dual "PSW_MANGLE" "ip protocol udp $(factor $UDP_PROXY_DROP_PORTS "udp dport") ip daddr" "$NFTSET_BLACK" "counter reject comment \"默认\""
|
||||
[ "${USE_GFW_LIST}" = "1" ] && nft "add rule $NFTABLE_NAME PSW_MANGLE ip protocol udp $(factor $UDP_PROXY_DROP_PORTS "udp dport") ip daddr @$NFTSET_GFW counter reject comment \"默认\""
|
||||
[ "${CHN_LIST}" != "0" ] && nft_rule_dual "PSW_MANGLE" "ip protocol udp $(factor $UDP_PROXY_DROP_PORTS "udp dport") ip daddr" "$NFTSET_CHN" "$(get_jump_nft ${CHN_LIST} "counter reject") comment \"默认\""
|
||||
[ "${USE_SHUNT_UDP}" = "1" ] && nft_rule_dual "PSW_MANGLE" "ip protocol udp $(factor $UDP_PROXY_DROP_PORTS "udp dport") ip daddr" "$NFTSET_SHUNT" "counter reject comment \"默认\""
|
||||
[ "${USE_SHUNT_NODE}" = "1" ] && nft_rule_dual "PSW_MANGLE" "ip protocol udp $(factor $UDP_PROXY_DROP_PORTS "udp dport") ip daddr" "$NFTSET_SHUNT" "counter reject comment \"默认\""
|
||||
[ "${UDP_PROXY_MODE}" != "disable" ] && nft "add rule $NFTABLE_NAME PSW_MANGLE ip protocol udp $(factor $UDP_PROXY_DROP_PORTS "udp dport") counter reject comment \"默认\""
|
||||
echolog " - ${msg}屏蔽代理 UDP 端口[${UDP_PROXY_DROP_PORTS}]"
|
||||
}
|
||||
@@ -732,20 +711,20 @@ load_acl() {
|
||||
|
||||
# 加载TCP默认代理模式
|
||||
if [ -n "${TCP_PROXY_MODE}" ]; then
|
||||
[ -n "$TCP_NODE" ] && {
|
||||
if [ "$(config_get_type $TCP_NODE)" = "socks" ]; then
|
||||
msg2="${msg}使用 TCP 节点[Socks 配置($(config_n_get $TCP_NODE port) 端口)]"
|
||||
[ -n "$NODE" ] && {
|
||||
if [ "$(config_get_type $NODE)" = "socks" ]; then
|
||||
msg2="${msg}代理 TCP 使用节点[Socks 配置($(config_n_get $NODE port) 端口)]"
|
||||
else
|
||||
msg2="${msg}使用 TCP 节点[$(config_n_get $TCP_NODE remarks)]"
|
||||
msg2="${msg}代理 TCP 使用节点[$(config_n_get $NODE remarks)]"
|
||||
fi
|
||||
if [ -n "${is_tproxy}" ]; then
|
||||
msg2="${msg2}(TPROXY:${TCP_REDIR_PORT})"
|
||||
msg2="${msg2}(TPROXY:${REDIR_PORT})"
|
||||
nft_chain="PSW_MANGLE"
|
||||
nft_j="counter jump PSW_RULE"
|
||||
else
|
||||
msg2="${msg2}(REDIRECT:${TCP_REDIR_PORT})"
|
||||
msg2="${msg2}(REDIRECT:${REDIR_PORT})"
|
||||
nft_chain="PSW_NAT"
|
||||
nft_j="$(REDIRECT $TCP_REDIR_PORT)"
|
||||
nft_j="$(REDIRECT $REDIR_PORT)"
|
||||
fi
|
||||
|
||||
[ "$accept_icmp" = "1" ] && {
|
||||
@@ -754,7 +733,7 @@ load_acl() {
|
||||
[ "${USE_PROXY_LIST}" = "1" ] && nft_rule_dual "PSW_ICMP_REDIRECT" "ip protocol icmp ip daddr" "$NFTSET_BLACK" "$(REDIRECT) comment \"默认\""
|
||||
[ "${USE_GFW_LIST}" = "1" ] && nft "add rule $NFTABLE_NAME PSW_ICMP_REDIRECT ip protocol icmp ip daddr @$NFTSET_GFW $(REDIRECT) comment \"默认\""
|
||||
[ "${CHN_LIST}" != "0" ] && nft_rule_dual "PSW_ICMP_REDIRECT" "ip protocol icmp ip daddr" "$NFTSET_CHN" "$(get_jump_nft ${CHN_LIST}) comment \"默认\""
|
||||
[ "${USE_SHUNT_TCP}" = "1" ] && nft_rule_dual "PSW_ICMP_REDIRECT" "ip protocol icmp ip daddr" "$NFTSET_SHUNT" "$(REDIRECT) comment \"默认\""
|
||||
[ "${USE_SHUNT_NODE}" = "1" ] && nft_rule_dual "PSW_ICMP_REDIRECT" "ip protocol icmp ip daddr" "$NFTSET_SHUNT" "$(REDIRECT) comment \"默认\""
|
||||
[ "${TCP_PROXY_MODE}" != "disable" ] && nft "add rule $NFTABLE_NAME PSW_ICMP_REDIRECT ip protocol icmp $(REDIRECT) comment \"默认\""
|
||||
nft "add rule $NFTABLE_NAME PSW_ICMP_REDIRECT ip protocol icmp return comment \"默认\""
|
||||
}
|
||||
@@ -765,7 +744,7 @@ load_acl() {
|
||||
[ "${USE_PROXY_LIST}" = "1" ] && nft_rule_dual "PSW_ICMP_REDIRECT" "meta l4proto icmpv6 ip6 daddr" "$NFTSET_BLACK6" "$(REDIRECT) comment \"默认\""
|
||||
[ "${USE_GFW_LIST}" = "1" ] && nft "add rule $NFTABLE_NAME PSW_ICMP_REDIRECT meta l4proto icmpv6 ip6 daddr @$NFTSET_GFW6 $(REDIRECT) comment \"默认\""
|
||||
[ "${CHN_LIST}" != "0" ] && nft_rule_dual "PSW_ICMP_REDIRECT" "meta l4proto icmpv6 ip6 daddr" "$NFTSET_CHN6" "$(get_jump_nft ${CHN_LIST}) comment \"默认\""
|
||||
[ "${USE_SHUNT_TCP}" = "1" ] && nft_rule_dual "PSW_ICMP_REDIRECT" "meta l4proto icmpv6 ip6 daddr" "$NFTSET_SHUNT6" "$(REDIRECT) comment \"默认\""
|
||||
[ "${USE_SHUNT_NODE}" = "1" ] && nft_rule_dual "PSW_ICMP_REDIRECT" "meta l4proto icmpv6 ip6 daddr" "$NFTSET_SHUNT6" "$(REDIRECT) comment \"默认\""
|
||||
[ "${TCP_PROXY_MODE}" != "disable" ] && nft "add rule $NFTABLE_NAME PSW_ICMP_REDIRECT meta l4proto icmpv6 $(REDIRECT) comment \"默认\""
|
||||
nft "add rule $NFTABLE_NAME PSW_ICMP_REDIRECT meta l4proto icmpv6 return comment \"默认\""
|
||||
}
|
||||
@@ -774,9 +753,9 @@ load_acl() {
|
||||
[ "${USE_PROXY_LIST}" = "1" ] && nft_rule_dual "$nft_chain" "ip protocol tcp $(factor $TCP_REDIR_PORTS "tcp dport") ip daddr" "$NFTSET_BLACK" "${nft_j} comment \"默认\""
|
||||
[ "${USE_GFW_LIST}" = "1" ] && nft "add rule $NFTABLE_NAME $nft_chain ip protocol tcp $(factor $TCP_REDIR_PORTS "tcp dport") ip daddr @$NFTSET_GFW ${nft_j} comment \"默认\""
|
||||
[ "${CHN_LIST}" != "0" ] && nft_rule_dual "$nft_chain" "ip protocol tcp $(factor $TCP_REDIR_PORTS "tcp dport") ip daddr" "$NFTSET_CHN" "$(get_jump_nft ${CHN_LIST} "${nft_j}") comment \"默认\""
|
||||
[ "${USE_SHUNT_TCP}" = "1" ] && nft_rule_dual "$nft_chain" "ip protocol tcp $(factor $TCP_REDIR_PORTS "tcp dport") ip daddr" "$NFTSET_SHUNT" "${nft_j} comment \"默认\""
|
||||
[ "${USE_SHUNT_NODE}" = "1" ] && nft_rule_dual "$nft_chain" "ip protocol tcp $(factor $TCP_REDIR_PORTS "tcp dport") ip daddr" "$NFTSET_SHUNT" "${nft_j} comment \"默认\""
|
||||
[ "${TCP_PROXY_MODE}" != "disable" ] && nft "add rule $NFTABLE_NAME $nft_chain ip protocol tcp $(factor $TCP_REDIR_PORTS "tcp dport") ${nft_j} comment \"默认\""
|
||||
[ -n "${is_tproxy}" ] && nft "add rule $NFTABLE_NAME $nft_chain ip protocol tcp $(REDIRECT $TCP_REDIR_PORT TPROXY4) comment \"默认\""
|
||||
[ -n "${is_tproxy}" ] && nft "add rule $NFTABLE_NAME $nft_chain ip protocol tcp $(REDIRECT $REDIR_PORT TPROXY4) comment \"默认\""
|
||||
nft "add rule $NFTABLE_NAME $nft_chain ip protocol tcp counter return comment \"默认\""
|
||||
|
||||
[ "$PROXY_IPV6" = "1" ] && {
|
||||
@@ -784,9 +763,9 @@ load_acl() {
|
||||
[ "${USE_PROXY_LIST}" = "1" ] && nft_rule_dual "PSW_MANGLE_V6" "meta l4proto tcp $(factor $TCP_REDIR_PORTS "tcp dport") ip6 daddr" "$NFTSET_BLACK6" "counter jump PSW_RULE comment \"默认\""
|
||||
[ "${USE_GFW_LIST}" = "1" ] && nft "add rule $NFTABLE_NAME PSW_MANGLE_V6 meta l4proto tcp $(factor $TCP_REDIR_PORTS "tcp dport") ip6 daddr @$NFTSET_GFW6 counter jump PSW_RULE comment \"默认\""
|
||||
[ "${CHN_LIST}" != "0" ] && nft_rule_dual "PSW_MANGLE_V6" "meta l4proto tcp $(factor $TCP_REDIR_PORTS "tcp dport") ip6 daddr" "$NFTSET_CHN6" "$(get_jump_nft ${CHN_LIST} "counter jump PSW_RULE") comment \"默认\""
|
||||
[ "${USE_SHUNT_TCP}" = "1" ] && nft_rule_dual "PSW_MANGLE_V6" "meta l4proto tcp $(factor $TCP_REDIR_PORTS "tcp dport") ip6 daddr" "$NFTSET_SHUNT6" "counter jump PSW_RULE comment \"默认\""
|
||||
[ "${USE_SHUNT_NODE}" = "1" ] && nft_rule_dual "PSW_MANGLE_V6" "meta l4proto tcp $(factor $TCP_REDIR_PORTS "tcp dport") ip6 daddr" "$NFTSET_SHUNT6" "counter jump PSW_RULE comment \"默认\""
|
||||
[ "${TCP_PROXY_MODE}" != "disable" ] && nft "add rule $NFTABLE_NAME PSW_MANGLE_V6 meta l4proto tcp $(factor $TCP_REDIR_PORTS "tcp dport") counter jump PSW_RULE comment \"默认\""
|
||||
nft "add rule $NFTABLE_NAME PSW_MANGLE_V6 meta l4proto tcp $(REDIRECT $TCP_REDIR_PORT TPROXY) comment \"默认\""
|
||||
nft "add rule $NFTABLE_NAME PSW_MANGLE_V6 meta l4proto tcp $(REDIRECT $REDIR_PORT TPROXY) comment \"默认\""
|
||||
nft "add rule $NFTABLE_NAME PSW_MANGLE_V6 meta l4proto tcp counter return comment \"默认\""
|
||||
}
|
||||
|
||||
@@ -796,20 +775,20 @@ load_acl() {
|
||||
|
||||
# 加载UDP默认代理模式
|
||||
if [ -n "${UDP_PROXY_MODE}" ]; then
|
||||
[ -n "$UDP_NODE" ] || [ "$TCP_UDP" = "1" ] && {
|
||||
if [ "$(config_get_type $UDP_NODE)" = "socks" ]; then
|
||||
msg2="${msg}使用 UDP 节点[Socks 配置($(config_n_get $UDP_NODE port) 端口)](TPROXY:${UDP_REDIR_PORT})"
|
||||
[ -n "$NODE" ] && {
|
||||
if [ "$(config_get_type $NODE)" = "socks" ]; then
|
||||
msg2="${msg}代理 UDP 使用节点[Socks 配置($(config_n_get $NODE port) 端口)](TPROXY:${REDIR_PORT})"
|
||||
else
|
||||
msg2="${msg}使用 UDP 节点[$(config_n_get $UDP_NODE remarks)](TPROXY:${UDP_REDIR_PORT})"
|
||||
msg2="${msg}代理 UDP 使用节点[$(config_n_get $NODE remarks)](TPROXY:${REDIR_PORT})"
|
||||
fi
|
||||
|
||||
[ "${USE_FAKEDNS}" = "1" ] && nft "add rule $NFTABLE_NAME PSW_MANGLE ip protocol udp ip daddr $FAKE_IP counter jump PSW_RULE comment \"默认\""
|
||||
[ "${USE_PROXY_LIST}" = "1" ] && nft_rule_dual "PSW_MANGLE" "ip protocol udp $(factor $UDP_REDIR_PORTS "udp dport") ip daddr" "$NFTSET_BLACK" "counter jump PSW_RULE comment \"默认\""
|
||||
[ "${USE_GFW_LIST}" = "1" ] && nft "add rule $NFTABLE_NAME PSW_MANGLE ip protocol udp $(factor $UDP_REDIR_PORTS "udp dport") ip daddr @$NFTSET_GFW counter jump PSW_RULE comment \"默认\""
|
||||
[ "${CHN_LIST}" != "0" ] && nft_rule_dual "PSW_MANGLE" "ip protocol udp $(factor $UDP_REDIR_PORTS "udp dport") ip daddr" "$NFTSET_CHN" "$(get_jump_nft ${CHN_LIST} "counter jump PSW_RULE") comment \"默认\""
|
||||
[ "${USE_SHUNT_UDP}" = "1" ] && nft_rule_dual "PSW_MANGLE" "ip protocol udp $(factor $UDP_REDIR_PORTS "udp dport") ip daddr" "$NFTSET_SHUNT" "counter jump PSW_RULE comment \"默认\""
|
||||
[ "${USE_SHUNT_NODE}" = "1" ] && nft_rule_dual "PSW_MANGLE" "ip protocol udp $(factor $UDP_REDIR_PORTS "udp dport") ip daddr" "$NFTSET_SHUNT" "counter jump PSW_RULE comment \"默认\""
|
||||
[ "${UDP_PROXY_MODE}" != "disable" ] && nft "add rule $NFTABLE_NAME PSW_MANGLE ip protocol udp $(factor $UDP_REDIR_PORTS "udp dport") counter jump PSW_RULE comment \"默认\""
|
||||
nft "add rule $NFTABLE_NAME PSW_MANGLE ip protocol udp $(REDIRECT $UDP_REDIR_PORT TPROXY4) comment \"默认\""
|
||||
nft "add rule $NFTABLE_NAME PSW_MANGLE ip protocol udp $(REDIRECT $REDIR_PORT TPROXY4) comment \"默认\""
|
||||
nft "add rule $NFTABLE_NAME PSW_MANGLE ip protocol udp counter return comment \"默认\""
|
||||
|
||||
[ "$PROXY_IPV6" = "1" ] && {
|
||||
@@ -817,9 +796,9 @@ load_acl() {
|
||||
[ "${USE_PROXY_LIST}" = "1" ] && nft_rule_dual "PSW_MANGLE_V6" "meta l4proto udp $(factor $UDP_REDIR_PORTS "udp dport") ip6 daddr" "$NFTSET_BLACK6" "counter jump PSW_RULE comment \"默认\""
|
||||
[ "${USE_GFW_LIST}" = "1" ] && nft "add rule $NFTABLE_NAME PSW_MANGLE_V6 meta l4proto udp $(factor $UDP_REDIR_PORTS "udp dport") ip6 daddr @$NFTSET_GFW6 counter jump PSW_RULE comment \"默认\""
|
||||
[ "${CHN_LIST}" != "0" ] && nft_rule_dual "PSW_MANGLE_V6" "meta l4proto udp $(factor $UDP_REDIR_PORTS "udp dport") ip6 daddr" "$NFTSET_CHN6" "$(get_jump_nft ${CHN_LIST} "counter jump PSW_RULE") comment \"默认\""
|
||||
[ "${USE_SHUNT_UDP}" = "1" ] && nft_rule_dual "PSW_MANGLE_V6" "meta l4proto udp $(factor $UDP_REDIR_PORTS "udp dport") ip6 daddr" "$NFTSET_SHUNT6" "counter jump PSW_RULE comment \"默认\""
|
||||
[ "${USE_SHUNT_NODE}" = "1" ] && nft_rule_dual "PSW_MANGLE_V6" "meta l4proto udp $(factor $UDP_REDIR_PORTS "udp dport") ip6 daddr" "$NFTSET_SHUNT6" "counter jump PSW_RULE comment \"默认\""
|
||||
[ "${UDP_PROXY_MODE}" != "disable" ] && nft "add rule $NFTABLE_NAME PSW_MANGLE_V6 meta l4proto udp $(factor $UDP_REDIR_PORTS "udp dport") counter jump PSW_RULE comment \"默认\""
|
||||
nft "add rule $NFTABLE_NAME PSW_MANGLE_V6 meta l4proto udp $(REDIRECT $UDP_REDIR_PORT TPROXY) comment \"默认\""
|
||||
nft "add rule $NFTABLE_NAME PSW_MANGLE_V6 meta l4proto udp $(REDIRECT $REDIR_PORT TPROXY) comment \"默认\""
|
||||
nft "add rule $NFTABLE_NAME PSW_MANGLE_V6 meta l4proto udp counter return comment \"默认\""
|
||||
}
|
||||
|
||||
@@ -1013,18 +992,14 @@ add_firewall_rule() {
|
||||
gen_nftset $NFTSET_SHUNT6_STATIC ipv6_addr 0
|
||||
|
||||
#导入规则列表、分流规则中的IP列表
|
||||
local USE_SHUNT_NODE=0
|
||||
local USE_PROXY_LIST_ALL=${USE_PROXY_LIST}
|
||||
local USE_DIRECT_LIST_ALL=${USE_DIRECT_LIST}
|
||||
local USE_BLOCK_LIST_ALL=${USE_BLOCK_LIST}
|
||||
local _TCP_NODE=$(config_t_get global tcp_node)
|
||||
local _UDP_NODE=$(config_t_get global udp_node)
|
||||
USE_SHUNT_NODE=0
|
||||
USE_GEOVIEW=$(config_t_get global_rules enable_geoview)
|
||||
[ -z "$(first_type $(config_t_get global_app geoview_file) geoview)" ] && USE_GEOVIEW=0
|
||||
|
||||
[ -n "$_TCP_NODE" ] && [ "$(config_n_get $_TCP_NODE protocol)" = "_shunt" ] && USE_SHUNT_TCP=1 && USE_SHUNT_NODE=1
|
||||
[ -n "$_UDP_NODE" ] && [ "$(config_n_get $_UDP_NODE protocol)" = "_shunt" ] && USE_SHUNT_UDP=1 && USE_SHUNT_NODE=1
|
||||
[ "$_UDP_NODE" = "tcp" ] && USE_SHUNT_UDP=$USE_SHUNT_TCP
|
||||
[ -n "$NODE" ] && [ "$(config_n_get $NODE protocol)" = "_shunt" ] && USE_SHUNT_NODE=1
|
||||
|
||||
for acl_section in $(uci show ${CONFIG} | grep "=acl_rule" | cut -d '.' -sf 2 | cut -d '=' -sf 1); do
|
||||
[ "$(config_n_get $acl_section enabled)" != "1" ] && continue
|
||||
@@ -1033,10 +1008,6 @@ add_firewall_rule() {
|
||||
[ "$(config_n_get $acl_section use_proxy_list 1)" = "1" ] && USE_DIRECT_LIST_ALL=1
|
||||
[ "$(config_n_get $acl_section use_block_list 1)" = "1" ] && USE_BLOCK_LIST_ALL=1
|
||||
}
|
||||
for _node in $(config_n_get $acl_section tcp_node) $(config_n_get $acl_section udp_node); do
|
||||
local node_protocol=$(config_n_get $_node protocol)
|
||||
[ "$node_protocol" = "_shunt" ] && { USE_SHUNT_NODE=1; break; }
|
||||
done
|
||||
done
|
||||
|
||||
#直连列表
|
||||
@@ -1085,12 +1056,8 @@ add_firewall_rule() {
|
||||
[ "$USE_SHUNT_NODE" = "1" ] && {
|
||||
local GEOIP_CODE=""
|
||||
local shunt_ids=$(uci show $CONFIG | grep "=shunt_rules" | awk -F '.' '{print $2}' | awk -F '=' '{print $1}')
|
||||
local shunt_group shunt_id
|
||||
if [ "${USE_SHUNT_TCP}" = "1" ]; then
|
||||
shunt_group=$(config_n_get $_TCP_NODE shunt_group)
|
||||
elif [ "${USE_SHUNT_UDP}" = "1" ]; then
|
||||
shunt_group=$(config_n_get $_UDP_NODE shunt_group)
|
||||
fi
|
||||
local shunt_group=$(config_n_get $NODE shunt_group)
|
||||
local shunt_id
|
||||
for shunt_id in $shunt_ids; do
|
||||
[ "${shunt_group}" != "$(config_n_get ${shunt_id} group)" ] && continue
|
||||
config_n_get $shunt_id ip_list | sed 's/#.*//' | grep -E "(\.((2(5[0-5]|[0-4][0-9]))|[0-1]?[0-9]{1,2})){3}" | insert_nftset $NFTSET_SHUNT_STATIC
|
||||
@@ -1145,8 +1112,7 @@ add_firewall_rule() {
|
||||
filter_vpsip > /dev/null 2>&1 &
|
||||
# filter_haproxy > /dev/null 2>&1 &
|
||||
# Prevent some conditions
|
||||
filter_vps_addr $(config_n_get $TCP_NODE address) $(config_n_get $UDP_NODE address) > /dev/null 2>&1 &
|
||||
filter_vps_addr $(config_n_get $TCP_NODE download_address) $(config_n_get $UDP_NODE download_address) > /dev/null 2>&1 &
|
||||
filter_vps_addr $(config_n_get $NODE address) $(config_n_get $NODE download_address) > /dev/null 2>&1 &
|
||||
|
||||
accept_icmp=$(config_t_get global_forwarding accept_icmp 0)
|
||||
accept_icmpv6=$(config_t_get global_forwarding accept_icmpv6 0)
|
||||
@@ -1291,8 +1257,6 @@ add_firewall_rule() {
|
||||
ip -6 route add local ::/0 dev lo table 999
|
||||
}
|
||||
|
||||
[ "$TCP_UDP" = "1" ] && [ -z "$UDP_NODE" ] && UDP_NODE=$TCP_NODE
|
||||
|
||||
[ "$ENABLED_DEFAULT_ACL" = 1 ] && {
|
||||
msg="【路由器本机】,"
|
||||
|
||||
@@ -1318,7 +1282,7 @@ add_firewall_rule() {
|
||||
fi
|
||||
}
|
||||
|
||||
if ([ -n "$TCP_NODE" ] && [ -n "${LOCALHOST_TCP_PROXY_MODE}" ]) || ([ -n "$UDP_NODE" ] && [ -n "${LOCALHOST_UDP_PROXY_MODE}" ]); then
|
||||
if [ -n "$NODE" ] && ([ -n "${LOCALHOST_TCP_PROXY_MODE}" ] || [ -n "${LOCALHOST_UDP_PROXY_MODE}" ]); then
|
||||
[ -n "$DNS_REDIRECT_PORT" ] && {
|
||||
nft "add rule $NFTABLE_NAME nat_output ip protocol udp oif lo udp dport 53 counter redirect to :$DNS_REDIRECT_PORT comment \"PSW_DNS\""
|
||||
nft "add rule $NFTABLE_NAME nat_output ip protocol tcp oif lo tcp dport 53 counter redirect to :$DNS_REDIRECT_PORT comment \"PSW_DNS\""
|
||||
@@ -1333,7 +1297,7 @@ add_firewall_rule() {
|
||||
[ "${USE_PROXY_LIST}" = "1" ] && nft_rule_dual "$nft_output_chain" "ip protocol tcp ip daddr" "$NFTSET_BLACK" "$(factor $TCP_PROXY_DROP_PORTS "tcp dport") counter reject"
|
||||
[ "${USE_GFW_LIST}" = "1" ] && nft add rule $NFTABLE_NAME $nft_output_chain ip protocol tcp ip daddr @$NFTSET_GFW $(factor $TCP_PROXY_DROP_PORTS "tcp dport") counter reject
|
||||
[ "${CHN_LIST}" != "0" ] && nft_rule_dual "$nft_output_chain" "ip protocol tcp ip daddr" "$NFTSET_CHN" "$(factor $TCP_PROXY_DROP_PORTS "tcp dport") $(get_jump_nft ${CHN_LIST} "counter reject")"
|
||||
[ "${USE_SHUNT_TCP}" = "1" ] && nft_rule_dual "$nft_output_chain" "ip protocol tcp ip daddr" "$NFTSET_SHUNT" "$(factor $TCP_PROXY_DROP_PORTS "tcp dport") counter reject"
|
||||
[ "${USE_SHUNT_NODE}" = "1" ] && nft_rule_dual "$nft_output_chain" "ip protocol tcp ip daddr" "$NFTSET_SHUNT" "$(factor $TCP_PROXY_DROP_PORTS "tcp dport") counter reject"
|
||||
[ "${LOCALHOST_TCP_PROXY_MODE}" != "disable" ] && nft add rule $NFTABLE_NAME $nft_output_chain ip protocol tcp $(factor $TCP_PROXY_DROP_PORTS "tcp dport") counter reject
|
||||
echolog " - ${msg}屏蔽代理 TCP 端口[${TCP_PROXY_DROP_PORTS}]"
|
||||
}
|
||||
@@ -1343,14 +1307,14 @@ add_firewall_rule() {
|
||||
[ "${USE_PROXY_LIST}" = "1" ] && nft_rule_dual "PSW_OUTPUT_MANGLE" "ip protocol udp ip daddr" "$NFTSET_BLACK" "$(factor $UDP_PROXY_DROP_PORTS "udp dport") counter reject"
|
||||
[ "${USE_GFW_LIST}" = "1" ] && nft add rule $NFTABLE_NAME PSW_OUTPUT_MANGLE ip protocol udp ip daddr @$NFTSET_GFW $(factor $UDP_PROXY_DROP_PORTS "udp dport") counter reject
|
||||
[ "${CHN_LIST}" != "0" ] && nft_rule_dual "PSW_OUTPUT_MANGLE" "ip protocol udp ip daddr" "$NFTSET_CHN" "$(factor $UDP_PROXY_DROP_PORTS "udp dport") $(get_jump_nft ${CHN_LIST} "counter reject")"
|
||||
[ "${USE_SHUNT_UDP}" = "1" ] && nft_rule_dual "PSW_OUTPUT_MANGLE" "ip protocol udp ip daddr" "$NFTSET_SHUNT" "$(factor $UDP_PROXY_DROP_PORTS "udp dport") counter reject"
|
||||
[ "${USE_SHUNT_NODE}" = "1" ] && nft_rule_dual "PSW_OUTPUT_MANGLE" "ip protocol udp ip daddr" "$NFTSET_SHUNT" "$(factor $UDP_PROXY_DROP_PORTS "udp dport") counter reject"
|
||||
[ "${LOCALHOST_UDP_PROXY_MODE}" != "disable" ] && nft add rule $NFTABLE_NAME PSW_OUTPUT_MANGLE ip protocol udp $(factor $UDP_PROXY_DROP_PORTS "udp dport") counter reject
|
||||
echolog " - ${msg}屏蔽代理 UDP 端口[${UDP_PROXY_DROP_PORTS}]"
|
||||
}
|
||||
}
|
||||
|
||||
# 加载路由器自身代理 TCP
|
||||
if [ -n "$TCP_NODE" ]; then
|
||||
if [ -n "$NODE" ]; then
|
||||
_proxy_tcp_access() {
|
||||
[ -n "${2}" ] || return 0
|
||||
if echo "${2}" | grep -q -v ':'; then
|
||||
@@ -1360,10 +1324,10 @@ add_firewall_rule() {
|
||||
return 0
|
||||
}
|
||||
if [ -z "${is_tproxy}" ]; then
|
||||
nft insert rule $NFTABLE_NAME PSW_OUTPUT_NAT ip protocol tcp ip daddr ${2} tcp dport ${3} $(REDIRECT $TCP_REDIR_PORT)
|
||||
nft insert rule $NFTABLE_NAME PSW_OUTPUT_NAT ip protocol tcp ip daddr ${2} tcp dport ${3} $(REDIRECT $REDIR_PORT)
|
||||
else
|
||||
nft insert rule $NFTABLE_NAME PSW_OUTPUT_MANGLE ip protocol tcp ip daddr ${2} tcp dport ${3} counter jump PSW_RULE
|
||||
nft insert rule $NFTABLE_NAME PSW_MANGLE ip protocol tcp iif lo tcp dport ${3} ip daddr ${2} $(REDIRECT $TCP_REDIR_PORT TPROXY4) comment \"本机\"
|
||||
nft insert rule $NFTABLE_NAME PSW_MANGLE ip protocol tcp iif lo tcp dport ${3} ip daddr ${2} $(REDIRECT $REDIR_PORT TPROXY4) comment \"本机\"
|
||||
fi
|
||||
echolog " - [$?]将上游 DNS 服务器 ${2}:${3} 加入到路由器自身代理的 TCP 转发链"
|
||||
else
|
||||
@@ -1373,7 +1337,7 @@ add_firewall_rule() {
|
||||
return 0
|
||||
}
|
||||
nft "insert rule $NFTABLE_NAME PSW_OUTPUT_MANGLE_V6 meta l4proto tcp ip6 daddr ${2} tcp dport ${3} counter jump PSW_RULE"
|
||||
nft "insert rule $NFTABLE_NAME PSW_MANGLE_V6 meta l4proto tcp iif lo tcp dport ${3} ip6 daddr ${2} $(REDIRECT $TCP_REDIR_PORT TPROXY6) comment \"本机\""
|
||||
nft "insert rule $NFTABLE_NAME PSW_MANGLE_V6 meta l4proto tcp iif lo tcp dport ${3} ip6 daddr ${2} $(REDIRECT $REDIR_PORT TPROXY6) comment \"本机\""
|
||||
echolog " - [$?]将上游 DNS 服务器 [${2}]:${3} 加入到路由器自身代理的 TCP 转发链,请确保您的节点支持IPv6,并开启IPv6透明代理!"
|
||||
fi
|
||||
}
|
||||
@@ -1384,7 +1348,7 @@ add_firewall_rule() {
|
||||
[ "${USE_PROXY_LIST}" = "1" ] && nft_rule_dual "PSW_ICMP_REDIRECT" "oif lo ip protocol icmp ip daddr" "$NFTSET_BLACK" "counter redirect"
|
||||
[ "${USE_GFW_LIST}" = "1" ] && nft "add rule $NFTABLE_NAME PSW_ICMP_REDIRECT oif lo ip protocol icmp ip daddr @$NFTSET_GFW counter redirect"
|
||||
[ "${CHN_LIST}" != "0" ] && nft_rule_dual "PSW_ICMP_REDIRECT" "oif lo ip protocol icmp ip daddr" "$NFTSET_CHN" "$(get_jump_nft ${CHN_LIST})"
|
||||
[ "${USE_SHUNT_TCP}" = "1" ] && nft_rule_dual "PSW_ICMP_REDIRECT" "oif lo ip protocol icmp ip daddr" "$NFTSET_SHUNT" "counter redirect"
|
||||
[ "${USE_SHUNT_NODE}" = "1" ] && nft_rule_dual "PSW_ICMP_REDIRECT" "oif lo ip protocol icmp ip daddr" "$NFTSET_SHUNT" "counter redirect"
|
||||
[ -n "${LOCALHOST_TCP_PROXY_MODE}" ] && [ "${LOCALHOST_TCP_PROXY_MODE}" != "disable" ] && nft "add rule $NFTABLE_NAME PSW_ICMP_REDIRECT oif lo ip protocol icmp counter redirect"
|
||||
nft "add rule $NFTABLE_NAME PSW_ICMP_REDIRECT oif lo ip protocol icmp counter return"
|
||||
}
|
||||
@@ -1394,7 +1358,7 @@ add_firewall_rule() {
|
||||
[ "${USE_PROXY_LIST}" = "1" ] && nft_rule_dual "PSW_ICMP_REDIRECT" "oif lo meta l4proto icmpv6 ip6 daddr" "$NFTSET_BLACK6" "counter redirect"
|
||||
[ "${USE_GFW_LIST}" = "1" ] && nft "add rule $NFTABLE_NAME PSW_ICMP_REDIRECT oif lo meta l4proto icmpv6 ip6 daddr @$NFTSET_GFW6 counter redirect"
|
||||
[ "${CHN_LIST}" != "0" ] && nft_rule_dual "PSW_ICMP_REDIRECT" "oif lo meta l4proto icmpv6 ip6 daddr" "$NFTSET_CHN6" "$(get_jump_nft ${CHN_LIST})"
|
||||
[ "${USE_SHUNT_TCP}" = "1" ] && nft_rule_dual "PSW_ICMP_REDIRECT" "oif lo meta l4proto icmpv6 ip6 daddr" "$NFTSET_SHUNT6" "counter redirect"
|
||||
[ "${USE_SHUNT_NODE}" = "1" ] && nft_rule_dual "PSW_ICMP_REDIRECT" "oif lo meta l4proto icmpv6 ip6 daddr" "$NFTSET_SHUNT6" "counter redirect"
|
||||
[ -n "${LOCALHOST_TCP_PROXY_MODE}" ] && [ "${LOCALHOST_TCP_PROXY_MODE}" != "disable" ] && nft "add rule $NFTABLE_NAME PSW_ICMP_REDIRECT oif lo meta l4proto icmpv6 counter redirect"
|
||||
nft "add rule $NFTABLE_NAME PSW_ICMP_REDIRECT oif lo meta l4proto icmpv6 counter return"
|
||||
}
|
||||
@@ -1404,7 +1368,7 @@ add_firewall_rule() {
|
||||
nft_j="counter jump PSW_RULE"
|
||||
else
|
||||
nft_chain="PSW_OUTPUT_NAT"
|
||||
nft_j="$(REDIRECT $TCP_REDIR_PORT)"
|
||||
nft_j="$(REDIRECT $REDIR_PORT)"
|
||||
fi
|
||||
|
||||
[ -n "${LOCALHOST_TCP_PROXY_MODE}" ] && {
|
||||
@@ -1412,9 +1376,9 @@ add_firewall_rule() {
|
||||
[ "${USE_PROXY_LIST}" = "1" ] && nft_rule_dual "$nft_chain" "ip protocol tcp ip daddr" "$NFTSET_BLACK" "$(factor $TCP_REDIR_PORTS "tcp dport") ${nft_j}"
|
||||
[ "${USE_GFW_LIST}" = "1" ] && nft "add rule $NFTABLE_NAME $nft_chain ip protocol tcp ip daddr @$NFTSET_GFW $(factor $TCP_REDIR_PORTS "tcp dport") ${nft_j}"
|
||||
[ "${CHN_LIST}" != "0" ] && nft_rule_dual "$nft_chain" "ip protocol tcp ip daddr" "$NFTSET_CHN" "$(factor $TCP_REDIR_PORTS "tcp dport") $(get_jump_nft ${CHN_LIST} "${nft_j}")"
|
||||
[ "${USE_SHUNT_TCP}" = "1" ] && nft_rule_dual "$nft_chain" "ip protocol tcp ip daddr" "$NFTSET_SHUNT" "$(factor $TCP_REDIR_PORTS "tcp dport") ${nft_j}"
|
||||
[ "${USE_SHUNT_NODE}" = "1" ] && nft_rule_dual "$nft_chain" "ip protocol tcp ip daddr" "$NFTSET_SHUNT" "$(factor $TCP_REDIR_PORTS "tcp dport") ${nft_j}"
|
||||
[ "${LOCALHOST_TCP_PROXY_MODE}" != "disable" ] && nft "add rule $NFTABLE_NAME $nft_chain ip protocol tcp $(factor $TCP_REDIR_PORTS "tcp dport") ${nft_j}"
|
||||
[ -n "${is_tproxy}" ] && nft "add rule $NFTABLE_NAME PSW_MANGLE ip protocol tcp iif lo $(REDIRECT $TCP_REDIR_PORT TPROXY4) comment \"本机\""
|
||||
[ -n "${is_tproxy}" ] && nft "add rule $NFTABLE_NAME PSW_MANGLE ip protocol tcp iif lo $(REDIRECT $REDIR_PORT TPROXY4) comment \"本机\""
|
||||
}
|
||||
[ -n "${is_tproxy}" ] && nft "add rule $NFTABLE_NAME PSW_MANGLE ip protocol tcp iif lo counter return comment \"本机\""
|
||||
[ -n "${is_tproxy}" ] && nft "add rule $NFTABLE_NAME mangle_output ip protocol tcp counter jump PSW_OUTPUT_MANGLE comment \"PSW_OUTPUT_MANGLE\""
|
||||
@@ -1426,16 +1390,16 @@ add_firewall_rule() {
|
||||
[ "${USE_PROXY_LIST}" = "1" ] && nft_rule_dual "PSW_OUTPUT_MANGLE_V6" "meta l4proto tcp ip6 daddr" "$NFTSET_BLACK6" "$(factor $TCP_REDIR_PORTS "tcp dport") counter jump PSW_RULE"
|
||||
[ "${USE_GFW_LIST}" = "1" ] && nft "add rule $NFTABLE_NAME PSW_OUTPUT_MANGLE_V6 meta l4proto tcp ip6 daddr @$NFTSET_GFW6 $(factor $TCP_REDIR_PORTS "tcp dport") counter jump PSW_RULE"
|
||||
[ "${CHN_LIST}" != "0" ] && nft_rule_dual "PSW_OUTPUT_MANGLE_V6" "meta l4proto tcp ip6 daddr" "$NFTSET_CHN6" "$(factor $TCP_REDIR_PORTS "tcp dport") $(get_jump_nft ${CHN_LIST} "counter jump PSW_RULE")"
|
||||
[ "${USE_SHUNT_TCP}" = "1" ] && nft_rule_dual "PSW_OUTPUT_MANGLE_V6" "meta l4proto tcp ip6 daddr" "$NFTSET_SHUNT6" "$(factor $TCP_REDIR_PORTS "tcp dport") counter jump PSW_RULE"
|
||||
[ "${USE_SHUNT_NODE}" = "1" ] && nft_rule_dual "PSW_OUTPUT_MANGLE_V6" "meta l4proto tcp ip6 daddr" "$NFTSET_SHUNT6" "$(factor $TCP_REDIR_PORTS "tcp dport") counter jump PSW_RULE"
|
||||
[ "${LOCALHOST_TCP_PROXY_MODE}" != "disable" ] && nft "add rule $NFTABLE_NAME PSW_OUTPUT_MANGLE_V6 meta l4proto tcp $(factor $TCP_REDIR_PORTS "tcp dport") counter jump PSW_RULE"
|
||||
nft "add rule $NFTABLE_NAME PSW_MANGLE_V6 meta l4proto tcp iif lo $(REDIRECT $TCP_REDIR_PORT TPROXY) comment \"本机\""
|
||||
nft "add rule $NFTABLE_NAME PSW_MANGLE_V6 meta l4proto tcp iif lo $(REDIRECT $REDIR_PORT TPROXY) comment \"本机\""
|
||||
}
|
||||
nft "add rule $NFTABLE_NAME PSW_MANGLE_V6 meta l4proto tcp iif lo counter return comment \"本机\""
|
||||
}
|
||||
fi
|
||||
|
||||
# 加载路由器自身代理 UDP
|
||||
if [ -n "$UDP_NODE" ] || [ "$TCP_UDP" = "1" ]; then
|
||||
if [ -n "$NODE" ]; then
|
||||
_proxy_udp_access() {
|
||||
[ -n "${2}" ] || return 0
|
||||
if echo "${2}" | grep -q -v ':'; then
|
||||
@@ -1445,7 +1409,7 @@ add_firewall_rule() {
|
||||
return 0
|
||||
}
|
||||
nft "insert rule $NFTABLE_NAME PSW_OUTPUT_MANGLE ip protocol udp ip daddr ${2} udp dport ${3} counter jump PSW_RULE"
|
||||
nft "insert rule $NFTABLE_NAME PSW_MANGLE ip protocol udp iif lo ip daddr ${2} $(REDIRECT $UDP_REDIR_PORT TPROXY4) comment \"本机\""
|
||||
nft "insert rule $NFTABLE_NAME PSW_MANGLE ip protocol udp iif lo ip daddr ${2} $(REDIRECT $REDIR_PORT TPROXY4) comment \"本机\""
|
||||
echolog " - [$?]将上游 DNS 服务器 ${2}:${3} 加入到路由器自身代理的 UDP 转发链"
|
||||
else
|
||||
nft "get element $NFTABLE_NAME $NFTSET_LAN6 {${2}}" &>/dev/null
|
||||
@@ -1454,7 +1418,7 @@ add_firewall_rule() {
|
||||
return 0
|
||||
}
|
||||
nft "insert rule $NFTABLE_NAME PSW_OUTPUT_MANGLE_V6 meta l4proto udp ip6 daddr ${2} udp dport ${3} counter jump PSW_RULE"
|
||||
nft "insert rule $NFTABLE_NAME PSW_MANGLE_V6 meta l4proto udp iif lo ip6 daddr ${2} $(REDIRECT $UDP_REDIR_PORT TPROXY6) comment \"本机\""
|
||||
nft "insert rule $NFTABLE_NAME PSW_MANGLE_V6 meta l4proto udp iif lo ip6 daddr ${2} $(REDIRECT $REDIR_PORT TPROXY6) comment \"本机\""
|
||||
echolog " - [$?]将上游 DNS 服务器 [${2}]:${3} 加入到路由器自身代理的 UDP 转发链,请确保您的节点支持IPv6,并开启IPv6透明代理!"
|
||||
fi
|
||||
}
|
||||
@@ -1464,9 +1428,9 @@ add_firewall_rule() {
|
||||
[ "${USE_PROXY_LIST}" = "1" ] && nft_rule_dual "PSW_OUTPUT_MANGLE" "ip protocol udp ip daddr" "$NFTSET_BLACK" "$(factor $UDP_REDIR_PORTS "udp dport") counter jump PSW_RULE"
|
||||
[ "${USE_GFW_LIST}" = "1" ] && nft "add rule $NFTABLE_NAME PSW_OUTPUT_MANGLE ip protocol udp ip daddr @$NFTSET_GFW $(factor $UDP_REDIR_PORTS "udp dport") counter jump PSW_RULE"
|
||||
[ "${CHN_LIST}" != "0" ] && nft_rule_dual "PSW_OUTPUT_MANGLE" "ip protocol udp ip daddr" "$NFTSET_CHN" "$(factor $UDP_REDIR_PORTS "udp dport") $(get_jump_nft ${CHN_LIST} "counter jump PSW_RULE")"
|
||||
[ "${USE_SHUNT_UDP}" = "1" ] && nft_rule_dual "PSW_OUTPUT_MANGLE" "ip protocol udp ip daddr" "$NFTSET_SHUNT" "$(factor $UDP_REDIR_PORTS "udp dport") counter jump PSW_RULE"
|
||||
[ "${USE_SHUNT_NODE}" = "1" ] && nft_rule_dual "PSW_OUTPUT_MANGLE" "ip protocol udp ip daddr" "$NFTSET_SHUNT" "$(factor $UDP_REDIR_PORTS "udp dport") counter jump PSW_RULE"
|
||||
[ "${LOCALHOST_UDP_PROXY_MODE}" != "disable" ] && nft "add rule $NFTABLE_NAME PSW_OUTPUT_MANGLE ip protocol udp $(factor $UDP_REDIR_PORTS "udp dport") counter jump PSW_RULE"
|
||||
nft "add rule $NFTABLE_NAME PSW_MANGLE ip protocol udp iif lo $(REDIRECT $UDP_REDIR_PORT TPROXY4) comment \"本机\""
|
||||
nft "add rule $NFTABLE_NAME PSW_MANGLE ip protocol udp iif lo $(REDIRECT $REDIR_PORT TPROXY4) comment \"本机\""
|
||||
}
|
||||
nft "add rule $NFTABLE_NAME PSW_MANGLE ip protocol udp iif lo counter return comment \"本机\""
|
||||
nft "add rule $NFTABLE_NAME mangle_output ip protocol udp counter jump PSW_OUTPUT_MANGLE comment \"PSW_OUTPUT_MANGLE\""
|
||||
@@ -1477,9 +1441,9 @@ add_firewall_rule() {
|
||||
[ "${USE_PROXY_LIST}" = "1" ] && nft_rule_dual "PSW_OUTPUT_MANGLE_V6" "meta l4proto udp ip6 daddr" "$NFTSET_BLACK6" "$(factor $UDP_REDIR_PORTS "udp dport") counter jump PSW_RULE"
|
||||
[ "${USE_GFW_LIST}" = "1" ] && nft "add rule $NFTABLE_NAME PSW_OUTPUT_MANGLE_V6 meta l4proto udp ip6 daddr @$NFTSET_GFW6 $(factor $UDP_REDIR_PORTS "udp dport") counter jump PSW_RULE"
|
||||
[ "${CHN_LIST}" != "0" ] && nft_rule_dual "PSW_OUTPUT_MANGLE_V6" "meta l4proto udp ip6 daddr" "$NFTSET_CHN6" "$(factor $UDP_REDIR_PORTS "udp dport") $(get_jump_nft ${CHN_LIST} "counter jump PSW_RULE")"
|
||||
[ "${USE_SHUNT_UDP}" = "1" ] && nft_rule_dual "PSW_OUTPUT_MANGLE_V6" "meta l4proto udp ip6 daddr" "$NFTSET_SHUNT6" "$(factor $UDP_REDIR_PORTS "udp dport") counter jump PSW_RULE"
|
||||
[ "${USE_SHUNT_NODE}" = "1" ] && nft_rule_dual "PSW_OUTPUT_MANGLE_V6" "meta l4proto udp ip6 daddr" "$NFTSET_SHUNT6" "$(factor $UDP_REDIR_PORTS "udp dport") counter jump PSW_RULE"
|
||||
[ "${LOCALHOST_UDP_PROXY_MODE}" != "disable" ] && nft "add rule $NFTABLE_NAME PSW_OUTPUT_MANGLE_V6 meta l4proto udp $(factor $UDP_REDIR_PORTS "udp dport") counter jump PSW_RULE"
|
||||
nft "add rule $NFTABLE_NAME PSW_MANGLE_V6 meta l4proto udp iif lo $(REDIRECT $UDP_REDIR_PORT TPROXY) comment \"本机\""
|
||||
nft "add rule $NFTABLE_NAME PSW_MANGLE_V6 meta l4proto udp iif lo $(REDIRECT $REDIR_PORT TPROXY) comment \"本机\""
|
||||
}
|
||||
nft "add rule $NFTABLE_NAME PSW_MANGLE_V6 meta l4proto udp iif lo counter return comment \"本机\""
|
||||
}
|
||||
|
||||
@@ -136,15 +136,13 @@ end
|
||||
-- 获取各项动态配置的当前服务器,可以用 get 和 set, get必须要获取到节点表
|
||||
local CONFIG = {}
|
||||
do
|
||||
local function import_config(protocol)
|
||||
local name = string.upper(protocol)
|
||||
if true then
|
||||
local szType = "@global[0]"
|
||||
local option = protocol .. "_node"
|
||||
|
||||
local option = "node"
|
||||
local node_id = uci_get(szType, option)
|
||||
CONFIG[#CONFIG + 1] = {
|
||||
log = true,
|
||||
remarks = name .. "节点",
|
||||
remarks = "全局节点",
|
||||
currentNode = (function(id)
|
||||
local section = id and uci_get(id) or nil
|
||||
if not section then return nil end
|
||||
@@ -159,8 +157,6 @@ do
|
||||
end
|
||||
}
|
||||
end
|
||||
import_config("tcp")
|
||||
import_config("udp")
|
||||
|
||||
if true then
|
||||
local i = 0
|
||||
@@ -255,30 +251,27 @@ do
|
||||
|
||||
if true then
|
||||
local i = 0
|
||||
local options = {"tcp", "udp"}
|
||||
uci_foreach("acl_rule", function(t)
|
||||
i = i + 1
|
||||
for index, value in ipairs(options) do
|
||||
local option = value .. "_node"
|
||||
local node_id = t[option]
|
||||
CONFIG[#CONFIG + 1] = {
|
||||
log = true,
|
||||
id = t[".name"],
|
||||
remarks = "访问控制列表[" .. i .. "]",
|
||||
currentNode = (function(id)
|
||||
local section = id and uci_get(id) or nil
|
||||
if not section then return nil end
|
||||
if section[".type"] == "socks" then
|
||||
return { Socks = id }
|
||||
end
|
||||
return section
|
||||
end)(node_id),
|
||||
set = function(o, server)
|
||||
uci_set(t[".name"], option, server)
|
||||
o.newNodeId = server
|
||||
local option = "node"
|
||||
local node_id = t[option]
|
||||
CONFIG[#CONFIG + 1] = {
|
||||
log = true,
|
||||
id = t[".name"],
|
||||
remarks = "访问控制列表[" .. i .. "]",
|
||||
currentNode = (function(id)
|
||||
local section = id and uci_get(id) or nil
|
||||
if not section then return nil end
|
||||
if section[".type"] == "socks" then
|
||||
return { Socks = id }
|
||||
end
|
||||
}
|
||||
end
|
||||
return section
|
||||
end)(node_id),
|
||||
set = function(o, server)
|
||||
uci_set(t[".name"], option, server)
|
||||
o.newNodeId = server
|
||||
end
|
||||
}
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
@@ -486,20 +486,16 @@ ln_run() {
|
||||
if [ -z "$persist_log_path" ] && [ "$sys_log" != "1" ]; then
|
||||
${file_func:-echolog " - ${ln_name}"} "$@" >${output} 2>&1 &
|
||||
else
|
||||
case "$output" in
|
||||
*TCP.log) local protocol="TCP" ;;
|
||||
*UDP.log) local protocol="UDP" ;;
|
||||
esac
|
||||
if [ -n "${persist_log_path}" ]; then
|
||||
mkdir -p ${persist_log_path}
|
||||
local log_file=${persist_log_path}/passwall_${protocol}_${ln_name}_$(date '+%F').log
|
||||
local log_file=${persist_log_path}/passwall_global_${ln_name}_$(date '+%F').log
|
||||
echolog "记录到持久性日志文件:${log_file}"
|
||||
${file_func:-echolog " - ${ln_name}"} "$@" >> ${log_file} 2>&1 &
|
||||
sys_log=0
|
||||
fi
|
||||
if [ "${sys_log}" = "1" ]; then
|
||||
echolog "记录 ${ln_name}_${protocol} 到系统日志"
|
||||
${file_func:-echolog " - ${ln_name}"} "$@" 2>&1 | logger -t PASSWALL_${protocol}_${ln_name} &
|
||||
echolog "记录 ${ln_name}_global 到系统日志"
|
||||
${file_func:-echolog " - ${ln_name}"} "$@" 2>&1 | logger -t PASSWALL_global_${ln_name} &
|
||||
fi
|
||||
fi
|
||||
[ "$NO_REC_PROCESS" = "1" ] && return
|
||||
|
||||
@@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-passwall2
|
||||
PKG_VERSION:=26.8.20
|
||||
PKG_RELEASE:=94
|
||||
PKG_RELEASE:=98
|
||||
PKG_PO_VERSION:=$(PKG_VERSION)
|
||||
|
||||
PKG_CONFIG_DEPENDS:= \
|
||||
|
||||
@@ -78,10 +78,13 @@
|
||||
const _ASSETS = '/luci-static/passwall2/';
|
||||
const CHECK_IP_URL = '<%=url([[admin]], [[services]], [[passwall2]], [[ip]])%>';
|
||||
|
||||
let mainContent = document.getElementById("maincontent");
|
||||
let statusBar = document.querySelector(".status-bar");
|
||||
|
||||
function resize() {
|
||||
statusBar.style.width = document.getElementById("maincontent").offsetWidth + 'px';
|
||||
wW = window.innerWidth;
|
||||
let lw = document.querySelector(".main-left, :root[data-layout='sidebar'] .fs-sidebar")?.offsetWidth ?? 5;
|
||||
statusBar.style.width = (wW - lw) + 'px';
|
||||
let flagElement = statusBar.querySelector(".flag");
|
||||
flagElement.style.width = (flagElement.offsetHeight / 3 * 4) + 'px';
|
||||
|
||||
@@ -125,5 +128,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
});
|
||||
|
||||
window.addEventListener('resize', resize);
|
||||
if (mainContent && window.getComputedStyle(mainContent).getPropertyValue("contain")=== "paint") {
|
||||
document.body.appendChild(statusBar);
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -4,7 +4,7 @@ LUCI_TITLE:=luci-app-ssr-plus
|
||||
LUCI_PKGARCH:=all
|
||||
PKG_NAME:=luci-app-ssr-plus
|
||||
PKG_VERSION:=196
|
||||
PKG_RELEASE:=61
|
||||
PKG_RELEASE:=65
|
||||
|
||||
PKG_CONFIG_DEPENDS:= \
|
||||
CONFIG_PACKAGE_$(PKG_NAME)_Iptables_Transparent_Proxy \
|
||||
|
||||
@@ -78,10 +78,13 @@
|
||||
const _ASSETS = '/luci-static/shadowsocksr/';
|
||||
const CHECK_IP_URL = '<%=url([[admin]], [[services]], [[shadowsocksr]], [[ip]])%>';
|
||||
|
||||
let mainContent = document.getElementById("maincontent");
|
||||
let statusBar = document.querySelector(".status-bar");
|
||||
|
||||
function resize() {
|
||||
statusBar.style.width = document.getElementById("maincontent").offsetWidth + 'px';
|
||||
wW = window.innerWidth;
|
||||
let lw = document.querySelector(".main-left, :root[data-layout='sidebar'] .fs-sidebar")?.offsetWidth ?? 5;
|
||||
statusBar.style.width = (wW - lw) + 'px';
|
||||
let flagElement = statusBar.querySelector(".flag");
|
||||
flagElement.style.width = (flagElement.offsetHeight / 3 * 4) + 'px';
|
||||
|
||||
@@ -125,5 +128,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
});
|
||||
|
||||
window.addEventListener('resize', resize);
|
||||
if (mainContent && window.getComputedStyle(mainContent).getPropertyValue("contain")=== "paint") {
|
||||
document.body.appendChild(statusBar);
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -17,7 +17,7 @@ LUCI_NAME:=luci-theme-footstrap
|
||||
FOOTSTRAP_VERSION?=
|
||||
ifneq ($(FOOTSTRAP_VERSION),)
|
||||
PKG_VERSION:=$(FOOTSTRAP_VERSION)
|
||||
PKG_RELEASE:=32
|
||||
PKG_RELEASE:=33
|
||||
endif
|
||||
|
||||
LUCI_TITLE:=Footstrap Theme
|
||||
|
||||
@@ -4,3 +4,4 @@ config footstrap 'settings'
|
||||
option darkmode 'dark'
|
||||
option wallpaper 'pattern'
|
||||
option layout 'sidebar'
|
||||
option palette 'bootstrap'
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=mosdns
|
||||
PKG_VERSION:=5.3.4
|
||||
PKG_RELEASE:=15
|
||||
PKG_RELEASE:=16
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://codeload.github.com/IrineSistiana/mosdns/tar.gz/v$(PKG_VERSION)?
|
||||
|
||||
@@ -0,0 +1,227 @@
|
||||
From 819415303eb05bdf5b6dadf119f947645c9062cc Mon Sep 17 00:00:00 2001
|
||||
From: sbwml <admin@cooluc.com>
|
||||
Date: Sat, 22 Aug 2026 22:56:30 +0800
|
||||
Subject: [PATCH] feat(cache): add proactive prefetch support
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
plugins:
|
||||
- tag: lazy_cache
|
||||
type: cache
|
||||
args:
|
||||
size: 1024
|
||||
# 开启预读功能 (默认为 false)
|
||||
prefetch: true
|
||||
# 在 TTL 还剩 10 秒时尝试预读 (默认为 10)
|
||||
prefetch_before_expire: 10
|
||||
# 至少被命中 2 次才触发预读 (默认为 3)
|
||||
prefetch_min_hits: 2
|
||||
# 后台扫描周期,每 3 秒扫描一次 (默认为 5)
|
||||
prefetch_scan_interval: 3
|
||||
|
||||
Signed-off-by: sbwml <admin@cooluc.com>
|
||||
---
|
||||
plugin/executable/cache/cache.go | 113 +++++++++++++++++++++++++++++--
|
||||
plugin/executable/cache/utils.go | 2 +
|
||||
2 files changed, 110 insertions(+), 5 deletions(-)
|
||||
|
||||
--- a/plugin/executable/cache/cache.go
|
||||
+++ b/plugin/executable/cache/cache.go
|
||||
@@ -27,6 +27,7 @@ import (
|
||||
"io"
|
||||
"net/http"
|
||||
"os"
|
||||
+ "reflect"
|
||||
"strconv"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
@@ -69,15 +70,22 @@ const (
|
||||
var _ sequence.RecursiveExecutable = (*Cache)(nil)
|
||||
|
||||
type Args struct {
|
||||
- Size int `yaml:"size"`
|
||||
- LazyCacheTTL int `yaml:"lazy_cache_ttl"`
|
||||
- DumpFile string `yaml:"dump_file"`
|
||||
- DumpInterval int `yaml:"dump_interval"`
|
||||
+ Size int `yaml:"size"`
|
||||
+ LazyCacheTTL int `yaml:"lazy_cache_ttl"`
|
||||
+ DumpFile string `yaml:"dump_file"`
|
||||
+ DumpInterval int `yaml:"dump_interval"`
|
||||
+ Prefetch bool `yaml:"prefetch"`
|
||||
+ PrefetchBeforeExpire int `yaml:"prefetch_before_expire"`
|
||||
+ PrefetchMinHits int `yaml:"prefetch_min_hits"`
|
||||
+ PrefetchScanInterval int `yaml:"prefetch_scan_interval"`
|
||||
}
|
||||
|
||||
func (a *Args) init() {
|
||||
utils.SetDefaultUnsignNum(&a.Size, 1024)
|
||||
utils.SetDefaultUnsignNum(&a.DumpInterval, 600)
|
||||
+ utils.SetDefaultUnsignNum(&a.PrefetchBeforeExpire, 10)
|
||||
+ utils.SetDefaultUnsignNum(&a.PrefetchMinHits, 3)
|
||||
+ utils.SetDefaultUnsignNum(&a.PrefetchScanInterval, 5)
|
||||
}
|
||||
|
||||
type Cache struct {
|
||||
@@ -94,6 +102,11 @@ type Cache struct {
|
||||
hitTotal prometheus.Counter
|
||||
lazyHitTotal prometheus.Counter
|
||||
size prometheus.GaugeFunc
|
||||
+
|
||||
+ prefetchTotal prometheus.Counter
|
||||
+ prefetchFailTotal prometheus.Counter
|
||||
+ capturedNext *sequence.ChainWalker
|
||||
+ captureOnce sync.Once
|
||||
}
|
||||
|
||||
func Init(bp *coremain.BP, args any) (any, error) {
|
||||
@@ -160,6 +173,16 @@ func NewCache(args *Args, opts Opts) *Ca
|
||||
Help: "The total number of queries that hit the expired cache",
|
||||
ConstLabels: lb,
|
||||
}),
|
||||
+ prefetchTotal: prometheus.NewCounter(prometheus.CounterOpts{
|
||||
+ Name: "prefetch_total",
|
||||
+ Help: "The total number of successful proactive prefetch operations",
|
||||
+ ConstLabels: lb,
|
||||
+ }),
|
||||
+ prefetchFailTotal: prometheus.NewCounter(prometheus.CounterOpts{
|
||||
+ Name: "prefetch_fail_total",
|
||||
+ Help: "The total number of failed proactive prefetch operations",
|
||||
+ ConstLabels: lb,
|
||||
+ }),
|
||||
size: prometheus.NewGaugeFunc(prometheus.GaugeOpts{
|
||||
Name: "size_current",
|
||||
Help: "Current cache size in records",
|
||||
@@ -173,12 +196,15 @@ func NewCache(args *Args, opts Opts) *Ca
|
||||
p.logger.Error("failed to load cache dump", zap.Error(err))
|
||||
}
|
||||
p.startDumpLoop()
|
||||
+ if p.args.Prefetch {
|
||||
+ p.startPrefetchLoop()
|
||||
+ }
|
||||
|
||||
return p
|
||||
}
|
||||
|
||||
func (c *Cache) RegMetricsTo(r prometheus.Registerer) error {
|
||||
- for _, collector := range [...]prometheus.Collector{c.queryTotal, c.hitTotal, c.lazyHitTotal, c.size} {
|
||||
+ for _, collector := range [...]prometheus.Collector{c.queryTotal, c.hitTotal, c.lazyHitTotal, c.prefetchTotal, c.prefetchFailTotal, c.size} {
|
||||
if err := r.Register(collector); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -187,6 +213,15 @@ func (c *Cache) RegMetricsTo(r prometheu
|
||||
}
|
||||
|
||||
func (c *Cache) Exec(ctx context.Context, qCtx *query_context.Context, next sequence.ChainWalker) error {
|
||||
+ c.captureOnce.Do(func() {
|
||||
+ // This implementation assumes the cache plugin is invoked from a single fixed position in the sequence.
|
||||
+ nextCopy := next
|
||||
+ c.capturedNext = &nextCopy
|
||||
+ })
|
||||
+ if c.capturedNext != nil && !reflect.DeepEqual(next, *c.capturedNext) {
|
||||
+ c.logger.Warn("cache plugin Exec called with a different next chain than first time")
|
||||
+ }
|
||||
+
|
||||
c.queryTotal.Inc()
|
||||
q := qCtx.Q()
|
||||
|
||||
@@ -205,6 +240,7 @@ func (c *Cache) Exec(ctx context.Context
|
||||
cachedResp.Id = q.Id // change msg id
|
||||
qCtx.SetResponse(cachedResp)
|
||||
if v, _, ok := c.backend.Get(key(msgKey)); ok && v != nil {
|
||||
+ v.hitCount.Add(1)
|
||||
ttl := int(v.expirationTime.Sub(v.storedTime).Seconds())
|
||||
remainingTtl := int(v.expirationTime.Sub(time.Now()).Seconds())
|
||||
if remainingTtl < 0 {
|
||||
@@ -255,6 +291,73 @@ func (c *Cache) doLazyUpdate(msgKey stri
|
||||
c.lazyUpdateSF.DoChan(msgKey, lazyUpdateFunc) // DoChan won't block this goroutine
|
||||
}
|
||||
|
||||
+func (c *Cache) startPrefetchLoop() {
|
||||
+ go func() {
|
||||
+ ticker := time.NewTicker(time.Duration(c.args.PrefetchScanInterval) * time.Second)
|
||||
+ defer ticker.Stop()
|
||||
+ for {
|
||||
+ select {
|
||||
+ case <-ticker.C:
|
||||
+ if c.capturedNext == nil {
|
||||
+ continue
|
||||
+ }
|
||||
+ now := time.Now()
|
||||
+ _ = c.backend.Range(func(k key, v *item, cacheExpirationTime time.Time) error {
|
||||
+ remainingTTL := int(v.expirationTime.Sub(now).Seconds())
|
||||
+ if remainingTTL >= 0 && remainingTTL < c.args.PrefetchBeforeExpire && v.hitCount.Load() >= uint32(c.args.PrefetchMinHits) {
|
||||
+ c.doPrefetch(string(k), v, remainingTTL)
|
||||
+ }
|
||||
+ return nil
|
||||
+ })
|
||||
+ case <-c.closeNotify:
|
||||
+ return
|
||||
+ }
|
||||
+ }
|
||||
+ }()
|
||||
+}
|
||||
+
|
||||
+func (c *Cache) doPrefetch(msgKey string, v *item, remainingTTL int) {
|
||||
+ prefetchFunc := func() (any, error) {
|
||||
+ defer c.lazyUpdateSF.Forget(msgKey)
|
||||
+
|
||||
+ req := new(dns.Msg)
|
||||
+ req.SetQuestion(v.resp.Question[0].Name, v.resp.Question[0].Qtype)
|
||||
+ req.Id = dns.Id()
|
||||
+ req.RecursionDesired = true
|
||||
+ newQCtx := query_context.NewContext(req)
|
||||
+
|
||||
+ qname := v.resp.Question[0].Name
|
||||
+ hitCount := v.hitCount.Load()
|
||||
+
|
||||
+ c.logger.Debug("start proactive prefetch",
|
||||
+ zap.String("qname", qname),
|
||||
+ zap.Uint32("hit_count", hitCount),
|
||||
+ zap.Int("remaining_ttl", remainingTTL),
|
||||
+ )
|
||||
+ ctx, cancel := context.WithTimeout(context.Background(), defaultLazyUpdateTimeout)
|
||||
+ defer cancel()
|
||||
+
|
||||
+ err := c.capturedNext.ExecNext(ctx, newQCtx)
|
||||
+ if err != nil {
|
||||
+ c.logger.Warn("failed to proactive prefetch", zap.String("qname", qname), zap.Error(err))
|
||||
+ c.prefetchFailTotal.Inc()
|
||||
+ return nil, err
|
||||
+ }
|
||||
+
|
||||
+ r := newQCtx.R()
|
||||
+ if r != nil {
|
||||
+ if saveRespToCache(msgKey, r, c.backend, c.args.LazyCacheTTL) {
|
||||
+ v.hitCount.Store(0)
|
||||
+ c.prefetchTotal.Inc()
|
||||
+ c.updatedKey.Add(1)
|
||||
+ }
|
||||
+ }
|
||||
+ c.logger.Debug("proactive prefetch updated", zap.String("qname", qname), newQCtx.InfoField())
|
||||
+ return nil, nil
|
||||
+ }
|
||||
+ c.lazyUpdateSF.DoChan(msgKey, prefetchFunc)
|
||||
+}
|
||||
+
|
||||
func (c *Cache) Close() error {
|
||||
if err := c.dumpCache(); err != nil {
|
||||
c.logger.Error("failed to dump cache", zap.Error(err))
|
||||
--- a/plugin/executable/cache/utils.go
|
||||
+++ b/plugin/executable/cache/utils.go
|
||||
@@ -21,6 +21,7 @@ package cache
|
||||
|
||||
import (
|
||||
"hash/maphash"
|
||||
+ "sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/IrineSistiana/mosdns/v5/pkg/cache"
|
||||
@@ -78,6 +79,7 @@ type item struct {
|
||||
resp *dns.Msg
|
||||
storedTime time.Time
|
||||
expirationTime time.Time
|
||||
+ hitCount atomic.Uint32
|
||||
}
|
||||
|
||||
func copyNoOpt(m *dns.Msg) *dns.Msg {
|
||||
@@ -10,7 +10,7 @@ include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=my-default-settings
|
||||
PKG_VERSION:=2
|
||||
PKG_RELEASE:=7
|
||||
PKG_RELEASE:=8
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ fi
|
||||
|
||||
if [ -z "$version" ] || [ "$version" -lt 1 ]; then
|
||||
uci -q set luci.main.lang='auto'
|
||||
uci -q set luci.main.mediaurlbase=/luci-static/argon
|
||||
uci -q set luci.main.mediaurlbase=/luci-static/footstrap
|
||||
uci commit luci
|
||||
|
||||
if uci -q get system.@system[0] >/dev/null; then
|
||||
|
||||
+2
-2
@@ -30,11 +30,11 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=wwand
|
||||
PKG_RELEASE:=6
|
||||
PKG_RELEASE:=7
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/ddimension/wwand.git
|
||||
PKG_SOURCE_VERSION:=57196fbe92f8d6fa18a3c3e4e8269c54328f2ffe
|
||||
PKG_SOURCE_VERSION:=4035709733ab3d10db5b205aa18d9263216db15e
|
||||
PKG_SOURCE_DATE:=2026-08-21
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
|
||||
Reference in New Issue
Block a user