luci-app-passwall: SS-Rust Server support
This commit is contained in:
parent
20caa25b11
commit
52175abb02
@ -46,6 +46,7 @@ LUCI_DEPENDS:=+coreutils +coreutils-base64 +coreutils-nohup +curl \
|
||||
+PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Libev_Client:shadowsocks-libev-ss-redir \
|
||||
+PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Libev_Server:shadowsocks-libev-ss-server \
|
||||
+PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Rust_Client:shadowsocks-rust-sslocal \
|
||||
+PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Rust_Server:shadowsocks-rust-ssserver \
|
||||
+PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR_Libev_Client:shadowsocksr-libev-ssr-local \
|
||||
+PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR_Libev_Client:shadowsocksr-libev-ssr-redir \
|
||||
+PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR_Libev_Server:shadowsocksr-libev-ssr-server \
|
||||
@ -113,6 +114,11 @@ config PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Rust_Client
|
||||
depends on aarch64||arm||i386||mips||mipsel||x86_64
|
||||
default y if aarch64
|
||||
|
||||
config PACKAGE_$(PKG_NAME)_INCLUDE_Shadowsocks_Rust_Server
|
||||
bool "Include Shadowsocks Rust Server"
|
||||
depends on aarch64||arm||i386||mips||mipsel||x86_64
|
||||
default y if aarch64
|
||||
|
||||
config PACKAGE_$(PKG_NAME)_INCLUDE_ShadowsocksR_Libev_Client
|
||||
bool "Include ShadowsocksR Libev Client"
|
||||
default y
|
||||
|
@ -112,7 +112,7 @@ local function start()
|
||||
end
|
||||
end
|
||||
bin = ln_run("/usr/bin/microsocks", "microsocks_" .. id, string.format("-i :: -p %s %s", port, auth), log_path)
|
||||
elseif type == "SS" or type == "SSR" then
|
||||
elseif type == "SS" or type == "SS-Rust" or type == "SSR" then
|
||||
config = require(require_dir .. "shadowsocks").gen_config(user)
|
||||
local udp_param = ""
|
||||
udp_forward = tonumber(user.udp_forward) or 1
|
||||
@ -120,7 +120,12 @@ local function start()
|
||||
udp_param = "-u"
|
||||
end
|
||||
type = type:lower()
|
||||
bin = ln_run("/usr/bin/" .. type .. "-server", type .. "-server", "-c " .. config_file .. " " .. udp_param, log_path)
|
||||
--bin = ln_run("/usr/bin/" .. type .. "-server", type .. "-server", "-c " .. config_file .. " " .. udp_param, log_path)
|
||||
if type == "ss-rust" then
|
||||
bin = ln_run("/usr/bin/" .. "ssserver", "ssserver", "-c " .. config_file)
|
||||
else
|
||||
bin = ln_run("/usr/bin/" .. type .. "-server", type .. "-server", "-c " .. config_file .. " " .. udp_param, log_path)
|
||||
end
|
||||
elseif type == "V2ray" then
|
||||
config = require(require_dir .. "v2ray").gen_config(user)
|
||||
bin = ln_run(api.get_v2ray_path(), "v2ray", "run -c " .. config_file, log_path)
|
||||
|
@ -1,19 +1,30 @@
|
||||
module("luci.model.cbi.passwall.server.api.shadowsocks", package.seeall)
|
||||
function gen_config(user)
|
||||
local config = {}
|
||||
config.server = {"[::0]", "0.0.0.0"}
|
||||
config.server_port = tonumber(user.port)
|
||||
config.password = user.password
|
||||
config.timeout = tonumber(user.timeout)
|
||||
config.fast_open = (user.tcp_fast_open and user.tcp_fast_open == "1") and true or false
|
||||
config.method = user.method
|
||||
if user.type == "SS-Rust" then
|
||||
local config = {}
|
||||
config.server = "::"
|
||||
config.mode = "tcp_and_udp"
|
||||
config.server_port = tonumber(user.port)
|
||||
config.password = user.password
|
||||
config.timeout = tonumber(user.timeout)
|
||||
config.fast_open = (user.tcp_fast_open and user.tcp_fast_open == "1") and true or false
|
||||
config.method = user.method
|
||||
return config
|
||||
else
|
||||
local config = {}
|
||||
config.server = {"[::0]", "0.0.0.0"}
|
||||
config.server_port = tonumber(user.port)
|
||||
config.password = user.password
|
||||
config.timeout = tonumber(user.timeout)
|
||||
config.fast_open = (user.tcp_fast_open and user.tcp_fast_open == "1") and true or false
|
||||
config.method = user.method
|
||||
|
||||
if user.type == "SSR" then
|
||||
config.protocol = user.protocol
|
||||
config.protocol_param = user.protocol_param
|
||||
config.obfs = user.obfs
|
||||
config.obfs_param = user.obfs_param
|
||||
if user.type == "SSR" then
|
||||
config.protocol = user.protocol
|
||||
config.protocol_param = user.protocol_param
|
||||
config.obfs = user.obfs
|
||||
config.obfs_param = user.obfs_param
|
||||
end
|
||||
return config
|
||||
end
|
||||
|
||||
return config
|
||||
end
|
||||
|
@ -9,6 +9,12 @@ local ss_encrypt_method_list = {
|
||||
"xchacha20-ietf-poly1305"
|
||||
}
|
||||
|
||||
local ss_rust_encrypt_method_list = {
|
||||
"plain", "none",
|
||||
"aes-128-gcm", "aes-256-gcm", "chacha20-ietf-poly1305",
|
||||
"2022-blake3-aes-128-gcm", "2022-blake3-aes-256-gcm", "2022-blake3-chacha20-poly1305"
|
||||
}
|
||||
|
||||
local ssr_encrypt_method_list = {
|
||||
"none", "table", "rc2-cfb", "rc4", "rc4-md5", "rc4-md5-6", "aes-128-cfb",
|
||||
"aes-192-cfb", "aes-256-cfb", "aes-128-ctr", "aes-192-ctr", "aes-256-ctr",
|
||||
@ -68,6 +74,9 @@ end
|
||||
if api.is_finded("ss-server") then
|
||||
type:value("SS", translate("Shadowsocks"))
|
||||
end
|
||||
if api.is_finded("ssserver") then
|
||||
type:value("SS-Rust", translate("Shadowsocks Rust"))
|
||||
end
|
||||
if api.is_finded("ssr-server") then
|
||||
type:value("SSR", translate("ShadowsocksR"))
|
||||
end
|
||||
@ -150,6 +159,7 @@ password = s:option(Value, "password", translate("Password"))
|
||||
password.password = true
|
||||
password:depends("auth", true)
|
||||
password:depends("type", "SS")
|
||||
password:depends("type", "SS-Rust")
|
||||
password:depends("type", "SSR")
|
||||
password:depends("type", "Brook")
|
||||
password:depends({ type = "V2ray", protocol = "shadowsocks" })
|
||||
@ -245,6 +255,16 @@ function ss_encrypt_method.write(self, section, value)
|
||||
m:set(section, "method", value)
|
||||
end
|
||||
|
||||
ss_rust_encrypt_method = s:option(ListValue, "ss_rust_encrypt_method", translate("Encrypt Method"))
|
||||
for a, t in ipairs(ss_rust_encrypt_method_list) do ss_rust_encrypt_method:value(t) end
|
||||
ss_rust_encrypt_method:depends("type", "SS-Rust")
|
||||
function ss_rust_encrypt_method.cfgvalue(self, section)
|
||||
return m:get(section, "method")
|
||||
end
|
||||
function ss_rust_encrypt_method.write(self, section, value)
|
||||
m:set(section, "method", value)
|
||||
end
|
||||
|
||||
ssr_encrypt_method = s:option(ListValue, "ssr_encrypt_method", translate("Encrypt Method"))
|
||||
for a, t in ipairs(ssr_encrypt_method_list) do ssr_encrypt_method:value(t) end
|
||||
ssr_encrypt_method:depends("type", "SSR")
|
||||
@ -311,6 +331,7 @@ timeout = s:option(Value, "timeout", translate("Connection Timeout"))
|
||||
timeout.datatype = "uinteger"
|
||||
timeout.default = 300
|
||||
timeout:depends("type", "SS")
|
||||
timeout:depends("type", "SS-Rust")
|
||||
timeout:depends("type", "SSR")
|
||||
|
||||
udp_forward = s:option(Flag, "udp_forward", translate("UDP Forward"))
|
||||
@ -617,6 +638,7 @@ ss_aead_pwd:depends("ss_aead", true)
|
||||
tcp_fast_open = s:option(Flag, "tcp_fast_open", translate("TCP Fast Open"))
|
||||
tcp_fast_open.default = "0"
|
||||
tcp_fast_open:depends("type", "SS")
|
||||
tcp_fast_open:depends("type", "SS-Rust")
|
||||
tcp_fast_open:depends("type", "SSR")
|
||||
tcp_fast_open:depends("type", "Trojan")
|
||||
tcp_fast_open:depends("type", "Trojan-Plus")
|
||||
|
Loading…
Reference in New Issue
Block a user