mirror of
https://github.com/caiwx86/small-packages.git
synced 2026-10-31 12:35:13 +08:00
update 2026-09-13 16:42:22
This commit is contained in:
1 parent
2e55e363ac
commit
141863e6d4
1977 files changed
+359
-1523334
No files matched your search
@@ -123,31 +123,46 @@ function gen_outbound(flag, node, tag, proxy_table)
|
||||
end
|
||||
|
||||
if node.type ~= "sing-box" then
|
||||
local relay_port = node.port
|
||||
local new_port = api.get_new_port()
|
||||
local config_file = string.format("%s_%s_%s.json", flag, tag, new_port)
|
||||
if tag and node_id and not tag:find(node_id) then
|
||||
config_file = string.format("%s_%s_%s_%s.json", flag, tag, node_id, new_port)
|
||||
end
|
||||
local new_port
|
||||
if run_socks_instance then
|
||||
sys.call(string.format('/usr/share/passwall2/app.sh run_socks "%s"> /dev/null',
|
||||
string.format("flag=%s node=%s bind=%s socks_port=%s config_file=%s relay_port=%s",
|
||||
new_port, --flag
|
||||
node_id, --node
|
||||
"127.0.0.1", --bind
|
||||
new_port, --socks port
|
||||
config_file, --config file
|
||||
(proxy_tag and relay_port) and tostring(relay_port) or "" --relay port
|
||||
local relay_port = (proxy_tag and node.port) and tostring(node.port) or ""
|
||||
if relay_port == "" then
|
||||
local cache = api.get_socks_port_by_cache(node_id)
|
||||
if cache then
|
||||
new_port = cache
|
||||
run_socks_instance = nil
|
||||
end
|
||||
end
|
||||
if run_socks_instance then
|
||||
new_port = api.get_new_port()
|
||||
local config_file = string.format("nodesocks_%s_%s.json", node_id, new_port)
|
||||
if tag and node_id and not tag:find(node_id) then
|
||||
config_file = string.format("nodesocks_%s_%s_%s.json", tag, node_id, new_port)
|
||||
end
|
||||
sys.call(string.format('/usr/share/passwall2/app.sh run_socks "%s"> /dev/null',
|
||||
string.format("flag=%s node=%s bind=%s socks_port=%s config_file=%s relay_port=%s",
|
||||
new_port, --flag
|
||||
node_id, --node
|
||||
"127.0.0.1", --bind
|
||||
new_port, --socks port
|
||||
config_file, --config file
|
||||
relay_port --relay port
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
if relay_port == "" then
|
||||
api.set_socks_port_to_cache(node_id, new_port)
|
||||
end
|
||||
end
|
||||
end
|
||||
if new_port then
|
||||
node = {
|
||||
protocol = "socks",
|
||||
address = "127.0.0.1",
|
||||
port = new_port
|
||||
}
|
||||
proxy_tag = "socks <- " .. node_id
|
||||
end
|
||||
node = {
|
||||
protocol = "socks",
|
||||
address = "127.0.0.1",
|
||||
port = new_port
|
||||
}
|
||||
proxy_tag = "socks <- " .. node_id
|
||||
else
|
||||
if proxy_tag then
|
||||
node.detour = proxy_tag
|
||||
|
||||
Reference in new issue
Block a user