luci-app-passwall: bump to 4-3
This commit is contained in:
parent
2538759688
commit
7ffe6dbcbd
@ -7,8 +7,8 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-passwall
|
||||
PKG_VERSION:=4
|
||||
PKG_RELEASE:=1
|
||||
PKG_DATE:=20201204
|
||||
PKG_RELEASE:=3
|
||||
PKG_DATE:=20201211
|
||||
|
||||
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
@ -16,15 +16,15 @@ include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/$(PKG_NAME)/config
|
||||
menu "Configuration"
|
||||
|
||||
|
||||
config PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks
|
||||
bool "Include Shadowsocks"
|
||||
default y
|
||||
|
||||
|
||||
config PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Server
|
||||
bool "Include Shadowsocks Server"
|
||||
default y
|
||||
|
||||
|
||||
config PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR
|
||||
bool "Include ShadowsocksR"
|
||||
default y
|
||||
@ -32,7 +32,7 @@ config PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR
|
||||
config PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR_Server
|
||||
bool "Include ShadowsocksR Server"
|
||||
default y
|
||||
|
||||
|
||||
config PACKAGE_$(PKG_NAME)_INCLUDE_Xray
|
||||
bool "Include Xray"
|
||||
default y if i386||x86_64||arm||aarch64
|
||||
@ -44,11 +44,11 @@ config PACKAGE_$(PKG_NAME)_INCLUDE_V2ray
|
||||
config PACKAGE_$(PKG_NAME)_INCLUDE_Trojan_Plus
|
||||
bool "Include Trojan_Plus"
|
||||
default y
|
||||
|
||||
|
||||
config PACKAGE_$(PKG_NAME)_INCLUDE_Trojan_GO
|
||||
bool "Include Trojan_GO"
|
||||
default y if i386||x86_64||arm||aarch64
|
||||
|
||||
|
||||
config PACKAGE_$(PKG_NAME)_INCLUDE_Brook
|
||||
bool "Include Brook"
|
||||
default n
|
||||
@ -132,6 +132,8 @@ endef
|
||||
define Package/$(PKG_NAME)/conffiles
|
||||
/etc/config/passwall
|
||||
/etc/config/passwall_server
|
||||
/usr/share/passwall/rules/direct_host
|
||||
/usr/share/passwall/rules/direct_ip
|
||||
/usr/share/passwall/rules/proxy_host
|
||||
/usr/share/passwall/rules/proxy_ip
|
||||
/usr/share/passwall/rules/proxy_host2
|
||||
@ -155,6 +157,7 @@ define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_DIR) $(1)/usr/share/passwall
|
||||
cp -pR ./root/usr/share/passwall/* $(1)/usr/share/passwall
|
||||
$(INSTALL_CONF) ./root/etc/config/passwall $(1)/usr/share/passwall/config.default
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/lib/lua/luci
|
||||
cp -pR ./luasrc/* $(1)/usr/lib/lua/luci/
|
||||
|
||||
|
||||
@ -44,6 +44,7 @@ function index()
|
||||
|
||||
--[[ API ]]
|
||||
entry({"admin", "services", appname, "server_user_status"}, call("server_user_status")).leaf = true
|
||||
entry({"admin", "services", appname, "server_user_log"}, call("server_user_log")).leaf = true
|
||||
entry({"admin", "services", appname, "server_get_log"}, call("server_get_log")).leaf = true
|
||||
entry({"admin", "services", appname, "server_clear_log"}, call("server_clear_log")).leaf = true
|
||||
entry({"admin", "services", appname, "link_append_temp"}, call("link_append_temp")).leaf = true
|
||||
@ -51,6 +52,7 @@ function index()
|
||||
entry({"admin", "services", appname, "link_clear_temp"}, call("link_clear_temp")).leaf = true
|
||||
entry({"admin", "services", appname, "link_add_node"}, call("link_add_node")).leaf = true
|
||||
entry({"admin", "services", appname, "get_now_use_node"}, call("get_now_use_node")).leaf = true
|
||||
entry({"admin", "services", appname, "get_redir_log"}, call("get_redir_log")).leaf = true
|
||||
entry({"admin", "services", appname, "get_log"}, call("get_log")).leaf = true
|
||||
entry({"admin", "services", appname, "clear_log"}, call("clear_log")).leaf = true
|
||||
entry({"admin", "services", appname, "status"}, call("status")).leaf = true
|
||||
@ -152,6 +154,20 @@ function get_now_use_node()
|
||||
luci.http.write_json(e)
|
||||
end
|
||||
|
||||
function get_redir_log()
|
||||
local e = {}
|
||||
local proto = luci.http.formvalue("proto")
|
||||
local index = luci.http.formvalue("index")
|
||||
local filename = proto .. "_" .. index
|
||||
if nixio.fs.access("/var/etc/passwall/" .. filename .. ".log") then
|
||||
e.code = 200
|
||||
else
|
||||
e.code = 400
|
||||
end
|
||||
e.data = luci.sys.exec("cat /var/etc/passwall/" .. filename .. ".log")
|
||||
http_write_json(e)
|
||||
end
|
||||
|
||||
function get_log()
|
||||
-- luci.sys.exec("[ -f /var/log/passwall.log ] && sed '1!G;h;$!d' /var/log/passwall.log > /var/log/passwall_show.log")
|
||||
luci.http.write(luci.sys.exec("[ -f '/var/log/passwall.log' ] && cat /var/log/passwall.log"))
|
||||
@ -338,6 +354,18 @@ function server_user_status()
|
||||
http_write_json(e)
|
||||
end
|
||||
|
||||
function server_user_log()
|
||||
local e = {}
|
||||
local id = luci.http.formvalue("id")
|
||||
if nixio.fs.access("/var/etc/passwall_server/" .. id .. ".log") then
|
||||
e.code = 200
|
||||
else
|
||||
e.code = 400
|
||||
end
|
||||
e.data = luci.sys.exec("cat /var/etc/passwall_server/" .. id .. ".log")
|
||||
http_write_json(e)
|
||||
end
|
||||
|
||||
function server_get_log()
|
||||
luci.http.write(luci.sys.exec("[ -f '/var/log/passwall_server.log' ] && cat /var/log/passwall_server.log"))
|
||||
end
|
||||
|
||||
@ -15,6 +15,32 @@ command_timeout = 300
|
||||
LEDE_BOARD = nil
|
||||
DISTRIB_TARGET = nil
|
||||
|
||||
function is_exist(table, value)
|
||||
for index, k in ipairs(table) do
|
||||
if k == value then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function get_args(arg, myarg)
|
||||
local var = {}
|
||||
for i, arg_k in pairs(arg) do
|
||||
if i > 0 then
|
||||
if is_exist(myarg, arg_k) == true then
|
||||
local v = arg[i + 1]
|
||||
if v then
|
||||
if is_exist(myarg, v) == false then
|
||||
var[arg_k] = v
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return var
|
||||
end
|
||||
|
||||
function get_valid_nodes()
|
||||
local nodes = {}
|
||||
uci:foreach(appname, "nodes", function(e)
|
||||
@ -42,6 +68,22 @@ function get_valid_nodes()
|
||||
return nodes
|
||||
end
|
||||
|
||||
function get_full_node_remarks(n)
|
||||
local remarks = ""
|
||||
if n then
|
||||
if n.protocol and (n.protocol == "_balancing" or n.protocol == "_shunt") then
|
||||
remarks = "%s:[%s] " % {i18n.translatef(n.type .. n.protocol), n.remarks}
|
||||
else
|
||||
if n.use_kcp and n.use_kcp == "1" then
|
||||
remarks = "%s+%s:[%s] %s" % {n.type, "Kcptun", n.remarks, n.address}
|
||||
else
|
||||
remarks = "%s:[%s] %s:%s" % {n.type, n.remarks, n.address, n.port}
|
||||
end
|
||||
end
|
||||
end
|
||||
return remarks
|
||||
end
|
||||
|
||||
function gen_uuid(format)
|
||||
local uuid = sys.exec("echo -n $(cat /proc/sys/kernel/random/uuid)")
|
||||
if format == nil then
|
||||
|
||||
@ -1,11 +1,23 @@
|
||||
local api = require "luci.model.cbi.passwall.api.api"
|
||||
local ucursor = require "luci.model.uci".cursor()
|
||||
local jsonc = require "luci.jsonc"
|
||||
local node_section = arg[1]
|
||||
local run_type = arg[2]
|
||||
local local_addr = arg[3]
|
||||
local local_port = arg[4]
|
||||
local server_host = arg[5]
|
||||
local server_port = arg[6]
|
||||
|
||||
local myarg = {
|
||||
"-node", "-run_type", "-local_addr", "-local_port", "-server_host", "-server_port"
|
||||
}
|
||||
|
||||
local var = api.get_args(arg, myarg)
|
||||
|
||||
local node_section = var["-node"]
|
||||
if not node_section then
|
||||
print("-node 不能为空")
|
||||
return
|
||||
end
|
||||
local run_type = var["-run_type"]
|
||||
local local_addr = var["-local_addr"]
|
||||
local local_port = var["-local_port"]
|
||||
local server_host = var["-server_host"]
|
||||
local server_port = var["-server_port"]
|
||||
local node = ucursor:get_all("passwall", node_section)
|
||||
|
||||
local config = {
|
||||
|
||||
@ -1,10 +1,22 @@
|
||||
local api = require "luci.model.cbi.passwall.api.api"
|
||||
local ucursor = require "luci.model.uci".cursor()
|
||||
local jsonc = require "luci.jsonc"
|
||||
local node_section = arg[1]
|
||||
local local_addr = arg[2]
|
||||
local local_port = arg[3]
|
||||
local server_host = arg[4]
|
||||
local server_port = arg[5]
|
||||
|
||||
local myarg = {
|
||||
"-node", "-local_addr", "-local_port", "-server_host", "-server_port"
|
||||
}
|
||||
|
||||
local var = api.get_args(arg, myarg)
|
||||
|
||||
local node_section = var["-node"]
|
||||
if not node_section then
|
||||
print("-node 不能为空")
|
||||
return
|
||||
end
|
||||
local local_addr = var["-local_addr"]
|
||||
local local_port = var["-local_port"]
|
||||
local server_host = var["-server_host"]
|
||||
local server_port = var["-server_port"]
|
||||
local node = ucursor:get_all("passwall", node_section)
|
||||
|
||||
local config = {
|
||||
|
||||
@ -1,11 +1,24 @@
|
||||
local api = require "luci.model.cbi.passwall.api.api"
|
||||
local ucursor = require"luci.model.uci".cursor()
|
||||
local json = require "luci.jsonc"
|
||||
local node_section = arg[1]
|
||||
local run_type = arg[2]
|
||||
local local_addr = arg[3]
|
||||
local local_port = arg[4]
|
||||
local server_host = arg[5]
|
||||
local server_port = arg[6]
|
||||
|
||||
local myarg = {
|
||||
"-node", "-run_type", "-local_addr", "-local_port", "-server_host", "-server_port", "-loglevel"
|
||||
}
|
||||
|
||||
local var = api.get_args(arg, myarg)
|
||||
|
||||
local node_section = var["-node"]
|
||||
if not node_section then
|
||||
print("-node 不能为空")
|
||||
return
|
||||
end
|
||||
local run_type = var["-run_type"]
|
||||
local local_addr = var["-local_addr"]
|
||||
local local_port = var["-local_port"]
|
||||
local server_host = var["-server_host"]
|
||||
local server_port = var["-server_port"]
|
||||
local loglevel = var["-loglevel"] or 2
|
||||
local node = ucursor:get_all("passwall", node_section)
|
||||
|
||||
local cipher = "ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA:AES128-SHA:AES256-SHA:DES-CBC3-SHA"
|
||||
@ -17,7 +30,7 @@ local trojan = {
|
||||
remote_addr = server_host or node.address,
|
||||
remote_port = tonumber(server_port) or tonumber(node.port),
|
||||
password = {node.password},
|
||||
log_level = 1,
|
||||
log_level = tonumber(loglevel),
|
||||
ssl = {
|
||||
verify = (node.tls_allowInsecure ~= "1") and true or false,
|
||||
verify_hostname = true,
|
||||
|
||||
@ -1,311 +0,0 @@
|
||||
module("luci.model.cbi.passwall.api.gen_v2ray", package.seeall)
|
||||
local ucursor = require"luci.model.uci".cursor()
|
||||
local sys = require "luci.sys"
|
||||
local json = require "luci.jsonc"
|
||||
local appname = "passwall"
|
||||
local inbounds = {}
|
||||
local outbounds = {}
|
||||
local routing = nil
|
||||
|
||||
local node_section = arg[1] or "nil"
|
||||
local proto = arg[2]
|
||||
local redir_port = arg[3]
|
||||
local socks_proxy_port = arg[4]
|
||||
local node = ucursor:get_all(appname, node_section)
|
||||
local network = proto
|
||||
local new_port
|
||||
|
||||
local function get_new_port()
|
||||
if new_port then
|
||||
new_port = tonumber(sys.exec(string.format("echo -n $(/usr/share/%s/app.sh get_new_port %s tcp)", appname, new_port + 1)))
|
||||
else
|
||||
new_port = tonumber(sys.exec(string.format("echo -n $(/usr/share/%s/app.sh get_new_port auto tcp)", appname)))
|
||||
end
|
||||
return new_port
|
||||
end
|
||||
|
||||
function gen_outbound(node, tag, relay_port)
|
||||
local result = nil
|
||||
if node then
|
||||
local node_id = node[".name"]
|
||||
if tag == nil then
|
||||
tag = node_id
|
||||
end
|
||||
if node.type ~= "V2ray" then
|
||||
if node.type == "Socks" then
|
||||
node.protocol = "socks"
|
||||
node.transport = "tcp"
|
||||
else
|
||||
local node_type = (proto and proto ~= "nil") and proto or "socks"
|
||||
new_port = get_new_port()
|
||||
node.port = new_port
|
||||
sys.call(string.format('/usr/share/%s/app.sh run_socks "%s" "%s" "%s" "%s" "%s" "%s" "%s" "%s"> /dev/null',
|
||||
appname,
|
||||
node_id,
|
||||
"127.0.0.1",
|
||||
new_port,
|
||||
string.format("/var/etc/%s/v2_%s_%s.json", appname, node_type, node_id),
|
||||
"0",
|
||||
"nil",
|
||||
"4",
|
||||
relay_port and tostring(relay_port) or ""
|
||||
)
|
||||
)
|
||||
node.protocol = "socks"
|
||||
node.transport = "tcp"
|
||||
node.address = "127.0.0.1"
|
||||
end
|
||||
node.stream_security = "none"
|
||||
else
|
||||
if node.tls and node.tls == "1" then
|
||||
node.stream_security = "tls"
|
||||
end
|
||||
|
||||
if node.transport == "mkcp" or node.transport == "quic" then
|
||||
node.stream_security = "none"
|
||||
end
|
||||
end
|
||||
|
||||
result = {
|
||||
tag = tag,
|
||||
protocol = node.protocol,
|
||||
mux = {
|
||||
enabled = (node.mux == "1") and true or false,
|
||||
concurrency = (node.mux_concurrency) and tonumber(node.mux_concurrency) or 8
|
||||
},
|
||||
-- 底层传输配置
|
||||
streamSettings = (node.protocol == "vmess" or node.protocol == "vless" or node.protocol == "socks" or node.protocol == "shadowsocks" or node.protocol == "trojan") and {
|
||||
network = node.transport,
|
||||
security = node.stream_security,
|
||||
tlsSettings = (node.stream_security == "tls") and {
|
||||
serverName = node.tls_serverName,
|
||||
allowInsecure = (node.tls_allowInsecure == "1") and true or false
|
||||
} or nil,
|
||||
tcpSettings = (node.transport == "tcp" and node.protocol ~= "socks") and {
|
||||
header = {
|
||||
type = node.tcp_guise,
|
||||
request = (node.tcp_guise == "http") and {
|
||||
path = node.tcp_guise_http_path or {"/"},
|
||||
headers = {
|
||||
Host = node.tcp_guise_http_host or {}
|
||||
}
|
||||
} or nil
|
||||
}
|
||||
} or nil,
|
||||
kcpSettings = (node.transport == "mkcp") and {
|
||||
mtu = tonumber(node.mkcp_mtu),
|
||||
tti = tonumber(node.mkcp_tti),
|
||||
uplinkCapacity = tonumber(node.mkcp_uplinkCapacity),
|
||||
downlinkCapacity = tonumber(node.mkcp_downlinkCapacity),
|
||||
congestion = (node.mkcp_congestion == "1") and true or false,
|
||||
readBufferSize = tonumber(node.mkcp_readBufferSize),
|
||||
writeBufferSize = tonumber(node.mkcp_writeBufferSize),
|
||||
seed = (node.mkcp_seed and node.mkcp_seed ~= "") and node.mkcp_seed or nil,
|
||||
header = {type = node.mkcp_guise}
|
||||
} or nil,
|
||||
wsSettings = (node.transport == "ws") and {
|
||||
path = node.ws_path or "",
|
||||
headers = (node.ws_host ~= nil) and
|
||||
{Host = node.ws_host} or nil
|
||||
} or nil,
|
||||
httpSettings = (node.transport == "h2") and
|
||||
{path = node.h2_path, host = node.h2_host} or
|
||||
nil,
|
||||
dsSettings = (node.transport == "ds") and
|
||||
{path = node.ds_path} or nil,
|
||||
quicSettings = (node.transport == "quic") and {
|
||||
security = node.quic_security,
|
||||
key = node.quic_key,
|
||||
header = {type = node.quic_guise}
|
||||
} or nil
|
||||
} or nil,
|
||||
settings = {
|
||||
vnext = (node.protocol == "vmess" or node.protocol == "vless") and {
|
||||
{
|
||||
address = node.address,
|
||||
port = tonumber(node.port),
|
||||
users = {
|
||||
{
|
||||
id = node.uuid,
|
||||
alterId = tonumber(node.alter_id),
|
||||
level = node.level and tonumber(node.level) or 0,
|
||||
security = (node.protocol == "vmess") and node.security or nil,
|
||||
encryption = node.encryption or "none",
|
||||
flow = node.flow or nil
|
||||
}
|
||||
}
|
||||
}
|
||||
} or nil,
|
||||
servers = (node.protocol == "socks" or node.protocol == "http" or node.protocol == "shadowsocks" or node.protocol == "trojan") and {
|
||||
{
|
||||
address = node.address,
|
||||
port = tonumber(node.port),
|
||||
method = node.method or nil,
|
||||
password = node.password or "",
|
||||
users = (node.username and node.password) and
|
||||
{{user = node.username, pass = node.password}} or nil
|
||||
}
|
||||
} or nil
|
||||
}
|
||||
}
|
||||
end
|
||||
return result
|
||||
end
|
||||
|
||||
if node then
|
||||
if socks_proxy_port ~= "nil" then
|
||||
table.insert(inbounds, {
|
||||
listen = "0.0.0.0",
|
||||
port = tonumber(socks_proxy_port),
|
||||
protocol = "socks",
|
||||
settings = {auth = "noauth", udp = true, ip = "127.0.0.1"}
|
||||
})
|
||||
network = "tcp,udp"
|
||||
end
|
||||
|
||||
if redir_port ~= "nil" then
|
||||
table.insert(inbounds, {
|
||||
port = tonumber(redir_port),
|
||||
protocol = "dokodemo-door",
|
||||
settings = {network = proto, followRedirect = true},
|
||||
sniffing = {enabled = true, destOverride = {"http", "tls"}}
|
||||
})
|
||||
if proto == "tcp" and node.tcp_socks == "1" then
|
||||
table.insert(inbounds, {
|
||||
listen = "0.0.0.0",
|
||||
port = tonumber(node.tcp_socks_port),
|
||||
protocol = "socks",
|
||||
settings = {
|
||||
auth = node.tcp_socks_auth,
|
||||
accounts = (node.tcp_socks_auth == "password") and {
|
||||
{
|
||||
user = node.tcp_socks_auth_username,
|
||||
pass = node.tcp_socks_auth_password
|
||||
}
|
||||
} or nil,
|
||||
udp = true
|
||||
}
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
if node.protocol == "_shunt" then
|
||||
local rules = {}
|
||||
ucursor:foreach(appname, "shunt_rules", function(e)
|
||||
local name = e[".name"]
|
||||
local _node_id = node[name] or nil
|
||||
if _node_id and _node_id ~= "nil" then
|
||||
local _node = ucursor:get_all(appname, _node_id)
|
||||
local is_proxy = node[name .. "_proxy"]
|
||||
local relay_port
|
||||
if is_proxy and is_proxy == "1" then
|
||||
new_port = get_new_port()
|
||||
relay_port = new_port
|
||||
table.insert(inbounds, {
|
||||
tag = "proxy_" .. name,
|
||||
listen = "127.0.0.1",
|
||||
port = new_port,
|
||||
protocol = "dokodemo-door",
|
||||
settings = {network = "tcp,udp", address = _node.address, port = tonumber(_node.port)}
|
||||
})
|
||||
if _node.tls_serverName == nil then
|
||||
_node.tls_serverName = _node.address
|
||||
end
|
||||
_node.address = "127.0.0.1"
|
||||
_node.port = new_port
|
||||
end
|
||||
local _outbound = gen_outbound(_node, name, relay_port)
|
||||
if _outbound then
|
||||
table.insert(outbounds, _outbound)
|
||||
if is_proxy and is_proxy == "1" then
|
||||
table.insert(rules, {
|
||||
type = "field",
|
||||
inboundTag = {"proxy_" .. name},
|
||||
outboundTag = "default"
|
||||
})
|
||||
end
|
||||
if e.domain_list then
|
||||
local _domain = {}
|
||||
string.gsub(e.domain_list, '[^' .. "\r\n" .. ']+', function(w)
|
||||
table.insert(_domain, w)
|
||||
end)
|
||||
table.insert(rules, {
|
||||
type = "field",
|
||||
outboundTag = name,
|
||||
domain = _domain
|
||||
})
|
||||
end
|
||||
if e.ip_list then
|
||||
local _ip = {}
|
||||
string.gsub(e.ip_list, '[^' .. "\r\n" .. ']+', function(w)
|
||||
table.insert(_ip, w)
|
||||
end)
|
||||
table.insert(rules, {
|
||||
type = "field",
|
||||
outboundTag = name,
|
||||
ip = _ip
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
local default_node_id = node.default_node or nil
|
||||
if default_node_id and default_node_id ~= "nil" then
|
||||
local default_node = ucursor:get_all(appname, default_node_id)
|
||||
local default_outbound = gen_outbound(default_node, "default")
|
||||
if default_outbound then
|
||||
table.insert(outbounds, default_outbound)
|
||||
local rule = {
|
||||
type = "field",
|
||||
outboundTag = "default",
|
||||
network = network
|
||||
}
|
||||
table.insert(rules, rule)
|
||||
end
|
||||
end
|
||||
|
||||
routing = {
|
||||
domainStrategy = node.domainStrategy or "AsIs",
|
||||
rules = rules
|
||||
}
|
||||
|
||||
elseif node.protocol == "_balancing" then
|
||||
if node.balancing_node then
|
||||
local nodes = node.balancing_node
|
||||
local length = #nodes
|
||||
for i = 1, length do
|
||||
local node = ucursor:get_all(appname, nodes[i])
|
||||
local outbound = gen_outbound(node)
|
||||
if outbound then table.insert(outbounds, outbound) end
|
||||
end
|
||||
routing = {
|
||||
domainStrategy = node.domainStrategy or "AsIs",
|
||||
balancers = {{tag = "balancer", selector = nodes}},
|
||||
rules = {
|
||||
{type = "field", network = "tcp,udp", balancerTag = "balancer"}
|
||||
}
|
||||
}
|
||||
end
|
||||
else
|
||||
local outbound = gen_outbound(node)
|
||||
if outbound then table.insert(outbounds, outbound) end
|
||||
end
|
||||
|
||||
-- 额外传出连接
|
||||
table.insert(outbounds, {protocol = "freedom", tag = "direct", settings = {keep = ""}})
|
||||
|
||||
local v2ray = {
|
||||
log = {
|
||||
-- error = string.format("/var/etc/passwall/%s.log", node[".name"]),
|
||||
loglevel = "warning"
|
||||
},
|
||||
-- 传入连接
|
||||
inbounds = inbounds,
|
||||
-- 传出连接
|
||||
outbounds = outbounds,
|
||||
-- 路由
|
||||
routing = routing
|
||||
}
|
||||
print(json.stringify(v2ray, 1))
|
||||
end
|
||||
@ -1,80 +0,0 @@
|
||||
local json = require "luci.jsonc"
|
||||
local inbounds = {}
|
||||
local outbounds = {}
|
||||
local routing = nil
|
||||
|
||||
local local_proto = arg[1]
|
||||
local local_address = arg[2]
|
||||
local local_port = arg[3]
|
||||
local server_proto = arg[4]
|
||||
local server_address = arg[5]
|
||||
local server_port = arg[6]
|
||||
local server_username = arg[7] or "nil"
|
||||
local server_password = arg[8] or "nil"
|
||||
|
||||
function gen_outbound(proto, address, port, username, password)
|
||||
local result = {
|
||||
protocol = proto,
|
||||
streamSettings = {
|
||||
network = "tcp",
|
||||
security = "none"
|
||||
},
|
||||
settings = {
|
||||
servers = {
|
||||
{
|
||||
address = address,
|
||||
port = tonumber(port),
|
||||
users = (username ~= "nil" and password ~= "nil") and {
|
||||
{
|
||||
user = username,
|
||||
pass = password
|
||||
}
|
||||
} or nil
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return result
|
||||
end
|
||||
|
||||
if local_proto ~= "nil" and local_address ~= "nil" and local_port ~= "nil" then
|
||||
local inbound = {
|
||||
listen = local_address,
|
||||
port = tonumber(local_port),
|
||||
protocol = local_proto,
|
||||
settings = {
|
||||
accounts = nil
|
||||
}
|
||||
}
|
||||
if local_proto == "socks" then
|
||||
inbound.settings.auth = "noauth"
|
||||
inbound.settings.udp = true
|
||||
elseif local_proto == "http" then
|
||||
inbound.settings.allowTransparent = false
|
||||
end
|
||||
table.insert(inbounds, inbound)
|
||||
end
|
||||
|
||||
if server_proto ~= "nil" and server_address ~= "nil" and server_port ~= "nil" then
|
||||
local outbound = gen_outbound(server_proto, server_address, server_port, server_username, server_password)
|
||||
if outbound then table.insert(outbounds, outbound) end
|
||||
end
|
||||
|
||||
-- 额外传出连接
|
||||
table.insert(outbounds, {
|
||||
protocol = "freedom", tag = "direct", settings = {keep = ""}
|
||||
})
|
||||
|
||||
local v2ray = {
|
||||
log = {
|
||||
-- error = string.format("/var/etc/passwall/%s.log", node[".name"]),
|
||||
loglevel = "warning"
|
||||
},
|
||||
-- 传入连接
|
||||
inbounds = inbounds,
|
||||
-- 传出连接
|
||||
outbounds = outbounds,
|
||||
-- 路由
|
||||
routing = routing
|
||||
}
|
||||
print(json.stringify(v2ray, 1))
|
||||
@ -1,4 +1,5 @@
|
||||
module("luci.model.cbi.passwall.api.gen_xray", package.seeall)
|
||||
local api = require "luci.model.cbi.passwall.api.api"
|
||||
local ucursor = require"luci.model.uci".cursor()
|
||||
local sys = require "luci.sys"
|
||||
local json = require "luci.jsonc"
|
||||
@ -7,11 +8,17 @@ local inbounds = {}
|
||||
local outbounds = {}
|
||||
local routing = nil
|
||||
|
||||
local node_section = arg[1] or "nil"
|
||||
local proto = arg[2]
|
||||
local redir_port = arg[3]
|
||||
local socks_proxy_port = arg[4]
|
||||
local node = ucursor:get_all(appname, node_section)
|
||||
local myarg = {
|
||||
"-node", "-proto", "-redir_port", "-socks_proxy_port", "-loglevel"
|
||||
}
|
||||
|
||||
local var = api.get_args(arg, myarg)
|
||||
|
||||
local node_section = var["-node"]
|
||||
local proto = var["-proto"]
|
||||
local redir_port = var["-redir_port"]
|
||||
local socks_proxy_port = var["-socks_proxy_port"]
|
||||
local loglevel = var["-loglevel"] or "warning"
|
||||
local network = proto
|
||||
local new_port
|
||||
|
||||
@ -31,12 +38,12 @@ function gen_outbound(node, tag, relay_port)
|
||||
if tag == nil then
|
||||
tag = node_id
|
||||
end
|
||||
if node.type ~= "Xray" then
|
||||
if node.type ~= "Xray" and node.type ~= "V2ray" then
|
||||
if node.type == "Socks" then
|
||||
node.protocol = "socks"
|
||||
node.transport = "tcp"
|
||||
else
|
||||
local node_type = (proto and proto ~= "nil") and proto or "socks"
|
||||
local node_type = proto or "socks"
|
||||
new_port = get_new_port()
|
||||
node.port = new_port
|
||||
sys.call(string.format('/usr/share/%s/app.sh run_socks "%s" "%s" "%s" "%s" "%s" "%s" "%s" "%s"> /dev/null',
|
||||
@ -159,8 +166,9 @@ function gen_outbound(node, tag, relay_port)
|
||||
return result
|
||||
end
|
||||
|
||||
if node then
|
||||
if socks_proxy_port ~= "nil" then
|
||||
if node_section then
|
||||
local node = ucursor:get_all(appname, node_section)
|
||||
if socks_proxy_port then
|
||||
table.insert(inbounds, {
|
||||
listen = "0.0.0.0",
|
||||
port = tonumber(socks_proxy_port),
|
||||
@ -170,7 +178,7 @@ if node then
|
||||
network = "tcp,udp"
|
||||
end
|
||||
|
||||
if redir_port ~= "nil" then
|
||||
if redir_port then
|
||||
table.insert(inbounds, {
|
||||
port = tonumber(redir_port),
|
||||
protocol = "dokodemo-door",
|
||||
@ -305,7 +313,7 @@ if node then
|
||||
local xray = {
|
||||
log = {
|
||||
-- error = string.format("/var/etc/passwall/%s.log", node[".name"]),
|
||||
loglevel = "warning"
|
||||
loglevel = loglevel
|
||||
},
|
||||
-- 传入连接
|
||||
inbounds = inbounds,
|
||||
|
||||
@ -1,16 +1,23 @@
|
||||
local api = require "luci.model.cbi.passwall.api.api"
|
||||
local json = require "luci.jsonc"
|
||||
local inbounds = {}
|
||||
local outbounds = {}
|
||||
local routing = nil
|
||||
|
||||
local local_proto = arg[1]
|
||||
local local_address = arg[2]
|
||||
local local_port = arg[3]
|
||||
local server_proto = arg[4]
|
||||
local server_address = arg[5]
|
||||
local server_port = arg[6]
|
||||
local server_username = arg[7] or "nil"
|
||||
local server_password = arg[8] or "nil"
|
||||
local myarg = {
|
||||
"-local_proto", "-local_address", "-local_port", "-server_proto", "-server_address", "-server_port", "-server_username", "-server_password"
|
||||
}
|
||||
|
||||
local var = api.get_args(arg, myarg)
|
||||
|
||||
local local_proto = var["-local_proto"]
|
||||
local local_address = var["-local_address"]
|
||||
local local_port = var["-local_port"]
|
||||
local server_proto = var["-server_proto"]
|
||||
local server_address = var["-server_address"]
|
||||
local server_port = var["-server_port"]
|
||||
local server_username = var["-server_username"]
|
||||
local server_password = var["-server_password"]
|
||||
|
||||
function gen_outbound(proto, address, port, username, password)
|
||||
local result = {
|
||||
@ -24,7 +31,7 @@ function gen_outbound(proto, address, port, username, password)
|
||||
{
|
||||
address = address,
|
||||
port = tonumber(port),
|
||||
users = (username ~= "nil" and password ~= "nil") and {
|
||||
users = (username and password) and {
|
||||
{
|
||||
user = username,
|
||||
pass = password
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
local o = require "luci.dispatcher"
|
||||
local d = require "luci.dispatcher"
|
||||
local uci = require"luci.model.uci".cursor()
|
||||
local api = require "luci.model.cbi.passwall.api.api"
|
||||
local appname = "passwall"
|
||||
@ -79,23 +79,35 @@ for i = 1, tcp_node_num, 1 do
|
||||
o = s:taboption("Main", ListValue, "tcp_node" .. i, translate("TCP Node") .. " " .. i)
|
||||
if i == 1 then
|
||||
o.title = translate("TCP Node")
|
||||
o.description = translate("For proxy specific list.") .. o.description
|
||||
if tonumber(m:get("@auto_switch[0]", "enable") or 0) == 1 then
|
||||
local current_node = luci.sys.exec(string.format("[ -f '/var/etc/%s/id/TCP_%s' ] && echo -n $(cat /var/etc/%s/id/TCP_%s)", appname, i, appname, i))
|
||||
if current_node and current_node ~= "" and current_node ~= "nil" then
|
||||
local e = uci:get_all(appname, current_node)
|
||||
if e then
|
||||
local remarks = ""
|
||||
if e.protocol and (e.protocol == "_balancing" or e.protocol == "_shunt") then
|
||||
remarks = "%s:[%s] " % {translatef(e.type .. e.protocol), e.remarks}
|
||||
else
|
||||
if e.use_kcp and e.use_kcp == "1" then
|
||||
remarks = "%s+%s:[%s] %s" % {e.type, "Kcptun", e.remarks, e.address}
|
||||
else
|
||||
remarks = "%s:[%s] %s:%s" % {e.type, e.remarks, e.address, e.port}
|
||||
o.description = ""
|
||||
--o.description = translate("For proxy specific list.")
|
||||
--o.description = o.description .. "<br />"
|
||||
local current_node = luci.sys.exec(string.format("[ -f '/var/etc/%s/id/TCP_%s' ] && echo -n $(cat /var/etc/%s/id/TCP_%s)", appname, i, appname, i))
|
||||
if current_node and current_node ~= "" and current_node ~= "nil" then
|
||||
local n = uci:get_all(appname, current_node)
|
||||
if n then
|
||||
if tonumber(m:get("@auto_switch[0]", "enable") or 0) == 1 then
|
||||
local remarks = api.get_full_node_remarks(n)
|
||||
local url = d.build_url("admin", "services", appname, "node_config", current_node)
|
||||
o.description = o.description .. translatef("Current node: %s", string.format('<a href="%s">%s</a>', url, remarks)) .. "<br />"
|
||||
end
|
||||
if n.protocol and n.protocol == "_shunt" then
|
||||
uci:foreach(appname, "shunt_rules", function(e)
|
||||
local id = e[".name"]
|
||||
local remarks = translate(e.remarks)
|
||||
if n[id] and n[id] ~= "nil" then
|
||||
local url = d.build_url("admin", "services", appname, "node_config", n[id])
|
||||
local r = api.get_full_node_remarks(uci:get_all(appname, n[id]))
|
||||
o.description = o.description .. remarks .. ":" .. string.format('<a href="%s">%s</a>', url, r) .. "<br />"
|
||||
end
|
||||
end)
|
||||
local id = "default_node"
|
||||
local remarks = translate("Default")
|
||||
if n[id] and n[id] ~= "nil" then
|
||||
local url = d.build_url("admin", "services", appname, "node_config", n[id])
|
||||
local r = api.get_full_node_remarks(uci:get_all(appname, n[id]))
|
||||
o.description = o.description .. remarks .. ":" .. string.format('<a href="%s">%s</a>', url, r) .. "<br />"
|
||||
end
|
||||
o.description = translate("For proxy specific list.") .. "<br />" .. translatef("Current node: %s", '<a href="node_config/' .. current_node .. '">' .. remarks .. '</a>')
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -111,7 +123,7 @@ for i = 1, udp_node_num, 1 do
|
||||
o:value("nil", translate("Close"))
|
||||
if i == 1 then
|
||||
o.title = translate("UDP Node")
|
||||
o.description = translate("For proxy game network, DNS hijack etc.") .. o.description .. "<br />" .. translate("The selected server will not use Kcptun.")
|
||||
--o.description = translate("For proxy game network, DNS hijack etc.") .. "<br />" .. translate("The selected server will not use Kcptun.")
|
||||
o:value("tcp_", translate("Same as the tcp node"))
|
||||
--o:value("tcp", translate("Same as the tcp node"))
|
||||
--o:value("tcp_", translate("Same as the tcp node") .. "(" .. translate("New process") .. ")")
|
||||
@ -293,6 +305,30 @@ o:value("disable", translate("No Proxy"))
|
||||
o.default = "default"
|
||||
o.rmempty = false
|
||||
|
||||
s:tab("log", translate("Log"))
|
||||
for i = 1, tcp_node_num, 1 do
|
||||
o = s:taboption("log", Flag, "close_log_tcp_" .. i , translate("Close") .. translate("Log") .. " " .. translate("TCP Node") .. " " .. i)
|
||||
o.rmempty = false
|
||||
end
|
||||
for i = 1, udp_node_num, 1 do
|
||||
o = s:taboption("log", Flag, "close_log_udp_" .. i, translate("Close") .. translate("Log") .. " " .. translate("UDP Node") .. " " .. i)
|
||||
o.rmempty = false
|
||||
end
|
||||
loglevel = s:taboption("log", ListValue, "loglevel", "X/V2ray" .. translate("Log Level"))
|
||||
loglevel.default = "warning"
|
||||
loglevel:value("debug")
|
||||
loglevel:value("info")
|
||||
loglevel:value("warning")
|
||||
loglevel:value("error")
|
||||
|
||||
trojan_loglevel = s:taboption("log", ListValue, "trojan_loglevel", "Trojan" .. translate("Log Level"))
|
||||
trojan_loglevel.default = "2"
|
||||
trojan_loglevel:value("0", "all")
|
||||
trojan_loglevel:value("1", "info")
|
||||
trojan_loglevel:value("2", "warn")
|
||||
trojan_loglevel:value("3", "error")
|
||||
trojan_loglevel:value("4", "fatal")
|
||||
|
||||
s:tab("tips", translate("Tips"))
|
||||
|
||||
o = s:taboption("tips", DummyValue, "")
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
local e = require "luci.sys"
|
||||
local net = require "luci.model.network".init()
|
||||
local uci = require "luci.model.uci".cursor()
|
||||
local api = require "luci.model.cbi.passwall.api.api"
|
||||
local appname = "passwall"
|
||||
|
||||
@ -83,6 +82,7 @@ o.default = "5"
|
||||
o.rmempty = false
|
||||
|
||||
---- Export
|
||||
--[[
|
||||
o = s:option(ListValue, "export", translate("Export Of Multi WAN"))
|
||||
o:value(0, translate("Auto"))
|
||||
local ifaces = e.net:devices()
|
||||
@ -97,6 +97,7 @@ for _, iface in ipairs(ifaces) do
|
||||
end
|
||||
o.default = 0
|
||||
o.rmempty = false
|
||||
]]--
|
||||
|
||||
---- Mode
|
||||
o = s:option(ListValue, "backup", translate("Mode"))
|
||||
|
||||
@ -24,10 +24,13 @@ local function cmd(cmd)
|
||||
sys.call(cmd)
|
||||
end
|
||||
|
||||
local function ln_start(s, d, command)
|
||||
local function ln_start(s, d, command, output)
|
||||
if not output then
|
||||
output = "/dev/null"
|
||||
end
|
||||
d = TMP_BIN_PATH .. "/" .. d
|
||||
cmd(string.format('[ ! -f "%s" ] && ln -s %s %s 2>/dev/null', d, s, d))
|
||||
return string.format("%s >/dev/null 2>&1 &", d .. " " ..command)
|
||||
return string.format("%s >%s 2>&1 &", d .. " " ..command, output)
|
||||
end
|
||||
|
||||
local function gen_include()
|
||||
@ -61,6 +64,13 @@ local function start()
|
||||
local id = user[".name"]
|
||||
local enable = user.enable
|
||||
if enable and tonumber(enable) == 1 then
|
||||
local enable_log = user.log
|
||||
local log_path = nil
|
||||
if enable_log and enable_log == "1" then
|
||||
log_path = CONFIG_PATH .. "/" .. id .. ".log"
|
||||
else
|
||||
log_path = nil
|
||||
end
|
||||
local remarks = user.remarks
|
||||
local port = tonumber(user.port)
|
||||
local bin
|
||||
@ -79,7 +89,7 @@ local function start()
|
||||
auth = username .. " " .. password
|
||||
end
|
||||
end
|
||||
bin = ln_start("/usr/bin/microsocks", "microsocks_" .. id, string.format("-i :: -p %s %s", port, auth))
|
||||
bin = ln_start("/usr/bin/microsocks", "microsocks_" .. id, string.format("-i :: -p %s %s", port, auth), log_path)
|
||||
elseif type == "SS" or type == "SSR" then
|
||||
config = require("luci.model.cbi.passwall.server.api.shadowsocks").gen_config(user)
|
||||
local udp_param = ""
|
||||
@ -88,26 +98,26 @@ local function start()
|
||||
udp_param = "-u"
|
||||
end
|
||||
type = type:lower()
|
||||
bin = ln_start("/usr/bin/" .. type .. "-server", type .. "-server", "-c " .. config_file .. " " .. udp_param)
|
||||
bin = ln_start("/usr/bin/" .. type .. "-server", type .. "-server", "-c " .. config_file .. " " .. udp_param, log_path)
|
||||
elseif type == "Xray" then
|
||||
config = require("luci.model.cbi.passwall.server.api.xray").gen_config(user)
|
||||
bin = ln_start(_api.get_xray_path(), "xray", "-config=" .. config_file)
|
||||
bin = ln_start(_api.get_xray_path(), "xray", "-config=" .. config_file, log_path)
|
||||
elseif type == "V2ray" then
|
||||
config = require("luci.model.cbi.passwall.server.api.v2ray").gen_config(user)
|
||||
bin = ln_start(_api.get_v2ray_path(), "v2ray", "-config=" .. config_file)
|
||||
bin = ln_start(_api.get_v2ray_path(), "v2ray", "-config=" .. config_file, log_path)
|
||||
elseif type == "Trojan" then
|
||||
config = require("luci.model.cbi.passwall.server.api.trojan").gen_config(user)
|
||||
bin = ln_start("/usr/sbin/trojan", "trojan", "-c " .. config_file)
|
||||
bin = ln_start("/usr/sbin/trojan", "trojan", "-c " .. config_file, log_path)
|
||||
elseif type == "Trojan-Plus" then
|
||||
config = require("luci.model.cbi.passwall.server.api.trojan").gen_config(user)
|
||||
bin = ln_start("/usr/sbin/trojan-plus", "trojan-plus", "-c " .. config_file)
|
||||
bin = ln_start("/usr/sbin/trojan-plus", "trojan-plus", "-c " .. config_file, log_path)
|
||||
elseif type == "Trojan-Go" then
|
||||
config = require("luci.model.cbi.passwall.server.api.trojan").gen_config(user)
|
||||
bin = ln_start(_api.get_trojan_go_path(), "trojan-go", "-config " .. config_file)
|
||||
bin = ln_start(_api.get_trojan_go_path(), "trojan-go", "-config " .. config_file, log_path)
|
||||
elseif type == "Brook" then
|
||||
local brook_protocol = user.protocol
|
||||
local brook_password = user.password
|
||||
bin = ln_start(_api.get_brook_path(), "brook_" .. id, string.format("%s -l :%s -p %s", brook_protocol, port, brook_password))
|
||||
bin = ln_start(_api.get_brook_path(), "brook_" .. id, string.format("%s -l :%s -p %s", brook_protocol, port, brook_password), log_path)
|
||||
end
|
||||
|
||||
if next(config) then
|
||||
|
||||
@ -9,7 +9,7 @@ function gen_config(user)
|
||||
remote_addr = (user.remote_enable == "1" and user.remote_address) and user.remote_address or nil,
|
||||
remote_port = (user.remote_enable == "1" and user.remote_port) and tonumber(user.remote_port) or nil,
|
||||
password = user.uuid,
|
||||
log_level = 1,
|
||||
log_level = (user.log and user.log == "1") and tonumber(user.loglevel) or 5,
|
||||
ssl = {
|
||||
cert = user.tls_certificateFile,
|
||||
key = user.tls_keyFile,
|
||||
|
||||
@ -97,7 +97,7 @@ function gen_config(user)
|
||||
local config = {
|
||||
log = {
|
||||
-- error = "/var/etc/passwall_server/log/" .. user[".name"] .. ".log",
|
||||
loglevel = "warning"
|
||||
loglevel = (user.log and user.log == "1") and user.loglevel or "none"
|
||||
},
|
||||
-- 传入连接
|
||||
inbounds = {
|
||||
|
||||
@ -97,7 +97,7 @@ function gen_config(user)
|
||||
local config = {
|
||||
log = {
|
||||
-- error = "/var/etc/passwall_server/log/" .. user[".name"] .. ".log",
|
||||
loglevel = "warning"
|
||||
loglevel = (user.log and user.log == "1") and user.loglevel or "none"
|
||||
},
|
||||
-- 传入连接
|
||||
inbounds = {
|
||||
|
||||
@ -57,6 +57,10 @@ end
|
||||
|
||||
e = t:option(DummyValue, "port", translate("Port"))
|
||||
|
||||
e = t:option(Flag, "log", translate("Enable") .. translate("Log"))
|
||||
e.default = "1"
|
||||
e.rmempty = false
|
||||
|
||||
m:append(Template("passwall/server/log"))
|
||||
|
||||
m:append(Template("passwall/server/users_list_status"))
|
||||
|
||||
@ -594,4 +594,34 @@ transit_node.default = "nil"
|
||||
transit_node:depends("type", "Xray")
|
||||
transit_node:depends("type", "V2ray")
|
||||
|
||||
log = s:option(Flag, "log", translate("Enable") .. translate("Log"))
|
||||
log.default = "1"
|
||||
log.rmempty = false
|
||||
|
||||
loglevel = s:option(ListValue, "loglevel", translate("Log Level"))
|
||||
loglevel.default = "warning"
|
||||
loglevel:value("debug")
|
||||
loglevel:value("info")
|
||||
loglevel:value("warning")
|
||||
loglevel:value("error")
|
||||
loglevel:depends({ type = "Xray", log = true })
|
||||
loglevel:depends({ type = "V2ray", log = true })
|
||||
|
||||
trojan_loglevel = s:option(ListValue, "trojan_loglevel", translate("Log Level"))
|
||||
trojan_loglevel.default = "2"
|
||||
trojan_loglevel:value("0", "all")
|
||||
trojan_loglevel:value("1", "info")
|
||||
trojan_loglevel:value("2", "warn")
|
||||
trojan_loglevel:value("3", "error")
|
||||
trojan_loglevel:value("4", "fatal")
|
||||
function trojan_loglevel.cfgvalue(self, section)
|
||||
return m:get(section, "loglevel")
|
||||
end
|
||||
function trojan_loglevel.write(self, section, value)
|
||||
m:set(section, "loglevel", value)
|
||||
end
|
||||
trojan_loglevel:depends({ type = "Trojan", log = true })
|
||||
trojan_loglevel:depends({ type = "Trojan-Plus", log = true })
|
||||
trojan_loglevel:depends({ type = "Trojan-Go", log = true })
|
||||
|
||||
return m
|
||||
|
||||
@ -6,6 +6,29 @@ local auto_switch = api.uci_get_type("auto_switch", "enable", 0)
|
||||
-%>
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
function get_redir_log(proto, index) {
|
||||
if (proto && index) {
|
||||
proto = proto.toUpperCase();
|
||||
XHR.get('<%=url([[admin]], [[services]], [[passwall]], [[get_redir_log]])%>', {
|
||||
proto: proto,
|
||||
index: index
|
||||
},
|
||||
function(x, result) {
|
||||
if (x && x.status == 200) {
|
||||
if (result.code == 200) {
|
||||
var content = result.data;
|
||||
content = content.replace(/\n/g, "<br />");
|
||||
var new_window = window.open();
|
||||
new_window.document.write(content);
|
||||
} else {
|
||||
alert('<%:Not enabled log%>');
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
var _status = document.getElementsByClassName('_status');
|
||||
for (var i = 0; i < _status.length; i++) {
|
||||
var id = _status[i].getAttribute("socks_id");
|
||||
@ -36,33 +59,44 @@ local auto_switch = api.uci_get_type("auto_switch", "enable", 0)
|
||||
);
|
||||
}
|
||||
|
||||
var global_id = null;
|
||||
var global = document.getElementById("cbi-passwall-global");
|
||||
if (global) {
|
||||
var node = global.getElementsByClassName("cbi-section-node")[0];
|
||||
var node_id = node.getAttribute("id");
|
||||
global_id = node_id;
|
||||
|
||||
for (var i = 0; i <= 1; i++) {
|
||||
var proto = "udp";
|
||||
var num = <%=udp_node_num%>;
|
||||
if (i == 0) {
|
||||
if (<%=auto_switch%> > 0) {
|
||||
continue;
|
||||
}
|
||||
proto = "tcp";
|
||||
num = <%=tcp_node_num%>;
|
||||
}
|
||||
if (num >= 1) {
|
||||
for (var j = 0; j < num; j++) {
|
||||
var index = j + 1;
|
||||
var node = document.getElementById(node_id + "-" + proto + "_node" + index);
|
||||
var node_select = document.getElementById(node.id.replace("cbi-", "cbid-").replace(new RegExp("-", 'g'), "."));
|
||||
var dom_id = node_id + "-" + proto + "_node" + index;
|
||||
dom_id = dom_id.replace("cbi-", "cbid-").replace(new RegExp("-", 'g'), ".");
|
||||
var node_select = document.getElementById(dom_id);
|
||||
var node_select_value = node_select.value;
|
||||
if (node_select_value && node_select_value != "nil") {
|
||||
var new_a = document.createElement("a");
|
||||
new_a.setAttribute("href","node_config/" + node_select_value);
|
||||
new_a.innerHTML = "<%:Edit Current Node%>";
|
||||
var v = document.getElementById(dom_id + "-" + node_select_value);
|
||||
node_select.title = v.text;
|
||||
|
||||
node_select.outerHTML = node_select.outerHTML + "  " + new_a.outerHTML;
|
||||
var edit_btn = document.createElement("input");
|
||||
edit_btn.setAttribute("class", "cbi-button cbi-button-edit");
|
||||
edit_btn.setAttribute("type", "button");
|
||||
edit_btn.setAttribute("value", "<%:Edit%>");
|
||||
edit_btn.setAttribute("onclick", "location.href='" + '<%=url([[admin]], [[services]], [[passwall]], [[node_config]])%>' + "/" + node_select_value + "'");
|
||||
|
||||
var log_btn = document.createElement("input");
|
||||
log_btn.setAttribute("class", "cbi-button cbi-button-add");
|
||||
log_btn.setAttribute("type", "button");
|
||||
log_btn.setAttribute("value", "<%:Log%>");
|
||||
log_btn.setAttribute("onclick", 'get_redir_log("' + proto + '","' + index + '")');
|
||||
|
||||
node_select.outerHTML = node_select.outerHTML + "  " + edit_btn.outerHTML + log_btn.outerHTML;
|
||||
//node_select.parentNode.insertBefore(new_a, node_select.nextSibling);
|
||||
}
|
||||
}
|
||||
@ -70,5 +104,44 @@ local auto_switch = api.uci_get_type("auto_switch", "enable", 0)
|
||||
}
|
||||
}
|
||||
|
||||
var socks = document.getElementById("cbi-passwall-socks");
|
||||
if (socks) {
|
||||
rows = socks.getElementsByClassName("cbi-section-table-row");
|
||||
for (var i = 0; i < rows.length; i++) {
|
||||
var row = rows[i];
|
||||
var id = row.id;
|
||||
var dom_id = id + "-node";
|
||||
var node = document.getElementById(dom_id);
|
||||
var dom_id = dom_id.replace("cbi-", "cbid-").replace(new RegExp("-", 'g'), ".");
|
||||
var node_select = document.getElementById(dom_id);
|
||||
var node_select_value = node_select.value;
|
||||
if (node_select_value && node_select_value != "nil") {
|
||||
if (global_id != null && node_select_value.indexOf("tcp") == 0) {
|
||||
var num = node_select_value.replace("tcp", "");
|
||||
var d = global_id + "-tcp_node" + index;
|
||||
d = d.replace("cbi-", "cbid-").replace(new RegExp("-", 'g'), ".");
|
||||
var dom = document.getElementById(d);
|
||||
var _node_select_value = dom.value;
|
||||
if (_node_select_value && _node_select_value != "nil") {
|
||||
node_select_value = _node_select_value;
|
||||
}
|
||||
}
|
||||
var v = document.getElementById(dom_id + "-" + node_select_value);
|
||||
node_select.title = v.text;
|
||||
|
||||
var new_input = document.createElement("input");
|
||||
new_input.setAttribute("class", "cbi-button cbi-button-edit");
|
||||
new_input.setAttribute("type", "button");
|
||||
new_input.setAttribute("value", "<%:Edit%>");
|
||||
new_input.setAttribute("alt", "<%:Edit%>");
|
||||
new_input.setAttribute("title", "<%:Edit%>");
|
||||
new_input.setAttribute("onclick","location.href='" + '<%=url([[admin]], [[services]], [[passwall]], [[node_config]])%>' + "/" + node_select_value + "'");
|
||||
|
||||
node_select.outerHTML = node_select.outerHTML + "  " + new_input.outerHTML;
|
||||
//node_select.parentNode.insertBefore(new_input, node_select.nextSibling);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//]]>
|
||||
</script>
|
||||
@ -1,10 +1,31 @@
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
function get_log(cbi_id) {
|
||||
if (cbi_id) {
|
||||
XHR.get('<%=url([[admin]], [[services]], [[passwall]], [[server_user_log]])%>', {
|
||||
id: cbi_id
|
||||
},
|
||||
function(x, result) {
|
||||
if (x && x.status == 200) {
|
||||
if (result.code == 200) {
|
||||
var content = result.data;
|
||||
content = content.replace(/\n/g, "<br />");
|
||||
var new_window = window.open();
|
||||
new_window.document.write(content);
|
||||
} else {
|
||||
alert('<%:Not enabled log%>');
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
var _users_status = document.getElementsByClassName('_users_status');
|
||||
for(var i = 0; i < _users_status.length; i++) {
|
||||
var id = _users_status[i].parentElement.parentElement.parentElement.id;
|
||||
id = id.substr(id.lastIndexOf("-") + 1);
|
||||
XHR.poll(1,'<%=url([[admin]], [[services]], [[passwall]], [[server_user_status]])%>', {
|
||||
XHR.get('<%=url([[admin]], [[services]], [[passwall]], [[server_user_status]])%>', {
|
||||
index: i,
|
||||
id: id
|
||||
},
|
||||
@ -15,5 +36,21 @@
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
var edit_btn = document.getElementById("cbi-passwall_server-user").getElementsByClassName("cbi-button cbi-button-edit");
|
||||
for (var i = 0; i < edit_btn.length; i++) {
|
||||
try {
|
||||
var onclick_str = edit_btn[i].getAttribute("onclick");
|
||||
var id = onclick_str.substring(onclick_str.lastIndexOf('/') + 1, onclick_str.length - 1);
|
||||
var td = edit_btn[i].parentNode;
|
||||
var new_div = "";
|
||||
//添加"日志"按钮
|
||||
new_div += '<input class="cbi-button cbi-button-add" type="button" value="<%:Log%>" onclick="get_log(\'' + id + '\')"/> ';
|
||||
td.innerHTML = new_div + td.innerHTML;
|
||||
}
|
||||
catch(err) {
|
||||
console.error(err);
|
||||
}
|
||||
}
|
||||
//]]>
|
||||
</script>
|
||||
@ -1132,6 +1132,15 @@ msgstr "用户管理"
|
||||
msgid "Logs"
|
||||
msgstr "日志"
|
||||
|
||||
msgid "Log"
|
||||
msgstr "日志"
|
||||
|
||||
msgid "Log Level"
|
||||
msgstr "日志等级"
|
||||
|
||||
msgid "Not enabled log"
|
||||
msgstr "未启用日志"
|
||||
|
||||
msgid "UDP Forward"
|
||||
msgstr "UDP转发"
|
||||
|
||||
|
||||
@ -13,6 +13,10 @@ config global
|
||||
option localhost_tcp_proxy_mode 'gfwlist'
|
||||
option localhost_udp_proxy_mode 'gfwlist'
|
||||
option socks_server '0.0.0.0:1080'
|
||||
option close_log_tcp_1 '1'
|
||||
option close_log_udp_1 '1'
|
||||
option loglevel 'warning'
|
||||
option trojan_loglevel '2'
|
||||
|
||||
config global_haproxy
|
||||
option balancing_enable '0'
|
||||
@ -48,8 +52,8 @@ config global_rules
|
||||
option chnroute6_url 'https://ispip.clang.cn/all_cn_ipv6.txt'
|
||||
|
||||
config global_app
|
||||
option xray_file '/usr/bin/xray/'
|
||||
option v2ray_file '/usr/bin/v2ray/'
|
||||
option xray_file '/usr/bin/xray'
|
||||
option v2ray_file '/usr/bin/v2ray'
|
||||
option trojan_go_file '/usr/bin/trojan-go'
|
||||
option kcptun_client_file '/usr/bin/kcptun-client'
|
||||
option brook_file '/usr/bin/brook'
|
||||
|
||||
@ -26,24 +26,10 @@ uci -q batch <<-EOF >/dev/null
|
||||
EOF
|
||||
|
||||
tmp=$(uci -q get passwall.@global_app[0].xray_file)
|
||||
if [ -z "$tmp" ]; then
|
||||
uci set passwall.@global_app[0].xray_file="/usr/bin/xray"
|
||||
else
|
||||
[ -n "$(echo $tmp | grep -E "^.*/xray/$")" ] && {
|
||||
uci set passwall.@global_app[0].xray_file="${tmp%?}"
|
||||
}
|
||||
fi
|
||||
[ -z "$tmp" ] && uci set passwall.@global_app[0].xray_file="/usr/bin/xray"
|
||||
tmp=$(uci -q get passwall.@global_app[0].v2ray_file)
|
||||
if [ -z "$tmp" ]; then
|
||||
uci set passwall.@global_app[0].v2ray_file="/usr/bin/v2ray"
|
||||
else
|
||||
[ -n "$(echo $tmp | grep -E "^.*/v2ray/$")" ] && {
|
||||
uci set passwall.@global_app[0].v2ray_file="${tmp%?}"
|
||||
}
|
||||
fi
|
||||
[ -z "$tmp" ] && uci set passwall.@global_app[0].v2ray_file="/usr/bin/v2ray"
|
||||
uci commit passwall
|
||||
|
||||
/etc/init.d/https-dns-proxy stop >/dev/null 2>&1 &
|
||||
/etc/init.d/https-dns-proxy disable >/dev/null 2>&1 &
|
||||
rm -rf /tmp/luci-*cache
|
||||
exit 0
|
||||
|
||||
@ -29,8 +29,6 @@ LUA_API_PATH=/usr/lib/lua/luci/model/cbi/$CONFIG/api
|
||||
API_GEN_SS=$LUA_API_PATH/gen_shadowsocks.lua
|
||||
API_GEN_XRAY=$LUA_API_PATH/gen_xray.lua
|
||||
API_GEN_XRAY_PROTO=$LUA_API_PATH/gen_xray_proto.lua
|
||||
API_GEN_V2RAY=$LUA_API_PATH/gen_v2ray.lua
|
||||
API_GEN_V2RAY_PROTO=$LUA_API_PATH/gen_v2ray_proto.lua
|
||||
API_GEN_TROJAN=$LUA_API_PATH/gen_trojan.lua
|
||||
API_GEN_NAIVE=$LUA_API_PATH/gen_naiveproxy.lua
|
||||
echolog() {
|
||||
@ -250,8 +248,9 @@ first_type() {
|
||||
ln_start_bin() {
|
||||
local file_func=${1}
|
||||
local ln_name=${2}
|
||||
local output=${3}
|
||||
|
||||
shift 2;
|
||||
shift 3;
|
||||
if [ "${file_func%%/*}" != "${file_func}" ]; then
|
||||
[ ! -L "${file_func}" ] && {
|
||||
ln -s "${file_func}" "${TMP_BIN_PATH}/${ln_name}" >/dev/null 2>&1
|
||||
@ -261,26 +260,32 @@ ln_start_bin() {
|
||||
fi
|
||||
#echo "${file_func} $*" >&2
|
||||
[ -n "${file_func}" ] || echolog " - 找不到 ${ln_name},无法启动..."
|
||||
${file_func:-echolog " - ${ln_name}"} "$@" >/dev/null 2>&1 &
|
||||
${file_func:-echolog " - ${ln_name}"} "$@" >${output} 2>&1 &
|
||||
}
|
||||
|
||||
ENABLED=$(config_t_get global enabled 0)
|
||||
|
||||
TCP_REDIR_PORT1=$(config_t_get global_forwarding tcp_redir_port 1041)
|
||||
TCP_NODE_NUM=$(config_t_get global_other tcp_node_num 1)
|
||||
for i in $(seq 1 $TCP_NODE_NUM); do
|
||||
eval TCP_NODE$i=$(config_t_get global tcp_node$i nil)
|
||||
[ $i -gt 1 ] && {
|
||||
_k=$(expr $i - 1)
|
||||
eval p=\$TCP_REDIR_PORT${_k}
|
||||
eval TCP_REDIR_PORT$i=$(expr $p + 1)
|
||||
}
|
||||
done
|
||||
TCP_REDIR_PORT1=$(config_t_get global_forwarding tcp_redir_port 1041)
|
||||
TCP_REDIR_PORT2=$(expr $TCP_REDIR_PORT1 + 1)
|
||||
TCP_REDIR_PORT3=$(expr $TCP_REDIR_PORT2 + 1)
|
||||
|
||||
UDP_REDIR_PORT1=$(config_t_get global_forwarding udp_redir_port 1051)
|
||||
UDP_NODE_NUM=$(config_t_get global_other udp_node_num 1)
|
||||
for i in $(seq 1 $UDP_NODE_NUM); do
|
||||
eval UDP_NODE$i=$(config_t_get global udp_node$i nil)
|
||||
[ $i -gt 1 ] && {
|
||||
_k=$(expr $i - 1)
|
||||
eval p=\$UDP_REDIR_PORT${_k}
|
||||
eval UDP_REDIR_PORT$i=$(expr $p + 1)
|
||||
}
|
||||
done
|
||||
UDP_REDIR_PORT1=$(config_t_get global_forwarding udp_redir_port 1051)
|
||||
UDP_REDIR_PORT2=$(expr $UDP_REDIR_PORT1 + 1)
|
||||
UDP_REDIR_PORT3=$(expr $UDP_REDIR_PORT2 + 1)
|
||||
|
||||
[ "$UDP_NODE1" == "tcp_" ] && UDP_NODE1=$TCP_NODE1
|
||||
[ "$UDP_NODE1" == "tcp" ] && UDP_REDIR_PORT1=$TCP_REDIR_PORT1
|
||||
@ -301,17 +306,6 @@ LOCALHOST_UDP_PROXY_MODE=$(config_t_get global localhost_udp_proxy_mode default)
|
||||
[ "$LOCALHOST_UDP_PROXY_MODE" == "default" ] && LOCALHOST_UDP_PROXY_MODE=$UDP_PROXY_MODE
|
||||
|
||||
load_config() {
|
||||
local auto_switch_list=$(config_t_get auto_switch tcp_node1 nil)
|
||||
[ -n "$auto_switch_list" -a "$auto_switch_list" != "nil" ] && {
|
||||
for tmp in $auto_switch_list; do
|
||||
tmp_id=$(config_n_get $tmp address nil)
|
||||
[ "$tmp_id" == "nil" ] && {
|
||||
uci -q del_list $CONFIG.@auto_switch[0].tcp_node1=$tmp
|
||||
uci commit $CONFIG
|
||||
}
|
||||
done
|
||||
}
|
||||
|
||||
[ "$ENABLED" != 1 ] && NO_PROXY=1
|
||||
[ "$TCP_NODE1" == "nil" -a "$UDP_NODE1" == "nil" ] && {
|
||||
echolog "没有选择节点!"
|
||||
@ -350,6 +344,7 @@ run_socks() {
|
||||
local http_config_file=$6
|
||||
local id=$7
|
||||
local relay_port=$8
|
||||
local log_file="/dev/null"
|
||||
local type=$(echo $(config_n_get $node type) | tr 'A-Z' 'a-z')
|
||||
local remarks=$(config_n_get $node remarks)
|
||||
local server_host=$(config_n_get $node address)
|
||||
@ -383,27 +378,27 @@ run_socks() {
|
||||
_username=$(config_n_get $node username)
|
||||
_password=$(config_n_get $node password)
|
||||
[ -n "$_username" ] && [ -n "$_password" ] && local _auth="--uname $_username --passwd $_password"
|
||||
ln_start_bin "$(first_type ssocks)" ssocks_SOCKS_$id --listen $socks_port --socks $server_host:$port $_auth
|
||||
ln_start_bin "$(first_type ssocks)" ssocks_SOCKS_$id $log_file --listen $socks_port --socks $server_host:$port $_auth
|
||||
;;
|
||||
xray)
|
||||
lua $API_GEN_XRAY $node nil nil $socks_port > $config_file
|
||||
ln_start_bin "$(first_type $(config_t_get global_app xray_file notset)/xray xray)" xray -config="$config_file"
|
||||
lua $API_GEN_XRAY -node $node -socks_proxy_port $socks_port > $config_file
|
||||
ln_start_bin "$(first_type $(config_t_get global_app xray_file notset)/xray xray)" xray $log_file -config="$config_file"
|
||||
;;
|
||||
v2ray)
|
||||
lua $API_GEN_V2RAY $node nil nil $socks_port > $config_file
|
||||
ln_start_bin "$(first_type $(config_t_get global_app v2ray_file notset)/v2ray v2ray)" v2ray -config="$config_file"
|
||||
lua $API_GEN_XRAY -node $node -socks_proxy_port $socks_port > $config_file
|
||||
ln_start_bin "$(first_type $(config_t_get global_app v2ray_file notset)/v2ray v2ray)" v2ray $log_file -config="$config_file"
|
||||
;;
|
||||
trojan-go)
|
||||
lua $API_GEN_TROJAN $node client $bind $socks_port $server_host $port > $config_file
|
||||
ln_start_bin "$(first_type $(config_t_get global_app trojan_go_file notset) trojan-go)" trojan-go -config "$config_file"
|
||||
lua $API_GEN_TROJAN -node $node -run_type client -local_addr $bind -local_port $socks_port -server_host $server_host -server_port $port > $config_file
|
||||
ln_start_bin "$(first_type $(config_t_get global_app trojan_go_file notset) trojan-go)" trojan-go $log_file -config "$config_file"
|
||||
;;
|
||||
trojan*)
|
||||
lua $API_GEN_TROJAN $node client $bind $socks_port $server_host $port > $config_file
|
||||
ln_start_bin "$(first_type ${type})" "${type}" -c "$config_file"
|
||||
lua $API_GEN_TROJAN -node $node -run_type client -local_addr $bind -local_port $socks_port -server_host $server_host -server_port $port > $config_file
|
||||
ln_start_bin "$(first_type ${type})" "${type}" $log_file -c "$config_file"
|
||||
;;
|
||||
naiveproxy)
|
||||
lua $API_GEN_NAIVE $node socks $bind $socks_port $server_host $port > $config_file
|
||||
ln_start_bin "$(first_type naive)" naive "$config_file"
|
||||
lua $API_GEN_NAIVE -node $node -run_type socks -local_addr $bind -local_port $socks_port -server_host $server_host -server_port $port > $config_file
|
||||
ln_start_bin "$(first_type naive)" naive $log_file "$config_file"
|
||||
;;
|
||||
brook)
|
||||
local protocol=$(config_n_get $node protocol client)
|
||||
@ -411,18 +406,19 @@ run_socks() {
|
||||
[ "$protocol" == "wsclient" ] && {
|
||||
[ "$brook_tls" == "1" ] && server_host="wss://${server_host}" || server_host="ws://${server_host}"
|
||||
}
|
||||
ln_start_bin "$(first_type $(config_t_get global_app brook_file notset) brook)" "brook_SOCKS_$id" "$protocol" --socks5 "$bind:$socks_port" -s "$server_host:$port" -p "$(config_n_get $node password)"
|
||||
ln_start_bin "$(first_type $(config_t_get global_app brook_file notset) brook)" "brook_SOCKS_$id" $log_file "$protocol" --socks5 "$bind:$socks_port" -s "$server_host:$port" -p "$(config_n_get $node password)"
|
||||
;;
|
||||
ss|ssr)
|
||||
lua $API_GEN_SS $node "0.0.0.0" $socks_port $server_host $port > $config_file
|
||||
ln_start_bin "$(first_type ${type}-local)" "${type}-local" -c "$config_file" -b "$bind" -u
|
||||
lua $API_GEN_SS -node $node -local_addr "0.0.0.0" -local_port $socks_port -server_host $server_host -server_port $port > $config_file
|
||||
ln_start_bin "$(first_type ${type}-local)" "${type}-local" $log_file -c "$config_file" -b "$bind" -u
|
||||
;;
|
||||
esac
|
||||
|
||||
# socks to http
|
||||
[ "$http_port" != "0" ] && [ "$http_config_file" != "nil" ] && {
|
||||
lua $API_GEN_V2RAY_PROTO http "0.0.0.0" $http_port socks "127.0.0.1" $socks_port $_username $_password > $http_config_file
|
||||
ln_start_bin "$(first_type $(config_t_get global_app v2ray_file notset)/v2ray v2ray)" v2ray -config="$http_config_file"
|
||||
lua $API_GEN_XRAY_PROTO -local_proto http -local_address "0.0.0.0" -local_port $http_port -server_proto socks -server_address "127.0.0.1" -server_port $socks_port -server_username $_username -server_password $_password > $http_config_file
|
||||
echo lua $API_GEN_XRAY_PROTO -local_proto http -local_address "0.0.0.0" -local_port $http_port -server_proto socks -server_address "127.0.0.1" -server_port $socks_port -server_username $_username -server_password $_password
|
||||
ln_start_bin "$(first_type $(config_t_get global_app xray_file notset)/xray xray)" xray $log_file -config="$http_config_file"
|
||||
}
|
||||
unset _username _password _auth
|
||||
}
|
||||
@ -432,8 +428,14 @@ run_redir() {
|
||||
local bind=$2
|
||||
local local_port=$3
|
||||
local config_file=$4
|
||||
local redir_type=$5
|
||||
local REDIR_TYPE=$5
|
||||
local index=$6
|
||||
local log_file=$7
|
||||
[ -z "$log_file" ] && log_file="/dev/null"
|
||||
local redir_type=$(echo $REDIR_TYPE | tr 'A-Z' 'a-z')
|
||||
local type=$(echo $(config_n_get $node type) | tr 'A-Z' 'a-z')
|
||||
local close_log=$(config_t_get global close_log_${redir_type}_${index} 1)
|
||||
[ "$close_log" = "1" ] && log_file="/dev/null"
|
||||
local remarks=$(config_n_get $node remarks)
|
||||
local server_host=$(config_n_get $node address)
|
||||
local port=$(config_n_get $node port)
|
||||
@ -447,11 +449,11 @@ run_redir() {
|
||||
return 1
|
||||
}
|
||||
[ "$server_host" == "127.0.0.1" ] && process=1
|
||||
[ "$bind" != "127.0.0.1" ] && echolog "${redir_type}_${6}节点:$remarks,节点:${server_host}:${port},监听端口:$local_port"
|
||||
[ "$bind" != "127.0.0.1" ] && echolog "${REDIR_TYPE}_${index}节点:$remarks,节点:${server_host}:${port},监听端口:$local_port"
|
||||
}
|
||||
eval ${redir_type}_NODE${6}_PORT=$port
|
||||
eval ${REDIR_TYPE}_NODE${index}_PORT=$port
|
||||
|
||||
case "$redir_type" in
|
||||
case "$REDIR_TYPE" in
|
||||
UDP)
|
||||
case "$type" in
|
||||
socks)
|
||||
@ -459,24 +461,28 @@ run_redir() {
|
||||
local node_port=$(config_n_get $node port)
|
||||
local server_username=$(config_n_get $node username)
|
||||
local server_password=$(config_n_get $node password)
|
||||
eval port=\$UDP_REDIR_PORT$6
|
||||
ln_start_bin "$(first_type ipt2socks)" "ipt2socks_udp_$6" -U -l "$port" -b 0.0.0.0 -s "$node_address" -p "$node_port" -R
|
||||
eval port=\$UDP_REDIR_PORT${index}
|
||||
ln_start_bin "$(first_type ipt2socks)" "ipt2socks_udp_${index}" $log_file -U -l "$port" -b 0.0.0.0 -s "$node_address" -p "$node_port" -R
|
||||
;;
|
||||
xray)
|
||||
lua $API_GEN_XRAY $node udp $local_port nil > $config_file
|
||||
ln_start_bin "$(first_type $(config_t_get global_app xray_file notset)/xray xray)" xray -config="$config_file"
|
||||
local loglevel=$(config_t_get global loglevel "warning")
|
||||
lua $API_GEN_XRAY -node $node -proto udp -redir_port $local_port -loglevel $loglevel > $config_file
|
||||
ln_start_bin "$(first_type $(config_t_get global_app xray_file notset)/xray xray)" xray $log_file -config="$config_file"
|
||||
;;
|
||||
v2ray)
|
||||
lua $API_GEN_V2RAY $node udp $local_port nil > $config_file
|
||||
ln_start_bin "$(first_type $(config_t_get global_app v2ray_file notset)/v2ray v2ray)" v2ray -config="$config_file"
|
||||
local loglevel=$(config_t_get global loglevel "warning")
|
||||
lua $API_GEN_XRAY -node $node -proto udp -redir_port $local_port -loglevel $loglevel > $config_file
|
||||
ln_start_bin "$(first_type $(config_t_get global_app v2ray_file notset)/v2ray v2ray)" v2ray $log_file -config="$config_file"
|
||||
;;
|
||||
trojan-go)
|
||||
lua $API_GEN_TROJAN $node nat "0.0.0.0" $local_port >$config_file
|
||||
ln_start_bin "$(first_type $(config_t_get global_app trojan_go_file notset) trojan-go)" trojan-go -config "$config_file"
|
||||
local loglevel=$(config_t_get global trojan_loglevel "2")
|
||||
lua $API_GEN_TROJAN -node $node -run_type nat -local_addr "0.0.0.0" -local_port $local_port -loglevel $loglevel > $config_file
|
||||
ln_start_bin "$(first_type $(config_t_get global_app trojan_go_file notset) trojan-go)" trojan-go $log_file -config "$config_file"
|
||||
;;
|
||||
trojan*)
|
||||
lua $API_GEN_TROJAN $node nat "0.0.0.0" $local_port >$config_file
|
||||
ln_start_bin "$(first_type ${type})" "${type}" -c "$config_file"
|
||||
local loglevel=$(config_t_get global trojan_loglevel "2")
|
||||
lua $API_GEN_TROJAN -node $node -run_type nat -local_addr "0.0.0.0" -local_port $local_port -loglevel $loglevel > $config_file
|
||||
ln_start_bin "$(first_type ${type})" "${type}" $log_file -c "$config_file"
|
||||
;;
|
||||
naiveproxy)
|
||||
echolog "Naiveproxy不支持UDP转发!"
|
||||
@ -486,12 +492,12 @@ run_redir() {
|
||||
if [ "$protocol" == "wsclient" ]; then
|
||||
echolog "Brook的WebSocket不支持UDP转发!"
|
||||
else
|
||||
ln_start_bin "$(first_type $(config_t_get global_app brook_file notset) brook)" "brook_udp_$6" tproxy -l ":$local_port" -s "$server_host:$port" -p "$(config_n_get $node password)"
|
||||
ln_start_bin "$(first_type $(config_t_get global_app brook_file notset) brook)" "brook_udp_${index}" $log_file tproxy -l ":$local_port" -s "$server_host:$port" -p "$(config_n_get $node password)"
|
||||
fi
|
||||
;;
|
||||
ss|ssr)
|
||||
lua $API_GEN_SS $node "0.0.0.0" $local_port > $config_file
|
||||
ln_start_bin "$(first_type ${type}-redir)" "${type}-redir" -c "$config_file" -U
|
||||
lua $API_GEN_SS -node $node -local_addr "0.0.0.0" -local_port $local_port > $config_file
|
||||
ln_start_bin "$(first_type ${type}-redir)" "${type}-redir" $log_file -c "$config_file" -U
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
@ -511,7 +517,7 @@ run_redir() {
|
||||
[ -n "$kcptun_server_host" ] && run_kcptun_ip=$(get_host_ip $network_type $kcptun_server_host)
|
||||
KCPTUN_REDIR_PORT=$(get_new_port $KCPTUN_REDIR_PORT tcp)
|
||||
kcptun_params="-l 0.0.0.0:$KCPTUN_REDIR_PORT -r $run_kcptun_ip:$kcptun_port $kcptun_config"
|
||||
ln_start_bin "$(first_type $(config_t_get global_app kcptun_client_file notset) kcptun-client)" "kcptun_tcp_$6" $kcptun_params
|
||||
ln_start_bin "$(first_type $(config_t_get global_app kcptun_client_file notset) kcptun-client)" "kcptun_tcp_${index}" $log_file $kcptun_params
|
||||
fi
|
||||
fi
|
||||
local _socks_flag _socks_address _socks_port _socks_username _socks_password
|
||||
@ -524,30 +530,34 @@ run_redir() {
|
||||
_socks_password=$(config_n_get $node password)
|
||||
;;
|
||||
xray)
|
||||
local loglevel=$(config_t_get global loglevel "warning")
|
||||
local extra_param="tcp"
|
||||
[ "$6" == 1 ] && [ "$UDP_NODE1" == "tcp" ] && extra_param="tcp,udp"
|
||||
lua $API_GEN_XRAY $node $extra_param $local_port nil > $config_file
|
||||
ln_start_bin "$(first_type $(config_t_get global_app xray_file notset)/xray xray)" xray -config="$config_file"
|
||||
[ "${index}" == 1 ] && [ "$UDP_NODE1" == "tcp" ] && extra_param="tcp,udp"
|
||||
lua $API_GEN_XRAY -node $node -proto $extra_param -redir_port $local_port -loglevel $loglevel > $config_file
|
||||
ln_start_bin "$(first_type $(config_t_get global_app xray_file notset)/xray xray)" xray $log_file -config="$config_file"
|
||||
;;
|
||||
v2ray)
|
||||
local loglevel=$(config_t_get global loglevel "warning")
|
||||
local extra_param="tcp"
|
||||
[ "$6" == 1 ] && [ "$UDP_NODE1" == "tcp" ] && extra_param="tcp,udp"
|
||||
lua $API_GEN_V2RAY $node $extra_param $local_port nil > $config_file
|
||||
ln_start_bin "$(first_type $(config_t_get global_app v2ray_file notset)/v2ray v2ray)" v2ray -config="$config_file"
|
||||
[ "${index}" == 1 ] && [ "$UDP_NODE1" == "tcp" ] && extra_param="tcp,udp"
|
||||
lua $API_GEN_XRAY -node $node -proto $extra_param -redir_port $local_port -loglevel $loglevel > $config_file
|
||||
ln_start_bin "$(first_type $(config_t_get global_app v2ray_file notset)/v2ray v2ray)" v2ray $log_file -config="$config_file"
|
||||
;;
|
||||
trojan-go)
|
||||
lua $API_GEN_TROJAN $node nat "0.0.0.0" $local_port > $config_file
|
||||
ln_start_bin "$(first_type $(config_t_get global_app trojan_go_file notset) trojan-go)" trojan-go -config "$config_file"
|
||||
local loglevel=$(config_t_get global trojan_loglevel "2")
|
||||
lua $API_GEN_TROJAN -node $node -run_type nat -local_addr "0.0.0.0" -local_port $local_port -loglevel $loglevel > $config_file
|
||||
ln_start_bin "$(first_type $(config_t_get global_app trojan_go_file notset) trojan-go)" trojan-go $log_file -config "$config_file"
|
||||
;;
|
||||
trojan*)
|
||||
lua $API_GEN_TROJAN $node nat "0.0.0.0" $local_port > $config_file
|
||||
local loglevel=$(config_t_get global trojan_loglevel "2")
|
||||
lua $API_GEN_TROJAN -node $node -run_type nat -local_addr "0.0.0.0" -local_port $local_port -loglevel $loglevel > $config_file
|
||||
for k in $(seq 1 $process); do
|
||||
ln_start_bin "$(first_type ${type})" "${type}" -c "$config_file"
|
||||
ln_start_bin "$(first_type ${type})" "${type}" $log_file -c "$config_file"
|
||||
done
|
||||
;;
|
||||
naiveproxy)
|
||||
lua $API_GEN_NAIVE $node redir "0.0.0.0" $local_port > $config_file
|
||||
ln_start_bin "$(first_type naive)" naive "$config_file"
|
||||
lua $API_GEN_NAIVE -node $node -run_type redir -local_addr "0.0.0.0" -local_port $local_port > $config_file
|
||||
ln_start_bin "$(first_type naive)" naive $log_file "$config_file"
|
||||
;;
|
||||
brook)
|
||||
local server_ip=$server_host
|
||||
@ -556,38 +566,38 @@ run_redir() {
|
||||
if [ "$protocol" == "wsclient" ]; then
|
||||
[ "$brook_tls" == "1" ] && server_ip="wss://${server_ip}" || server_ip="ws://${server_ip}"
|
||||
socks_port=$(get_new_port 2081 tcp)
|
||||
ln_start_bin "$(first_type $(config_t_get global_app brook_file notset) brook)" "brook_tcp_$6" wsclient --socks5 "127.0.0.1:$socks_port" -s "$server_ip:$port" -p "$(config_n_get $node password)"
|
||||
ln_start_bin "$(first_type $(config_t_get global_app brook_file notset) brook)" "brook_tcp_${index}" $log_file wsclient --socks5 "127.0.0.1:$socks_port" -s "$server_ip:$port" -p "$(config_n_get $node password)"
|
||||
_socks_flag=1
|
||||
_socks_address="127.0.0.1"
|
||||
_socks_port=$socks_port
|
||||
echolog "Brook的WebSocket不支持透明代理,将使用ipt2socks转换透明代理!"
|
||||
[ "$6" == 1 ] && [ "$UDP_NODE1" == "tcp" ] && echolog "Brook的WebSocket不支持UDP转发!"
|
||||
[ "${index}" == 1 ] && [ "$UDP_NODE1" == "tcp" ] && echolog "Brook的WebSocket不支持UDP转发!"
|
||||
else
|
||||
[ "$kcptun_use" == "1" ] && {
|
||||
server_ip=127.0.0.1
|
||||
port=$KCPTUN_REDIR_PORT
|
||||
}
|
||||
ln_start_bin "$(first_type $(config_t_get global_app brook_file notset) brook)" "brook_tcp_$6" tproxy -l ":$local_port" -s "$server_ip:$port" -p "$(config_n_get $node password)"
|
||||
ln_start_bin "$(first_type $(config_t_get global_app brook_file notset) brook)" "brook_tcp_${index}" $log_file tproxy -l ":$local_port" -s "$server_ip:$port" -p "$(config_n_get $node password)"
|
||||
fi
|
||||
;;
|
||||
ss|ssr)
|
||||
if [ "$kcptun_use" == "1" ]; then
|
||||
lua $API_GEN_SS $node "0.0.0.0" $local_port "127.0.0.1" $KCPTUN_REDIR_PORT > $config_file
|
||||
lua $API_GEN_SS -node $node -local_addr "0.0.0.0" -local_port $socks_port -server_host "127.0.0.1" -server_port $KCPTUN_REDIR_PORT > $config_file
|
||||
process=1
|
||||
[ "$6" == 1 ] && [ "$UDP_NODE1" == "tcp" ] && echolog "Kcptun不支持UDP转发!"
|
||||
[ "${index}" == 1 ] && [ "$UDP_NODE1" == "tcp" ] && echolog "Kcptun不支持UDP转发!"
|
||||
else
|
||||
lua $API_GEN_SS $node "0.0.0.0" $local_port > $config_file
|
||||
[ "$6" == 1 ] && [ "$UDP_NODE1" == "tcp" ] && extra_param="-u"
|
||||
lua $API_GEN_SS -node $node -local_addr "0.0.0.0" -local_port $local_port > $config_file
|
||||
[ "${index}" == 1 ] && [ "$UDP_NODE1" == "tcp" ] && extra_param="-u"
|
||||
fi
|
||||
for k in $(seq 1 $process); do
|
||||
ln_start_bin "$(first_type ${type}-redir)" "${type}-redir" -c "$config_file" $extra_param
|
||||
ln_start_bin "$(first_type ${type}-redir)" "${type}-redir" $log_file -c "$config_file" $extra_param
|
||||
done
|
||||
;;
|
||||
esac
|
||||
if [ -n "$_socks_flag" ]; then
|
||||
local extra_param="-T"
|
||||
[ "$6" == 1 ] && [ "$UDP_NODE1" == "tcp" ] && extra_param=""
|
||||
ln_start_bin "$(first_type ipt2socks)" "ipt2socks_tcp_$6" -l "$local_port" -b 0.0.0.0 -s "$_socks_address" -p "$_socks_port" -R $extra_param
|
||||
[ "${index}" == 1 ] && [ "$UDP_NODE1" == "tcp" ] && extra_param=""
|
||||
ln_start_bin "$(first_type ipt2socks)" "ipt2socks_tcp_${index}" $log_file -l "$local_port" -b 0.0.0.0 -s "$_socks_address" -p "$_socks_port" -R $extra_param
|
||||
fi
|
||||
unset _socks_flag _socks_address _socks_port _socks_username _socks_password
|
||||
;;
|
||||
@ -601,9 +611,10 @@ node_switch() {
|
||||
[ -n "$1" -a -n "$2" -a -n "$3" -a -n "$4" ] && {
|
||||
ps -w | grep -E "$TMP_PATH" | grep -i "${1}_${i}" | grep -v "grep" | awk '{print $1}' | xargs kill -9 >/dev/null 2>&1 &
|
||||
local config_file=$TMP_PATH/${1}_${i}.json
|
||||
local log_file=$TMP_PATH/${1}_${i}.log
|
||||
eval current_port=\$${1}_REDIR_PORT${i}
|
||||
local port=$(cat $TMP_PORT_PATH/${1}_${i})
|
||||
run_redir $node "0.0.0.0" $port $config_file $1 $i
|
||||
run_redir $node "0.0.0.0" $port $config_file $1 $i $log_file
|
||||
echo $node > $TMP_ID_PATH/${1}_${i}
|
||||
#local node_net=$(echo $1 | tr 'A-Z' 'a-z')
|
||||
#uci set $CONFIG.@global[0].${node_net}_node${i}=$node
|
||||
@ -619,10 +630,11 @@ start_redir() {
|
||||
[ "$node" != "nil" ] && {
|
||||
TYPE=$(echo $(config_n_get $node type) | tr 'A-Z' 'a-z')
|
||||
local config_file=$TMP_PATH/${1}_${i}.json
|
||||
local log_file=$TMP_PATH/${1}_${i}.log
|
||||
eval current_port=\$${1}_REDIR_PORT$i
|
||||
local port=$(echo $(get_new_port $current_port $2))
|
||||
eval ${1}_REDIR${i}=$port
|
||||
run_redir $node "0.0.0.0" $port $config_file $1 $i
|
||||
run_redir $node "0.0.0.0" $port $config_file $1 $i $log_file
|
||||
#eval ip=\$${1}_NODE${i}_IP
|
||||
echo $node > $TMP_ID_PATH/${1}_${i}
|
||||
echo $port > $TMP_PORT_PATH/${1}_${i}
|
||||
@ -644,6 +656,7 @@ start_socks() {
|
||||
[ "$node" == "nil" ] && continue
|
||||
local port=$(config_n_get $id port)
|
||||
local config_file=$TMP_PATH/SOCKS_${id}.json
|
||||
local log_file=$TMP_PATH/SOCKS_${id}.log
|
||||
local http_port=$(config_n_get $id http_port 0)
|
||||
local http_config_file=$TMP_PATH/SOCKS2HTTP_${id}.json
|
||||
run_socks $node "0.0.0.0" $port $config_file $http_port $http_config_file $id
|
||||
@ -733,7 +746,7 @@ start_dns() {
|
||||
_doh=$(config_t_get global up_china_dns_doh "https://dns.alidns.com/dns-query,223.5.5.5,223.6.6.6,2400:3200::1,2400:3200:baba::1")
|
||||
_doh_url=$(echo $_doh | awk -F ',' '{print $1}')
|
||||
_doh_bootstrap=$(echo $_doh | cut -d ',' -sf 2-)
|
||||
ln_start_bin "$(first_type https-dns-proxy)" https-dns-proxy -a 127.0.0.1 -p "${LOCAL_DOH_PORT}" -b "${_doh_bootstrap}" -r "${_doh_url}" -4
|
||||
ln_start_bin "$(first_type https-dns-proxy)" https-dns-proxy "/dev/null" -a 127.0.0.1 -p "${LOCAL_DOH_PORT}" -b "${_doh_bootstrap}" -r "${_doh_url}" -4
|
||||
LOCAL_DNS="127.0.0.1#${LOCAL_DOH_PORT}"
|
||||
unset _doh _doh_url _doh_bootstrap
|
||||
fi
|
||||
@ -800,7 +813,7 @@ start_dns() {
|
||||
chnlist_param=${chnlist_param:+-m "${chnlist_param}" -M}
|
||||
}
|
||||
[ "$(config_t_get global fair_mode 1)" = "1" ] && extra_mode="-f"
|
||||
ln_start_bin "$(first_type chinadns-ng)" chinadns-ng -l "${dns_listen_port}" ${china_ng_chn:+-c "${china_ng_chn}"} ${chnlist_param} ${china_ng_gfw:+-t "${china_ng_gfw}"} ${gfwlist_param:+-g "${gfwlist_param}"} $extra_mode
|
||||
ln_start_bin "$(first_type chinadns-ng)" chinadns-ng "/dev/null" -l "${dns_listen_port}" ${china_ng_chn:+-c "${china_ng_chn}"} ${chnlist_param} ${china_ng_gfw:+-t "${china_ng_gfw}"} ${gfwlist_param:+-g "${gfwlist_param}"} $extra_mode
|
||||
echolog " + 过滤服务:ChinaDNS-NG(:${dns_listen_port}${extra_mode}) + ${msg}:中国域名列表:${china_ng_chn:-D114.114.114.114},防火墙域名列表:${china_ng_gfw:-D8.8.8.8}"
|
||||
#[ -n "${global}${chnlist}" ] && [ -z "${returnhome}" ] && TUN_DNS="${china_ng_gfw}"
|
||||
dns_listen_port=${other_port}
|
||||
@ -850,7 +863,7 @@ start_dns() {
|
||||
esac
|
||||
if [ -n "$(echo ${DNS_MODE} | grep pdnsd)" ]; then
|
||||
gen_pdnsd_config "${dns_listen_port}" "${pdnsd_forward}"
|
||||
ln_start_bin "$(first_type pdnsd)" pdnsd --daemon -c "${TMP_PATH}/pdnsd/pdnsd.conf" -d
|
||||
ln_start_bin "$(first_type pdnsd)" pdnsd "/dev/null" --daemon -c "${TMP_PATH}/pdnsd/pdnsd.conf" -d
|
||||
fi
|
||||
if [ -n "$(echo ${DNS_MODE} | grep 'https-dns-proxy')" ]; then
|
||||
up_trust_doh=$(config_t_get global up_trust_doh "https://dns.google/dns-query,8.8.8.8,8.8.4.4")
|
||||
@ -861,7 +874,7 @@ start_dns() {
|
||||
up_trust_doh_dns=$(config_t_get global up_trust_doh_dns "tcp")
|
||||
if [ "$up_trust_doh_dns" = "socks" ]; then
|
||||
socks_server=$(echo $(config_t_get global socks_server 127.0.0.1:9050) | sed "s/#/:/g")
|
||||
ln_start_bin "$(first_type https-dns-proxy)" https-dns-proxy -a 127.0.0.1 -p "${dns_listen_port}" -b "${_doh_bootstrap}" -r "${_doh_url}" -4 -t socks5h://${socks_server}
|
||||
ln_start_bin "$(first_type https-dns-proxy)" https-dns-proxy "/dev/null" -a 127.0.0.1 -p "${dns_listen_port}" -b "${_doh_bootstrap}" -r "${_doh_url}" -4 -t socks5h://${socks_server}
|
||||
elif [ "${up_trust_doh_dns}" = "tcp" ]; then
|
||||
DNS_FORWARD=""
|
||||
_doh_bootstrap_dns=$(echo $_doh_bootstrap | sed "s/,/ /g")
|
||||
@ -869,7 +882,7 @@ start_dns() {
|
||||
_dns=$(echo $_dns | awk -F ':' '{print $1}'):${_doh_port:-443}
|
||||
[ -n "$DNS_FORWARD" ] && DNS_FORWARD=${DNS_FORWARD},${_dns} || DNS_FORWARD=${_dns}
|
||||
done
|
||||
ln_start_bin "$(first_type https-dns-proxy)" https-dns-proxy -a 127.0.0.1 -p "${dns_listen_port}" -b "${_doh_bootstrap}" -r "${_doh_url}" -4
|
||||
ln_start_bin "$(first_type https-dns-proxy)" https-dns-proxy "/dev/null" -a 127.0.0.1 -p "${dns_listen_port}" -b "${_doh_bootstrap}" -r "${_doh_url}" -4
|
||||
unset _dns _doh_bootstrap_dns
|
||||
fi
|
||||
unset _doh_url _doh_port _doh_bootstrap
|
||||
@ -878,7 +891,7 @@ start_dns() {
|
||||
local dns2socks_socks_server=$(echo $(config_t_get global socks_server 127.0.0.1:9050) | sed "s/#/:/g")
|
||||
local dns2socks_forward=$(get_first_dns DNS_FORWARD 53 | sed 's/#/:/g')
|
||||
[ "$DNS_CACHE" == "0" ] && local dns2sock_cache="/d"
|
||||
ln_start_bin "$(first_type dns2socks)" dns2socks "$dns2socks_socks_server" "$dns2socks_forward" "127.0.0.1:$dns_listen_port" $dns2sock_cache
|
||||
ln_start_bin "$(first_type dns2socks)" dns2socks "/dev/null" "$dns2socks_socks_server" "$dns2socks_forward" "127.0.0.1:$dns_listen_port" $dns2sock_cache
|
||||
echolog " - dns2sock(127.0.0.1:${dns_listen_port}${dns2sock_cache}),${dns2socks_socks_server:-127.0.0.1:9050} -> ${dns2socks_forward-D46.182.19.48:53}"
|
||||
#[ "$CHINADNS_NG" = "1" ] && [ -n "${global}${chnlist}" ] && [ -z "${returnhome}" ] && TUN_DNS=$(echo "${dns_listen_port}" | sed 's/:/#/g')
|
||||
fi
|
||||
@ -1169,6 +1182,8 @@ start_haproxy() {
|
||||
server $bip:$bport $bip:$bport weight $lbweight check inter 1500 rise 1 fall 3 $bbackup
|
||||
EOF
|
||||
|
||||
#暂时不开启此功能,以后抽时间改成后台执行,防止卡luci。
|
||||
:<<!
|
||||
if [ "$export" != "0" ]; then
|
||||
unset msg
|
||||
failcount=0
|
||||
@ -1188,6 +1203,7 @@ start_haproxy() {
|
||||
done
|
||||
fi
|
||||
echolog " | - ${msg}出口节点:${bip}:${bport},权重:${lbweight}"
|
||||
!
|
||||
done
|
||||
|
||||
# 控制台配置
|
||||
@ -1207,7 +1223,7 @@ start_haproxy() {
|
||||
EOF
|
||||
|
||||
[ "${hasvalid}" != "1" ] && echolog " - 没有发现任何有效节点信息..." && return 0
|
||||
ln_start_bin "$(first_type haproxy)" haproxy -f "${haproxy_file}"
|
||||
ln_start_bin "$(first_type haproxy)" haproxy "/dev/null" -f "${haproxy_file}"
|
||||
echolog " * 控制台端口:${console_port}/,${auth:-公开}"
|
||||
}
|
||||
|
||||
|
||||
@ -98,7 +98,19 @@ naver.com
|
||||
naver.jp
|
||||
nbc.com
|
||||
nbcuni.com
|
||||
fast.com
|
||||
netflix.com
|
||||
netflix.com.edgesuite.net
|
||||
netflixdnstest0.com
|
||||
netflixdnstest1.com
|
||||
netflixdnstest2.com
|
||||
netflixdnstest3.com
|
||||
netflixdnstest4.com
|
||||
netflixdnstest5.com
|
||||
netflixdnstest6.com
|
||||
netflixdnstest7.com
|
||||
netflixdnstest8.com
|
||||
netflixdnstest9.com
|
||||
netflix.net
|
||||
nflxext.com
|
||||
nflximg.com
|
||||
@ -117,6 +129,7 @@ pbs.org
|
||||
playstation.net
|
||||
primevideo.com
|
||||
pubmatic.com
|
||||
pureapk.com
|
||||
radiotime.com
|
||||
sa.bbc.co.uk
|
||||
sho.com
|
||||
|
||||
Loading…
Reference in New Issue
Block a user