mirror of
https://github.com/kenzok8/small-package.git
synced 2026-02-07 07:18:00 +08:00
update 2025-05-28 20:45:31
This commit is contained in:
@@ -568,7 +568,7 @@ return view.extend({
|
||||
}
|
||||
|
||||
so = ss.option(form.Value, 'tls_ech_cfg', _('API ECH config'),
|
||||
_('This ECH parameter needs to be added to the SVCB/HTTPS record of the domain.'));
|
||||
_('This ECH parameter needs to be added to the HTTPS record of the domain.'));
|
||||
so.placeholder = 'AEn+DQBFKwAgACABWIHUGj4u+PIggYXcR5JF0gYk3dCRioBW8uJq9H4mKAAIAAEAAQABAANAEnB1YmxpYy50bHMtZWNoLmRldgAA';
|
||||
/* TLS END */
|
||||
|
||||
|
||||
@@ -641,7 +641,7 @@ return view.extend({
|
||||
so.modalonly = true;
|
||||
|
||||
so = ss.taboption('field_tls', form.Value, 'tls_ech_config', _('ECH config'),
|
||||
_('The ECH parameter of the SVCB/HTTPS record for the domain. Leave empty to resolve via DNS.'));
|
||||
_('The ECH parameter of the HTTPS record for the domain. Leave empty to resolve via DNS.'));
|
||||
so.placeholder = 'AEn+DQBFKwAgACABWIHUGj4u+PIggYXcR5JF0gYk3dCRioBW8uJq9H4mKAAIAAEAAQABAANAEnB1YmxpYy50bHMtZWNoLmRldgAA';
|
||||
so.depends('tls_ech', '1');
|
||||
so.modalonly = true;
|
||||
|
||||
@@ -378,7 +378,7 @@ return view.extend({
|
||||
o.modalonly = true;
|
||||
|
||||
o = s.taboption('field_tls', form.Value, 'tls_ech_config', _('ECH config'),
|
||||
_('This ECH parameter needs to be added to the SVCB/HTTPS record of the domain.'));
|
||||
_('This ECH parameter needs to be added to the HTTPS record of the domain.'));
|
||||
o.placeholder = 'AEn+DQBFKwAgACABWIHUGj4u+PIggYXcR5JF0gYk3dCRioBW8uJq9H4mKAAIAAEAAQABAANAEnB1YmxpYy50bHMtZWNoLmRldgAA';
|
||||
o.depends({tls: '1', type: /^(http|socks|mixed|vmess|vless|trojan|anytls|hysteria2|tuic)$/});
|
||||
o.modalonly = true;
|
||||
|
||||
@@ -2325,7 +2325,7 @@ msgstr ""
|
||||
|
||||
#: htdocs/luci-static/resources/view/fchomo/node.js:644
|
||||
msgid ""
|
||||
"The ECH parameter of the SVCB/HTTPS record for the domain. Leave empty to "
|
||||
"The ECH parameter of the HTTPS record for the domain. Leave empty to "
|
||||
"resolve via DNS."
|
||||
msgstr ""
|
||||
|
||||
@@ -2354,7 +2354,7 @@ msgstr ""
|
||||
#: htdocs/luci-static/resources/view/fchomo/global.js:570
|
||||
#: htdocs/luci-static/resources/view/fchomo/server.js:380
|
||||
msgid ""
|
||||
"This ECH parameter needs to be added to the SVCB/HTTPS record of the domain."
|
||||
"This ECH parameter needs to be added to the HTTPS record of the domain."
|
||||
msgstr ""
|
||||
|
||||
#: htdocs/luci-static/resources/view/fchomo/node.js:632
|
||||
|
||||
@@ -2354,9 +2354,9 @@ msgstr "WireGuard 网络中使用的本机 %s 地址。"
|
||||
|
||||
#: htdocs/luci-static/resources/view/fchomo/node.js:644
|
||||
msgid ""
|
||||
"The ECH parameter of the SVCB/HTTPS record for the domain. Leave empty to "
|
||||
"The ECH parameter of the HTTPS record for the domain. Leave empty to "
|
||||
"resolve via DNS."
|
||||
msgstr "域名的 SVCB/HTTPS 记录的 ECH 参数。留空则通过 DNS 解析。"
|
||||
msgstr "域名的 HTTPS 记录的 ECH 参数。留空则通过 DNS 解析。"
|
||||
|
||||
#: htdocs/luci-static/resources/view/fchomo/global.js:322
|
||||
msgid "The default value is 2:00 every day."
|
||||
@@ -2383,8 +2383,8 @@ msgstr "服务端公钥,需要 PEM 格式。"
|
||||
#: htdocs/luci-static/resources/view/fchomo/global.js:570
|
||||
#: htdocs/luci-static/resources/view/fchomo/server.js:380
|
||||
msgid ""
|
||||
"This ECH parameter needs to be added to the SVCB/HTTPS record of the domain."
|
||||
msgstr "此 ECH 参数需要添加到域名的 SVCB/HTTPS 记录中。"
|
||||
"This ECH parameter needs to be added to the HTTPS record of the domain."
|
||||
msgstr "此 ECH 参数需要添加到域名的 HTTPS 记录中。"
|
||||
|
||||
#: htdocs/luci-static/resources/view/fchomo/node.js:632
|
||||
#: htdocs/luci-static/resources/view/fchomo/node.js:1161
|
||||
|
||||
@@ -2354,9 +2354,9 @@ msgstr "WireGuard 網路中使用的本機 %s 位址。"
|
||||
|
||||
#: htdocs/luci-static/resources/view/fchomo/node.js:644
|
||||
msgid ""
|
||||
"The ECH parameter of the SVCB/HTTPS record for the domain. Leave empty to "
|
||||
"The ECH parameter of the HTTPS record for the domain. Leave empty to "
|
||||
"resolve via DNS."
|
||||
msgstr "網域的 SVCB/HTTPS 記錄的 ECH 參數。留空則透過 DNS 解析。"
|
||||
msgstr "網域的 HTTPS 記錄的 ECH 參數。留空則透過 DNS 解析。"
|
||||
|
||||
#: htdocs/luci-static/resources/view/fchomo/global.js:322
|
||||
msgid "The default value is 2:00 every day."
|
||||
@@ -2383,8 +2383,8 @@ msgstr "服務端公鑰,需要 PEM 格式。"
|
||||
#: htdocs/luci-static/resources/view/fchomo/global.js:570
|
||||
#: htdocs/luci-static/resources/view/fchomo/server.js:380
|
||||
msgid ""
|
||||
"This ECH parameter needs to be added to the SVCB/HTTPS record of the domain."
|
||||
msgstr "此 ECH 參數需要加入到網域的 SVCB/HTTPS 記錄中。"
|
||||
"This ECH parameter needs to be added to the HTTPS record of the domain."
|
||||
msgstr "此 ECH 參數需要加入到網域的 HTTPS 記錄中。"
|
||||
|
||||
#: htdocs/luci-static/resources/view/fchomo/node.js:632
|
||||
#: htdocs/luci-static/resources/view/fchomo/node.js:1161
|
||||
|
||||
@@ -6,9 +6,9 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
LUCI_TITLE:=LuCI support for Fileassistant
|
||||
LUCI_PKGARCH:=all
|
||||
PKG_VERSION:=1.0-5
|
||||
PKG_RELEASE:=5
|
||||
PKG_VERSION:=1.0
|
||||
PKG_RELEASE:=6
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
||||
|
||||
@@ -91,40 +91,6 @@ String.prototype.replaceAll = function(search, replacement) {
|
||||
}
|
||||
}
|
||||
|
||||
function chmodPath(filename, isdir) {
|
||||
var newmod = prompt('请输入新的权限位(支持八进制权限位或者a+x格式):', isdir === "1" ? "0755" : "0644");
|
||||
if (newmod) {
|
||||
iwxhr.get('/cgi-bin/luci/admin/nas/fileassistant/chmod',
|
||||
{
|
||||
filepath: concatPath(currentPath, filename),
|
||||
newmod: newmod
|
||||
},
|
||||
function (x, res) {
|
||||
if (res.ec === 0) {
|
||||
refresh_list(res.data, currentPath);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function chownPath(filename) {
|
||||
var newown = prompt('请输入新的用户名(支持用户名或用户名:群组格式):', "root");
|
||||
if (newown) {
|
||||
iwxhr.get('/cgi-bin/luci/admin/nas/fileassistant/chown',
|
||||
{
|
||||
filepath: concatPath(currentPath, filename),
|
||||
newown: newown
|
||||
},
|
||||
function (x, res) {
|
||||
if (res.ec === 0) {
|
||||
refresh_list(res.data, currentPath);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function openpath(filename, dirname) {
|
||||
dirname = dirname || currentPath;
|
||||
window.open('/cgi-bin/luci/admin/nas/fileassistant/open?path='
|
||||
@@ -164,13 +130,6 @@ String.prototype.replaceAll = function(search, replacement) {
|
||||
else if (targetElem.className.indexOf('cbi-button-edit') > -1) {
|
||||
renamePath(targetElem.parentNode.parentNode.dataset['filename']);
|
||||
}
|
||||
else if (targetElem.className.indexOf('cbi-button-chmod') > -1) {
|
||||
infoElem = targetElem.parentNode.parentNode;
|
||||
chmodPath(infoElem.dataset['filename'] , infoElem.dataset['isdir']);
|
||||
}
|
||||
else if (targetElem.className.indexOf('cbi-button-chown') > -1) {
|
||||
chownPath(targetElem.parentNode.parentNode.dataset['filename']);
|
||||
}
|
||||
else if (targetElem = getFileElem(targetElem)) {
|
||||
if (targetElem.className.indexOf('parent-icon') > -1) {
|
||||
update_list(currentPath.replace(/\/[^/]+($|\/$)/, ''));
|
||||
@@ -197,14 +156,7 @@ String.prototype.replaceAll = function(search, replacement) {
|
||||
}
|
||||
}
|
||||
function refresh_list(filenames, path) {
|
||||
var listHtml = '<table class="cbi-section-table"><thead><tr class="cbi-section-table-row cbi-rowstyle-2">'
|
||||
+'<td class="cbi-value-field">文件</td>'
|
||||
+'<td class="cbi-value-field">所有者</td>'
|
||||
+'<td class="cbi-value-field">修改时间</td>'
|
||||
+'<td class="cbi-value-field">大小</td>'
|
||||
+'<td class="cbi-value-field">权限</td>'
|
||||
+'<td class="cbi-section-table-cell">操作</td>'
|
||||
+'</tr></thead><tbody>';
|
||||
var listHtml = '<table class="cbi-section-table"><tbody>';
|
||||
if (path !== '/') {
|
||||
listHtml += '<tr class="cbi-section-table-row cbi-rowstyle-2"><td class="parent-icon" colspan="6"><strong>..</strong></td></tr>';
|
||||
}
|
||||
@@ -244,9 +196,7 @@ String.prototype.replaceAll = function(search, replacement) {
|
||||
+ '<td class="cbi-value-field cbi-value-perm">'+o.perms+'</td>'
|
||||
+ '<td class="cbi-section-table-cell">\
|
||||
<button class="cbi-button cbi-button-edit">重命名</button>\
|
||||
<button class="cbi-button cbi-button-remove">删除</button>\
|
||||
<button class="cbi-button cbi-button-apply cbi-button-chmod">改权限</button>\
|
||||
<button class="cbi-button cbi-button-apply cbi-button-chown">改用户</button>'
|
||||
<button class="cbi-button cbi-button-remove">删除</button>'
|
||||
+ install_btn
|
||||
+ '</td>'
|
||||
+ '</tr>';
|
||||
@@ -320,26 +270,6 @@ String.prototype.replaceAll = function(search, replacement) {
|
||||
}
|
||||
};
|
||||
|
||||
document.getElementById('mkdir-toggle').onclick = function() {
|
||||
var dirname = null;
|
||||
if (dirname = prompt("请输入文件夹名称:")) {
|
||||
var formData = new FormData();
|
||||
formData.append('path', currentPath);
|
||||
formData.append('dirname', dirname);
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", "/cgi-bin/luci/admin/nas/fileassistant/mkdir", true);
|
||||
xhr.onload = function() {
|
||||
if (xhr.status == 200) {
|
||||
var res = JSON.parse(xhr.responseText);
|
||||
refresh_list(res.data, currentPath);
|
||||
}
|
||||
else {
|
||||
alert('创建失败,请稍后再试...');
|
||||
}
|
||||
};
|
||||
xhr.send(formData);
|
||||
}
|
||||
};
|
||||
document.addEventListener('DOMContentLoaded', function(evt) {
|
||||
var initPath = '/';
|
||||
if (/path=([/\w]+)/.test(location.search)) {
|
||||
|
||||
@@ -6,6 +6,7 @@ function index()
|
||||
page = entry({"admin", "system", "fileassistant"}, template("fileassistant"), _("文件管理"), 50)
|
||||
page.i18n = "base"
|
||||
page.dependent = true
|
||||
page.acl_depends = { "luci-app-fileassistant" }
|
||||
|
||||
page = entry({"admin", "nas", "fileassistant", "list"}, call("fileassistant_list"), nil)
|
||||
page.leaf = true
|
||||
@@ -25,14 +26,6 @@ function index()
|
||||
page = entry({"admin", "nas", "fileassistant", "install"}, call("fileassistant_install"), nil)
|
||||
page.leaf = true
|
||||
|
||||
page = entry({"admin", "nas", "fileassistant", "mkdir"}, call("fileassistant_mkdir"), nil)
|
||||
page.leaf = true
|
||||
|
||||
page = entry({"admin", "nas", "fileassistant", "chmod"}, call("fileassistant_chmod"), nil)
|
||||
page.leaf = true
|
||||
|
||||
page = entry({"admin", "nas", "fileassistant", "chown"}, call("fileassistant_chown"), nil)
|
||||
page.leaf = true
|
||||
end
|
||||
|
||||
function list_response(path, success)
|
||||
@@ -116,18 +109,15 @@ function installIPK(filepath)
|
||||
end
|
||||
|
||||
function fileassistant_upload()
|
||||
local filecontent = luci.http.formvalue("upload-file")
|
||||
local filename = luci.http.formvalue("upload-filename")
|
||||
local uploaddir = luci.http.formvalue("upload-dir")
|
||||
local filepath = uploaddir..filename
|
||||
|
||||
local fp
|
||||
-- MUST setfilehandler before formvalue,
|
||||
-- beacuse formvalue will parse form and write body to /tmp if filehandler not present
|
||||
luci.http.setfilehandler(
|
||||
function(meta, chunk, eof)
|
||||
if not fp and meta and meta.name == "upload-file" then
|
||||
local filename = luci.http.formvalue("upload-filename")
|
||||
local uploaddir = luci.http.formvalue("upload-dir")
|
||||
if not uploaddir or not filename then
|
||||
error("uploaddir or filename is nil")
|
||||
end
|
||||
local filepath = uploaddir..filename
|
||||
fp = io.open(filepath, "w")
|
||||
end
|
||||
if fp and chunk then
|
||||
@@ -139,28 +129,7 @@ function fileassistant_upload()
|
||||
end
|
||||
)
|
||||
|
||||
list_response(luci.http.formvalue("upload-dir"), true)
|
||||
end
|
||||
|
||||
function fileassistant_mkdir()
|
||||
local path = luci.http.formvalue("path")
|
||||
local dirname = luci.http.formvalue("dirname")
|
||||
local success = os.execute('sh -c \'cd "'..path..'" && mkdir -p "'..dirname..'"\'')
|
||||
list_response(path, success)
|
||||
end
|
||||
|
||||
function fileassistant_chmod()
|
||||
local path = luci.http.formvalue("filepath")
|
||||
local newmod = luci.http.formvalue("newmod")
|
||||
local success = os.execute('chmod '..newmod..' "'..path..'"')
|
||||
list_response(nixio.fs.dirname(path), success)
|
||||
end
|
||||
|
||||
function fileassistant_chown()
|
||||
local path = luci.http.formvalue("filepath")
|
||||
local newown = luci.http.formvalue("newown")
|
||||
local success = os.execute('chown '..newown..' "'..path..'"')
|
||||
list_response(nixio.fs.dirname(path), success)
|
||||
list_response(uploaddir, true)
|
||||
end
|
||||
|
||||
function scandir(directory)
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
<%+header%>
|
||||
|
||||
<link rel="stylesheet" href="/luci-static/resources/fileassistant/fb.css<%# ?v=PKG_VERSION %>">
|
||||
<link rel="stylesheet" href="/luci-static/resources/fileassistant/fb.css?v=@ver">
|
||||
<h2 name="content">文件助手</h2>
|
||||
<fieldset class="cbi-section fb-container">
|
||||
<input id="current-path" type="text" class="current-path cbi-input-text" value="/"/>
|
||||
<div class="panel-container">
|
||||
<div class="panel-title">文件列表</div>
|
||||
<button id="upload-toggle" class="upload-toggle cbi-button cbi-button-edit">上传</button>
|
||||
<button id="mkdir-toggle" class="upload-toggle cbi-button cbi-button-edit">新建文件夹… </button>
|
||||
</div>
|
||||
<div class="upload-container" id="upload-container">
|
||||
<input id="upload-file" name="upload-file" class="upload-file" type="file">
|
||||
@@ -16,6 +15,6 @@
|
||||
<div id="list-content"></div>
|
||||
</fieldset>
|
||||
|
||||
<script src="/luci-static/resources/fileassistant/fb.js<%# ?v=PKG_VERSION %>"></script>
|
||||
<script src="/luci-static/resources/fileassistant/fb.js?v=@ver"></script>
|
||||
|
||||
<%+footer%>
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"luci-app-fileassistant": {
|
||||
"description": "Grant UCI access for luci-app-fileassistant",
|
||||
"read": {
|
||||
"uci": [ "fileassistant" ]
|
||||
},
|
||||
"write": {
|
||||
"uci": [ "fileassistant" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,13 +2,12 @@
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_VERSION:=1.0.4-1
|
||||
PKG_VERSION:=1.1.0-1
|
||||
PKG_RELEASE:=
|
||||
PKG_MAINTAINER:=jjm2473 <jjm2473@gmail.com>
|
||||
|
||||
LUCI_TITLE:=LuCI realtime client bandwidth monitor
|
||||
LUCI_PKGARCH:=all
|
||||
LUCI_DEPENDS:=+iptables
|
||||
|
||||
define Package/luci-app-rtbwmon/prerm
|
||||
#!/bin/sh
|
||||
|
||||
@@ -8,10 +8,10 @@ end
|
||||
|
||||
function data()
|
||||
luci.http.prepare_content("text/csv")
|
||||
luci.http.write(luci.sys.exec("/usr/libexec/rtbwmon.sh update"))
|
||||
luci.http.write(luci.sys.exec("/usr/libexec/rtbwmon.sh update 2>/dev/null"))
|
||||
end
|
||||
|
||||
function ifaces()
|
||||
luci.http.prepare_content("text/csv")
|
||||
luci.http.write(luci.sys.exec("/usr/libexec/rtbwmon.sh ifaces"))
|
||||
luci.http.write(luci.sys.exec("/usr/libexec/rtbwmon.sh ifaces 2>/dev/null"))
|
||||
end
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/bin/sh
|
||||
NFTABLES=false
|
||||
|
||||
lookup() {
|
||||
local MAC=$1
|
||||
@@ -47,8 +48,8 @@ merge() {
|
||||
local arpfile="$1"
|
||||
local countfile="$2"
|
||||
local outfile="$3"
|
||||
local pkts bytes src dest ip mac iface up down
|
||||
while read pkts bytes src dest; do
|
||||
local pkts bytes src dest ip mac iface up down ignored
|
||||
while read pkts bytes src dest ignored; do
|
||||
if [[ "$dest" = '0.0.0.0/0' ]]; then
|
||||
eval "local up_${src//[.:]/_}=\"$pkts,$bytes\""
|
||||
else
|
||||
@@ -63,6 +64,9 @@ merge() {
|
||||
}
|
||||
|
||||
do_clean() {
|
||||
if $NFTABLES; then
|
||||
nft delete table rtbwmon 2>/dev/null
|
||||
fi
|
||||
iptables -t mangle -D FORWARD -j RTBWMON_IFACE 2>/dev/null
|
||||
iptables -t mangle -F RTBWMON_IFACE 2>/dev/null
|
||||
iptables -t mangle -F RTBWMON_IP 2>/dev/null
|
||||
@@ -72,50 +76,105 @@ do_clean() {
|
||||
}
|
||||
|
||||
do_update() {
|
||||
local ip
|
||||
local ip handler
|
||||
local INTERFACE="$1"
|
||||
|
||||
find /var/run/rtbwmon.csv -mmin +30 2>/dev/null | grep -q . && do_clean
|
||||
|
||||
# init iptable
|
||||
iptables -t mangle -C FORWARD -j RTBWMON_IFACE 2>/dev/null || {
|
||||
iptables -t mangle -N RTBWMON_IFACE 2>/dev/null
|
||||
iptables -t mangle -N RTBWMON_IP 2>/dev/null
|
||||
iptables -t mangle -I FORWARD -j RTBWMON_IFACE
|
||||
# iptables -t mangle -I FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j RTBWMON_IFACE
|
||||
if $NFTABLES; then
|
||||
nft -f- <<-EOF
|
||||
table ip rtbwmon {
|
||||
chain FORWARD {
|
||||
type filter hook forward priority mangle; policy accept;
|
||||
}
|
||||
|
||||
# if interface changed, clean chain
|
||||
iptables -t mangle -C RTBWMON_IFACE -o "$INTERFACE" -j RTBWMON_IP 2>/dev/null || {
|
||||
iptables -t mangle -F RTBWMON_IP
|
||||
iptables -t mangle -F RTBWMON_IFACE
|
||||
# iptables -t mangle -A RTBWMON_IFACE -m addrtype --dst-type LOCAL -j RETURN
|
||||
iptables -t mangle -A RTBWMON_IFACE -i "$INTERFACE" -j RTBWMON_IP
|
||||
iptables -t mangle -A RTBWMON_IFACE -o "$INTERFACE" -j RTBWMON_IP
|
||||
chain RTBWMON_IFACE {
|
||||
}
|
||||
|
||||
chain RTBWMON_IP {
|
||||
}
|
||||
}
|
||||
flush chain rtbwmon FORWARD
|
||||
flush chain rtbwmon RTBWMON_IFACE
|
||||
table ip rtbwmon {
|
||||
chain FORWARD {
|
||||
jump RTBWMON_IFACE
|
||||
}
|
||||
|
||||
chain RTBWMON_IFACE {
|
||||
iifname "$INTERFACE" jump RTBWMON_IP
|
||||
oifname "$INTERFACE" jump RTBWMON_IP
|
||||
}
|
||||
}
|
||||
EOF
|
||||
else
|
||||
# init iptable
|
||||
iptables -t mangle -C FORWARD -j RTBWMON_IFACE 2>/dev/null || {
|
||||
iptables -t mangle -N RTBWMON_IFACE 2>/dev/null
|
||||
iptables -t mangle -N RTBWMON_IP 2>/dev/null
|
||||
iptables -t mangle -I FORWARD -j RTBWMON_IFACE
|
||||
# iptables -t mangle -I FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j RTBWMON_IFACE
|
||||
}
|
||||
|
||||
# if interface changed, clean chain
|
||||
iptables -t mangle -C RTBWMON_IFACE -o "$INTERFACE" -j RTBWMON_IP 2>/dev/null || {
|
||||
iptables -t mangle -F RTBWMON_IP
|
||||
iptables -t mangle -F RTBWMON_IFACE
|
||||
# iptables -t mangle -A RTBWMON_IFACE -m addrtype --dst-type LOCAL -j RETURN
|
||||
iptables -t mangle -A RTBWMON_IFACE -i "$INTERFACE" -j RTBWMON_IP
|
||||
iptables -t mangle -A RTBWMON_IFACE -o "$INTERFACE" -j RTBWMON_IP
|
||||
}
|
||||
fi
|
||||
|
||||
# schedule cleaning task
|
||||
/etc/init.d/rtbwmon start
|
||||
|
||||
# save system state
|
||||
iptables -t mangle -nvxL RTBWMON_IP | tail -n +3 | grep -Fv 'Zeroing chain' | sed -e 's/ \+/\t/g' | cut -f2,3,9,10 >/var/run/rtbwmon.tmp.count
|
||||
if $NFTABLES; then
|
||||
nft -at list chain rtbwmon RTBWMON_IP | tail -n +3 | grep 'ip ' | sed -n \
|
||||
-e 's@^\t\+ip saddr \([0-9.]\+\) counter packets \([0-9]\+\) bytes \([0-9]\+\) return # handle \([0-9]\+\)$@\2 \3 \1 0.0.0.0/0 \4@' \
|
||||
-e 's@^\t\+ip daddr \([0-9.]\+\) counter packets \([0-9]\+\) bytes \([0-9]\+\) return # handle \([0-9]\+\)$@\2 \3 0.0.0.0/0 \1 \4@' \
|
||||
-e 's/ \+/\t/gp' >/var/run/rtbwmon.tmp.count
|
||||
else
|
||||
iptables -t mangle -nvxL RTBWMON_IP | tail -n +3 | grep -Fv 'Zeroing chain' | sed -e 's/ \+/\t/g' | cut -f2,3,9,10 >/var/run/rtbwmon.tmp.count
|
||||
fi
|
||||
get_arp_excluded "$(enforce_wan_iface "$INTERFACE")" >/var/run/rtbwmon.tmp.arp
|
||||
|
||||
# get ip
|
||||
cut -f3 /var/run/rtbwmon.tmp.count | grep -Fv '0.0.0.0/0' >/var/run/rtbwmon.tmp.oips
|
||||
cut -f3 /var/run/rtbwmon.tmp.count | grep -Fwv '0.0.0.0/0' >/var/run/rtbwmon.tmp.oips
|
||||
cut -f1 /var/run/rtbwmon.tmp.arp >/var/run/rtbwmon.tmp.nips
|
||||
|
||||
# delete offline ip
|
||||
grep -Fvf /var/run/rtbwmon.tmp.nips /var/run/rtbwmon.tmp.oips | while read ip; do
|
||||
iptables -t mangle -D RTBWMON_IP -s "$ip" -j RETURN
|
||||
iptables -t mangle -D RTBWMON_IP -d "$ip" -j RETURN
|
||||
done
|
||||
if $NFTABLES; then
|
||||
{ cut -f3,5 /var/run/rtbwmon.tmp.count ; cut -f4,5 /var/run/rtbwmon.tmp.count; } | grep -Fwv '0.0.0.0/0' >/var/run/rtbwmon.tmp.oips-nft
|
||||
grep -Fwvf /var/run/rtbwmon.tmp.nips /var/run/rtbwmon.tmp.oips-nft | cut -f2 | while read handler; do
|
||||
nft delete rule rtbwmon RTBWMON_IP handle $handler
|
||||
done
|
||||
else
|
||||
grep -Fwvf /var/run/rtbwmon.tmp.nips /var/run/rtbwmon.tmp.oips | while read ip; do
|
||||
iptables -t mangle -D RTBWMON_IP -s "$ip" -j RETURN
|
||||
iptables -t mangle -D RTBWMON_IP -d "$ip" -j RETURN
|
||||
done
|
||||
fi
|
||||
|
||||
# add new ip
|
||||
grep -Fvf /var/run/rtbwmon.tmp.oips /var/run/rtbwmon.tmp.nips | while read ip; do
|
||||
iptables -t mangle -A RTBWMON_IP -s "$ip" -j RETURN
|
||||
iptables -t mangle -A RTBWMON_IP -d "$ip" -j RETURN
|
||||
done
|
||||
if $NFTABLES; then
|
||||
{
|
||||
echo "table ip rtbwmon {"
|
||||
echo " chain RTBWMON_IP {"
|
||||
grep -Fwvf /var/run/rtbwmon.tmp.oips /var/run/rtbwmon.tmp.nips | while read ip; do
|
||||
echo " ip saddr $ip counter return"
|
||||
echo " ip daddr $ip counter return"
|
||||
done
|
||||
echo " }"
|
||||
echo "}"
|
||||
} | nft -f-
|
||||
else
|
||||
grep -Fwvf /var/run/rtbwmon.tmp.oips /var/run/rtbwmon.tmp.nips | while read ip; do
|
||||
iptables -t mangle -A RTBWMON_IP -s "$ip" -j RETURN
|
||||
iptables -t mangle -A RTBWMON_IP -d "$ip" -j RETURN
|
||||
done
|
||||
fi
|
||||
|
||||
merge /var/run/rtbwmon.tmp.arp /var/run/rtbwmon.tmp.count /var/run/rtbwmon.csv
|
||||
|
||||
@@ -138,7 +197,7 @@ update() {
|
||||
if [ -z "$WAN_INTERFACE" ]; then
|
||||
do_clean
|
||||
else
|
||||
do_update "$WAN_INTERFACE" 2>/dev/null
|
||||
do_update "$WAN_INTERFACE"
|
||||
cat /var/run/rtbwmon.csv
|
||||
fi
|
||||
flock -u 1000 2>/dev/null
|
||||
@@ -189,6 +248,8 @@ prerm() {
|
||||
flock -u 1000
|
||||
}
|
||||
|
||||
[ -x /sbin/fw4 ] && NFTABLES=true
|
||||
|
||||
case $1 in
|
||||
"clean")
|
||||
clean
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_VERSION:=1.0.12-20250428
|
||||
PKG_VERSION:=1.0.12-20250528
|
||||
PKG_RELEASE:=
|
||||
|
||||
LUCI_TITLE:=LuCI support for SysTools
|
||||
LUCI_PKGARCH:=all
|
||||
LUCI_DEPENDS:=+lsblk +docker +dockerd +luci-lib-iform +luci-lib-taskd +speedtestcli
|
||||
LUCI_DEPENDS:=+lsblk +luci-lib-iform +luci-lib-taskd +speedtestcli
|
||||
LUCI_EXTRA_DEPENDS:=luci-lib-iform (>=1.1)
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
@@ -21,13 +21,13 @@ define Download/geoip
|
||||
HASH:=8023379316bca4713dcfa5ba4ea2fe7f4c127fff64a0cb7859d4756142b2c4dc
|
||||
endef
|
||||
|
||||
GEOSITE_VER:=20250527033106
|
||||
GEOSITE_VER:=20250528105809
|
||||
GEOSITE_FILE:=dlc.dat.$(GEOSITE_VER)
|
||||
define Download/geosite
|
||||
URL:=https://github.com/v2fly/domain-list-community/releases/download/$(GEOSITE_VER)/
|
||||
URL_FILE:=dlc.dat
|
||||
FILE:=$(GEOSITE_FILE)
|
||||
HASH:=ccbe379ad5baa0a4d2b3090fe4eca4591fd763d1071cdbb92b320c7d1ac24e43
|
||||
HASH:=d0a7649feb5273550a8d2dc345786728765d48acaeafdd622fe190b09ddaef7c
|
||||
endef
|
||||
|
||||
GEOSITE_IRAN_VER:=202505260041
|
||||
|
||||
Reference in New Issue
Block a user