update 2026-08-07 08:51:09
|
After Width: | Height: | Size: 91 KiB |
|
After Width: | Height: | Size: 319 KiB |
|
After Width: | Height: | Size: 389 KiB |
|
Before Width: | Height: | Size: 640 KiB |
|
Before Width: | Height: | Size: 550 KiB |
|
Before Width: | Height: | Size: 547 KiB |
|
Before Width: | Height: | Size: 659 KiB |
|
Before Width: | Height: | Size: 650 KiB |
@@ -1,4 +1,4 @@
|
||||
# Copyright (C) 2018-2021 Lienol <lawlienol@gmail.com>
|
||||
# Copyright (C) 2018-2026 Lienol <lawlienol@gmail.com>
|
||||
#
|
||||
# This is free software, licensed under the Apache License, Version 2.0 .
|
||||
#
|
||||
@@ -6,7 +6,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-ipsec-server
|
||||
PKG_VERSION:=20260801
|
||||
PKG_VERSION:=20260807
|
||||
PKG_RELEASE:=2
|
||||
|
||||
PKG_MAINTAINER:=Lienol <lawlienol@gmail.com>
|
||||
|
||||
@@ -11,10 +11,7 @@ function index()
|
||||
entry({"admin", "vpn", "ipsec-server", "settings"}, cbi("ipsec-server/settings"), _("General Settings"), 10).leaf = true
|
||||
entry({"admin", "vpn", "ipsec-server", "users"}, cbi("ipsec-server/users"), _("Users Manager"), 20).leaf = true
|
||||
entry({"admin", "vpn", "ipsec-server", "l2tp_user"}, cbi("ipsec-server/l2tp_user")).leaf = true
|
||||
local uci = require "luci.model.uci".cursor()
|
||||
if uci:get("luci-app-ipsec-server", "ipsec", "type") == "L2TP" then
|
||||
entry({"admin", "vpn", "ipsec-server", "online"}, cbi("ipsec-server/online"), _("L2TP Online Users"), 30).leaf = true
|
||||
end
|
||||
entry({"admin", "vpn", "ipsec-server", "online"}, cbi("ipsec-server/online"), _("Online Users"), 30).leaf = true
|
||||
entry({"admin", "vpn", "ipsec-server", "status"}, call("act_status")).leaf = true
|
||||
end
|
||||
|
||||
|
||||
@@ -1,26 +1,123 @@
|
||||
local o = require "luci.dispatcher"
|
||||
local d = require "luci.dispatcher"
|
||||
local fs = require "nixio.fs"
|
||||
local jsonc = require "luci.jsonc"
|
||||
local sys = require "luci.sys"
|
||||
local util = require "luci.util"
|
||||
local uci = require "luci.model.uci".cursor()
|
||||
|
||||
local sessions = {}
|
||||
local session_path = "/var/etc/xl2tpd/session"
|
||||
if fs.access(session_path) then
|
||||
for filename in fs.dir(session_path) do
|
||||
local session_file = session_path .. "/" .. filename
|
||||
local file = io.open(session_file, "r")
|
||||
local t = jsonc.parse(file:read("*a"))
|
||||
if t then
|
||||
t.session_file = session_file
|
||||
sessions[#sessions + 1] = t
|
||||
f = SimpleForm("processes")
|
||||
f.reset = false
|
||||
f.submit = false
|
||||
|
||||
local firewall_user_path = "/etc/firewall.user"
|
||||
|
||||
if uci:get("luci-app-ipsec-server", "ipsec", "type") ~= "L2TP" then
|
||||
local sessions = {}
|
||||
local status_dump = io.popen('ipsec status 2>&1 | grep "ESTABLISHED"')
|
||||
if status_dump then
|
||||
local line
|
||||
for line in status_dump:lines() do
|
||||
local line = string.split(line, ",")
|
||||
local s1 = string.split(line[1], " ")
|
||||
local type_count = s1[1]
|
||||
local user = line[2]
|
||||
local user_split = string.split(user, "...")
|
||||
if #user_split == 2 then
|
||||
local leftid = string.match(user_split[1], "%[(.-)%]")
|
||||
local username = string.match(user_split[2], "%[(.-)%]")
|
||||
local remote_ip = string.split(user_split[2], "[")[1]
|
||||
local a = {}
|
||||
for i, v in ipairs(s1) do
|
||||
if i > 2 then
|
||||
a[#a + 1] = v
|
||||
end
|
||||
end
|
||||
local login_time = table.concat(a, " ")
|
||||
sessions[#sessions + 1] = {
|
||||
username = username,
|
||||
remote_ip = remote_ip,
|
||||
login_time = login_time
|
||||
}
|
||||
end
|
||||
end
|
||||
file:close()
|
||||
end
|
||||
for i, v in ipairs(sessions) do
|
||||
local ip = util.exec("ipsec leases 2>/dev/null | grep 'online' | grep '%s' | awk '{print $1}'" % { v.username })
|
||||
v.ip = ip
|
||||
end
|
||||
t = f:section(Table, sessions, translate("Online Users"))
|
||||
t:option(DummyValue, "username", translate("Username") .. "/" .. translate("Identifier"))
|
||||
t:option(DummyValue, "ip", translate("Client IP"))
|
||||
t:option(DummyValue, "login_time", translate("Login Time"))
|
||||
t:option(DummyValue, "remote_ip", translate("IP address"))
|
||||
add_blacklist = t:option(Button, "add_blacklist", translate("Blacklist"))
|
||||
function add_blacklist.render(e, t, a)
|
||||
e.title = translate("Add to Blacklist")
|
||||
e.inputstyle = "remove"
|
||||
Button.render(e, t, a)
|
||||
end
|
||||
function add_blacklist.write(t, s)
|
||||
local e = t.map:get(s, "remote_ip")
|
||||
util.execi("echo 'iptables -I INPUT -s %s -p udp -m multiport --dports 500,4500 -j DROP ## ipsec-blacklist-%s' >> %s" % {e, e, firewall_user_path})
|
||||
util.execi("iptables -I INPUT -s %s -p udp -m multiport --dports 500,4500 -j DROP" % {e})
|
||||
luci.http.redirect(d.build_url("admin/vpn/ipsec-server/online"))
|
||||
end
|
||||
else
|
||||
local l2tp_sessions = {}
|
||||
local l2tp_session_path = "/var/etc/xl2tpd/session"
|
||||
if fs.access(l2tp_session_path) then
|
||||
for filename in fs.dir(l2tp_session_path) do
|
||||
local session_file = l2tp_session_path .. "/" .. filename
|
||||
local file = io.open(session_file, "r")
|
||||
local t = jsonc.parse(file:read("*a"))
|
||||
if t then
|
||||
t.session_file = session_file
|
||||
l2tp_sessions[#l2tp_sessions + 1] = t
|
||||
end
|
||||
file:close()
|
||||
end
|
||||
end
|
||||
|
||||
t = f:section(Table, l2tp_sessions, translate("L2TP Online Users"))
|
||||
t:option(DummyValue, "username", translate("Username"))
|
||||
t:option(DummyValue, "interface", translate("Interface"))
|
||||
t:option(DummyValue, "ip", translate("Client IP"))
|
||||
t:option(DummyValue, "remote_ip", translate("IP address"))
|
||||
t:option(DummyValue, "login_time", translate("Login Time"))
|
||||
|
||||
_blacklist = t:option(Button, "_blacklist", translate("Blacklist"))
|
||||
function _blacklist.render(e, t, a)
|
||||
e.title = translate("Add to Blacklist")
|
||||
e.inputstyle = "remove"
|
||||
Button.render(e, t, a)
|
||||
end
|
||||
function _blacklist.write(t, s)
|
||||
local e = t.map:get(s, "remote_ip")
|
||||
util.execi("echo 'iptables -I INPUT -s %s -p udp -m multiport --dports 500,4500,1701 -j DROP ## xl2tpd-blacklist-%s' >> %s" % {e, e, firewall_user_path})
|
||||
util.execi("iptables -I INPUT -s %s -p udp -m multiport --dports 500,4500,1701 -j DROP" % {e})
|
||||
util.execi("rm -f " .. t.map:get(s, "session_file"))
|
||||
null, t.tag_error[s] = sys.process.signal(t.map:get(s, "pid"), 9)
|
||||
luci.http.redirect(d.build_url("admin/vpn/ipsec-server/online"))
|
||||
end
|
||||
|
||||
_kill = t:option(Button, "_kill", translate("Forced offline"))
|
||||
_kill.inputstyle = "remove"
|
||||
function _kill.write(t, s)
|
||||
util.execi("rm -f " .. t.map:get(s, "session_file"))
|
||||
null, t.tag_error[t] = sys.process.signal(t.map:get(s, "pid"), 9)
|
||||
luci.http.redirect(d.build_url("admin/vpn/ipsec-server/online"))
|
||||
end
|
||||
end
|
||||
|
||||
local blacklist = {}
|
||||
local firewall_user_path = "/etc/firewall.user"
|
||||
if fs.access(firewall_user_path) then
|
||||
for line in io.lines(firewall_user_path) do
|
||||
local m = line:match('ipsec%-blacklist%-([^\n]+)')
|
||||
if m then
|
||||
local t = {}
|
||||
t.ip = m
|
||||
blacklist[#blacklist + 1] = t
|
||||
end
|
||||
local m = line:match('xl2tpd%-blacklist%-([^\n]+)')
|
||||
if m then
|
||||
local t = {}
|
||||
@@ -30,54 +127,22 @@ if fs.access(firewall_user_path) then
|
||||
end
|
||||
end
|
||||
|
||||
f = SimpleForm("processes")
|
||||
f.reset = false
|
||||
f.submit = false
|
||||
|
||||
t = f:section(Table, sessions, translate("L2TP Online Users"))
|
||||
t:option(DummyValue, "username", translate("Username"))
|
||||
t:option(DummyValue, "interface", translate("Interface"))
|
||||
t:option(DummyValue, "ip", translate("Client IP"))
|
||||
t:option(DummyValue, "remote_ip", translate("IP address"))
|
||||
t:option(DummyValue, "login_time", translate("Login Time"))
|
||||
|
||||
_blacklist = t:option(Button, "_blacklist", translate("Blacklist"))
|
||||
function _blacklist.render(e, t, a)
|
||||
e.title = translate("Add to Blacklist")
|
||||
e.inputstyle = "remove"
|
||||
Button.render(e, t, a)
|
||||
end
|
||||
function _blacklist.write(t, s)
|
||||
local e = t.map:get(s, "remote_ip")
|
||||
luci.util.execi("echo 'iptables -I INPUT -s %s -p udp -m multiport --dports 500,4500,1701 -j DROP ## xl2tpd-blacklist-%s' >> /etc/firewall.user" % {e, e})
|
||||
luci.util.execi("iptables -I INPUT -s %s -p udp -m multiport --dports 500,4500,1701 -j DROP" % {e})
|
||||
luci.util.execi("rm -f " .. t.map:get(s, "session_file"))
|
||||
null, t.tag_error[s] = luci.sys.process.signal(t.map:get(s, "pid"), 9)
|
||||
luci.http.redirect(o.build_url("admin/vpn/ipsec-server/online"))
|
||||
end
|
||||
|
||||
_kill = t:option(Button, "_kill", translate("Forced offline"))
|
||||
_kill.inputstyle = "remove"
|
||||
function _kill.write(t, s)
|
||||
luci.util.execi("rm -f " .. t.map:get(s, "session_file"))
|
||||
null, t.tag_error[t] = luci.sys.process.signal(t.map:get(s, "pid"), 9)
|
||||
luci.http.redirect(o.build_url("admin/vpn/ipsec-server/online"))
|
||||
end
|
||||
|
||||
t = f:section(Table, blacklist, translate("Blacklist"))
|
||||
t:option(DummyValue, "ip", translate("IP address"))
|
||||
|
||||
_blacklist2 = t:option(Button, "_blacklist2", translate("Blacklist"))
|
||||
function _blacklist2.render(e, t, a)
|
||||
remove_blacklist = t:option(Button, "remove_blacklist", translate("Blacklist"))
|
||||
function remove_blacklist.render(e, t, a)
|
||||
e.title = translate("Remove from Blacklist")
|
||||
e.inputstyle = "apply"
|
||||
Button.render(e, t, a)
|
||||
end
|
||||
function _blacklist2.write(t, s)
|
||||
function remove_blacklist.write(t, s)
|
||||
local e = t.map:get(s, "ip")
|
||||
luci.util.execi("sed -i -e '/## xl2tpd-blacklist-%s/d' /etc/firewall.user" % {e})
|
||||
luci.util.execi("iptables -D INPUT -s %s -p udp -m multiport --dports 500,4500,1701 -j DROP" % {e})
|
||||
luci.http.redirect(o.build_url("admin/vpn/ipsec-server/online"))
|
||||
util.execi("sed -i -e '/## ipsec-blacklist-%s/d' %s" % {e, firewall_user_path})
|
||||
util.execi("sed -i -e '/## xl2tpd-blacklist-%s/d' %s" % {e, firewall_user_path})
|
||||
util.execi("iptables -D INPUT -s %s -p udp -m multiport --dports 500,4500 -j DROP 2>/dev/null" % {e})
|
||||
util.execi("iptables -D INPUT -s %s -p udp -m multiport --dports 500,4500,1701 -j DROP 2>/dev/null" % {e})
|
||||
luci.http.redirect(d.build_url("admin/vpn/ipsec-server/online"))
|
||||
end
|
||||
|
||||
return f
|
||||
|
||||
@@ -1,15 +1,46 @@
|
||||
# Copyright (C) 2018-2022 Lienol <lawlienol@gmail.com>
|
||||
# Copyright (C) 2018-2026 Lienol <lawlienol@gmail.com>
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v3.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
LUCI_TITLE:=LuCI support for KodExplorer
|
||||
LUCI_DEPENDS:=+nginx-ssl +unzip +zoneinfo-asia +php8 +php8-fastcgi +php8-fpm +php8-mod-curl +php8-mod-dom +php8-mod-gd +php8-mod-iconv +php8-mod-mbstring +php8-mod-opcache +php8-mod-session +php8-mod-zip +php8-mod-sqlite3 +php8-mod-pdo +php8-mod-pdo-sqlite +php8-mod-pdo-mysql +php8-mod-xml +php8-mod-xmlreader +php8-mod-xmlwriter
|
||||
LUCI_PKGARCH:=all
|
||||
PKG_NAME:=luci-app-kodexplorer
|
||||
PKG_VERSION:=20220109
|
||||
PKG_RELEASE:=2
|
||||
PKG_RELEASE:=3
|
||||
|
||||
LUCI_TITLE:=LuCI support for KodExplorer
|
||||
LUCI_PKGARCH:=all
|
||||
|
||||
define Package/$(PKG_NAME)/config
|
||||
|
||||
config PACKAGE_$(PKG_NAME)_depends
|
||||
depends on PACKAGE_$(PKG_NAME)
|
||||
bool
|
||||
default y
|
||||
select PACKAGE_nginx-ssl
|
||||
select PACKAGE_unzip
|
||||
select PACKAGE_zoneinfo-asia
|
||||
select PACKAGE_php8
|
||||
select PACKAGE_php8-fastcgi
|
||||
select PACKAGE_php8-fpm
|
||||
select PACKAGE_php8-mod-curl
|
||||
select PACKAGE_php8-mod-dom
|
||||
select PACKAGE_php8-mod-gd
|
||||
select PACKAGE_php8-mod-iconv
|
||||
select PACKAGE_php8-mod-mbstring
|
||||
select PACKAGE_php8-mod-opcache
|
||||
select PACKAGE_php8-mod-pdo
|
||||
select PACKAGE_php8-mod-pdo-mysql
|
||||
select PACKAGE_php8-mod-pdo-sqlite
|
||||
select PACKAGE_php8-mod-session
|
||||
select PACKAGE_php8-mod-sqlite3
|
||||
select PACKAGE_php8-mod-xml
|
||||
select PACKAGE_php8-mod-xmlreader
|
||||
select PACKAGE_php8-mod-xmlwriter
|
||||
select PACKAGE_php8-mod-zip
|
||||
|
||||
endef
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
|
||||
@@ -1105,6 +1105,9 @@ function gen_config(var)
|
||||
local dns_socks_address = var["dns_socks_address"]
|
||||
local dns_socks_port = var["dns_socks_port"]
|
||||
local no_run = var["no_run"]
|
||||
local use_proxy_list = var["use_proxy_list"]
|
||||
local use_gfw_list = var["use_gfw_list"]
|
||||
local chn_list = var["chn_list"]
|
||||
|
||||
local dns_domain_rules = {}
|
||||
local dns = nil
|
||||
@@ -1552,7 +1555,50 @@ function gen_config(var)
|
||||
end
|
||||
|
||||
--shunt rule
|
||||
uci:foreach(appname, "shunt_rules", function(e)
|
||||
local function foreach_shunt_rule(callback)
|
||||
uci:foreach(appname, "shunt_rules", callback)
|
||||
|
||||
if use_gfw_list ~= "1" or chn_list ~= "0" then return end
|
||||
|
||||
-- GFW 模式下使用分流节点时添加特定规则
|
||||
local function read_proxy_list(path)
|
||||
if use_proxy_list ~= "1" then return "" end
|
||||
local map, list = {}, {}
|
||||
local f = io.open(path)
|
||||
if f then
|
||||
for line in f:lines() do
|
||||
if line ~= "" and not line:find("#", 1, true) and not map[line] then
|
||||
map[line] = 1
|
||||
list[#list + 1] = line
|
||||
end
|
||||
end
|
||||
f:close()
|
||||
end
|
||||
return table.concat(list, "\n")
|
||||
end
|
||||
|
||||
local domain_list = read_proxy_list("/usr/share/passwall/rules/proxy_host")
|
||||
local ip_list = read_proxy_list("/usr/share/passwall/rules/proxy_ip")
|
||||
|
||||
local bin = api.finded_com("geoview")
|
||||
if bin then
|
||||
local geo_file = (uci:get(appname, "@global_rules[0]", "v2ray_location_asset") or "/usr/share/v2ray/"):match("^(.*)/") .. "/geosite.dat"
|
||||
if luci.sys.call('"' .. bin .. '" -type geosite -input "' .. geo_file .. '" | grep -q "^GFW$"') == 0 then
|
||||
domain_list = (domain_list == "") and "geosite:gfw" or domain_list .. "\ngeosite:gfw"
|
||||
end
|
||||
end
|
||||
|
||||
if domain_list ~= "" or ip_list ~= "" then
|
||||
node["GFW_Mode_List"] = "_default"
|
||||
callback({
|
||||
[".name"] = "GFW_Mode_List",
|
||||
remarks = "GFW_Mode_List",
|
||||
domain_list = (domain_list ~= "") and domain_list or nil,
|
||||
ip_list = (ip_list ~= "") and ip_list or nil
|
||||
})
|
||||
end
|
||||
end
|
||||
foreach_shunt_rule(function(e)
|
||||
local outboundTag = gen_shunt_node(e[".name"])
|
||||
if outboundTag and e.remarks then
|
||||
if outboundTag == "default" then
|
||||
@@ -1755,6 +1801,14 @@ function gen_config(var)
|
||||
table.insert(rules, rule)
|
||||
end
|
||||
end)
|
||||
|
||||
if use_gfw_list == "1" and chn_list == "0" then -- GFW 模式下使用分流节点时添加兜底规则
|
||||
table.insert(rules, {
|
||||
action = "route",
|
||||
port_range = { "0:65535" },
|
||||
outbound = "direct"
|
||||
})
|
||||
end
|
||||
else
|
||||
COMMON.default_outbound_tag = gen_outbound_get_tag(flag, node or node_id, nil, {
|
||||
fragment = singbox_settings.fragment == "1" or nil,
|
||||
|
||||
@@ -868,6 +868,9 @@ function gen_config(var)
|
||||
local dns_socks_port = var["dns_socks_port"]
|
||||
local loglevel = var["loglevel"] or "warning"
|
||||
local no_run = var["no_run"]
|
||||
local use_proxy_list = var["use_proxy_list"]
|
||||
local use_gfw_list = var["use_gfw_list"]
|
||||
local chn_list = var["chn_list"]
|
||||
|
||||
local dns_domain_rules = {}
|
||||
local dns = nil
|
||||
@@ -1363,7 +1366,50 @@ function gen_config(var)
|
||||
end
|
||||
|
||||
--shunt rule
|
||||
uci:foreach(appname, "shunt_rules", function(e)
|
||||
local function foreach_shunt_rule(callback)
|
||||
uci:foreach(appname, "shunt_rules", callback)
|
||||
|
||||
if use_gfw_list ~= "1" or chn_list ~= "0" then return end
|
||||
|
||||
-- GFW 模式下使用分流节点时添加特定规则
|
||||
local function read_proxy_list(path)
|
||||
if use_proxy_list ~= "1" then return "" end
|
||||
local map, list = {}, {}
|
||||
local f = io.open(path)
|
||||
if f then
|
||||
for line in f:lines() do
|
||||
if line ~= "" and not line:find("#", 1, true) and not map[line] then
|
||||
map[line] = 1
|
||||
list[#list + 1] = line
|
||||
end
|
||||
end
|
||||
f:close()
|
||||
end
|
||||
return table.concat(list, "\n")
|
||||
end
|
||||
|
||||
local domain_list = read_proxy_list("/usr/share/passwall/rules/proxy_host")
|
||||
local ip_list = read_proxy_list("/usr/share/passwall/rules/proxy_ip")
|
||||
|
||||
local bin = api.finded_com("geoview")
|
||||
if bin then
|
||||
local geo_file = (uci:get(appname, "@global_rules[0]", "v2ray_location_asset") or "/usr/share/v2ray/"):match("^(.*)/") .. "/geosite.dat"
|
||||
if luci.sys.call('"' .. bin .. '" -type geosite -input "' .. geo_file .. '" | grep -q "^GFW$"') == 0 then
|
||||
domain_list = (domain_list == "") and "geosite:gfw" or domain_list .. "\ngeosite:gfw"
|
||||
end
|
||||
end
|
||||
|
||||
if domain_list ~= "" or ip_list ~= "" then
|
||||
node["GFW_Mode_List"] = "_default"
|
||||
callback({
|
||||
[".name"] = "GFW_Mode_List",
|
||||
remarks = "GFW_Mode_List",
|
||||
domain_list = (domain_list ~= "") and domain_list or nil,
|
||||
ip_list = (ip_list ~= "") and ip_list or nil
|
||||
})
|
||||
end
|
||||
end
|
||||
foreach_shunt_rule(function(e)
|
||||
local outbound_tag = gen_shunt_node(e[".name"])
|
||||
if outbound_tag and e.remarks then
|
||||
if outbound_tag == "default" then
|
||||
@@ -1463,6 +1509,15 @@ function gen_config(var)
|
||||
end
|
||||
end)
|
||||
|
||||
if use_gfw_list == "1" and chn_list == "0" then -- GFW 模式下使用分流节点时添加兜底规则
|
||||
table.insert(rules, {
|
||||
ruleTag = "GFW_Mode_Default",
|
||||
outboundTag = "direct",
|
||||
port = (node.domainStrategy == "IPIfNonMatch") and "1-65535" or nil,
|
||||
network = (node.domainStrategy ~= "IPIfNonMatch") and "tcp,udp" or nil
|
||||
})
|
||||
end
|
||||
|
||||
table.insert(rules, {
|
||||
outboundTag = "direct",
|
||||
ip = { "geoip:private" }
|
||||
|
||||
@@ -99,7 +99,7 @@ run_ipt2socks() {
|
||||
run_singbox() {
|
||||
local flag type node tcp_redir_port tcp_proxy_way udp_redir_port socks_address socks_port socks_username socks_password http_address http_port http_username http_password
|
||||
local dns_listen_port direct_dns_query_strategy direct_dns_port direct_dns_udp_server direct_dns_tcp_server remote_dns_protocol remote_dns_udp_server remote_dns_tcp_server remote_dns_doh remote_dns_client_ip remote_fakedns remote_dns_query_strategy dns_cache dns_socks_address dns_socks_port
|
||||
local loglevel log_file config_file server_host server_port no_run
|
||||
local loglevel log_file config_file server_host server_port no_run use_proxy_list use_gfw_list chn_list
|
||||
eval_set_val "$@"
|
||||
[ -z "$type" ] && {
|
||||
type=$(echo $(config_n_get $node type) | tr 'A-Z' 'a-z')
|
||||
@@ -120,6 +120,9 @@ run_singbox() {
|
||||
|
||||
[ -n "$flag" ] && json_add_string "flag" "$flag"
|
||||
[ -n "$node" ] && json_add_string "node" "$node"
|
||||
[ -n "$use_proxy_list" ] && json_add_string "use_proxy_list" "$use_proxy_list"
|
||||
[ -n "$use_gfw_list" ] && json_add_string "use_gfw_list" "$use_gfw_list"
|
||||
[ -n "$chn_list" ] && json_add_string "chn_list" "$chn_list"
|
||||
[ -n "$server_host" ] && json_add_string "server_host" "$server_host"
|
||||
[ -n "$server_port" ] && json_add_string "server_port" "$server_port"
|
||||
[ -n "$tcp_redir_port" ] && json_add_string "tcp_redir_port" "$tcp_redir_port"
|
||||
@@ -197,7 +200,7 @@ run_singbox() {
|
||||
run_xray() {
|
||||
local flag type node tcp_redir_port tcp_proxy_way udp_redir_port socks_address socks_port socks_username socks_password http_address http_port http_username http_password
|
||||
local dns_listen_port direct_dns_query_strategy direct_dns_port direct_dns_udp_server direct_dns_tcp_server remote_dns_protocol remote_dns_udp_server remote_dns_tcp_server remote_dns_doh remote_dns_client_ip remote_fakedns remote_dns_query_strategy dns_cache dns_socks_address dns_socks_port
|
||||
local loglevel log_file config_file server_host server_port no_run
|
||||
local loglevel log_file config_file server_host server_port no_run use_proxy_list use_gfw_list chn_list
|
||||
eval_set_val "$@"
|
||||
[ -z "$type" ] && {
|
||||
type=$(echo $(config_n_get $node type) | tr 'A-Z' 'a-z')
|
||||
@@ -209,6 +212,9 @@ run_xray() {
|
||||
[ -z "$loglevel" ] && local loglevel=$(config_t_get global loglevel "warning")
|
||||
[ -n "$flag" ] && json_add_string "flag" "$flag"
|
||||
[ -n "$node" ] && json_add_string "node" "$node"
|
||||
[ -n "$use_proxy_list" ] && json_add_string "use_proxy_list" "$use_proxy_list"
|
||||
[ -n "$use_gfw_list" ] && json_add_string "use_gfw_list" "$use_gfw_list"
|
||||
[ -n "$chn_list" ] && json_add_string "chn_list" "$chn_list"
|
||||
[ -n "$server_host" ] && json_add_string "server_host" "$server_host"
|
||||
[ -n "$server_port" ] && json_add_string "server_port" "$server_port"
|
||||
[ -n "$tcp_redir_port" ] && json_add_string "tcp_redir_port" "$tcp_redir_port"
|
||||
@@ -760,6 +766,7 @@ run_redir() {
|
||||
}
|
||||
NEXT_DNS_LISTEN_PORT=$(expr $NEXT_DNS_LISTEN_PORT + 1)
|
||||
}
|
||||
_args="${_args} use_proxy_list=$USE_PROXY_LIST use_gfw_list=$USE_GFW_LIST chn_list=$CHN_LIST"
|
||||
run_singbox flag=$_flag node=$node tcp_redir_port=$local_port tcp_proxy_way=$TCP_PROXY_WAY config_file=$config_file log_file=$log_file ${_args}
|
||||
;;
|
||||
xray)
|
||||
@@ -846,6 +853,7 @@ run_redir() {
|
||||
}
|
||||
NEXT_DNS_LISTEN_PORT=$(expr $NEXT_DNS_LISTEN_PORT + 1)
|
||||
}
|
||||
_args="${_args} use_proxy_list=$USE_PROXY_LIST use_gfw_list=$USE_GFW_LIST chn_list=$CHN_LIST"
|
||||
run_xray flag=$_flag node=$node tcp_redir_port=$local_port tcp_proxy_way=$TCP_PROXY_WAY config_file=$config_file log_file=$log_file ${_args}
|
||||
;;
|
||||
naiveproxy)
|
||||
@@ -1743,6 +1751,7 @@ acl_app() {
|
||||
}
|
||||
config_file="$TMP_PATH/$config_file"
|
||||
[ "${type}" = "sing-box" ] && type="singbox"
|
||||
_extra_param="${_extra_param} use_proxy_list=$use_proxy_list use_gfw_list=$use_gfw_list chn_list=$chn_list"
|
||||
run_${type} flag=$tcp_node node=$tcp_node tcp_redir_port=$redir_port ${_extra_param} config_file=$config_file log_file=$log_file loglevel=$loglevel
|
||||
else
|
||||
config_file="acl/${tcp_node}_SOCKS_${socks_port}.json"
|
||||
|
||||
@@ -1398,8 +1398,8 @@ del_firewall_rule() {
|
||||
done
|
||||
for ipt in "$ipt_f" "$ip6t_f"; do
|
||||
for chain in "FORWARD" "INPUT" "OUTPUT"; do
|
||||
for i in $(seq 1 $($ipt -nL $chain | grep -c PSW)); do
|
||||
local index=$($ipt --line-number -nL $chain | grep PSW | head -1 | awk '{print $1}')
|
||||
for i in $(seq 1 $($ipt -nL $chain | grep -c PSW_REJECT)); do
|
||||
local index=$($ipt --line-number -nL $chain | grep PSW_REJECT | head -1 | awk '{print $1}')
|
||||
$ipt -D $chain $index 2>/dev/null
|
||||
done
|
||||
done
|
||||
|
||||