mirror of
https://github.com/caiwx86/small-packages.git
synced 2026-11-05 18:44:06 +08:00
update 2026-09-26 11:07:27
This commit is contained in:
1 parent
7b88b273d0
commit
97ae9f68da
4898 files changed
-1712274
No files matched your search
@@ -1,23 +0,0 @@
|
||||
#!/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