mirror of
https://github.com/caiwx86/small-packages.git
synced 2026-11-06 03:14:22 +08:00
update 2026-10-16 10:47:46
This commit is contained in:
1 parent
e0a60ac545
commit
4b2689b979
4914 files changed
+2042554
No files matched your search
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/lua
|
||||
|
||||
require 'luci.sys'
|
||||
local jsonc = require "luci.jsonc"
|
||||
|
||||
local function get_config_path()
|
||||
return luci.sys.exec("echo -n $(cat /usr/share/ssr_mudb_server/userapiconfig.py | grep 'MUDB_FILE' | cut -d \"'\" -f 2)")
|
||||
end
|
||||
|
||||
local function get_config_json()
|
||||
return luci.sys.exec("cat " .. get_config_path()) or "[]"
|
||||
end
|
||||
|
||||
local json = jsonc.parse(get_config_json())
|
||||
if json then
|
||||
for index = 1, table.maxn(json) do
|
||||
local o = json[index]
|
||||
if o.enable == 1 then
|
||||
luci.sys.call(string.format("iptables -A SSR_MUDB-SERVER -p tcp --dport %s -m comment --comment %s -j ACCEPT", o.port, o.user))
|
||||
luci.sys.call(string.format("iptables -A SSR_MUDB-SERVER -p udp --dport %s -m comment --comment %s -j ACCEPT", o.port, o.user))
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in new issue
Block a user