luci: drop Brook
Don't want to maintain too many Go application, please use Socks.
This commit is contained in:
parent
b3c93f9691
commit
8e9d1ba88e
@ -12,7 +12,6 @@ PKG_RELEASE:=
|
|||||||
PKG_CONFIG_DEPENDS:= \
|
PKG_CONFIG_DEPENDS:= \
|
||||||
CONFIG_PACKAGE_$(PKG_NAME)_Iptables_Transparent_Proxy \
|
CONFIG_PACKAGE_$(PKG_NAME)_Iptables_Transparent_Proxy \
|
||||||
CONFIG_PACKAGE_$(PKG_NAME)_Nftables_Transparent_Proxy \
|
CONFIG_PACKAGE_$(PKG_NAME)_Nftables_Transparent_Proxy \
|
||||||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Brook \
|
|
||||||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Haproxy \
|
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Haproxy \
|
||||||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Hysteria \
|
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_Hysteria \
|
||||||
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_NaiveProxy \
|
CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_NaiveProxy \
|
||||||
@ -67,11 +66,6 @@ config PACKAGE_$(PKG_NAME)_Nftables_Transparent_Proxy
|
|||||||
depends on PACKAGE_$(PKG_NAME)
|
depends on PACKAGE_$(PKG_NAME)
|
||||||
default y if PACKAGE_firewall4
|
default y if PACKAGE_firewall4
|
||||||
|
|
||||||
config PACKAGE_$(PKG_NAME)_INCLUDE_Brook
|
|
||||||
bool "Include Brook"
|
|
||||||
select PACKAGE_brook
|
|
||||||
default n
|
|
||||||
|
|
||||||
config PACKAGE_$(PKG_NAME)_INCLUDE_Haproxy
|
config PACKAGE_$(PKG_NAME)_INCLUDE_Haproxy
|
||||||
bool "Include Haproxy"
|
bool "Include Haproxy"
|
||||||
select PACKAGE_haproxy
|
select PACKAGE_haproxy
|
||||||
|
@ -1,40 +0,0 @@
|
|||||||
local m, s = ...
|
|
||||||
|
|
||||||
local api = require "luci.passwall.api"
|
|
||||||
|
|
||||||
if not api.finded_com("brook") then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local type_name = "Brook"
|
|
||||||
|
|
||||||
local option_prefix = "brook_"
|
|
||||||
|
|
||||||
local function option_name(name)
|
|
||||||
return option_prefix .. name
|
|
||||||
end
|
|
||||||
|
|
||||||
-- [[ Brook ]]
|
|
||||||
|
|
||||||
s.fields["type"]:value(type_name, translate("Brook"))
|
|
||||||
|
|
||||||
o = s:option(ListValue, option_name("protocol"), translate("Protocol"))
|
|
||||||
o:value("client", translate("Brook"))
|
|
||||||
o:value("wsclient", translate("WebSocket"))
|
|
||||||
|
|
||||||
o = s:option(Value, option_name("address"), translate("Address (Support Domain Name)"))
|
|
||||||
|
|
||||||
o = s:option(Value, option_name("port"), translate("Port"))
|
|
||||||
o.datatype = "port"
|
|
||||||
|
|
||||||
o = s:option(Value, option_name("ws_path"), translate("WebSocket Path"))
|
|
||||||
o.placeholder = "/"
|
|
||||||
o:depends({ [option_name("protocol")] = "wsclient" })
|
|
||||||
|
|
||||||
o = s:option(Flag, option_name("tls"), translate("Use TLS"))
|
|
||||||
o:depends({ [option_name("protocol")] = "wsclient" })
|
|
||||||
|
|
||||||
o = s:option(Value, option_name("password"), translate("Password"))
|
|
||||||
o.password = true
|
|
||||||
|
|
||||||
api.luci_types(arg[1], m, s, type_name, option_prefix)
|
|
@ -1,119 +0,0 @@
|
|||||||
local m, s = ...
|
|
||||||
|
|
||||||
local api = require "luci.passwall.api"
|
|
||||||
|
|
||||||
if not api.finded_com("trojan-go") then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local type_name = "Trojan-Go"
|
|
||||||
|
|
||||||
local option_prefix = "trojan_go_"
|
|
||||||
|
|
||||||
local function option_name(name)
|
|
||||||
return option_prefix .. name
|
|
||||||
end
|
|
||||||
|
|
||||||
local encrypt_methods_ss_aead = {
|
|
||||||
"chacha20-ietf-poly1305",
|
|
||||||
"aes-128-gcm",
|
|
||||||
"aes-256-gcm",
|
|
||||||
}
|
|
||||||
|
|
||||||
-- [[ Trojan Go ]]
|
|
||||||
|
|
||||||
s.fields["type"]:value(type_name, "Trojan-Go")
|
|
||||||
|
|
||||||
o = s:option(Value, option_name("address"), translate("Address (Support Domain Name)"))
|
|
||||||
|
|
||||||
o = s:option(Value, option_name("port"), translate("Port"))
|
|
||||||
o.datatype = "port"
|
|
||||||
|
|
||||||
o = s:option(Value, option_name("password"), translate("Password"))
|
|
||||||
o.password = true
|
|
||||||
|
|
||||||
o = s:option(ListValue, option_name("tcp_fast_open"), "TCP " .. translate("Fast Open"), translate("Need node support required"))
|
|
||||||
o:value("false")
|
|
||||||
o:value("true")
|
|
||||||
|
|
||||||
o = s:option(Flag, option_name("tls"), translate("TLS"))
|
|
||||||
o.default = 1
|
|
||||||
|
|
||||||
o = s:option(Flag, option_name("tls_allowInsecure"), translate("allowInsecure"), translate("Whether unsafe connections are allowed. When checked, Certificate validation will be skipped."))
|
|
||||||
o.default = "0"
|
|
||||||
o:depends({ [option_name("tls")] = true })
|
|
||||||
|
|
||||||
o = s:option(Value, option_name("tls_serverName"), translate("Domain"))
|
|
||||||
o:depends({ [option_name("tls")] = true })
|
|
||||||
|
|
||||||
o = s:option(Flag, option_name("tls_sessionTicket"), translate("Session Ticket"))
|
|
||||||
o.default = "0"
|
|
||||||
o:depends({ [option_name("tls")] = true })
|
|
||||||
|
|
||||||
o = s:option(ListValue, option_name("fingerprint"), translate("Finger Print"))
|
|
||||||
o:value("disable", translate("Disable"))
|
|
||||||
o:value("firefox")
|
|
||||||
o:value("chrome")
|
|
||||||
o:value("ios")
|
|
||||||
o.default = "disable"
|
|
||||||
o:depends({ [option_name("tls")] = true })
|
|
||||||
|
|
||||||
o = s:option(ListValue, option_name("transport"), translate("Transport"))
|
|
||||||
o:value("original", translate("Original"))
|
|
||||||
o:value("ws", "WebSocket")
|
|
||||||
o.default = "original"
|
|
||||||
o.rewrite_option = "trojan_transport"
|
|
||||||
|
|
||||||
o = s:option(ListValue, option_name("plugin_type"), translate("Transport Plugin"))
|
|
||||||
o:value("plaintext", "Plain Text")
|
|
||||||
o:value("shadowsocks", "ShadowSocks")
|
|
||||||
o:value("other", "Other")
|
|
||||||
o.default = "plaintext"
|
|
||||||
o:depends({ [option_name("tls")] = false, [option_name("transport")] = "original" })
|
|
||||||
|
|
||||||
o = s:option(Value, option_name("plugin_cmd"), translate("Plugin Binary"))
|
|
||||||
o.placeholder = "eg: /usr/bin/v2ray-plugin"
|
|
||||||
o:depends({ [option_name("plugin_type")] = "shadowsocks" })
|
|
||||||
o:depends({ [option_name("plugin_type")] = "other" })
|
|
||||||
|
|
||||||
o = s:option(Value, option_name("plugin_option"), translate("Plugin Option"))
|
|
||||||
o.placeholder = "eg: obfs=http;obfs-host=www.baidu.com"
|
|
||||||
o:depends({ [option_name("plugin_type")] = "shadowsocks" })
|
|
||||||
o:depends({ [option_name("plugin_type")] = "other" })
|
|
||||||
|
|
||||||
o = s:option(DynamicList, option_name("plugin_arg"), translate("Plugin Option Args"))
|
|
||||||
o.placeholder = "eg: [\"-config\", \"test.json\"]"
|
|
||||||
o:depends({ [option_name("plugin_type")] = "shadowsocks" })
|
|
||||||
o:depends({ [option_name("plugin_type")] = "other" })
|
|
||||||
|
|
||||||
o = s:option(Value, option_name("ws_host"), translate("WebSocket Host"))
|
|
||||||
o:depends({ [option_name("transport")] = "ws" })
|
|
||||||
|
|
||||||
o = s:option(Value, option_name("ws_path"), translate("WebSocket Path"))
|
|
||||||
o.placeholder = "/"
|
|
||||||
o:depends({ [option_name("transport")] = "ws" })
|
|
||||||
|
|
||||||
-- [[ Shadowsocks2 ]] --
|
|
||||||
o = s:option(Flag, option_name("ss_aead"), translate("Shadowsocks secondary encryption"))
|
|
||||||
o.default = "0"
|
|
||||||
|
|
||||||
o = s:option(ListValue, option_name("ss_aead_method"), translate("Encrypt Method"))
|
|
||||||
for _, v in ipairs(encrypt_methods_ss_aead) do o:value(v, v) end
|
|
||||||
o.default = "aes-128-gcm"
|
|
||||||
o:depends({ [option_name("ss_aead")] = true })
|
|
||||||
|
|
||||||
o = s:option(Value, option_name("ss_aead_pwd"), translate("Password"))
|
|
||||||
o.password = true
|
|
||||||
o:depends({ [option_name("ss_aead")] = true })
|
|
||||||
|
|
||||||
o = s:option(Flag, option_name("smux"), translate("Smux"))
|
|
||||||
|
|
||||||
o = s:option(Value, option_name("mux_concurrency"), translate("Mux concurrency"))
|
|
||||||
o.default = 8
|
|
||||||
o:depends({ [option_name("smux")] = true })
|
|
||||||
|
|
||||||
o = s:option(Value, option_name("smux_idle_timeout"), translate("Mux idle timeout"))
|
|
||||||
o.default = 60
|
|
||||||
o:depends({ [option_name("smux")] = true })
|
|
||||||
|
|
||||||
api.luci_types(arg[1], m, s, type_name, option_prefix)
|
|
@ -1,41 +0,0 @@
|
|||||||
local m, s = ...
|
|
||||||
|
|
||||||
local api = require "luci.passwall.api"
|
|
||||||
|
|
||||||
if not api.finded_com("brook") then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local type_name = "Brook"
|
|
||||||
|
|
||||||
local option_prefix = "brook_"
|
|
||||||
|
|
||||||
local function option_name(name)
|
|
||||||
return option_prefix .. name
|
|
||||||
end
|
|
||||||
|
|
||||||
-- [[ Brook ]]
|
|
||||||
|
|
||||||
s.fields["type"]:value(type_name, translate("Brook"))
|
|
||||||
|
|
||||||
o = s:option(Value, option_name("port"), translate("Listen Port"))
|
|
||||||
o.datatype = "port"
|
|
||||||
|
|
||||||
o = s:option(ListValue, option_name("protocol"), translate("Protocol"))
|
|
||||||
o:value("server", "Brook")
|
|
||||||
o:value("wsserver", "WebSocket")
|
|
||||||
|
|
||||||
--o = s:option(Flag, option_name("tls"), translate("Use TLS"))
|
|
||||||
--o:depends({ [option_name("protocol")] = "wsserver" })
|
|
||||||
|
|
||||||
o = s:option(Value, option_name("password"), translate("Password"))
|
|
||||||
o.password = true
|
|
||||||
|
|
||||||
o = s:option(Value, option_name("ws_path"), translate("WebSocket Path"))
|
|
||||||
o:depends({ [option_name("protocol")] = "wsserver" })
|
|
||||||
|
|
||||||
o = s:option(Flag, option_name("log"), translate("Log"))
|
|
||||||
o.default = "1"
|
|
||||||
o.rmempty = false
|
|
||||||
|
|
||||||
api.luci_types(arg[1], m, s, type_name, option_prefix)
|
|
@ -1,159 +0,0 @@
|
|||||||
local m, s = ...
|
|
||||||
|
|
||||||
local api = require "luci.passwall.api"
|
|
||||||
|
|
||||||
if not api.finded_com("trojan-go") then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local type_name = "Trojan-Go"
|
|
||||||
|
|
||||||
local option_prefix = "trojan_go_"
|
|
||||||
|
|
||||||
local function option_name(name)
|
|
||||||
return option_prefix .. name
|
|
||||||
end
|
|
||||||
|
|
||||||
local encrypt_methods_ss_aead = {
|
|
||||||
"chacha20-ietf-poly1305",
|
|
||||||
"aes-128-gcm",
|
|
||||||
"aes-256-gcm",
|
|
||||||
}
|
|
||||||
|
|
||||||
-- [[ Trojan-Go ]]
|
|
||||||
|
|
||||||
s.fields["type"]:value(type_name, "Trojan-Go")
|
|
||||||
|
|
||||||
o = s:option(Value, option_name("port"), translate("Listen Port"))
|
|
||||||
o.datatype = "port"
|
|
||||||
|
|
||||||
o = s:option(DynamicList, option_name("uuid"), translate("ID") .. "/" .. translate("Password"))
|
|
||||||
for i = 1, 3 do
|
|
||||||
o:value(api.gen_uuid(1))
|
|
||||||
end
|
|
||||||
|
|
||||||
o = s:option(Flag, option_name("tls"), translate("TLS"))
|
|
||||||
o.default = 0
|
|
||||||
o.validate = function(self, value, t)
|
|
||||||
if value then
|
|
||||||
local type = s.fields["type"] and s.fields["type"]:formvalue(t) or ""
|
|
||||||
if value == "0" and type == type_name then
|
|
||||||
return nil, translate("Original Trojan only supported 'tls', please choose 'tls'.")
|
|
||||||
end
|
|
||||||
if value == "1" then
|
|
||||||
local ca = s.fields[option_name("tls_certificateFile")] and s.fields[option_name("tls_certificateFile")]:formvalue(t) or ""
|
|
||||||
local key = s.fields[option_name("tls_keyFile")] and s.fields[option_name("tls_keyFile")]:formvalue(t) or ""
|
|
||||||
if ca == "" or key == "" then
|
|
||||||
return nil, translate("Public key and Private key path can not be empty!")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return value
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
o = s:option(FileUpload, option_name("tls_certificateFile"), translate("Public key absolute path"), translate("as:") .. "/etc/ssl/fullchain.pem")
|
|
||||||
o.default = m:get(s.section, "tls_certificateFile") or "/etc/config/ssl/" .. arg[1] .. ".pem"
|
|
||||||
o:depends({ [option_name("tls")] = true })
|
|
||||||
o.validate = function(self, value, t)
|
|
||||||
if value and value ~= "" then
|
|
||||||
if not nixio.fs.access(value) then
|
|
||||||
return nil, translate("Can't find this file!")
|
|
||||||
else
|
|
||||||
return value
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
|
|
||||||
o = s:option(FileUpload, option_name("tls_keyFile"), translate("Private key absolute path"), translate("as:") .. "/etc/ssl/private.key")
|
|
||||||
o.default = m:get(s.section, "tls_keyFile") or "/etc/config/ssl/" .. arg[1] .. ".key"
|
|
||||||
o:depends({ [option_name("tls")] = true })
|
|
||||||
o.validate = function(self, value, t)
|
|
||||||
if value and value ~= "" then
|
|
||||||
if not nixio.fs.access(value) then
|
|
||||||
return nil, translate("Can't find this file!")
|
|
||||||
else
|
|
||||||
return value
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
|
|
||||||
o = s:option(Flag, option_name("tls_sessionTicket"), translate("Session Ticket"))
|
|
||||||
o.default = "0"
|
|
||||||
o:depends({ [option_name("tls")] = true })
|
|
||||||
|
|
||||||
o = s:option(ListValue, option_name("transport"), translate("Transport"))
|
|
||||||
o:value("original", translate("Original"))
|
|
||||||
o:value("ws", "WebSocket")
|
|
||||||
o.default = "original"
|
|
||||||
|
|
||||||
o = s:option(ListValue, option_name("plugin_type"), translate("Transport Plugin"))
|
|
||||||
o:value("plaintext", "Plain Text")
|
|
||||||
o:value("shadowsocks", "ShadowSocks")
|
|
||||||
o:value("other", "Other")
|
|
||||||
o.default = "plaintext"
|
|
||||||
o:depends({ [option_name("tls")] = false, [option_name("transport")] = "original" })
|
|
||||||
|
|
||||||
o = s:option(Value, option_name("plugin_cmd"), translate("Plugin Binary"))
|
|
||||||
o.placeholder = "eg: /usr/bin/v2ray-plugin"
|
|
||||||
o:depends({ [option_name("plugin_type")] = "shadowsocks" })
|
|
||||||
o:depends({ [option_name("plugin_type")] = "other" })
|
|
||||||
|
|
||||||
o = s:option(Value, option_name("plugin_option"), translate("Plugin Option"))
|
|
||||||
o.placeholder = "eg: obfs=http;obfs-host=www.baidu.com"
|
|
||||||
o:depends({ [option_name("plugin_type")] = "shadowsocks" })
|
|
||||||
o:depends({ [option_name("plugin_type")] = "other" })
|
|
||||||
|
|
||||||
o = s:option(DynamicList, option_name("plugin_arg"), translate("Plugin Option Args"))
|
|
||||||
o.placeholder = "eg: [\"-config\", \"test.json\"]"
|
|
||||||
o:depends({ [option_name("plugin_type")] = "shadowsocks" })
|
|
||||||
o:depends({ [option_name("plugin_type")] = "other" })
|
|
||||||
|
|
||||||
o = s:option(Value, option_name("ws_host"), translate("WebSocket Host"))
|
|
||||||
o:depends({ [option_name("transport")] = "ws" })
|
|
||||||
|
|
||||||
o = s:option(Value, option_name("ws_path"), translate("WebSocket Path"))
|
|
||||||
o:depends({ [option_name("transport")] = "ws" })
|
|
||||||
|
|
||||||
o = s:option(Flag, option_name("ss_aead"), translate("Shadowsocks secondary encryption"))
|
|
||||||
o.default = "0"
|
|
||||||
|
|
||||||
o = s:option(ListValue, option_name("ss_aead_method"), translate("Encrypt Method"))
|
|
||||||
for _, v in ipairs(encrypt_methods_ss_aead) do o:value(v, v) end
|
|
||||||
o.default = "aes-128-gcm"
|
|
||||||
o:depends({ [option_name("ss_aead")] = true })
|
|
||||||
|
|
||||||
o = s:option(Value, option_name("ss_aead_pwd"), translate("Password"))
|
|
||||||
o.password = true
|
|
||||||
o:depends({ [option_name("ss_aead")] = true })
|
|
||||||
|
|
||||||
o = s:option(Flag, option_name("tcp_fast_open"), translate("TCP Fast Open"))
|
|
||||||
o.default = "0"
|
|
||||||
|
|
||||||
o = s:option(Flag, option_name("remote_enable"), translate("Enable Remote"), translate("You can forward to Nginx/Caddy/V2ray/Xray WebSocket and more."))
|
|
||||||
o.default = "1"
|
|
||||||
o.rmempty = false
|
|
||||||
|
|
||||||
o = s:option(Value, option_name("remote_address"), translate("Remote Address"))
|
|
||||||
o.default = "127.0.0.1"
|
|
||||||
o:depends({ [option_name("remote_enable")] = true })
|
|
||||||
|
|
||||||
o = s:option(Value, option_name("remote_port"), translate("Remote Port"))
|
|
||||||
o.datatype = "port"
|
|
||||||
o.default = "80"
|
|
||||||
o:depends({ [option_name("remote_enable")] = true })
|
|
||||||
|
|
||||||
o = s:option(Flag, option_name("log"), translate("Log"))
|
|
||||||
o.default = "1"
|
|
||||||
|
|
||||||
o = s:option(ListValue, option_name("loglevel"), translate("Log Level"))
|
|
||||||
o.default = "2"
|
|
||||||
o:value("0", "all")
|
|
||||||
o:value("1", "info")
|
|
||||||
o:value("2", "warn")
|
|
||||||
o:value("3", "error")
|
|
||||||
o:value("4", "fatal")
|
|
||||||
o:depends({ [option_name("log")] = true })
|
|
||||||
|
|
||||||
api.luci_types(arg[1], m, s, type_name, option_prefix)
|
|
@ -8,17 +8,6 @@ local function gh_pre_release_url(self)
|
|||||||
return "https://api.github.com/repos/" .. self.repo .. "/releases?per_page=1"
|
return "https://api.github.com/repos/" .. self.repo .. "/releases?per_page=1"
|
||||||
end
|
end
|
||||||
|
|
||||||
_M.brook = {
|
|
||||||
name = "Brook",
|
|
||||||
repo = "txthinking/brook",
|
|
||||||
get_url = gh_release_url,
|
|
||||||
cmd_version = "-v | awk '{print $3}'",
|
|
||||||
zipped = false,
|
|
||||||
default_path = "/usr/bin/brook",
|
|
||||||
match_fmt_str = "linux_%s$",
|
|
||||||
file_tree = {}
|
|
||||||
}
|
|
||||||
|
|
||||||
_M.hysteria = {
|
_M.hysteria = {
|
||||||
name = "Hysteria",
|
name = "Hysteria",
|
||||||
repo = "HyNetwork/hysteria",
|
repo = "HyNetwork/hysteria",
|
||||||
|
@ -155,15 +155,6 @@ local function start()
|
|||||||
elseif type == "Trojan-Go" then
|
elseif type == "Trojan-Go" then
|
||||||
config = require(require_dir .. "util_trojan").gen_config_server(user)
|
config = require(require_dir .. "util_trojan").gen_config_server(user)
|
||||||
bin = ln_run(api.get_app_path("trojan-go"), "trojan-go", "-config " .. config_file, log_path)
|
bin = ln_run(api.get_app_path("trojan-go"), "trojan-go", "-config " .. config_file, log_path)
|
||||||
elseif type == "Brook" then
|
|
||||||
local brook_protocol = user.protocol
|
|
||||||
local brook_password = user.password
|
|
||||||
local brook_path = user.ws_path or "/ws"
|
|
||||||
local brook_path_arg = ""
|
|
||||||
if brook_protocol == "wsserver" and brook_path then
|
|
||||||
brook_path_arg = " --path " .. brook_path
|
|
||||||
end
|
|
||||||
bin = ln_run(api.get_app_path("brook"), "brook_" .. id, string.format("--debug %s -l :%s -p %s%s", brook_protocol, port, brook_password, brook_path_arg), log_path)
|
|
||||||
elseif type == "Hysteria2" then
|
elseif type == "Hysteria2" then
|
||||||
config = require(require_dir .. "util_hysteria2").gen_config_server(user)
|
config = require(require_dir .. "util_hysteria2").gen_config_server(user)
|
||||||
bin = ln_run(api.get_app_path("hysteria"), "hysteria", "-c " .. config_file .. " server", log_path)
|
bin = ln_run(api.get_app_path("hysteria"), "hysteria", "-c " .. config_file .. " server", log_path)
|
||||||
|
@ -143,9 +143,6 @@ local api = require "luci.passwall.api"
|
|||||||
} else if (v_type === "Trojan-Go") {
|
} else if (v_type === "Trojan-Go") {
|
||||||
dom_prefix = "trojan_go_"
|
dom_prefix = "trojan_go_"
|
||||||
protocol = "trojan-go"
|
protocol = "trojan-go"
|
||||||
} else if (v_type === "Brook") {
|
|
||||||
dom_prefix = "brook_"
|
|
||||||
protocol = "brook"
|
|
||||||
} else if (v_type === "Hysteria2") {
|
} else if (v_type === "Hysteria2") {
|
||||||
dom_prefix = "hysteria2_"
|
dom_prefix = "hysteria2_"
|
||||||
protocol = "hysteria2"
|
protocol = "hysteria2"
|
||||||
@ -386,34 +383,6 @@ local api = require "luci.passwall.api"
|
|||||||
params = params.substring(1);
|
params = params.substring(1);
|
||||||
}
|
}
|
||||||
url += params;
|
url += params;
|
||||||
} else if (v_type === "Brook") {
|
|
||||||
var url = "";
|
|
||||||
var params = "?";
|
|
||||||
var v_protocol = opt.get(dom_prefix + "protocol");
|
|
||||||
var v_port = opt.get(dom_prefix + "port");
|
|
||||||
var v_password = opt.get(dom_prefix + "password");
|
|
||||||
var b_protocol_value = v_protocol.value.split('client').join('server');
|
|
||||||
|
|
||||||
var url_protocol = b_protocol_value;
|
|
||||||
params += opt.query("password", dom_prefix + "password");
|
|
||||||
if (b_protocol_value == "wsserver") {
|
|
||||||
var server = '';
|
|
||||||
var prefix = "ws://";
|
|
||||||
if (opt.get(dom_prefix + "tls").checked) {
|
|
||||||
prefix = "wss://";
|
|
||||||
url_protocol = 'wssserver';
|
|
||||||
}
|
|
||||||
var v_path = opt.get(dom_prefix + "ws_path");
|
|
||||||
var v_path_value = v_path.value || '/ws';
|
|
||||||
if (v_path_value.length > 1 && v_path_value.indexOf('/') < 0) {
|
|
||||||
v_path_value = '/' + v_path_value;
|
|
||||||
}
|
|
||||||
params += "&" + url_protocol + "=" + encodeURIComponent(prefix + _address + ":" + v_port.value + v_path_value);
|
|
||||||
} else {
|
|
||||||
params += "&" + url_protocol + "=" + encodeURIComponent(_address + ":" + v_port.value);
|
|
||||||
}
|
|
||||||
url += url_protocol;
|
|
||||||
url += params;
|
|
||||||
} else if ((v_type === "Hysteria2") || (v_type === "sing-box" && opt.get(dom_prefix + "protocol").value === "hysteria2")) {
|
} else if ((v_type === "Hysteria2") || (v_type === "sing-box" && opt.get(dom_prefix + "protocol").value === "hysteria2")) {
|
||||||
protocol = "hysteria2"
|
protocol = "hysteria2"
|
||||||
var v_port = opt.get(dom_prefix + "port");
|
var v_port = opt.get(dom_prefix + "port");
|
||||||
@ -962,62 +931,6 @@ local api = require "luci.passwall.api"
|
|||||||
opt.set('remarks', decodeURI(m.hash.substr(1)));
|
opt.set('remarks', decodeURI(m.hash.substr(1)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ssu[0] === "brook") {
|
|
||||||
dom_prefix = "brook_"
|
|
||||||
var stype = "Brook";
|
|
||||||
var m = parseNodeUrl(ssrurl);
|
|
||||||
|
|
||||||
var from_protocol = m.host;
|
|
||||||
var protocol = from_protocol.split('server').join('client');
|
|
||||||
|
|
||||||
var queryParam = {};
|
|
||||||
if (m.search.length > 1) {
|
|
||||||
var query = m.search.split('?');
|
|
||||||
var queryParams = query[1];
|
|
||||||
var queryArray = queryParams.split('&');
|
|
||||||
var params;
|
|
||||||
for (i = 0; i < queryArray.length; i++) {
|
|
||||||
params = queryArray[i].split('=');
|
|
||||||
queryParam[decodeURIComponent(params[0])] = decodeURIComponent(params[1] || '');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var password = queryParam.password;
|
|
||||||
if (password === "") {
|
|
||||||
s.innerHTML = "<font color='red'><%:Invalid Share URL Format%></font>";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
opt.set('type', stype);
|
|
||||||
opt.set(dom_prefix + 'protocol', protocol);
|
|
||||||
opt.set(dom_prefix + 'password', password);
|
|
||||||
|
|
||||||
if (protocol == 'wsclient' || protocol == 'wssclient') {
|
|
||||||
opt.set(dom_prefix + 'protocol', 'wsclient');
|
|
||||||
var wsserver = queryParam[from_protocol].split('://');
|
|
||||||
wsserver = wsserver[1].split('/');
|
|
||||||
var path = wsserver[1] && '/' + wsserver[1] || '/ws';
|
|
||||||
var server = wsserver[0].split(':');
|
|
||||||
opt.set(dom_prefix + 'address', server[0]);
|
|
||||||
opt.set(dom_prefix + 'port', server[1]);
|
|
||||||
opt.set(dom_prefix + 'ws_path', path);
|
|
||||||
if (protocol == 'wssclient') {
|
|
||||||
opt.set(dom_prefix + 'tls', true);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
var server = queryParam[from_protocol].split(':');
|
|
||||||
if (server.length < 2) {
|
|
||||||
s.innerHTML = "<font color='red'><%:Invalid Share URL Format%></font>";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
opt.set(dom_prefix + 'address', server[0]);
|
|
||||||
opt.set(dom_prefix + 'port', server[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m.hash) {
|
|
||||||
opt.set('remarks', decodeURI(m.hash.substr(1)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ssu[0] === "hysteria2" || ssu[0] === "hy2") {
|
if (ssu[0] === "hysteria2" || ssu[0] === "hy2") {
|
||||||
var m = parseNodeUrl(ssrurl);
|
var m = parseNodeUrl(ssrurl);
|
||||||
var password = m.passwd;
|
var password = m.passwd;
|
||||||
|
@ -1120,12 +1120,6 @@ msgstr "插件名称"
|
|||||||
msgid "Plugin Arguments"
|
msgid "Plugin Arguments"
|
||||||
msgstr "插件参数"
|
msgstr "插件参数"
|
||||||
|
|
||||||
msgid "Brook Protocol"
|
|
||||||
msgstr "Brook协议"
|
|
||||||
|
|
||||||
msgid "Use TLS"
|
|
||||||
msgstr "使用TLS"
|
|
||||||
|
|
||||||
msgid "Naiveproxy Protocol"
|
msgid "Naiveproxy Protocol"
|
||||||
msgstr "Naiveproxy协议"
|
msgstr "Naiveproxy协议"
|
||||||
|
|
||||||
|
@ -76,7 +76,6 @@ config global_app
|
|||||||
option singbox_file '/usr/bin/sing-box'
|
option singbox_file '/usr/bin/sing-box'
|
||||||
option xray_file '/usr/bin/xray'
|
option xray_file '/usr/bin/xray'
|
||||||
option trojan_go_file '/usr/bin/trojan-go'
|
option trojan_go_file '/usr/bin/trojan-go'
|
||||||
option brook_file '/usr/bin/brook'
|
|
||||||
option hysteria_file '/usr/bin/hysteria'
|
option hysteria_file '/usr/bin/hysteria'
|
||||||
option chinadns_ng '/usr/bin/chinadns-ng'
|
option chinadns_ng '/usr/bin/chinadns-ng'
|
||||||
|
|
||||||
|
@ -620,21 +620,6 @@ run_socks() {
|
|||||||
lua $UTIL_NAIVE gen_config -node $node -run_type socks -local_addr $bind -local_port $socks_port -server_host $server_host -server_port $port > $config_file
|
lua $UTIL_NAIVE gen_config -node $node -run_type socks -local_addr $bind -local_port $socks_port -server_host $server_host -server_port $port > $config_file
|
||||||
ln_run "$(first_type naive)" naive $log_file "$config_file"
|
ln_run "$(first_type naive)" naive $log_file "$config_file"
|
||||||
;;
|
;;
|
||||||
brook)
|
|
||||||
local protocol=$(config_n_get $node protocol client)
|
|
||||||
local prefix=""
|
|
||||||
[ "$protocol" == "wsclient" ] && {
|
|
||||||
prefix="ws://"
|
|
||||||
local brook_tls=$(config_n_get $node brook_tls 0)
|
|
||||||
[ "$brook_tls" == "1" ] && {
|
|
||||||
prefix="wss://"
|
|
||||||
protocol="wssclient"
|
|
||||||
}
|
|
||||||
local ws_path=$(config_n_get $node ws_path "/ws")
|
|
||||||
}
|
|
||||||
server_host=${prefix}${server_host}
|
|
||||||
ln_run "$(first_type $(config_t_get global_app brook_file) brook)" "brook_SOCKS_${flag}" $log_file "$protocol" --socks5 "$bind:$socks_port" -s "${server_host}:${port}${ws_path}" -p "$(config_n_get $node password)"
|
|
||||||
;;
|
|
||||||
ssr)
|
ssr)
|
||||||
lua $UTIL_SS gen_config -node $node -local_addr "0.0.0.0" -local_port $socks_port -server_host $server_host -server_port $port > $config_file
|
lua $UTIL_SS gen_config -node $node -local_addr "0.0.0.0" -local_port $socks_port -server_host $server_host -server_port $port > $config_file
|
||||||
ln_run "$(first_type ssr-local)" "ssr-local" $log_file -c "$config_file" -v -u
|
ln_run "$(first_type ssr-local)" "ssr-local" $log_file -c "$config_file" -v -u
|
||||||
@ -746,14 +731,6 @@ run_redir() {
|
|||||||
naiveproxy)
|
naiveproxy)
|
||||||
echolog "Naiveproxy不支持UDP转发!"
|
echolog "Naiveproxy不支持UDP转发!"
|
||||||
;;
|
;;
|
||||||
brook)
|
|
||||||
local protocol=$(config_n_get $node protocol client)
|
|
||||||
if [ "$protocol" == "wsclient" ]; then
|
|
||||||
echolog "Brook的WebSocket不支持UDP转发!"
|
|
||||||
else
|
|
||||||
ln_run "$(first_type $(config_t_get global_app brook_file) brook)" "brook_UDP" $log_file tproxy -l ":$local_port" -s "$server_host:$port" -p "$(config_n_get $node password)" --doNotRunScripts
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
ssr)
|
ssr)
|
||||||
lua $UTIL_SS gen_config -node $node -local_addr "0.0.0.0" -local_port $local_port > $config_file
|
lua $UTIL_SS gen_config -node $node -local_addr "0.0.0.0" -local_port $local_port > $config_file
|
||||||
ln_run "$(first_type ssr-redir)" "ssr-redir" $log_file -c "$config_file" -v -U
|
ln_run "$(first_type ssr-redir)" "ssr-redir" $log_file -c "$config_file" -v -U
|
||||||
@ -923,19 +900,6 @@ run_redir() {
|
|||||||
lua $UTIL_NAIVE gen_config -node $node -run_type redir -local_addr "0.0.0.0" -local_port $local_port > $config_file
|
lua $UTIL_NAIVE gen_config -node $node -run_type redir -local_addr "0.0.0.0" -local_port $local_port > $config_file
|
||||||
ln_run "$(first_type naive)" naive $log_file "$config_file"
|
ln_run "$(first_type naive)" naive $log_file "$config_file"
|
||||||
;;
|
;;
|
||||||
brook)
|
|
||||||
local server_ip=$server_host
|
|
||||||
local protocol=$(config_n_get $node protocol client)
|
|
||||||
local prefix=""
|
|
||||||
[ "$protocol" == "wsclient" ] && {
|
|
||||||
prefix="ws://"
|
|
||||||
local brook_tls=$(config_n_get $node brook_tls 0)
|
|
||||||
[ "$brook_tls" == "1" ] && prefix="wss://"
|
|
||||||
local ws_path=$(config_n_get $node ws_path "/ws")
|
|
||||||
}
|
|
||||||
server_ip=${prefix}${server_ip}
|
|
||||||
ln_run "$(first_type $(config_t_get global_app brook_file) brook)" "brook_TCP" $log_file tproxy -l ":$local_port" -s "${server_ip}:${port}${ws_path}" -p "$(config_n_get $node password)" --doNotRunScripts
|
|
||||||
;;
|
|
||||||
ssr)
|
ssr)
|
||||||
[ "$tcp_proxy_way" = "tproxy" ] && lua_tproxy_arg="-tcp_tproxy true"
|
[ "$tcp_proxy_way" = "tproxy" ] && lua_tproxy_arg="-tcp_tproxy true"
|
||||||
[ "$TCP_UDP" = "1" ] && {
|
[ "$TCP_UDP" = "1" ] && {
|
||||||
@ -1754,7 +1718,7 @@ FILTER_PROXY_IPV6=$(config_t_get global filter_proxy_ipv6 0)
|
|||||||
dns_listen_port=${DNS_PORT}
|
dns_listen_port=${DNS_PORT}
|
||||||
|
|
||||||
REDIRECT_LIST="socks ss ss-rust ssr sing-box xray trojan-go trojan-plus naiveproxy hysteria2"
|
REDIRECT_LIST="socks ss ss-rust ssr sing-box xray trojan-go trojan-plus naiveproxy hysteria2"
|
||||||
TPROXY_LIST="brook socks ss ss-rust ssr sing-box xray trojan-go trojan-plus hysteria2"
|
TPROXY_LIST="socks ss ss-rust ssr sing-box xray trojan-go trojan-plus hysteria2"
|
||||||
RESOLVFILE=/tmp/resolv.conf.d/resolv.conf.auto
|
RESOLVFILE=/tmp/resolv.conf.d/resolv.conf.auto
|
||||||
[ -f "${RESOLVFILE}" ] && [ -s "${RESOLVFILE}" ] || RESOLVFILE=/tmp/resolv.conf.auto
|
[ -f "${RESOLVFILE}" ] && [ -s "${RESOLVFILE}" ] || RESOLVFILE=/tmp/resolv.conf.auto
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user