mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-09-14 20:34:19 +08:00
Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
67b93951e1 | ||
|
|
357b27c00f | ||
|
|
a9e3dd3e88 | ||
|
|
b93641d613 | ||
|
|
f88d417520 |
@@ -236,7 +236,7 @@ jobs:
|
|||||||
(
|
(
|
||||||
git_clone https://github.com/kenzok8/openwrt-daede && mv -f openwrt-daede/*dae* ./;rm -rf openwrt-daede
|
git_clone https://github.com/kenzok8/openwrt-daede && mv -f openwrt-daede/*dae* ./;rm -rf openwrt-daede
|
||||||
git_clone https://github.com/kenzok8/vmlinux-btf vmlinuxb && mvdir vmlinuxb
|
git_clone https://github.com/kenzok8/vmlinux-btf vmlinuxb && mvdir vmlinuxb
|
||||||
# git_clone https://github.com/QiuSimons/luci-app-daed-next daed1 && mvdir daed1
|
git_clone https://github.com/QiuSimons/luci-app-daed daed1 && mv -f daed1/luci-app* ./;rm -rf daed1
|
||||||
git_clone https://github.com/JiaY-shi/fancontrol fanc && mv fanc/{fancontrol,luci-app-fancontrol} ./;rm -rf fanc
|
git_clone https://github.com/JiaY-shi/fancontrol fanc && mv fanc/{fancontrol,luci-app-fancontrol} ./;rm -rf fanc
|
||||||
git_sparse_clone master "https://github.com/coolsnowwolf/lede" package/lean package/network/services/shellsync package/qca/shortcut-fe
|
git_sparse_clone master "https://github.com/coolsnowwolf/lede" package/lean package/network/services/shellsync package/qca/shortcut-fe
|
||||||
git_clone https://github.com/linkease/istore-packages
|
git_clone https://github.com/linkease/istore-packages
|
||||||
|
|||||||
@@ -62,3 +62,4 @@
|
|||||||
/quectel_SRPD_PCIE
|
/quectel_SRPD_PCIE
|
||||||
/quectel_Gobinet
|
/quectel_Gobinet
|
||||||
/fibocom_MHI
|
/fibocom_MHI
|
||||||
|
/*zabbix*
|
||||||
|
|||||||
@@ -1,13 +1,15 @@
|
|||||||
# SPDX-License-Identifier: Apache-2.0
|
|
||||||
#
|
|
||||||
# Copyright (C) 2023 ImmortalWrt.org
|
|
||||||
|
|
||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
LUCI_TITLE:=LuCI app for dae dashboard
|
PKG_NAME:=luci-app-daed
|
||||||
LUCI_DEPENDS:=+daed +daed-geoip +daed-geosite
|
PKG_VERSION:=1.4
|
||||||
|
PKG_RELEASE:=2
|
||||||
|
|
||||||
|
LUCI_TITLE:=LuCI Support for DAED
|
||||||
|
LUCI_DEPENDS:=+daed +zoneinfo-asia +luci-compat
|
||||||
LUCI_PKGARCH:=all
|
LUCI_PKGARCH:=all
|
||||||
|
|
||||||
include $(TOPDIR)/feeds/luci/luci.mk
|
define Package/$(PKG_NAME)/conffiles
|
||||||
|
endef
|
||||||
|
|
||||||
|
include $(TOPDIR)/feeds/luci/luci.mk
|
||||||
# call BuildPackage - OpenWrt buildroot signature
|
# call BuildPackage - OpenWrt buildroot signature
|
||||||
|
|||||||
@@ -1,93 +0,0 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
'require form';
|
|
||||||
'require poll';
|
|
||||||
'require rpc';
|
|
||||||
'require uci';
|
|
||||||
'require view';
|
|
||||||
|
|
||||||
const callServiceList = rpc.declare({
|
|
||||||
object: 'service',
|
|
||||||
method: 'list',
|
|
||||||
params: ['name'],
|
|
||||||
expect: { '': {} }
|
|
||||||
});
|
|
||||||
|
|
||||||
function getServiceStatus() {
|
|
||||||
return L.resolveDefault(callServiceList('daed'), {}).then(function(res) {
|
|
||||||
let isRunning = false;
|
|
||||||
try {
|
|
||||||
isRunning = res['daed']['instances']['daed']['running'];
|
|
||||||
} catch (e) { }
|
|
||||||
return isRunning;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function renderStatus(isRunning, port) {
|
|
||||||
let spanTemp = '<span style="color:%s"><strong>%s %s</strong></span>';
|
|
||||||
let renderHTML;
|
|
||||||
if (isRunning) {
|
|
||||||
let button = String.format(' <a class="btn cbi-button" href="http://%s:%s" target="_blank" rel="noreferrer noopener">%s</a>',
|
|
||||||
window.location.hostname, port, _('Open Web Interface'));
|
|
||||||
renderHTML = spanTemp.format('green', _('daed'), _('RUNNING')) + button;
|
|
||||||
} else {
|
|
||||||
renderHTML = spanTemp.format('red', _('daed'), _('NOT RUNNING'));
|
|
||||||
}
|
|
||||||
|
|
||||||
return renderHTML;
|
|
||||||
}
|
|
||||||
|
|
||||||
return view.extend({
|
|
||||||
load: function() {
|
|
||||||
return Promise.all([
|
|
||||||
uci.load('daed')
|
|
||||||
]);
|
|
||||||
},
|
|
||||||
|
|
||||||
render: function(data) {
|
|
||||||
let m, s, o;
|
|
||||||
let webport = (uci.get(data[0], 'config', 'address') || '0.0.0.0:2023').split(':').slice(-1)[0];
|
|
||||||
|
|
||||||
m = new form.Map('daed', _('daed'),
|
|
||||||
_('A modern dashboard for dae.'));
|
|
||||||
|
|
||||||
s = m.section(form.TypedSection);
|
|
||||||
s.anonymous = true;
|
|
||||||
s.render = function() {
|
|
||||||
poll.add(function() {
|
|
||||||
return L.resolveDefault(getServiceStatus()).then(function(res) {
|
|
||||||
let view = document.getElementById('service_status');
|
|
||||||
view.innerHTML = renderStatus(res, webport);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
return E('div', { class: 'cbi-section', id: 'status_bar' }, [
|
|
||||||
E('p', { id: 'service_status' }, _('Collecting data…'))
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
s = m.section(form.NamedSection, 'config', 'daed');
|
|
||||||
|
|
||||||
o = s.option(form.Flag, 'enabled', _('Enable'));
|
|
||||||
o.default = o.disabled;
|
|
||||||
o.rmempty = false;
|
|
||||||
|
|
||||||
o = s.option(form.Value, 'listen_addr', _('Listening address'));
|
|
||||||
o.datatype = 'ipaddrport(1)';
|
|
||||||
o.default = '0.0.0.0:2023';
|
|
||||||
o.rmempty = false;
|
|
||||||
|
|
||||||
o = s.option(form.Value, 'log_maxbackups', _('Max log backups'),
|
|
||||||
_('The maximum number of old log files to retain.'));
|
|
||||||
o.datatype = 'uinteger';
|
|
||||||
o.default = '1';
|
|
||||||
|
|
||||||
o = s.option(form.Value, 'log_maxsize', _('Max log size'),
|
|
||||||
_('The maximum size in megabytes of the log file before it gets rotated.'));
|
|
||||||
o.datatype = 'uinteger';
|
|
||||||
o.default = '5';
|
|
||||||
|
|
||||||
return m.render();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
@@ -1,94 +0,0 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
'require dom';
|
|
||||||
'require fs';
|
|
||||||
'require poll';
|
|
||||||
'require view';
|
|
||||||
|
|
||||||
return view.extend({
|
|
||||||
render() {
|
|
||||||
/* Thanks to luci-app-aria2 */
|
|
||||||
let css = ' \
|
|
||||||
#log_textarea { \
|
|
||||||
text-align: left; \
|
|
||||||
} \
|
|
||||||
#log_textarea pre { \
|
|
||||||
padding: .5rem; \
|
|
||||||
word-break: break-all; \
|
|
||||||
margin: 0; \
|
|
||||||
} \
|
|
||||||
.description { \
|
|
||||||
background-color: #33ccff; \
|
|
||||||
}';
|
|
||||||
|
|
||||||
let log_textarea = E('div', { 'id': 'log_textarea' },
|
|
||||||
E('img', {
|
|
||||||
'src': L.resource('icons/loading.svg'),
|
|
||||||
'alt': _('Loading...'),
|
|
||||||
'style': 'vertical-align:middle'
|
|
||||||
}, _('Collecting data…'))
|
|
||||||
);
|
|
||||||
|
|
||||||
poll.add(L.bind(function() {
|
|
||||||
return fs.read_direct('/var/log/daed/daed.log', 'text')
|
|
||||||
.then(function(content) {
|
|
||||||
let log = E('pre', { 'wrap': 'pre' }, [
|
|
||||||
content.trim() || _('Log is empty.')
|
|
||||||
]);
|
|
||||||
|
|
||||||
dom.content(log_textarea, log);
|
|
||||||
}).catch(function(e) {
|
|
||||||
let log;
|
|
||||||
|
|
||||||
if (e.toString().includes('NotFoundError'))
|
|
||||||
log = E('pre', { 'wrap': 'pre' }, [
|
|
||||||
_('Log file does not exist.')
|
|
||||||
]);
|
|
||||||
else
|
|
||||||
log = E('pre', { 'wrap': 'pre' }, [
|
|
||||||
_('Unknown error: %s').format(e)
|
|
||||||
]);
|
|
||||||
|
|
||||||
dom.content(log_textarea, log);
|
|
||||||
});
|
|
||||||
}));
|
|
||||||
|
|
||||||
const scrollDownButton = E('button', {
|
|
||||||
'id': 'scrollDownButton',
|
|
||||||
'class': 'cbi-button cbi-button-neutral',
|
|
||||||
}, _('Scroll to tail', 'scroll to bottom (the tail) of the log file')
|
|
||||||
);
|
|
||||||
scrollDownButton.addEventListener('click', () => {
|
|
||||||
scrollUpButton.focus();
|
|
||||||
});
|
|
||||||
|
|
||||||
const scrollUpButton = E('button', {
|
|
||||||
'id' : 'scrollUpButton',
|
|
||||||
'class': 'cbi-button cbi-button-neutral',
|
|
||||||
}, _('Scroll to head', 'scroll to top (the head) of the log file')
|
|
||||||
);
|
|
||||||
scrollUpButton.addEventListener('click', () => {
|
|
||||||
scrollDownButton.focus();
|
|
||||||
});
|
|
||||||
|
|
||||||
return E([
|
|
||||||
E('style', [ css ]),
|
|
||||||
E('h2', {}, [ _('Log') ]),
|
|
||||||
E('div', {'class': 'cbi-map'}, [
|
|
||||||
E('div', {'style': 'padding-bottom: 20px'}, [scrollDownButton]),
|
|
||||||
E('div', {'class': 'cbi-section'}, [
|
|
||||||
log_textarea,
|
|
||||||
E('div', {'style': 'text-align:right'},
|
|
||||||
E('small', {}, _('Refresh every %s seconds.').format(L.env.pollinterval))
|
|
||||||
)
|
|
||||||
]),
|
|
||||||
E('div', {'style': 'padding-bottom: 20px'}, [scrollUpButton])
|
|
||||||
])
|
|
||||||
]);
|
|
||||||
},
|
|
||||||
|
|
||||||
handleSaveApply: null,
|
|
||||||
handleSave: null,
|
|
||||||
handleReset: null
|
|
||||||
});
|
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
local sys = require "luci.sys"
|
||||||
|
local http = require "luci.http"
|
||||||
|
|
||||||
|
module("luci.controller.daed", package.seeall)
|
||||||
|
|
||||||
|
function index()
|
||||||
|
if not nixio.fs.access("/etc/config/daed") then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
entry({"admin", "services", "daed"}, alias("admin", "services", "daed", "setting"),_("DAED"), 58).dependent = true
|
||||||
|
entry({"admin", "services", "daed", "setting"}, cbi("daed/basic"), _("Base Setting"), 1).leaf=true
|
||||||
|
entry({"admin", "services", "daed", "daed"}, template("daed/daed"), _("Dashboard"), 2).leaf = true
|
||||||
|
entry({"admin", "services", "daed", "log"}, cbi("daed/log"), _("Logs"), 3).leaf = true
|
||||||
|
entry({"admin", "services", "daed_status"}, call("act_status"))
|
||||||
|
entry({"admin", "services", "daed", "get_log"}, call("get_log")).leaf = true
|
||||||
|
entry({"admin", "services", "daed", "clear_log"}, call("clear_log")).leaf = true
|
||||||
|
end
|
||||||
|
|
||||||
|
function act_status()
|
||||||
|
local sys = require "luci.sys"
|
||||||
|
local e = { }
|
||||||
|
e.running = sys.call("pidof daed >/dev/null") == 0
|
||||||
|
luci.http.prepare_content("application/json")
|
||||||
|
luci.http.write_json(e)
|
||||||
|
end
|
||||||
|
|
||||||
|
function get_log()
|
||||||
|
http.write(sys.exec("cat /var/log/daed/daed.log"))
|
||||||
|
end
|
||||||
|
|
||||||
|
function clear_log()
|
||||||
|
sys.call("true > /var/log/daed/daed.log")
|
||||||
|
end
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
local m, s ,o
|
||||||
|
|
||||||
|
m = Map("daed")
|
||||||
|
m.title = translate("DAED")
|
||||||
|
m.description = translate("DAE is a Linux high-performance transparent proxy solution based on eBPF, And DAED is a modern dashboard for dae.")
|
||||||
|
|
||||||
|
m:section(SimpleSection).template = "daed/daed_status"
|
||||||
|
|
||||||
|
s = m:section(TypedSection, "daed", translate("Global Settings"))
|
||||||
|
s.addremove = false
|
||||||
|
s.anonymous = true
|
||||||
|
|
||||||
|
o = s:option(Flag,"enabled",translate("Enable"))
|
||||||
|
o.default = 0
|
||||||
|
|
||||||
|
o = s:option(Value, "log_maxbackups", translate("Logfile retention count"))
|
||||||
|
o.default = 1
|
||||||
|
|
||||||
|
o = s:option(Value, "log_maxsize", translate("Logfile Max Size (MB)"))
|
||||||
|
o.default = 5
|
||||||
|
|
||||||
|
o = s:option(Value, "listen_addr",translate("Set the DAED listen address"))
|
||||||
|
o.default = '0.0.0.0:2023'
|
||||||
|
|
||||||
|
o = s:option(Value, "dashboard_port", translate("Dashboard Access Port"))
|
||||||
|
o.placeholder = translate("Leave empty to use listen port")
|
||||||
|
o.datatype = "range(1,65535)"
|
||||||
|
o.description = translate("For reverse proxy scenarios, leave empty to use the port from listen address")
|
||||||
|
|
||||||
|
m.apply_on_parse = true
|
||||||
|
m.on_after_apply = function(self,map)
|
||||||
|
luci.sys.exec("/etc/init.d/daed restart")
|
||||||
|
end
|
||||||
|
|
||||||
|
return m
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
m = Map("daed")
|
||||||
|
|
||||||
|
m:append(Template("daed/daed_log"))
|
||||||
|
|
||||||
|
return m
|
||||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,33 @@
|
|||||||
|
<script type="text/javascript">
|
||||||
|
//<![CDATA[
|
||||||
|
function clear_log(btn) {
|
||||||
|
XHR.get('<%=url([[admin]], [[services]], [[daed]], [[clear_log]])%>', null,
|
||||||
|
function(x, data) {
|
||||||
|
if(x && x.status == 200) {
|
||||||
|
var log_textarea = document.getElementById('log_textarea');
|
||||||
|
log_textarea.innerHTML = "";
|
||||||
|
log_textarea.scrollTop = log_textarea.scrollHeight;
|
||||||
|
}
|
||||||
|
location.reload();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
var scrolled = false;
|
||||||
|
XHR.poll(2, '<%=url([[admin]], [[services]], [[daed]], [[get_log]])%>', null,
|
||||||
|
function(x, data) {
|
||||||
|
if(x && x.status == 200) {
|
||||||
|
var log_textarea = document.getElementById('log_textarea');
|
||||||
|
log_textarea.innerHTML = x.responseText;
|
||||||
|
if (!scrolled) {
|
||||||
|
log_textarea.scrollTop = log_textarea.scrollHeight;
|
||||||
|
scrolled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
//]]>
|
||||||
|
</script>
|
||||||
|
<fieldset class="cbi-section" id="_log_fieldset">
|
||||||
|
<input class="cbi-button cbi-input-remove" type="button" onclick="clear_log()" value="<%:Clear logs%>" style="margin-left: 10px; margin-top: 10px;">
|
||||||
|
<textarea id="log_textarea" class="cbi-input-textarea" style="width: calc(100% - 20px); height: 645px; margin: 10px;" data-update="change" rows="5" wrap="off" readonly="readonly"></textarea>
|
||||||
|
</fieldset>
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
<script type="text/javascript">//<![CDATA[
|
||||||
|
XHR.poll(3, '<%=url([[admin]], [[services]], [[daed_status]])%>', null,
|
||||||
|
function(x, data) {
|
||||||
|
var tb = document.getElementById('daed_status');
|
||||||
|
if (data && tb)
|
||||||
|
{
|
||||||
|
if (data.running)
|
||||||
|
{
|
||||||
|
tb.innerHTML = '<em><b style=\"color:green\"><%:DAED%> <%:RUNNING%></b></em>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tb.innerHTML = '<em><b style=\"color:red\"><%:DAED%> <%:NOT RUNNING%></b></em>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
//]]></script>
|
||||||
|
<style>.mar-10 {margin-left: 50px; margin-right: 10px;}</style>
|
||||||
|
<fieldset class="cbi-section">
|
||||||
|
<p id="daed_status">
|
||||||
|
<em><%:Collecting data...%></em>
|
||||||
|
</p>
|
||||||
|
</fieldset>
|
||||||
@@ -1,97 +0,0 @@
|
|||||||
msgid ""
|
|
||||||
msgstr "Content-Type: text/plain; charset=UTF-8"
|
|
||||||
|
|
||||||
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:53
|
|
||||||
msgid "A modern dashboard for dae."
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:66
|
|
||||||
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/log.js:30
|
|
||||||
msgid "Collecting data…"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:72
|
|
||||||
msgid "Enable"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: applications/luci-app-daed/root/usr/share/rpcd/acl.d/luci-app-daed.json:3
|
|
||||||
msgid "Grant access to daed configuration"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:76
|
|
||||||
msgid "Listening address"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/log.js:28
|
|
||||||
msgid "Loading..."
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/log.js:77
|
|
||||||
#: applications/luci-app-daed/root/usr/share/luci/menu.d/luci-app-daed.json:22
|
|
||||||
msgid "Log"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/log.js:46
|
|
||||||
msgid "Log file does not exist."
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/log.js:37
|
|
||||||
msgid "Log is empty."
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:81
|
|
||||||
msgid "Max log backups"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:86
|
|
||||||
msgid "Max log size"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:35
|
|
||||||
msgid "NOT RUNNING"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:32
|
|
||||||
msgid "Open Web Interface"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:33
|
|
||||||
msgid "RUNNING"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/log.js:83
|
|
||||||
msgid "Refresh every %s seconds."
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/log.js:69
|
|
||||||
msgctxt "scroll to top (the head) of the log file"
|
|
||||||
msgid "Scroll to head"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/log.js:60
|
|
||||||
msgctxt "scroll to bottom (the tail) of the log file"
|
|
||||||
msgid "Scroll to tail"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: applications/luci-app-daed/root/usr/share/luci/menu.d/luci-app-daed.json:14
|
|
||||||
msgid "Settings"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:82
|
|
||||||
msgid "The maximum number of old log files to retain."
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:87
|
|
||||||
msgid "The maximum size in megabytes of the log file before it gets rotated."
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/log.js:50
|
|
||||||
msgid "Unknown error: %s"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:33
|
|
||||||
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:35
|
|
||||||
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:52
|
|
||||||
#: applications/luci-app-daed/root/usr/share/luci/menu.d/luci-app-daed.json:3
|
|
||||||
msgid "daed"
|
|
||||||
msgstr ""
|
|
||||||
@@ -1,104 +1,68 @@
|
|||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr "Content-Type: text/plain; charset=UTF-8"
|
||||||
"Content-Type: text/plain; charset=UTF-8\n"
|
|
||||||
"Project-Id-Version: PACKAGE VERSION\n"
|
|
||||||
"Last-Translator: Automatically generated\n"
|
|
||||||
"Language-Team: none\n"
|
|
||||||
"Language: zh-Hans\n"
|
|
||||||
"MIME-Version: 1.0\n"
|
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
|
||||||
|
|
||||||
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:53
|
msgid "DAED"
|
||||||
msgid "A modern dashboard for dae."
|
msgstr "DAED"
|
||||||
msgstr "dae 现代化控制面板。"
|
|
||||||
|
|
||||||
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:66
|
msgid "DAE is a Linux high-performance transparent proxy solution based on eBPF, And DAED is a modern dashboard for dae."
|
||||||
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/log.js:30
|
msgstr "DAE是一个基于eBPF的Linux高性能透明代理解决方案,而DAED是DAE的管理面板。"
|
||||||
msgid "Collecting data…"
|
|
||||||
msgstr "正在收集数据中…"
|
|
||||||
|
|
||||||
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:72
|
msgid "Base Setting"
|
||||||
msgid "Enable"
|
msgstr "基本设置"
|
||||||
msgstr "启用"
|
|
||||||
|
|
||||||
#: applications/luci-app-daed/root/usr/share/rpcd/acl.d/luci-app-daed.json:3
|
msgid "Dashboard"
|
||||||
msgid "Grant access to daed configuration"
|
msgstr "仪表板"
|
||||||
msgstr "授予访问 daed 配置的权限"
|
|
||||||
|
|
||||||
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:76
|
msgid "Logs"
|
||||||
msgid "Listening address"
|
|
||||||
msgstr "监听地址"
|
|
||||||
|
|
||||||
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/log.js:28
|
|
||||||
msgid "Loading..."
|
|
||||||
msgstr "加载中..."
|
|
||||||
|
|
||||||
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/log.js:77
|
|
||||||
#: applications/luci-app-daed/root/usr/share/luci/menu.d/luci-app-daed.json:22
|
|
||||||
msgid "Log"
|
|
||||||
msgstr "日志"
|
msgstr "日志"
|
||||||
|
|
||||||
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/log.js:46
|
msgid "Clear logs"
|
||||||
msgid "Log file does not exist."
|
msgstr "清空日志"
|
||||||
msgstr "日志文件不存在。"
|
|
||||||
|
|
||||||
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/log.js:37
|
|
||||||
msgid "Log is empty."
|
|
||||||
msgstr "日志为空"
|
|
||||||
|
|
||||||
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:81
|
|
||||||
msgid "Max log backups"
|
|
||||||
msgstr "最大日志备份"
|
|
||||||
|
|
||||||
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:86
|
|
||||||
msgid "Max log size"
|
|
||||||
msgstr "最大日志大小"
|
|
||||||
|
|
||||||
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:35
|
|
||||||
msgid "NOT RUNNING"
|
|
||||||
msgstr "未运行"
|
|
||||||
|
|
||||||
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:32
|
|
||||||
msgid "Open Web Interface"
|
|
||||||
msgstr "打开 Web 界面"
|
|
||||||
|
|
||||||
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:33
|
|
||||||
msgid "RUNNING"
|
msgid "RUNNING"
|
||||||
msgstr "运行中"
|
msgstr "运行中"
|
||||||
|
|
||||||
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/log.js:83
|
msgid "NOT RUNNING"
|
||||||
msgid "Refresh every %s seconds."
|
msgstr "未运行"
|
||||||
msgstr "每 %s 秒刷新。"
|
|
||||||
|
|
||||||
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/log.js:69
|
msgid "Collecting data..."
|
||||||
msgctxt "scroll to top (the head) of the log file"
|
msgstr "收集数据..."
|
||||||
msgid "Scroll to head"
|
|
||||||
msgstr "滚动到顶部"
|
|
||||||
|
|
||||||
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/log.js:60
|
msgid "Logfile retention count"
|
||||||
msgctxt "scroll to bottom (the tail) of the log file"
|
msgstr "日志文件保留数量"
|
||||||
msgid "Scroll to tail"
|
|
||||||
msgstr "滚动到尾部"
|
|
||||||
|
|
||||||
#: applications/luci-app-daed/root/usr/share/luci/menu.d/luci-app-daed.json:14
|
msgid "Logfile Max Size (MB)"
|
||||||
msgid "Settings"
|
msgstr "日志文件大小(MB)"
|
||||||
msgstr "设置"
|
|
||||||
|
|
||||||
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:82
|
msgid "Set the DAED listen address"
|
||||||
msgid "The maximum number of old log files to retain."
|
msgstr "设置监听地址"
|
||||||
msgstr "要保留的最大旧日志文件数量。"
|
|
||||||
|
|
||||||
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:87
|
msgid "Dashboard Access Port"
|
||||||
msgid "The maximum size in megabytes of the log file before it gets rotated."
|
msgstr "仪表板访问端口"
|
||||||
msgstr "要保留的最大日志大小(单位:MB)。"
|
|
||||||
|
|
||||||
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/log.js:50
|
msgid "Leave empty to use listen port"
|
||||||
msgid "Unknown error: %s"
|
msgstr "留空则使用监听端口"
|
||||||
msgstr "未知错误:%s"
|
|
||||||
|
|
||||||
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:33
|
msgid "For reverse proxy scenarios, leave empty to use the port from listen address"
|
||||||
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:35
|
msgstr "用于反向代理场景,留空则使用监听地址的端口"
|
||||||
#: applications/luci-app-daed/htdocs/luci-static/resources/view/daed/config.js:52
|
|
||||||
#: applications/luci-app-daed/root/usr/share/luci/menu.d/luci-app-daed.json:3
|
msgid "DAED is not running"
|
||||||
msgid "daed"
|
msgstr "DAED 未运行"
|
||||||
msgstr "daed"
|
|
||||||
|
msgid "Please start the DAED service first and try again"
|
||||||
|
msgstr "请先启动 DAED 服务后重试"
|
||||||
|
|
||||||
|
msgid "Enable Auto Subscribe Update"
|
||||||
|
msgstr "启用订阅自动更新"
|
||||||
|
|
||||||
|
msgid "Update Cycle"
|
||||||
|
msgstr "更新周期"
|
||||||
|
|
||||||
|
msgid "Update Time (Every Day)"
|
||||||
|
msgstr "更新时间(每天)"
|
||||||
|
|
||||||
|
msgid "Username"
|
||||||
|
msgstr "用户名"
|
||||||
|
|
||||||
|
msgid "Password"
|
||||||
|
msgstr "密码"
|
||||||
+31
@@ -0,0 +1,31 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
[ "$ACTION" = "ifup" ] || [ "$ACTION" = "ifupdate" ] || exit 0
|
||||||
|
[ "$ACTION" = "ifupdate" ] && [ -z "$IFUPDATE_ADDRESSES" ] && [ -z "$IFUPDATE_DATA" ] && exit 0
|
||||||
|
|
||||||
|
UPTIME=$(cut -d. -f1 /proc/uptime 2>/dev/null)
|
||||||
|
[ -n "$UPTIME" ] && [ "$UPTIME" -lt 30 ] && exit 0
|
||||||
|
|
||||||
|
. /lib/functions/network.sh
|
||||||
|
network_find_wan6 NET_IF6
|
||||||
|
network_find_wan NET_IF
|
||||||
|
[ "$INTERFACE" != "$NET_IF6" ] && [ "$INTERFACE" != "$NET_IF" ] && exit 0
|
||||||
|
|
||||||
|
[ "$(uci -q get daed.config.enabled)" = "1" ] || exit 0
|
||||||
|
|
||||||
|
DEBOUNCE_FILE="/tmp/run/daed_hotplug_gen"
|
||||||
|
mkdir -p /tmp/run
|
||||||
|
|
||||||
|
my_gen="$$.$(date +%s)"
|
||||||
|
echo "$my_gen" > "$DEBOUNCE_FILE"
|
||||||
|
|
||||||
|
(
|
||||||
|
sleep 5
|
||||||
|
[ "$(cat "$DEBOUNCE_FILE" 2>/dev/null)" = "$my_gen" ] || exit 0
|
||||||
|
|
||||||
|
if /etc/init.d/daed running; then
|
||||||
|
/etc/init.d/daed restart
|
||||||
|
else
|
||||||
|
/etc/init.d/daed start
|
||||||
|
fi
|
||||||
|
) &
|
||||||
Executable
+93
@@ -0,0 +1,93 @@
|
|||||||
|
#!/bin/sh /etc/rc.common
|
||||||
|
# Copyright (C) 2023 Tianling Shen <cnsztl@immortalwrt.org>
|
||||||
|
|
||||||
|
USE_PROCD=0
|
||||||
|
START=98
|
||||||
|
|
||||||
|
CONF="daed"
|
||||||
|
PROG="/usr/bin/daed"
|
||||||
|
LOG="/var/log/daed/daed.log"
|
||||||
|
RESOLV_DAED="/tmp/resolv.conf.daed"
|
||||||
|
|
||||||
|
update_cron() {
|
||||||
|
local temp_cron="/tmp/root.cron"
|
||||||
|
|
||||||
|
if [ -f /etc/crontabs/root ]; then
|
||||||
|
grep -v '/etc/daed/daed_sub.sh' /etc/crontabs/root > "$temp_cron" 2>/dev/null
|
||||||
|
fi
|
||||||
|
: >> "$temp_cron"
|
||||||
|
|
||||||
|
local auto_update
|
||||||
|
auto_update=$(uci -q get daed.config.subscribe_auto_update)
|
||||||
|
if [ "$1" = "add" ] && [ "${auto_update:-0}" -eq 1 ]; then
|
||||||
|
local min=$((RANDOM % 60))
|
||||||
|
local hr=$(uci -q get daed.config.subscribe_update_day_time)
|
||||||
|
local wk=$(uci -q get daed.config.subscribe_update_week_time)
|
||||||
|
echo "$min ${hr:-*} * * ${wk:-*} /etc/daed/daed_sub.sh >/dev/null 2>&1" >> "$temp_cron"
|
||||||
|
fi
|
||||||
|
|
||||||
|
crontab "$temp_cron" 2>/dev/null
|
||||||
|
rm -f "$temp_cron"
|
||||||
|
}
|
||||||
|
|
||||||
|
hijack_resolv_conf() {
|
||||||
|
grep -q ' /tmp/resolv\.conf ' /proc/mounts && return 0
|
||||||
|
|
||||||
|
grep -E '^(search|domain) ' /tmp/resolv.conf > "$RESOLV_DAED" 2>/dev/null
|
||||||
|
|
||||||
|
local dns_list LOGICAL_WAN
|
||||||
|
. /lib/functions/network.sh
|
||||||
|
network_find_wan LOGICAL_WAN 2>/dev/null
|
||||||
|
if [ -n "$LOGICAL_WAN" ]; then
|
||||||
|
dns_list=$(ubus call "network.interface.$LOGICAL_WAN" status 2>/dev/null | \
|
||||||
|
jsonfilter -e '@["dns-server"][*]' 2>/dev/null)
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$dns_list" ] && [ -f "/tmp/resolv.conf.d/resolv.conf.auto" ]; then
|
||||||
|
dns_list=$(awk '/^nameserver/{print $2}' "/tmp/resolv.conf.d/resolv.conf.auto")
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ -z "$dns_list" ] && dns_list="119.29.29.29 223.5.5.5"
|
||||||
|
|
||||||
|
for dns in $dns_list; do
|
||||||
|
echo "nameserver $dns" >> "$RESOLV_DAED"
|
||||||
|
done
|
||||||
|
|
||||||
|
mount --bind "$RESOLV_DAED" /tmp/resolv.conf
|
||||||
|
mount -o remount,ro,bind /tmp/resolv.conf
|
||||||
|
}
|
||||||
|
|
||||||
|
restore_resolv_conf() {
|
||||||
|
grep -q ' /tmp/resolv\.conf ' /proc/mounts || return 0
|
||||||
|
mount -o remount,rw,bind /tmp/resolv.conf 2>/dev/null
|
||||||
|
umount /tmp/resolv.conf 2>/dev/null
|
||||||
|
rm -f "$RESOLV_DAED"
|
||||||
|
}
|
||||||
|
|
||||||
|
start_service() {
|
||||||
|
[ -f "/etc/init.d/daed" ] && grep -q "DAE_LOCATION_ASSET" "/etc/init.d/daed" || sed -i '/run/i\ procd_set_param env DAE_LOCATION_ASSET="/usr/share/v2ray"' "/etc/init.d/daed"
|
||||||
|
config_load "$CONF"
|
||||||
|
|
||||||
|
local enabled
|
||||||
|
config_get_bool enabled "config" "enabled" "0"
|
||||||
|
if [ "$enabled" -eq 0 ]; then
|
||||||
|
update_cron "remove"
|
||||||
|
restore_resolv_conf
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
update_cron "add"
|
||||||
|
hijack_resolv_conf
|
||||||
|
}
|
||||||
|
|
||||||
|
stop_service() {
|
||||||
|
update_cron "remove"
|
||||||
|
restore_resolv_conf
|
||||||
|
}
|
||||||
|
|
||||||
|
service_triggers() {
|
||||||
|
procd_add_reload_trigger "$CONF"
|
||||||
|
}
|
||||||
|
|
||||||
|
reload_service() {
|
||||||
|
restart
|
||||||
|
}
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
{
|
|
||||||
"admin/services/daed": {
|
|
||||||
"title": "daed",
|
|
||||||
"order": 20,
|
|
||||||
"action": {
|
|
||||||
"type": "firstchild"
|
|
||||||
},
|
|
||||||
"depends": {
|
|
||||||
"acl": [ "luci-app-daed" ],
|
|
||||||
"uci": { "daed": true }
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"admin/services/daed/config": {
|
|
||||||
"title": "Settings",
|
|
||||||
"order": 10,
|
|
||||||
"action": {
|
|
||||||
"type": "view",
|
|
||||||
"path": "daed/config"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"admin/services/daed/log": {
|
|
||||||
"title": "Log",
|
|
||||||
"order": 20,
|
|
||||||
"action": {
|
|
||||||
"type": "view",
|
|
||||||
"path": "daed/log"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,13 +1,7 @@
|
|||||||
{
|
{
|
||||||
"luci-app-daed": {
|
"luci-app-daed": {
|
||||||
"description": "Grant access to daed configuration",
|
"description": "Grant UCI access for luci-app-daed",
|
||||||
"read": {
|
"read": {
|
||||||
"file": {
|
|
||||||
"/var/log/daed/daed.log": [ "read" ]
|
|
||||||
},
|
|
||||||
"ubus": {
|
|
||||||
"service": [ "list" ]
|
|
||||||
},
|
|
||||||
"uci": [ "daed" ]
|
"uci": [ "daed" ]
|
||||||
},
|
},
|
||||||
"write": {
|
"write": {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
|
|||||||
|
|
||||||
PKG_NAME:=luci-app-passwall
|
PKG_NAME:=luci-app-passwall
|
||||||
PKG_VERSION:=26.8.19
|
PKG_VERSION:=26.8.19
|
||||||
PKG_RELEASE:=242
|
PKG_RELEASE:=243
|
||||||
PKG_PO_VERSION:=$(PKG_VERSION)
|
PKG_PO_VERSION:=$(PKG_VERSION)
|
||||||
|
|
||||||
PKG_CONFIG_DEPENDS:= \
|
PKG_CONFIG_DEPENDS:= \
|
||||||
|
|||||||
@@ -1268,11 +1268,18 @@ function gen_config(var)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function get_node_by_id(node_id)
|
function get_node_by_id(node_id)
|
||||||
if not node_id or node_id == "" or node_id == "nil" then return nil end
|
local section
|
||||||
local section = api.uci_get_c(node_id) or {}
|
if type(node_id) == "table" then
|
||||||
|
section = node_id
|
||||||
|
elseif type(node_id) == "string" then
|
||||||
|
if node_id == "" or node_id == "nil" then return nil end
|
||||||
|
section = api.uci_get_c(node_id) or {}
|
||||||
|
else
|
||||||
|
return nil
|
||||||
|
end
|
||||||
if section[".type"] == "socks" then
|
if section[".type"] == "socks" then
|
||||||
local result = {
|
return {
|
||||||
[".name"] = node_id,
|
[".name"] = section[".name"],
|
||||||
remarks = "socks[%s]" % section.port,
|
remarks = "socks[%s]" % section.port,
|
||||||
type = "sing-box",
|
type = "sing-box",
|
||||||
protocol = "socks",
|
protocol = "socks",
|
||||||
@@ -1280,7 +1287,6 @@ function gen_config(var)
|
|||||||
port = section.port,
|
port = section.port,
|
||||||
uot = "1"
|
uot = "1"
|
||||||
}
|
}
|
||||||
return result
|
|
||||||
end
|
end
|
||||||
if section[".type"] == "nodes" then
|
if section[".type"] == "nodes" then
|
||||||
return section
|
return section
|
||||||
@@ -1447,12 +1453,7 @@ function gen_config(var)
|
|||||||
|
|
||||||
function gen_outbound_get_tag(flag, node_id, tag, proxy_table)
|
function gen_outbound_get_tag(flag, node_id, tag, proxy_table)
|
||||||
if not node_id or node_id == "nil" then return nil end
|
if not node_id or node_id == "nil" then return nil end
|
||||||
local node
|
local node = get_node_by_id(node_id)
|
||||||
if type(node_id) == "string" then
|
|
||||||
node = get_node_by_id(node_id)
|
|
||||||
elseif type(node_id) == "table" then
|
|
||||||
node = node_id
|
|
||||||
end
|
|
||||||
if not tag then tag = node[".name"] end
|
if not tag then tag = node[".name"] end
|
||||||
if node then
|
if node then
|
||||||
if proxy_table.chain_proxy == "1" or proxy_table.chain_proxy == "2" then
|
if proxy_table.chain_proxy == "1" or proxy_table.chain_proxy == "2" then
|
||||||
|
|||||||
@@ -1010,11 +1010,18 @@ function gen_config(var)
|
|||||||
|
|
||||||
|
|
||||||
function get_node_by_id(node_id)
|
function get_node_by_id(node_id)
|
||||||
if not node_id or node_id == "" or node_id == "nil" then return nil end
|
local section
|
||||||
local section = api.uci_get_c(node_id) or {}
|
if type(node_id) == "table" then
|
||||||
|
section = node_id
|
||||||
|
elseif type(node_id) == "string" then
|
||||||
|
if node_id == "" or node_id == "nil" then return nil end
|
||||||
|
section = api.uci_get_c(node_id) or {}
|
||||||
|
else
|
||||||
|
return nil
|
||||||
|
end
|
||||||
if section[".type"] == "socks" then
|
if section[".type"] == "socks" then
|
||||||
local result = {
|
return {
|
||||||
[".name"] = node_id,
|
[".name"] = section[".name"],
|
||||||
remarks = "socks[%s]" % section.port,
|
remarks = "socks[%s]" % section.port,
|
||||||
type = "Xray",
|
type = "Xray",
|
||||||
protocol = "socks",
|
protocol = "socks",
|
||||||
@@ -1023,7 +1030,6 @@ function gen_config(var)
|
|||||||
transport = "tcp",
|
transport = "tcp",
|
||||||
stream_security = "none"
|
stream_security = "none"
|
||||||
}
|
}
|
||||||
return result
|
|
||||||
end
|
end
|
||||||
if section[".type"] == "nodes" then
|
if section[".type"] == "nodes" then
|
||||||
return section
|
return section
|
||||||
@@ -1272,12 +1278,7 @@ function gen_config(var)
|
|||||||
|
|
||||||
function gen_outbound_get_tag(flag, node_id, tag, proxy_table)
|
function gen_outbound_get_tag(flag, node_id, tag, proxy_table)
|
||||||
if not node_id or node_id == "" or node_id == "nil" then return nil end
|
if not node_id or node_id == "" or node_id == "nil" then return nil end
|
||||||
local node
|
local node = get_node_by_id(node_id)
|
||||||
if type(node_id) == "string" then
|
|
||||||
node = get_node_by_id(node_id)
|
|
||||||
elseif type(node_id) == "table" then
|
|
||||||
node = node_id
|
|
||||||
end
|
|
||||||
if not tag then tag = node[".name"] end
|
if not tag then tag = node[".name"] end
|
||||||
if node then
|
if node then
|
||||||
if proxy_table.chain_proxy == "1" or proxy_table.chain_proxy == "2" then
|
if proxy_table.chain_proxy == "1" or proxy_table.chain_proxy == "2" then
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk
|
|||||||
|
|
||||||
PKG_NAME:=luci-app-passwall2
|
PKG_NAME:=luci-app-passwall2
|
||||||
PKG_VERSION:=26.8.20
|
PKG_VERSION:=26.8.20
|
||||||
PKG_RELEASE:=100
|
PKG_RELEASE:=101
|
||||||
PKG_PO_VERSION:=$(PKG_VERSION)
|
PKG_PO_VERSION:=$(PKG_VERSION)
|
||||||
|
|
||||||
PKG_CONFIG_DEPENDS:= \
|
PKG_CONFIG_DEPENDS:= \
|
||||||
|
|||||||
@@ -1311,11 +1311,18 @@ function gen_config(var)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function get_node_by_id(node_id)
|
function get_node_by_id(node_id)
|
||||||
if not node_id or node_id == "" or node_id == "nil" then return nil end
|
local section
|
||||||
local section = api.uci_get_c(node_id) or {}
|
if type(node_id) == "table" then
|
||||||
|
section = node_id
|
||||||
|
elseif type(node_id) == "string" then
|
||||||
|
if node_id == "" or node_id == "nil" then return nil end
|
||||||
|
section = api.uci_get_c(node_id) or {}
|
||||||
|
else
|
||||||
|
return nil
|
||||||
|
end
|
||||||
if section[".type"] == "socks" then
|
if section[".type"] == "socks" then
|
||||||
local result = {
|
return {
|
||||||
[".name"] = node_id,
|
[".name"] = section[".name"],
|
||||||
remarks = "socks[%s]" % section.port,
|
remarks = "socks[%s]" % section.port,
|
||||||
type = "sing-box",
|
type = "sing-box",
|
||||||
protocol = "socks",
|
protocol = "socks",
|
||||||
@@ -1323,7 +1330,6 @@ function gen_config(var)
|
|||||||
port = section.port,
|
port = section.port,
|
||||||
uot = "1"
|
uot = "1"
|
||||||
}
|
}
|
||||||
return result
|
|
||||||
end
|
end
|
||||||
if section[".type"] == "nodes" then
|
if section[".type"] == "nodes" then
|
||||||
return section
|
return section
|
||||||
@@ -1487,12 +1493,7 @@ function gen_config(var)
|
|||||||
|
|
||||||
function gen_outbound_get_tag(flag, node_id, tag, proxy_table)
|
function gen_outbound_get_tag(flag, node_id, tag, proxy_table)
|
||||||
if not node_id or node_id == "nil" then return nil end
|
if not node_id or node_id == "nil" then return nil end
|
||||||
local node
|
local node = get_node_by_id(node_id)
|
||||||
if type(node_id) == "string" then
|
|
||||||
node = get_node_by_id(node_id)
|
|
||||||
elseif type(node_id) == "table" then
|
|
||||||
node = node_id
|
|
||||||
end
|
|
||||||
if not tag then tag = node[".name"] end
|
if not tag then tag = node[".name"] end
|
||||||
if node then
|
if node then
|
||||||
if proxy_table.chain_proxy == "1" or proxy_table.chain_proxy == "2" then
|
if proxy_table.chain_proxy == "1" or proxy_table.chain_proxy == "2" then
|
||||||
|
|||||||
@@ -1010,11 +1010,18 @@ function gen_config(var)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function get_node_by_id(node_id)
|
function get_node_by_id(node_id)
|
||||||
if not node_id or node_id == "" or node_id == "nil" then return nil end
|
local section
|
||||||
local section = api.uci_get_c(node_id) or {}
|
if type(node_id) == "table" then
|
||||||
|
section = node_id
|
||||||
|
elseif type(node_id) == "string" then
|
||||||
|
if node_id == "" or node_id == "nil" then return nil end
|
||||||
|
section = api.uci_get_c(node_id) or {}
|
||||||
|
else
|
||||||
|
return nil
|
||||||
|
end
|
||||||
if section[".type"] == "socks" then
|
if section[".type"] == "socks" then
|
||||||
local result = {
|
return {
|
||||||
[".name"] = node_id,
|
[".name"] = section[".name"],
|
||||||
remarks = "socks[%s]" % section.port,
|
remarks = "socks[%s]" % section.port,
|
||||||
type = "Xray",
|
type = "Xray",
|
||||||
protocol = "socks",
|
protocol = "socks",
|
||||||
@@ -1023,7 +1030,6 @@ function gen_config(var)
|
|||||||
transport = "tcp",
|
transport = "tcp",
|
||||||
stream_security = "none"
|
stream_security = "none"
|
||||||
}
|
}
|
||||||
return result
|
|
||||||
end
|
end
|
||||||
if section[".type"] == "nodes" then
|
if section[".type"] == "nodes" then
|
||||||
return section
|
return section
|
||||||
@@ -1269,12 +1275,7 @@ function gen_config(var)
|
|||||||
|
|
||||||
function gen_outbound_get_tag(flag, node_id, tag, proxy_table)
|
function gen_outbound_get_tag(flag, node_id, tag, proxy_table)
|
||||||
if not node_id or node_id == "" or node_id == "nil" then return nil end
|
if not node_id or node_id == "" or node_id == "nil" then return nil end
|
||||||
local node
|
local node = get_node_by_id(node_id)
|
||||||
if type(node_id) == "string" then
|
|
||||||
node = get_node_by_id(node_id)
|
|
||||||
elseif type(node_id) == "table" then
|
|
||||||
node = node_id
|
|
||||||
end
|
|
||||||
if not tag then tag = node[".name"] end
|
if not tag then tag = node[".name"] end
|
||||||
if node then
|
if node then
|
||||||
if proxy_table.chain_proxy == "1" or proxy_table.chain_proxy == "2" then
|
if proxy_table.chain_proxy == "1" or proxy_table.chain_proxy == "2" then
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_VERSION:=1.2.0-r1
|
PKG_VERSION:=1.3.0-r1
|
||||||
PKG_RELEASE:=5
|
PKG_RELEASE:=6
|
||||||
|
|
||||||
LUCI_TITLE:=LuCI support for shadowrt
|
LUCI_TITLE:=LuCI support for shadowrt
|
||||||
LUCI_PKGARCH:=all
|
LUCI_PKGARCH:=all
|
||||||
|
|||||||
@@ -88,6 +88,9 @@ end
|
|||||||
o = s:option(Flag, "mnt", translate("Share /mnt"), translate("Share host's /mnt directory"))
|
o = s:option(Flag, "mnt", translate("Share /mnt"), translate("Share host's /mnt directory"))
|
||||||
o.default = 0
|
o.default = 0
|
||||||
|
|
||||||
|
o = s:option(Flag, "dind", translate("Enable Docker-in-Docker"), translate("Enable Docker in this instance"))
|
||||||
|
o.default = 0
|
||||||
|
|
||||||
o = s:option(ListValue, "proto", translate("IP Protocol"), translate("Select how this instance gets its IP address"))
|
o = s:option(ListValue, "proto", translate("IP Protocol"), translate("Select how this instance gets its IP address"))
|
||||||
o:value("static", translate("Static address"))
|
o:value("static", translate("Static address"))
|
||||||
o:value("dhcp", translate("DHCP client"))
|
o:value("dhcp", translate("DHCP client"))
|
||||||
|
|||||||
@@ -29,15 +29,15 @@ msgstr ""
|
|||||||
msgid "Copy/Edit"
|
msgid "Copy/Edit"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: luasrc/model/cbi/shadowrt/config.lua:109
|
#: luasrc/model/cbi/shadowrt/config.lua:112
|
||||||
msgid "DHCP Server"
|
msgid "DHCP Server"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: luasrc/model/cbi/shadowrt/config.lua:93
|
#: luasrc/model/cbi/shadowrt/config.lua:96
|
||||||
msgid "DHCP client"
|
msgid "DHCP client"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: luasrc/model/cbi/shadowrt/config.lua:105
|
#: luasrc/model/cbi/shadowrt/config.lua:108
|
||||||
msgid "DNS Servers"
|
msgid "DNS Servers"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@@ -55,29 +55,37 @@ msgid ""
|
|||||||
"ID in the same data directory will use this data)"
|
"ID in the same data directory will use this data)"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: luasrc/model/cbi/shadowrt/config.lua:109
|
#: luasrc/model/cbi/shadowrt/config.lua:112
|
||||||
msgid "Enable DHCP server on this instance"
|
msgid "Enable DHCP server on this instance"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: luasrc/model/cbi/shadowrt/config.lua:91
|
||||||
|
msgid "Enable Docker in this instance"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: luasrc/model/cbi/shadowrt/config.lua:91
|
||||||
|
msgid "Enable Docker-in-Docker"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: luasrc/view/shadowrt/status.htm:7
|
#: luasrc/view/shadowrt/status.htm:7
|
||||||
msgid ""
|
msgid ""
|
||||||
"Executing a shutdown within the clone will restart the clone. To shut down, "
|
"Executing a shutdown within the clone will restart the clone. To shut down, "
|
||||||
"use the \"Stop\" button below."
|
"use the \"Stop\" button below."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: luasrc/model/cbi/shadowrt/config.lua:96
|
#: luasrc/model/cbi/shadowrt/config.lua:99
|
||||||
msgid "Format: xxx.xxx.xxx.xxx/xx"
|
msgid "Format: xxx.xxx.xxx.xxx/xx"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: luasrc/model/cbi/shadowrt/config.lua:101
|
#: luasrc/model/cbi/shadowrt/config.lua:104
|
||||||
msgid "Gateway"
|
msgid "Gateway"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: luasrc/model/cbi/shadowrt/config.lua:96
|
#: luasrc/model/cbi/shadowrt/config.lua:99
|
||||||
msgid "IP Address"
|
msgid "IP Address"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: luasrc/model/cbi/shadowrt/config.lua:91
|
#: luasrc/model/cbi/shadowrt/config.lua:94
|
||||||
msgid "IP Protocol"
|
msgid "IP Protocol"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@@ -97,7 +105,7 @@ msgstr ""
|
|||||||
msgid "Loading view…"
|
msgid "Loading view…"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: luasrc/model/cbi/shadowrt/config.lua:105
|
#: luasrc/model/cbi/shadowrt/config.lua:108
|
||||||
msgid ""
|
msgid ""
|
||||||
"Multiple DNS servers can be separated by spaces, e.g., '8.8.8.8 8.8.4.4'"
|
"Multiple DNS servers can be separated by spaces, e.g., '8.8.8.8 8.8.4.4'"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@@ -136,7 +144,7 @@ msgstr ""
|
|||||||
msgid "Running"
|
msgid "Running"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: luasrc/model/cbi/shadowrt/config.lua:91
|
#: luasrc/model/cbi/shadowrt/config.lua:94
|
||||||
msgid "Select how this instance gets its IP address"
|
msgid "Select how this instance gets its IP address"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@@ -181,7 +189,7 @@ msgstr ""
|
|||||||
msgid "Starting"
|
msgid "Starting"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: luasrc/model/cbi/shadowrt/config.lua:92
|
#: luasrc/model/cbi/shadowrt/config.lua:95
|
||||||
msgid "Static address"
|
msgid "Static address"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
|||||||
@@ -32,15 +32,15 @@ msgstr "配置"
|
|||||||
msgid "Copy/Edit"
|
msgid "Copy/Edit"
|
||||||
msgstr "复制/编辑"
|
msgstr "复制/编辑"
|
||||||
|
|
||||||
#: luasrc/model/cbi/shadowrt/config.lua:109
|
#: luasrc/model/cbi/shadowrt/config.lua:112
|
||||||
msgid "DHCP Server"
|
msgid "DHCP Server"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: luasrc/model/cbi/shadowrt/config.lua:93
|
#: luasrc/model/cbi/shadowrt/config.lua:96
|
||||||
msgid "DHCP client"
|
msgid "DHCP client"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: luasrc/model/cbi/shadowrt/config.lua:105
|
#: luasrc/model/cbi/shadowrt/config.lua:108
|
||||||
msgid "DNS Servers"
|
msgid "DNS Servers"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@@ -60,29 +60,37 @@ msgstr ""
|
|||||||
"是否同时删除实例数据?(若保留,未来相同数据目录下创建相同 ID 的实例将会使用"
|
"是否同时删除实例数据?(若保留,未来相同数据目录下创建相同 ID 的实例将会使用"
|
||||||
"此数据)"
|
"此数据)"
|
||||||
|
|
||||||
#: luasrc/model/cbi/shadowrt/config.lua:109
|
#: luasrc/model/cbi/shadowrt/config.lua:112
|
||||||
msgid "Enable DHCP server on this instance"
|
msgid "Enable DHCP server on this instance"
|
||||||
msgstr "这个实例提供 DHCP 服务"
|
msgstr "这个实例提供 DHCP 服务"
|
||||||
|
|
||||||
|
#: luasrc/model/cbi/shadowrt/config.lua:91
|
||||||
|
msgid "Enable Docker in this instance"
|
||||||
|
msgstr "在这个实例启用 Docker"
|
||||||
|
|
||||||
|
#: luasrc/model/cbi/shadowrt/config.lua:91
|
||||||
|
msgid "Enable Docker-in-Docker"
|
||||||
|
msgstr "启用 Docker-in-Docker"
|
||||||
|
|
||||||
#: luasrc/view/shadowrt/status.htm:7
|
#: luasrc/view/shadowrt/status.htm:7
|
||||||
msgid ""
|
msgid ""
|
||||||
"Executing a shutdown within the clone will restart the clone. To shut down, "
|
"Executing a shutdown within the clone will restart the clone. To shut down, "
|
||||||
"use the \"Stop\" button below."
|
"use the \"Stop\" button below."
|
||||||
msgstr "分身内执行关机会重启分身,如果要关机,使用下面的“停止”按钮。"
|
msgstr "分身内执行关机会重启分身,如果要关机,使用下面的“停止”按钮。"
|
||||||
|
|
||||||
#: luasrc/model/cbi/shadowrt/config.lua:96
|
#: luasrc/model/cbi/shadowrt/config.lua:99
|
||||||
msgid "Format: xxx.xxx.xxx.xxx/xx"
|
msgid "Format: xxx.xxx.xxx.xxx/xx"
|
||||||
msgstr "格式:xxx.xxx.xxx.xxx/xx"
|
msgstr "格式:xxx.xxx.xxx.xxx/xx"
|
||||||
|
|
||||||
#: luasrc/model/cbi/shadowrt/config.lua:101
|
#: luasrc/model/cbi/shadowrt/config.lua:104
|
||||||
msgid "Gateway"
|
msgid "Gateway"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: luasrc/model/cbi/shadowrt/config.lua:96
|
#: luasrc/model/cbi/shadowrt/config.lua:99
|
||||||
msgid "IP Address"
|
msgid "IP Address"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: luasrc/model/cbi/shadowrt/config.lua:91
|
#: luasrc/model/cbi/shadowrt/config.lua:94
|
||||||
msgid "IP Protocol"
|
msgid "IP Protocol"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@@ -102,7 +110,7 @@ msgstr "操作说明"
|
|||||||
msgid "Loading view…"
|
msgid "Loading view…"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: luasrc/model/cbi/shadowrt/config.lua:105
|
#: luasrc/model/cbi/shadowrt/config.lua:108
|
||||||
msgid ""
|
msgid ""
|
||||||
"Multiple DNS servers can be separated by spaces, e.g., '8.8.8.8 8.8.4.4'"
|
"Multiple DNS servers can be separated by spaces, e.g., '8.8.8.8 8.8.4.4'"
|
||||||
msgstr "多个 DNS 可以用空格隔开,例如‘8.8.8.8 8.8.4.4’"
|
msgstr "多个 DNS 可以用空格隔开,例如‘8.8.8.8 8.8.4.4’"
|
||||||
@@ -141,7 +149,7 @@ msgstr "重启中"
|
|||||||
msgid "Running"
|
msgid "Running"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: luasrc/model/cbi/shadowrt/config.lua:91
|
#: luasrc/model/cbi/shadowrt/config.lua:94
|
||||||
msgid "Select how this instance gets its IP address"
|
msgid "Select how this instance gets its IP address"
|
||||||
msgstr "实例如何获取自身 IP 地址"
|
msgstr "实例如何获取自身 IP 地址"
|
||||||
|
|
||||||
@@ -191,7 +199,7 @@ msgstr ""
|
|||||||
msgid "Starting"
|
msgid "Starting"
|
||||||
msgstr "启动中"
|
msgstr "启动中"
|
||||||
|
|
||||||
#: luasrc/model/cbi/shadowrt/config.lua:92
|
#: luasrc/model/cbi/shadowrt/config.lua:95
|
||||||
msgid "Static address"
|
msgid "Static address"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ config instance
|
|||||||
option 'id' 'shadowrt0'
|
option 'id' 'shadowrt0'
|
||||||
# option 'data' '/mnt/data/shadowrt'
|
# option 'data' '/mnt/data/shadowrt'
|
||||||
option 'mnt' '0'
|
option 'mnt' '0'
|
||||||
|
option 'dind' '0'
|
||||||
option 'proto' 'static'
|
option 'proto' 'static'
|
||||||
option 'address' '192.168.100.2/24'
|
option 'address' '192.168.100.2/24'
|
||||||
option 'gateway' '192.168.100.1'
|
option 'gateway' '192.168.100.1'
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ do_install() {
|
|||||||
local id="`uci get shadowrt.@instance[0].id 2>/dev/null`"
|
local id="`uci get shadowrt.@instance[0].id 2>/dev/null`"
|
||||||
local data="`uci get shadowrt.@instance[0].data 2>/dev/null`"
|
local data="`uci get shadowrt.@instance[0].data 2>/dev/null`"
|
||||||
local mnt="`uci get shadowrt.@instance[0].mnt 2>/dev/null`"
|
local mnt="`uci get shadowrt.@instance[0].mnt 2>/dev/null`"
|
||||||
|
local dind="`uci get shadowrt.@instance[0].dind 2>/dev/null`"
|
||||||
local proto=`uci get shadowrt.@instance[0].proto 2>/dev/null`
|
local proto=`uci get shadowrt.@instance[0].proto 2>/dev/null`
|
||||||
local address=`uci get shadowrt.@instance[0].address 2>/dev/null`
|
local address=`uci get shadowrt.@instance[0].address 2>/dev/null`
|
||||||
local gateway=`uci get shadowrt.@instance[0].gateway 2>/dev/null`
|
local gateway=`uci get shadowrt.@instance[0].gateway 2>/dev/null`
|
||||||
@@ -47,7 +48,7 @@ do_install() {
|
|||||||
echo "WARNING: $data/$id already exists, may use old data." >&2
|
echo "WARNING: $data/$id already exists, may use old data." >&2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local config="{\"id\":\"$id\",\"data\":\"$data\",\"mnt\":\"$mnt\",\"proto\":\"$proto\",\"address\":\"$address\",\"gateway\":\"$gateway\",\"dns\":\"$dns\",\"dhcp_server\":\"$dhcp_server\",\"ports\":\"$ports\"}"
|
local config="{\"id\":\"$id\",\"data\":\"$data\",\"mnt\":\"$mnt\",\"dind\":\"$dind\",\"proto\":\"$proto\",\"address\":\"$address\",\"gateway\":\"$gateway\",\"dns\":\"$dns\",\"dhcp_server\":\"$dhcp_server\",\"ports\":\"$ports\"}"
|
||||||
|
|
||||||
local cmd="docker run --restart=unless-stopped -d \
|
local cmd="docker run --restart=unless-stopped -d \
|
||||||
--stop-signal SIGINT \
|
--stop-signal SIGINT \
|
||||||
@@ -56,7 +57,6 @@ do_install() {
|
|||||||
--security-opt apparmor=unconfined \
|
--security-opt apparmor=unconfined \
|
||||||
--cap-add=SYS_ADMIN \
|
--cap-add=SYS_ADMIN \
|
||||||
--cap-add=SYS_CHROOT \
|
--cap-add=SYS_CHROOT \
|
||||||
--cap-drop=MKNOD \
|
|
||||||
--cap-add=LEASE \
|
--cap-add=LEASE \
|
||||||
--cap-add=SETGID \
|
--cap-add=SETGID \
|
||||||
--cap-add=SETUID \
|
--cap-add=SETUID \
|
||||||
@@ -75,6 +75,12 @@ do_install() {
|
|||||||
--label 'com.shadowrt.config=$config' \
|
--label 'com.shadowrt.config=$config' \
|
||||||
-v '$data/$id/overlay:/overlay:rw' "
|
-v '$data/$id/overlay:/overlay:rw' "
|
||||||
|
|
||||||
|
if [ "$dind" = "1" -o "$dind" = "on" ]; then
|
||||||
|
cmd="$cmd -e DIND=on"
|
||||||
|
else
|
||||||
|
cmd="$cmd --cap-drop=MKNOD"
|
||||||
|
fi
|
||||||
|
|
||||||
[ -n "$proto" ] && cmd="$cmd -e IP_PROTO=$proto"
|
[ -n "$proto" ] && cmd="$cmd -e IP_PROTO=$proto"
|
||||||
if [ "$proto" = "static" ]; then
|
if [ "$proto" = "static" ]; then
|
||||||
[ -n "$address" ] && cmd="$cmd -e IP_ADDRESS=$address"
|
[ -n "$address" ] && cmd="$cmd -e IP_ADDRESS=$address"
|
||||||
@@ -143,6 +149,7 @@ do_clone() {
|
|||||||
echo "$config_json" | jsonfilter -e 'id=$.id' \
|
echo "$config_json" | jsonfilter -e 'id=$.id' \
|
||||||
-e 'data=$.data' \
|
-e 'data=$.data' \
|
||||||
-e 'mnt=$.mnt' \
|
-e 'mnt=$.mnt' \
|
||||||
|
-e 'dind=$.dind' \
|
||||||
-e 'proto=$.proto' \
|
-e 'proto=$.proto' \
|
||||||
-e 'address=$.address' \
|
-e 'address=$.address' \
|
||||||
-e 'gateway=$.gateway' \
|
-e 'gateway=$.gateway' \
|
||||||
@@ -182,11 +189,12 @@ do_reset_network() {
|
|||||||
/bin/config_generate
|
/bin/config_generate
|
||||||
/bin/sh -c ". /rom/etc/uci-defaults/zzz-dockerenv"
|
/bin/sh -c ". /rom/etc/uci-defaults/zzz-dockerenv"
|
||||||
/bin/sh -c '. /rom/etc/uci-defaults/12_network-generate-ula'
|
/bin/sh -c '. /rom/etc/uci-defaults/12_network-generate-ula'
|
||||||
|
/bin/sh -c '. /rom/etc/uci-defaults/14_network-generate-duid'
|
||||||
/etc/init.d/network restart
|
/etc/init.d/network restart
|
||||||
sleep 2
|
sleep 2
|
||||||
EOF
|
EOF
|
||||||
else
|
else
|
||||||
echo 'rm -f etc/uci-defaults/zzz-dockerenv etc/uci-defaults/12_network-generate-ula'
|
echo 'rm -f etc/uci-defaults/zzz-dockerenv etc/uci-defaults/12_network-generate-ula etc/uci-defaults/14_network-generate-duid'
|
||||||
fi
|
fi
|
||||||
} | sh -c "$shell"
|
} | sh -c "$shell"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,10 +2,15 @@
|
|||||||
|
|
||||||
mkdir -p /var/lock
|
mkdir -p /var/lock
|
||||||
|
|
||||||
for service in adb-enablemodem appfilter dockerd gpio_switch hd-idle \
|
ADD_SERVICES=
|
||||||
|
|
||||||
|
[ "on" = "$DIND" ] || ADD_SERVICES="$ADD_SERVICES dockerd"
|
||||||
|
|
||||||
|
for service in adb-enablemodem appfilter gpio_switch hd-idle \
|
||||||
kmods kmods-unload lcdsimple led lm-sensors luci-fan \
|
kmods kmods-unload lcdsimple led lm-sensors luci-fan \
|
||||||
mdadm modemmanager odhcpd smartd sysfixtime sysfsutils sysntpd \
|
mdadm modemmanager odhcpd smartd sysfixtime sysfsutils sysntpd \
|
||||||
tuning_net umount usbmode usbmuxd wan_drop zprintk zram \
|
tuning_net umount usbmode usbmuxd wan_drop zprintk zram \
|
||||||
|
$ADD_SERVICES \
|
||||||
log
|
log
|
||||||
do
|
do
|
||||||
[ -x /etc/init.d/$service ] && /etc/init.d/$service disable
|
[ -x /etc/init.d/$service ] && /etc/init.d/$service disable
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ mount --make-private /overlay
|
|||||||
mount -t tmpfs -o ro,relatime tmpfs /sys/block
|
mount -t tmpfs -o ro,relatime tmpfs /sys/block
|
||||||
mount -t tmpfs -o size=1M tmpfs /tmp
|
mount -t tmpfs -o size=1M tmpfs /tmp
|
||||||
|
|
||||||
|
[ "on" = "$DIND" ] && mount -o rw,remount /sys/fs/cgroup
|
||||||
|
|
||||||
# make all private except /mnt
|
# make all private except /mnt
|
||||||
mkdir -p $PATCHROM
|
mkdir -p $PATCHROM
|
||||||
mount --bind / $PATCHROM
|
mount --bind / $PATCHROM
|
||||||
@@ -66,6 +68,9 @@ umount $PATCHROM/tmp/shadowrt
|
|||||||
umount $PATCHROM/tmp
|
umount $PATCHROM/tmp
|
||||||
rm -rf /tmp/tmp
|
rm -rf /tmp/tmp
|
||||||
|
|
||||||
|
export -n DIND
|
||||||
|
unset DIND
|
||||||
|
|
||||||
set_default_ip()
|
set_default_ip()
|
||||||
{
|
{
|
||||||
local ip=$1
|
local ip=$1
|
||||||
|
|||||||
@@ -15,12 +15,12 @@
|
|||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=luci-app-wwand
|
PKG_NAME:=luci-app-wwand
|
||||||
PKG_RELEASE:=4
|
PKG_RELEASE:=5
|
||||||
|
|
||||||
PKG_SOURCE_PROTO:=git
|
PKG_SOURCE_PROTO:=git
|
||||||
PKG_SOURCE_URL:=https://github.com/ddimension/luci-app-wwand.git
|
PKG_SOURCE_URL:=https://github.com/ddimension/luci-app-wwand.git
|
||||||
PKG_SOURCE_VERSION:=7f0c58f56cc060bd3355fed7fd86a68ad7003e9e
|
PKG_SOURCE_VERSION:=ae57d82431f6c65e6afa27267bfb71c8bea39bff
|
||||||
PKG_SOURCE_DATE:=2026-08-24
|
PKG_SOURCE_DATE:=2026-08-25
|
||||||
PKG_MIRROR_HASH:=skip
|
PKG_MIRROR_HASH:=skip
|
||||||
|
|
||||||
PKG_LICENSE:=GPL-2.0-only
|
PKG_LICENSE:=GPL-2.0-only
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
include $(TOPDIR)/rules.mk
|
|
||||||
|
|
||||||
PKG_NAME:=luci-app-zabbix
|
|
||||||
|
|
||||||
LUCI_TITLE:=zabbix agentd configuration
|
|
||||||
LUCI_DEPENDS:=+luci-base
|
|
||||||
LUCI_DEPENDS:=zabbix-agentd-ssl
|
|
||||||
LUCI_PKGARCH:=all
|
|
||||||
|
|
||||||
include $(TOPDIR)/feeds/luci/luci.mk
|
|
||||||
|
|
||||||
# call BuildPackage - OpenWrt buildroot signature
|
|
||||||
@@ -1,81 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
'require form';
|
|
||||||
'require view';
|
|
||||||
'require uci';
|
|
||||||
'require ui';
|
|
||||||
'require fs';
|
|
||||||
|
|
||||||
return view.extend({
|
|
||||||
render: function() {
|
|
||||||
|
|
||||||
var m, s, o;
|
|
||||||
|
|
||||||
m = new form.Map('zabbix', _('Zabbix Agent configuration'));
|
|
||||||
|
|
||||||
s = m.section(form.TypedSection, 'zabbix');
|
|
||||||
s.anonymous = true;
|
|
||||||
s.addremove = false;
|
|
||||||
s.tab('general', _('General Settings'));
|
|
||||||
s.tab('passive', _('Passive Checks'));
|
|
||||||
s.tab('active', _('Active Checks'));
|
|
||||||
s.tab('tls', _('TLS Configuration'));
|
|
||||||
|
|
||||||
o = s.taboption('general', form.Flag, 'enabled', _('Enabled'));
|
|
||||||
o.rmempty = false;
|
|
||||||
|
|
||||||
o = s.taboption('general', form.Value, 'hostname', _('Hostname'), _('Unique hostname used by the agent to register with the Zabbix server. Required for active checks and must match the node name specified on the server.'));
|
|
||||||
o.rmempty = false;
|
|
||||||
o.datatype = 'host';
|
|
||||||
o.cfgvalue = function(section_id) {
|
|
||||||
return uci.get('zabbix', section_id, 'hostname') || fs.trimmed('/proc/sys/kernel/hostname')
|
|
||||||
};
|
|
||||||
|
|
||||||
o = s.taboption('passive', form.DynamicList, 'server', _('Server'), _('List of IP addresses (or hostnames) of Zabbix servers allowed to connect to this agent. If 0.0.0.0/0 is specified, the agent will accept connections from any IP address.'));
|
|
||||||
o.rmempty = false;
|
|
||||||
o.datatype = 'or(cidr,ipmask,host)';
|
|
||||||
|
|
||||||
o = s.taboption('passive', form.Value, 'listen_ip', _('ListenIP'), _('IP address of the local network interfaces on which the Zabbix agent will listen for incoming connections from the server.'));
|
|
||||||
o.datatype = 'host';
|
|
||||||
|
|
||||||
o = s.taboption('passive', form.Value, 'listen_port', _('ListenPort'), _('The agent will listen on this port for connections from the server.'));
|
|
||||||
o.placeholder = 10050;
|
|
||||||
o.datatype = 'range(1024,32767)';
|
|
||||||
|
|
||||||
o = s.taboption('passive', form.ListValue, 'tls_accept', _('TLSAccept'), _('The parameter defines which types of TLS connections the agent will accept.'));
|
|
||||||
o.default = 'unencrypted';
|
|
||||||
o.value('unencrypted',_('without encryption'));
|
|
||||||
o.value('psk',_('pre-shared key'));
|
|
||||||
o.value('cert',_('certificate'));
|
|
||||||
|
|
||||||
o = s.taboption('active', form.Value, 'server_active', _('ServerActive'), _('IP address or hostname of the Zabbix server for active checks. If the parameter is not specified, active checks are disabled.'));
|
|
||||||
o.datatype = 'or(cidr,host,hostport,ipaddrport)';
|
|
||||||
|
|
||||||
o = s.taboption('active', form.ListValue, 'tls_connect', _('TLSConnect'), _('The parameter defines how the agent should establish a secure connection with the Zabbix server or proxy.'));
|
|
||||||
o.default = 'unencrypted';
|
|
||||||
o.value('unencrypted',_('without encryption'));
|
|
||||||
o.value('psk',_('pre-shared key'));
|
|
||||||
o.value('cert',_('certificate'));
|
|
||||||
|
|
||||||
o = s.taboption('tls', form.Value, 'tls_psk_identity', _('TLSPSKIdentity'), _('Pre-shared key identifier string. Used for unique identification and management of the pre-shared key, ensuring the security of the connection between the agent and the server.'));
|
|
||||||
o.depends({tls_accept: 'psk'});
|
|
||||||
o.depends({tls_connect: 'psk'});
|
|
||||||
|
|
||||||
o = s.taboption('tls', form.FileUpload, 'tls_psk_file', _('TLSPSKFile'), _('Agent pre-shared key.'));
|
|
||||||
o.depends({tls_accept: 'psk'});
|
|
||||||
o.depends({tls_connect: 'psk'});
|
|
||||||
|
|
||||||
o = s.taboption('tls', form.FileUpload, 'tls_ca_file', _('TLSCAFile'), _('Root CA certificate. Used for encrypted connections between Zabbix components.'));
|
|
||||||
o.depends({tls_accept: 'cert'});
|
|
||||||
o.depends({tls_connect: 'cert'});
|
|
||||||
|
|
||||||
o = s.taboption('tls', form.FileUpload, 'tls_cert_file', _('TLSCertFile'), _('Agent certificate or certificate chain used to establish secure (TLS/SSL) connections between Zabbix components.'));
|
|
||||||
o.depends({tls_accept: 'cert'});
|
|
||||||
o.depends({tls_connect: 'cert'});
|
|
||||||
|
|
||||||
o = s.taboption('tls', form.FileUpload, 'tls_key_file', _('TLSKeyFile'), _('Agent private key.'));
|
|
||||||
o.depends({tls_accept: 'cert'});
|
|
||||||
o.depends({tls_connect: 'cert'});
|
|
||||||
|
|
||||||
return m.render();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
@@ -1,95 +0,0 @@
|
|||||||
msgid "Zabbix Agent configuration"
|
|
||||||
msgstr "Zabbix Agent configuration"
|
|
||||||
|
|
||||||
msgid "General Settings"
|
|
||||||
msgstr "General Settings"
|
|
||||||
|
|
||||||
msgid "Passive Checks"
|
|
||||||
msgstr "Passive Checks"
|
|
||||||
|
|
||||||
msgid "Active Checks"
|
|
||||||
msgstr "Active Checks"
|
|
||||||
|
|
||||||
msgid "TLS Configuration"
|
|
||||||
msgstr "TLS Configuration"
|
|
||||||
|
|
||||||
msgid "Enabled"
|
|
||||||
msgstr "Enabled"
|
|
||||||
|
|
||||||
msgid "Hostname"
|
|
||||||
msgstr "Hostname"
|
|
||||||
|
|
||||||
msgid "Unique hostname used by the agent to register with the Zabbix server. Required for active checks and must match the node name specified on the server."
|
|
||||||
msgstr "Unique hostname used by the agent to register with the Zabbix server. Required for active checks and must match the node name specified on the server."
|
|
||||||
|
|
||||||
msgid "Server"
|
|
||||||
msgstr "Server"
|
|
||||||
|
|
||||||
msgid "List of IP addresses (or hostnames) of Zabbix servers allowed to connect to this agent. If 0.0.0.0/0 is specified, the agent will accept connections from any IP address."
|
|
||||||
msgstr "List of IP addresses (or hostnames) of Zabbix servers allowed to connect to this agent. If 0.0.0.0/0 is specified, the agent will accept connections from any IP address."
|
|
||||||
|
|
||||||
msgid "IP address of the local network interfaces on which the Zabbix agent will listen for incoming connections from the server."
|
|
||||||
msgstr "IP address of the local network interfaces on which the Zabbix agent will listen for incoming connections from the server."
|
|
||||||
|
|
||||||
msgid "ListenPort"
|
|
||||||
msgstr "ListenPort"
|
|
||||||
|
|
||||||
msgid "The agent will listen on this port for connections from the server."
|
|
||||||
msgstr "The agent will listen on this port for connections from the server."
|
|
||||||
|
|
||||||
msgid "TLSAccept"
|
|
||||||
msgstr "TLSAccept"
|
|
||||||
|
|
||||||
msgid "The parameter defines which types of TLS connections the agent will accept."
|
|
||||||
msgstr "The parameter defines which types of TLS connections the agent will accept."
|
|
||||||
|
|
||||||
msgid "without encryption"
|
|
||||||
msgstr "without encryption"
|
|
||||||
|
|
||||||
msgid "pre-shared key"
|
|
||||||
msgstr "pre-shared key"
|
|
||||||
|
|
||||||
msgid "certificate"
|
|
||||||
msgstr "certificate"
|
|
||||||
|
|
||||||
msgid "ServerActive"
|
|
||||||
msgstr "ServerActive"
|
|
||||||
|
|
||||||
msgid "IP address or hostname of the Zabbix server for active checks. If the parameter is not specified, active checks are disabled."
|
|
||||||
msgstr "IP address or hostname of the Zabbix server for active checks. If the parameter is not specified, active checks are disabled."
|
|
||||||
|
|
||||||
msgid "TLSConnect"
|
|
||||||
msgstr "TLSConnect"
|
|
||||||
|
|
||||||
msgid "The parameter defines how the agent should establish a secure connection with the Zabbix server or proxy."
|
|
||||||
msgstr "The parameter defines how the agent should establish a secure connection with the Zabbix server or proxy."
|
|
||||||
|
|
||||||
msgid "TLSPSKIdentity"
|
|
||||||
msgstr "TLSPSKIdentity"
|
|
||||||
|
|
||||||
msgid "Pre-shared key identifier string. Used for unique identification and management of the pre-shared key, ensuring the security of the connection between the agent and the server."
|
|
||||||
msgstr "Pre-shared key identifier string. Used for unique identification and management of the pre-shared key, ensuring the security of the connection between the agent and the server."
|
|
||||||
|
|
||||||
msgid "TLSPSKFile"
|
|
||||||
msgstr "TLSPSKFile"
|
|
||||||
|
|
||||||
msgid "Agent pre-shared key."
|
|
||||||
msgstr "Agent pre-shared key."
|
|
||||||
|
|
||||||
msgid "TLSCAFile"
|
|
||||||
msgstr "TLSCAFile"
|
|
||||||
|
|
||||||
msgid "Root CA certificate. Used for encrypted connections between Zabbix components."
|
|
||||||
msgstr "Root CA certificate. Used for encrypted connections between Zabbix components."
|
|
||||||
|
|
||||||
msgid "TLSCertFile"
|
|
||||||
msgstr "TLSCertFile"
|
|
||||||
|
|
||||||
msgid "Agent certificate or certificate chain used to establish secure (TLS/SSL) connections between Zabbix components."
|
|
||||||
msgstr "Agent certificate or certificate chain used to establish secure (TLS/SSL) connections between Zabbix components."
|
|
||||||
|
|
||||||
msgid "TLSKeyFile"
|
|
||||||
msgstr "TLSKeyFile"
|
|
||||||
|
|
||||||
msgid "Agent private key."
|
|
||||||
msgstr "Agent private key."
|
|
||||||
@@ -1,95 +0,0 @@
|
|||||||
msgid "Zabbix Agent configuration"
|
|
||||||
msgstr "Настройки Zabbix Agent"
|
|
||||||
|
|
||||||
msgid "General Settings"
|
|
||||||
msgstr "Основные настройки"
|
|
||||||
|
|
||||||
msgid "Passive Checks"
|
|
||||||
msgstr "Пассивные проверки"
|
|
||||||
|
|
||||||
msgid "Active Checks"
|
|
||||||
msgstr "Активные проверки"
|
|
||||||
|
|
||||||
msgid "TLS Configuration"
|
|
||||||
msgstr "TLS шифрование"
|
|
||||||
|
|
||||||
msgid "Enabled"
|
|
||||||
msgstr "Включить"
|
|
||||||
|
|
||||||
msgid "Hostname"
|
|
||||||
msgstr "Hostname"
|
|
||||||
|
|
||||||
msgid "Unique hostname used by the agent to register with the Zabbix server. Required for active checks and must match the node name specified on the server."
|
|
||||||
msgstr "Уникальное имя хоста, используемое агентом для регистрации на сервере Zabbix. Необходимо для активных проверок и должно соответствовать имени узла, указанному на сервере."
|
|
||||||
|
|
||||||
msgid "Server"
|
|
||||||
msgstr "Server"
|
|
||||||
|
|
||||||
msgid "List of IP addresses (or hostnames) of Zabbix servers allowed to connect to this agent. If 0.0.0.0/0 is specified, the agent will accept connections from any IP address."
|
|
||||||
msgstr "Список IP-адресов (или имён хостов) серверов Zabbix, которым разрешено подключаться к этому агенту. Если указать 0.0.0.0/0, агент будет принимать подключения с любого IP-адреса."
|
|
||||||
|
|
||||||
msgid "IP address of the local network interfaces on which the Zabbix agent will listen for incoming connections from the server."
|
|
||||||
msgstr "IP-адрес локальных сетевых интерфейсов, на которых Zabbix-агент будет ожидать входящие соединения от сервера."
|
|
||||||
|
|
||||||
msgid "ListenPort"
|
|
||||||
msgstr "ListenPort"
|
|
||||||
|
|
||||||
msgid "The agent will listen on this port for connections from the server."
|
|
||||||
msgstr "Агент будет слушать этот порт для подключений с сервера."
|
|
||||||
|
|
||||||
msgid "TLSAccept"
|
|
||||||
msgstr "TLSAccept"
|
|
||||||
|
|
||||||
msgid "The parameter defines which types of TLS connections the agent will accept."
|
|
||||||
msgstr "Параметр определяет, какие типы TLS-соединений агент будет принимать."
|
|
||||||
|
|
||||||
msgid "without encryption"
|
|
||||||
msgstr "без шифрования"
|
|
||||||
|
|
||||||
msgid "pre-shared key"
|
|
||||||
msgstr "pre-shared ключ"
|
|
||||||
|
|
||||||
msgid "certificate"
|
|
||||||
msgstr "сертификат"
|
|
||||||
|
|
||||||
msgid "ServerActive"
|
|
||||||
msgstr "ServerActive"
|
|
||||||
|
|
||||||
msgid "IP address or hostname of the Zabbix server for active checks. If the parameter is not specified, active checks are disabled."
|
|
||||||
msgstr "IP адрес или имя хоста Zabbix-сервера для активных проверок. Если параметр не указан, активные проверки отключены."
|
|
||||||
|
|
||||||
msgid "TLSConnect"
|
|
||||||
msgstr "TLSConnect"
|
|
||||||
|
|
||||||
msgid "The parameter defines how the agent should establish a secure connection with the Zabbix server or proxy."
|
|
||||||
msgstr "Параметр определяет, как агент должен устанавливать защищенное соединение с Zabbix-сервером или прокси."
|
|
||||||
|
|
||||||
msgid "TLSPSKIdentity"
|
|
||||||
msgstr "TLSPSKIdentity"
|
|
||||||
|
|
||||||
msgid "Pre-shared key identifier string. Used for unique identification and management of the pre-shared key, ensuring the security of the connection between the agent and the server."
|
|
||||||
msgstr "Строка идентификатор pre-shared ключа. Используется для уникальной идентификации и управления предустановленным ключом, обеспечивая безопасность соединения между агентом и сервером."
|
|
||||||
|
|
||||||
msgid "TLSPSKFile"
|
|
||||||
msgstr "TLSPSKFile"
|
|
||||||
|
|
||||||
msgid "Agent pre-shared key."
|
|
||||||
msgstr "Pre-shared ключ агента."
|
|
||||||
|
|
||||||
msgid "TLSCAFile"
|
|
||||||
msgstr "TLSCAFile"
|
|
||||||
|
|
||||||
msgid "Root CA certificate. Used for encrypted connections between Zabbix components."
|
|
||||||
msgstr "Сертификат верхнего уровня CA. Используется для зашифрованных соединений между Zabbix компонентами."
|
|
||||||
|
|
||||||
msgid "TLSCertFile"
|
|
||||||
msgstr "TLSCertFile"
|
|
||||||
|
|
||||||
msgid "Agent certificate or certificate chain used to establish secure (TLS/SSL) connections between Zabbix components."
|
|
||||||
msgstr "Сертификат агента или цепочка сертификатов, используемых для установления защищенных (TLS/SSL) соединений между компонентами Zabbix."
|
|
||||||
|
|
||||||
msgid "TLSKeyFile"
|
|
||||||
msgstr "TLSKeyFile"
|
|
||||||
|
|
||||||
msgid "Agent private key."
|
|
||||||
msgstr "Приватный ключ агента."
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
[ ! -f "/usr/share/ucitrack/luci-app-zabbix.json" ] && {
|
|
||||||
cat > /usr/share/ucitrack/luci-app-zabbix.json << EEOF
|
|
||||||
{
|
|
||||||
"config": "zabbix",
|
|
||||||
"init": "zabbix"
|
|
||||||
}
|
|
||||||
EEOF
|
|
||||||
}
|
|
||||||
|
|
||||||
uci -q batch <<-EOF >/dev/null
|
|
||||||
delete ucitrack.@zabbix[-1]
|
|
||||||
add ucitrack zabbix
|
|
||||||
set ucitrack.@zabbix[-1].init=zabbix_agentd
|
|
||||||
commit ucitrack
|
|
||||||
EOF
|
|
||||||
|
|
||||||
rm -f /tmp/luci-indexcache
|
|
||||||
exit 0
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
{
|
|
||||||
"admin/services/zabbix": {
|
|
||||||
"title": "Zabbix Agent",
|
|
||||||
"action": {
|
|
||||||
"type": "view",
|
|
||||||
"path": "zabbix/zabbix"
|
|
||||||
},
|
|
||||||
"depends": {
|
|
||||||
"acl": [ "luci-app-zabbix" ]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
{
|
|
||||||
"luci-app-zabbix": {
|
|
||||||
"description": "Grant UCI access for luci-app-zabbix",
|
|
||||||
"read": {
|
|
||||||
"uci": [ "zabbix" ]
|
|
||||||
},
|
|
||||||
"write": {
|
|
||||||
"uci": [ "zabbix" ]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -10,7 +10,7 @@ include $(INCLUDE_DIR)/kernel.mk
|
|||||||
|
|
||||||
PKG_NAME:=my-default-settings
|
PKG_NAME:=my-default-settings
|
||||||
PKG_VERSION:=2
|
PKG_VERSION:=2
|
||||||
PKG_RELEASE:=8
|
PKG_RELEASE:=9
|
||||||
|
|
||||||
include $(INCLUDE_DIR)/package.mk
|
include $(INCLUDE_DIR)/package.mk
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,9 @@ fi
|
|||||||
|
|
||||||
if [ -z "$version" ] || [ "$version" -lt 1 ]; then
|
if [ -z "$version" ] || [ "$version" -lt 1 ]; then
|
||||||
uci -q set luci.main.lang='auto'
|
uci -q set luci.main.lang='auto'
|
||||||
uci -q set luci.main.mediaurlbase=/luci-static/footstrap
|
if [ -f /usr/share/rpcd/acl.d/luci-theme-footstrap.json ]; then
|
||||||
|
uci -q set luci.main.mediaurlbase=/luci-static/footstrap
|
||||||
|
fi
|
||||||
uci commit luci
|
uci commit luci
|
||||||
|
|
||||||
if uci -q get system.@system[0] >/dev/null; then
|
if uci -q get system.@system[0] >/dev/null; then
|
||||||
|
|||||||
@@ -1,44 +0,0 @@
|
|||||||
|
|
||||||
include $(TOPDIR)/rules.mk
|
|
||||||
|
|
||||||
PKG_NAME:=zabbix-config
|
|
||||||
PKG_VERSION:=1
|
|
||||||
PKG_RELEASE:=1
|
|
||||||
PKG_BUILD_DIR:=$(BUILD_DIR)/zabbix-config
|
|
||||||
|
|
||||||
include $(INCLUDE_DIR)/package.mk
|
|
||||||
|
|
||||||
define Package/zabbix-config
|
|
||||||
SECTION:=admin
|
|
||||||
CATEGORY:=Administration
|
|
||||||
SUBMENU:=Zabbix
|
|
||||||
TITLE:=Zabbix-config
|
|
||||||
TITLE:=Additional configuration and init for zabbix-agent
|
|
||||||
PKGARCH:=all
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/zabbix-config/description
|
|
||||||
This package contains a changed config and init file for zabbix_agentd
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Build/Prepare
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Build/Configure
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Build/Compile
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/zabbix-config/install
|
|
||||||
$(INSTALL_DIR) $(1)/etc
|
|
||||||
$(INSTALL_BIN) ./files/zabbix_agentd.conf $(1)/etc/zabbix_agentd.conf
|
|
||||||
$(INSTALL_DIR) $(1)/etc/zabbix_agentd.conf.d
|
|
||||||
$(INSTALL_BIN) ./files/device_template.conf $(1)/etc/zabbix_agentd.conf.d/
|
|
||||||
$(INSTALL_DIR) $(1)/etc/config
|
|
||||||
$(CP) ./files/zabbix.config $(1)/etc/config/zabbix
|
|
||||||
$(INSTALL_DIR) $(1)/etc/init.d
|
|
||||||
$(INSTALL_BIN) ./files/zabbix_agentd.init $(1)/etc/init.d/zabbix_agentd
|
|
||||||
endef
|
|
||||||
|
|
||||||
$(eval $(call BuildPackage,zabbix-config))
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
###DEVICE###
|
|
||||||
UserParameter=device_hostname,getinfo hostname
|
|
||||||
UserParameter=device_serial,getinfo serialnum
|
|
||||||
UserParameter=device_fw,getinfo release
|
|
||||||
UserParameter=device_voltage,getinfo voltage
|
|
||||||
UserParameter=device_temp,getinfo temp
|
|
||||||
UserParameter=device_uptime,getinfo uptime
|
|
||||||
#MODEM
|
|
||||||
UserParameter=modem_imei,getinfo imei
|
|
||||||
UserParameter=modem_data,getinfo packtype
|
|
||||||
UserParameter=modem_operator,getinfo operator
|
|
||||||
UserParameter=modem_csq,getinfo signal
|
|
||||||
UserParameter=modem_sim_imsi,getinfo imsi
|
|
||||||
UserParameter=modem_sim_ccid,getinfo ccid
|
|
||||||
UserParameter=modem_sim_state,getinfo simstatus
|
|
||||||
#MWAN3
|
|
||||||
UserParameter=wan_ip,getinfo wanip
|
|
||||||
UserParameter=current_wan,getinfo currentwan
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
config zabbix
|
|
||||||
option enabled '0'
|
|
||||||
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
LogType=system
|
|
||||||
StartAgents=1
|
|
||||||
AllowRoot=1
|
|
||||||
Include=/etc/zabbix_agentd.conf.d/
|
|
||||||
Include=/tmp/zabbix_agentd.conf
|
|
||||||
@@ -1,93 +0,0 @@
|
|||||||
#!/bin/sh /etc/rc.common
|
|
||||||
# Copyright (C) 2008-2011 OpenWrt.org
|
|
||||||
|
|
||||||
START=60
|
|
||||||
|
|
||||||
USE_PROCD=1
|
|
||||||
PROG=/usr/sbin/zabbix_agentd
|
|
||||||
CONFIG=/etc/zabbix_agentd.conf
|
|
||||||
TMP_CONFIG=/tmp/zabbix_agentd.conf
|
|
||||||
|
|
||||||
start_service_daemon() {
|
|
||||||
config_get enabled "$1" enabled
|
|
||||||
config_get hostname "$1" hostname
|
|
||||||
config_get server "$1" server
|
|
||||||
config_get listen_ip "$1" listen_ip
|
|
||||||
config_get listen_port "$1" listen_port
|
|
||||||
config_get tls_accept "$1" tls_accept
|
|
||||||
config_get server_active "$1" server_active
|
|
||||||
config_get tls_connect "$1" tls_connect
|
|
||||||
config_get tls_psk_identity "$1" tls_psk_identity
|
|
||||||
config_get tls_psk_file "$1" tls_psk_file
|
|
||||||
config_get tls_ca_file "$1" tls_ca_file
|
|
||||||
config_get tls_cert_file "$1" tls_cert_file
|
|
||||||
config_get tls_key_file "$1" tls_key_file
|
|
||||||
|
|
||||||
[ -f ${CONFIG} ] || return 1
|
|
||||||
|
|
||||||
[ "$enabled" = 0 ] && {
|
|
||||||
echo "service disabled"
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
[ -z "${server}" -o -z "${hostname}" ] && {
|
|
||||||
echo "hostname or server are not set"
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
#FIXME
|
|
||||||
[ -f ${TMP_CONFIG} ] && rm ${TMP_CONFIG}
|
|
||||||
touch ${TMP_CONFIG}
|
|
||||||
|
|
||||||
server=$(echo ${server} | sed -r 's/[ ]+/,/g')
|
|
||||||
echo "Server=${server}" >> ${TMP_CONFIG}
|
|
||||||
echo "Hostname=${hostname}" >> ${TMP_CONFIG}
|
|
||||||
|
|
||||||
[ -n "${listen_ip}" ] && echo "ListenIP=${listen_ip}" >> ${TMP_CONFIG}
|
|
||||||
[ -n "${listen_port}" ] && echo "ListenPort=${listen_port}" >> ${TMP_CONFIG}
|
|
||||||
[ -n "${tls_accept}" ] && {
|
|
||||||
tls_accept=$(echo ${tls_accept} | sed -r 's/[ ]+/,/g')
|
|
||||||
echo "TLSAccept=${tls_accept}" >> ${TMP_CONFIG}
|
|
||||||
}
|
|
||||||
|
|
||||||
[ -n "${server_active}" ] && echo "ServerActive=${server_active}" >> ${TMP_CONFIG}
|
|
||||||
[ -n "${tls_connect}" ] && echo "TLSConnect=${tls_connect}" >> ${TMP_CONFIG}
|
|
||||||
[ -n "${tls_psk_identity}" ] && echo "TLSPSKIdentity=${tls_psk_identity}" >> ${TMP_CONFIG}
|
|
||||||
[ -n "${tls_psk_file}" ] && {
|
|
||||||
echo "TLSPSKFile=${tls_psk_file}" >> ${TMP_CONFIG}
|
|
||||||
chmod 644 ${tls_psk_file}
|
|
||||||
}
|
|
||||||
[ -n "${tls_ca_file}" ] && {
|
|
||||||
echo "TLSCAFile=${tls_ca_file}" >> ${TMP_CONFIG}
|
|
||||||
chmod 644 ${tls_ca_file}
|
|
||||||
}
|
|
||||||
[ -n "${tls_cert_file}" ] && {
|
|
||||||
echo "TLSCertFile=${tls_cert_file}" >> ${TMP_CONFIG}
|
|
||||||
chmod 644 ${tls_cert_file}
|
|
||||||
}
|
|
||||||
[ -n "${tls_key_file}" ] && {
|
|
||||||
echo "TLSKeyFile=${tls_key_file}" >> ${TMP_CONFIG}
|
|
||||||
chmod 644 ${tls_key_file}
|
|
||||||
}
|
|
||||||
|
|
||||||
procd_open_instance
|
|
||||||
procd_set_param command ${PROG} -c ${CONFIG} -f
|
|
||||||
procd_set_param respawn
|
|
||||||
procd_set_param stdout 1
|
|
||||||
procd_set_param stderr 1
|
|
||||||
procd_close_instance
|
|
||||||
}
|
|
||||||
|
|
||||||
start_service(){
|
|
||||||
config_load 'zabbix'
|
|
||||||
config_foreach start_service_daemon 'zabbix'
|
|
||||||
}
|
|
||||||
|
|
||||||
service_triggers() {
|
|
||||||
procd_add_reload_trigger 'zabbix'
|
|
||||||
}
|
|
||||||
|
|
||||||
reload_service() {
|
|
||||||
stop
|
|
||||||
start
|
|
||||||
}
|
|
||||||
@@ -1,102 +0,0 @@
|
|||||||
#
|
|
||||||
# Copyright (C) 2006-2015 OpenWrt.org
|
|
||||||
#
|
|
||||||
# This is free software, licensed under the GNU General Public License v2.
|
|
||||||
# See /LICENSE for more information.
|
|
||||||
#
|
|
||||||
|
|
||||||
include $(TOPDIR)/rules.mk
|
|
||||||
|
|
||||||
PKG_NAME:=zabbix-ssl
|
|
||||||
PKG_VERSION:=5.0.8
|
|
||||||
PKG_RELEASE:=1
|
|
||||||
|
|
||||||
PKG_SOURCE:=zabbix-$(PKG_VERSION).tar.gz
|
|
||||||
PKG_SOURCE_URL:=https://cdn.zabbix.com/zabbix/sources/stable/5.0/
|
|
||||||
PKG_HASH:=skip
|
|
||||||
|
|
||||||
PKG_BUILD_DIR=$(BUILD_DIR)/zabbix-$(PKG_VERSION)
|
|
||||||
PKG_MAINTAINER:=Etienne CHAMPETIER <champetier.etienne@gmail.com>
|
|
||||||
PKG_LICENSE:=GPL-2.0
|
|
||||||
PKG_LICENSE_FILES:=COPYING
|
|
||||||
PKG_CPE_ID:=cpe:/a:zabbix:zabbix
|
|
||||||
|
|
||||||
PKG_INSTALL:=1
|
|
||||||
PKG_BUILD_PARALLEL:=1
|
|
||||||
|
|
||||||
include $(INCLUDE_DIR)/package.mk
|
|
||||||
include $(INCLUDE_DIR)/nls.mk
|
|
||||||
|
|
||||||
define Package/zabbix-ssl/Default
|
|
||||||
SECTION:=admin
|
|
||||||
CATEGORY:=Administration
|
|
||||||
SUBMENU:=Zabbix
|
|
||||||
TITLE:=Zabbix-ssl
|
|
||||||
URL:=https://www.zabbix.com/
|
|
||||||
USERID:=zabbix=53:zabbix=53
|
|
||||||
DEPENDS += $(ICONV_DEPENDS) +libpcre2 +zlib +libopenssl +libmariadbclient
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/zabbix-agentd-ssl
|
|
||||||
$(call Package/zabbix-ssl/Default)
|
|
||||||
TITLE+= agentd-ssl
|
|
||||||
DEPENDS += +libpq
|
|
||||||
endef
|
|
||||||
|
|
||||||
CONFIGURE_ARGS+= \
|
|
||||||
--enable-agent \
|
|
||||||
--enable-proxy \
|
|
||||||
$(call autoconf_bool,CONFIG_IPV6,ipv6) \
|
|
||||||
--disable-java \
|
|
||||||
--with-mysql \
|
|
||||||
--with-libevent=$(STAGING_DIR)/usr/include/libevent \
|
|
||||||
--with-libpcre=$(STAGING_DIR)/usr/include \
|
|
||||||
--with-zlib=$(STAGING_DIR)/usr/include \
|
|
||||||
--with-openssl="$(STAGING_DIR)/usr"
|
|
||||||
|
|
||||||
CONFIGURE_VARS += \
|
|
||||||
ac_cv_header_sys_sysinfo_h=no
|
|
||||||
|
|
||||||
MAKE_FLAGS += ARCH="linux"
|
|
||||||
|
|
||||||
define Package/zabbix-ssl/install/sbin
|
|
||||||
$(INSTALL_DIR) \
|
|
||||||
$(1)/usr/sbin
|
|
||||||
|
|
||||||
$(INSTALL_BIN) \
|
|
||||||
$(PKG_INSTALL_DIR)/usr/sbin/zabbix_$(2) \
|
|
||||||
$(1)/usr/sbin/
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/zabbix-ssl/install/bin
|
|
||||||
$(INSTALL_DIR) \
|
|
||||||
$(1)/usr/bin
|
|
||||||
|
|
||||||
$(INSTALL_BIN) \
|
|
||||||
$(PKG_INSTALL_DIR)/usr/bin/zabbix_$(2) \
|
|
||||||
$(1)/usr/bin/
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/zabbix-ssl/install/etc
|
|
||||||
$(INSTALL_DIR) \
|
|
||||||
$(1)/etc
|
|
||||||
|
|
||||||
$(INSTALL_CONF) \
|
|
||||||
$(PKG_INSTALL_DIR)/etc/zabbix_$(2).conf \
|
|
||||||
$(1)/etc/
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Build/Prepare
|
|
||||||
$(call Build/Prepare/Default)
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Build/Compile
|
|
||||||
$(call Build/Compile/Default)
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/zabbix-agentd-ssl/install
|
|
||||||
$(INSTALL_DIR) $(1)/etc/zabbix_agentd.conf.d
|
|
||||||
$(call Package/zabbix-ssl/install/sbin,$(1),agentd)
|
|
||||||
endef
|
|
||||||
|
|
||||||
$(eval $(call BuildPackage,zabbix-agentd-ssl))
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
#see https://openwrt.org/docs/guide-user/services/network_monitoring/zabbix for ready to use templates
|
|
||||||
|
|
||||||
# If you want to know the exact meaning of an UserParameter, you can search in the ieee80211 standard:
|
|
||||||
# https://standards.ieee.org/getieee802/download/802.11-2012.pdf
|
|
||||||
# example: for mac80211.ACKFailureCount search for dot11ACKFailureCount (page 2145)
|
|
||||||
|
|
||||||
# mac80211 phy discovery (like 'phy0')
|
|
||||||
# example: {"data":[{"{#PHY}":"phy0"}]}
|
|
||||||
#
|
|
||||||
UserParameter=mac80211.phydiscovery,zabbix_helper_mac80211 discovery
|
|
||||||
|
|
||||||
#phy statistics (you need {#PHY} as parameter)
|
|
||||||
#
|
|
||||||
UserParameter=mac80211.ACKFailureCount[*],zabbix_helper_mac80211 $1 dot11ACKFailureCount
|
|
||||||
UserParameter=mac80211.FCSErrorCount[*],zabbix_helper_mac80211 $1 dot11FCSErrorCount
|
|
||||||
UserParameter=mac80211.RTSFailureCount[*],zabbix_helper_mac80211 $1 dot11RTSFailureCount
|
|
||||||
UserParameter=mac80211.RTSSuccessCount[*],zabbix_helper_mac80211 $1 dot11RTSSuccessCount
|
|
||||||
|
|
||||||
# hidden behind MAC80211_DEBUG_COUNTERS
|
|
||||||
UserParameter=mac80211.FailedCount[*],zabbix_helper_mac80211 $1 dot11FailedCount
|
|
||||||
UserParameter=mac80211.FrameDuplicateCount[*],zabbix_helper_mac80211 $1 dot11FrameDuplicateCount
|
|
||||||
UserParameter=mac80211.MulticastReceivedFrameCount[*],zabbix_helper_mac80211 $1 dot11MulticastReceivedFrameCount
|
|
||||||
UserParameter=mac80211.MulticastTransmittedFrameCount[*],zabbix_helper_mac80211 $1 dot11MulticastTransmittedFrameCount
|
|
||||||
UserParameter=mac80211.MultipleRetryCount[*],zabbix_helper_mac80211 $1 dot11MultipleRetryCount
|
|
||||||
UserParameter=mac80211.ReceivedFragmentCount[*],zabbix_helper_mac80211 $1 dot11ReceivedFragmentCount
|
|
||||||
UserParameter=mac80211.RetryCount[*],zabbix_helper_mac80211 $1 dot11RetryCount
|
|
||||||
UserParameter=mac80211.TransmittedFragmentCount[*],zabbix_helper_mac80211 $1 dot11TransmittedFragmentCount
|
|
||||||
UserParameter=mac80211.TransmittedFrameCount[*],zabbix_helper_mac80211 $1 dot11TransmittedFrameCount
|
|
||||||
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
#see https://openwrt.org/docs/guide-user/services/network_monitoring/zabbix for ready to use templates
|
|
||||||
|
|
||||||
# network interface discovery
|
|
||||||
# example: {"data":[{"{#IF}":"lo", "{#NET}":"loopback"},{"{#IF}":"br-lan", "{#NET}":"lan"},{"{#IF}":"eth0.1", "{#NET}":"wan"}]}
|
|
||||||
#
|
|
||||||
UserParameter=netowrt.discovery,lua -l ubus -e 'u=ubus.connect();list="{\"data\":[";dump=u:call("network.interface", "dump", {});for _, intf in ipairs(dump.interface) do list=list.."{\"{#IF}\":\""..intf.device.."\", \"{#NET}\":\""..intf.interface.."\"},";end;list=string.gsub(list,",$","");print(list.."]}")'
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
#see https://openwrt.org/docs/guide-user/services/network_monitoring/zabbix for ready to use templates
|
|
||||||
|
|
||||||
# wifi interface discovery
|
|
||||||
# example: {"data":[{"{#IF}":"wlan0", "{#MODE}":"ap", "{#SSID}":"Openwrt", "{#NET}":"lan", "{#DEV}":"radio0", "{#ENC}":"psk2+ccmp", "{#TYPE}":"mac80211", "{#HWMODE}":"11ng", "{#CHANNEL}":"11", "{#BSSID}":"xx:xx:xx:xx:xx:xx"}]}
|
|
||||||
UserParameter=wifi.ifdiscovery, lua -l ubus -l iwinfo -e 'u=ubus.connect();list="{\"data\":[";stat=u:call("network.wireless", "status", {});for dev, dev_table in pairs(stat) do for i, iface in pairs(dev_table["interfaces"]) do c=iface["config"];i=iface["ifname"];t=iwinfo.type(i);iw=iwinfo[t];e = iw.encryption(i);e = e and e.description or "None";n = table.concat(c["network"]," ");list=list.."{\"{#IF}\":\""..i.."\", \"{#MODE}\":\""..iw.mode(i).."\", \"{#SSID}\":\""..c["ssid"].."\", \"{#NET}\":\""..n.."\", \"{#DEV}\":\""..dev.."\", \"{#ENC}\":\""..e.."\", \"{#TYPE}\":\""..t.."\", \"{#HWMODE}\":\"".."?".."\", \"{#CHANNEL}\":\""..iw.channel(i).."\", \"{#BSSID}\":\""..iw.bssid(i).."\"},";end;end;list=string.gsub(list,",$","");print(list.."]}")'
|
|
||||||
|
|
||||||
|
|
||||||
#iwinfo info (you need {#IF} as parameter, like 'wlan0')
|
|
||||||
UserParameter=wifi.iwinfo.channel[*],lua -l iwinfo -e "print(iwinfo[iwinfo.type('$1')].channel('$1'))"
|
|
||||||
UserParameter=wifi.iwinfo.frequency[*],lua -l iwinfo -e "print(iwinfo[iwinfo.type('$1')].frequency('$1'))"
|
|
||||||
UserParameter=wifi.iwinfo.txpower[*],lua -l iwinfo -e "print(iwinfo[iwinfo.type('$1')].txpower('$1'))"
|
|
||||||
UserParameter=wifi.iwinfo.bitrate[*],lua -l iwinfo -e "b = iwinfo[iwinfo.type('$1')].bitrate('$1'); print(b or '0')"
|
|
||||||
UserParameter=wifi.iwinfo.signal[*],lua -l iwinfo -e "s = iwinfo[iwinfo.type('$1')].signal('$1'); print(s or '-255')"
|
|
||||||
UserParameter=wifi.iwinfo.noise[*],lua -l iwinfo -e "print(iwinfo[iwinfo.type('$1')].noise('$1'))"
|
|
||||||
UserParameter=wifi.iwinfo.quality[*],lua -l iwinfo -e "print(iwinfo[iwinfo.type('$1')].quality('$1'))"
|
|
||||||
UserParameter=wifi.iwinfo.quality_max[*],lua -l iwinfo -e "print(iwinfo[iwinfo.type('$1')].quality_max('$1'))"
|
|
||||||
UserParameter=wifi.iwinfo.mode[*],lua -l iwinfo -e "print(iwinfo[iwinfo.type('$1')].mode('$1'))"
|
|
||||||
UserParameter=wifi.iwinfo.ssid[*],lua -l iwinfo -e "print(iwinfo[iwinfo.type('$1')].ssid('$1'))"
|
|
||||||
UserParameter=wifi.iwinfo.bssid[*],lua -l iwinfo -e "print(iwinfo[iwinfo.type('$1')].bssid('$1'))"
|
|
||||||
UserParameter=wifi.iwinfo.country[*],lua -l iwinfo -e "print(iwinfo[iwinfo.type('$1')].country('$1'))"
|
|
||||||
UserParameter=wifi.iwinfo.nbusers[*],lua -l iwinfo -e "n = 0; for _,_ in pairs(iwinfo[iwinfo.type('$1')].assoclist('$1')) do n = n + 1 end; print(n)"
|
|
||||||
UserParameter=wifi.iwinfo.encryption[*],lua -l iwinfo -e "e = iwinfo[iwinfo.type('$1')].encryption('$1'); print(e and e.description or 'None')"
|
|
||||||
UserParameter=wifi.iwinfo.hwmode[*],lua -l iwinfo -e "x=iwinfo[iwinfo.type('$1')].hwmodelist('$1'); print((x.a and 'a' or '')..(x.b and 'b' or '')..(x.g and 'g' or '')..(x.n and 'n' or ''))"
|
|
||||||
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
{
|
|
||||||
"user": "zabbix",
|
|
||||||
"access": {
|
|
||||||
"network.interface": {
|
|
||||||
"methods": [ "dump" ]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
{
|
|
||||||
"user": "zabbix",
|
|
||||||
"access": {
|
|
||||||
"network.wireless": {
|
|
||||||
"methods": [ "status" ]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,77 +0,0 @@
|
|||||||
#define _GNU_SOURCE
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <dirent.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
|
|
||||||
int discovery()
|
|
||||||
{
|
|
||||||
DIR *dir;
|
|
||||||
struct dirent *ent;
|
|
||||||
bool comma = false;
|
|
||||||
if ((dir = opendir ("/sys/kernel/debug/ieee80211/")) != NULL) {
|
|
||||||
printf("{\"data\":[");
|
|
||||||
while ((ent = readdir (dir)) != NULL) {
|
|
||||||
if (strcmp(".", ent->d_name) && strcmp("..", ent->d_name)) {
|
|
||||||
if (comma)
|
|
||||||
printf(",");
|
|
||||||
printf("{\"{#PHY}\":\"%s\"}", ent->d_name);
|
|
||||||
comma = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
printf("]}\n");
|
|
||||||
closedir(dir);
|
|
||||||
} else {
|
|
||||||
perror("");
|
|
||||||
return EXIT_FAILURE;
|
|
||||||
}
|
|
||||||
return EXIT_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
int get_param(char *phy, char *stat)
|
|
||||||
{
|
|
||||||
char *filename = NULL;
|
|
||||||
FILE *f = NULL;
|
|
||||||
phy = basename(phy);
|
|
||||||
stat = basename(stat);
|
|
||||||
if (asprintf(&filename, "/sys/kernel/debug/ieee80211/%s/statistics/%s", phy, stat) > 0)
|
|
||||||
f = fopen(filename, "r");
|
|
||||||
|
|
||||||
if (f != NULL) {
|
|
||||||
char temp[256];
|
|
||||||
while (fgets(temp, 256, f) != NULL)
|
|
||||||
printf("%s",temp);
|
|
||||||
|
|
||||||
fclose(f);
|
|
||||||
} else {
|
|
||||||
perror("");
|
|
||||||
return EXIT_FAILURE;
|
|
||||||
}
|
|
||||||
free(filename);
|
|
||||||
return EXIT_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
int usage(char *name)
|
|
||||||
{
|
|
||||||
fprintf(stderr, "Usage:\n");
|
|
||||||
fprintf(stderr, " %s discovery\n", name);
|
|
||||||
fprintf(stderr, " => print mac80211.phydiscovery discovery rule\n");
|
|
||||||
fprintf(stderr, " %s PHY STAT\n", name);
|
|
||||||
fprintf(stderr, " => cat /sys/kernel/debug/ieee80211/PHY/statistics/STAT as root\n");
|
|
||||||
return EXIT_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
|
||||||
{
|
|
||||||
|
|
||||||
switch (argc) {
|
|
||||||
case 2:
|
|
||||||
return discovery();
|
|
||||||
case 3:
|
|
||||||
return get_param(argv[1], argv[2]);
|
|
||||||
default:
|
|
||||||
return usage(argv[0]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
--- a/src/libs/zbxcommon/str.c
|
|
||||||
+++ b/src/libs/zbxcommon/str.c
|
|
||||||
@@ -54,7 +54,7 @@ static const char help_message_footer[]
|
|
||||||
void version(void)
|
|
||||||
{
|
|
||||||
printf("%s (Zabbix) %s\n", title_message, ZABBIX_VERSION);
|
|
||||||
- printf("Revision %s %s, compilation time: %s %s\n\n", ZABBIX_REVISION, ZABBIX_REVDATE, __DATE__, __TIME__);
|
|
||||||
+ printf("Revision %s %s\n\n", ZABBIX_REVISION, ZABBIX_REVDATE);
|
|
||||||
puts(copyright_message);
|
|
||||||
#if defined(HAVE_GNUTLS) || defined(HAVE_OPENSSL)
|
|
||||||
printf("\n");
|
|
||||||
Reference in New Issue
Block a user