From 8ce766b57dc4e1ccba9491dafaec6441807a37bb Mon Sep 17 00:00:00 2001
From: Mattraks <16359027+Mattraks@users.noreply.github.com>
Date: Wed, 2 Dec 2020 13:32:54 +0800
Subject: [PATCH] Replace v2ray with Xray and set v2ray default is n
---
luci-app-ssr-plus/Makefile | 14 +-
.../model/cbi/shadowsocksr/client-config.lua | 24 +---
.../luasrc/model/cbi/shadowsocksr/client.lua | 2 +-
luci-app-ssr-plus/po/zh-cn/ssr-plus.po | 4 +-
.../root/etc/init.d/shadowsocksr | 45 ++-----
.../{genvlessconfig.lua => genv2config.lua} | 30 ++---
.../usr/share/shadowsocksr/genv2rayconfig.lua | 116 ----------------
.../usr/share/shadowsocksr/genxrayconfig.lua | 127 ------------------
8 files changed, 39 insertions(+), 323 deletions(-)
rename luci-app-ssr-plus/root/usr/share/shadowsocksr/{genvlessconfig.lua => genv2config.lua} (77%)
delete mode 100644 luci-app-ssr-plus/root/usr/share/shadowsocksr/genv2rayconfig.lua
delete mode 100644 luci-app-ssr-plus/root/usr/share/shadowsocksr/genxrayconfig.lua
diff --git a/luci-app-ssr-plus/Makefile b/luci-app-ssr-plus/Makefile
index f887a896..58542a7d 100644
--- a/luci-app-ssr-plus/Makefile
+++ b/luci-app-ssr-plus/Makefile
@@ -16,10 +16,6 @@ config PACKAGE_$(PKG_NAME)_INCLUDE_V2ray_plugin
bool "Include Shadowsocks V2ray Plugin"
default y if i386||x86_64||arm||aarch64
-config PACKAGE_$(PKG_NAME)_INCLUDE_V2ray
- bool "Include V2ray"
- default y if i386||x86_64||arm||aarch64
-
config PACKAGE_$(PKG_NAME)_INCLUDE_Xray
bool "Include Xray"
default y if i386||x86_64||arm||aarch64
@@ -28,14 +24,18 @@ config PACKAGE_$(PKG_NAME)_INCLUDE_Trojan
bool "Include Trojan"
default y if i386||x86_64||arm||aarch64
+config PACKAGE_$(PKG_NAME)_INCLUDE_Redsocks2
+ bool "Include Redsocks2"
+ default y if i386||x86_64||arm||aarch64
+
config PACKAGE_$(PKG_NAME)_INCLUDE_NaiveProxy
bool "Include NaiveProxy"
depends on !(arc||armeb||mips||mips64||powerpc)
default n
-config PACKAGE_$(PKG_NAME)_INCLUDE_Redsocks2
- bool "Include Redsocks2"
- default y if i386||x86_64||arm||aarch64
+config PACKAGE_$(PKG_NAME)_INCLUDE_V2ray
+ bool "Include V2ray"
+ default n
config PACKAGE_$(PKG_NAME)_INCLUDE_Kcptun
bool "Include Kcptun"
diff --git a/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/client-config.lua b/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/client-config.lua
index a75febc4..9e1555b5 100644
--- a/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/client-config.lua
+++ b/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/client-config.lua
@@ -128,13 +128,10 @@ o:value("ssr", translate("ShadowsocksR"))
if nixio.fs.access("/usr/bin/ss-redir") then
o:value("ss", translate("Shadowsocks New Version"))
end
-if nixio.fs.access("/usr/bin/v2ray/v2ray") or nixio.fs.access("/usr/bin/v2ray") then
+if nixio.fs.access("/usr/bin/xray") or nixio.fs.access("/usr/bin/xray/xray") or nixio.fs.access("/usr/bin/v2ray/v2ray") or nixio.fs.access("/usr/bin/v2ray") then
o:value("v2ray", translate("V2Ray"))
o:value("vless", translate("VLESS"))
end
-if nixio.fs.access("/usr/bin/xray") then
-o:value("xray", translate("XRay"))
-end
if nixio.fs.access("/usr/sbin/trojan") then
o:value("trojan", translate("Trojan"))
end
@@ -163,7 +160,6 @@ o:depends("type", "ssr")
o:depends("type", "ss")
o:depends("type", "v2ray")
o:depends("type", "vless")
-o:depends("type", "xray")
o:depends("type", "trojan")
o:depends("type", "naiveproxy")
o:depends("type", "socks5")
@@ -175,7 +171,6 @@ o:depends("type", "ssr")
o:depends("type", "ss")
o:depends("type", "v2ray")
o:depends("type", "vless")
-o:depends("type", "xray")
o:depends("type", "trojan")
o:depends("type", "naiveproxy")
o:depends("type", "socks5")
@@ -247,14 +242,12 @@ o.rmempty = true
o.default = uuid
o:depends("type", "v2ray")
o:depends("type", "vless")
-o:depends("type", "xray")
-- VLESS Encryption
o = s:option(Value, "vless_encryption", translate("VLESS Encryption"))
o.rmempty = true
o.default = "none"
o:depends("type", "vless")
-o:depends("type", "xray")
-- 加密方式
o = s:option(ListValue, "security", translate("Encrypt Method"))
@@ -272,7 +265,6 @@ o:value("quic", "QUIC")
o.rmempty = true
o:depends("type", "v2ray")
o:depends("type", "vless")
-o:depends("type", "xray")
-- [[ TCP部分 ]]--
@@ -389,7 +381,7 @@ o.default = 2
o.rmempty = true
o = s:option(Value, "seed", translate("Obfuscate password (optional)"))
-o:depends("transport", "kcp")
+o:depends({type="vless", transport="kcp"})
o.rmempty = true
o = s:option(Flag, "congestion", translate("Congestion"))
@@ -401,9 +393,8 @@ o = s:option(Flag, "insecure", translate("allowInsecure"))
o.rmempty = false
o:depends("type", "v2ray")
o:depends("type", "vless")
-o:depends("type", "xray")
o:depends("type", "trojan")
-o.default = "1"
+o.default = "0"
o.description = translate("If true, allowss insecure connection at TLS client, e.g., TLS server uses unverifiable certificates.")
-- [[ TLS ]]--
o = s:option(Flag, "tls", translate("TLS"))
@@ -411,7 +402,6 @@ o.rmempty = true
o.default = "0"
o:depends("type", "v2ray")
o:depends("type", "vless")
-o:depends("type", "xray")
o:depends("type", "trojan")
o = s:option(Value, "tls_host", translate("TLS Host"))
@@ -420,11 +410,12 @@ o:depends("tls", "1")
o.rmempty = true
-- XTLS
+if nixio.fs.access("/usr/bin/xray") or nixio.fs.access("/usr/bin/xray/xray") then
o = s:option(Flag, "xtls", translate("XTLS"))
o.rmempty = true
o.default = "0"
-o:depends({type="vless", tls="1"})
-o:depends({type="xray", tls="1"})
+o:depends({type="vless", tls=true})
+end
-- Flow
o = s:option(Value, "vless_flow", translate("Flow"))
@@ -438,7 +429,7 @@ o = s:option(Flag, "mux", translate("Mux"))
o.rmempty = true
o.default = "0"
o:depends("type", "v2ray")
-o:depends("type", "vless")
+o:depends({type="vless", xtls=false})
o = s:option(Value, "concurrency", translate("Concurrency"))
o.datatype = "uinteger"
@@ -453,7 +444,6 @@ o.default = "0"
o:depends("type", "trojan")
o:depends("type", "v2ray")
o:depends("type", "vless")
-o:depends("type", "xray")
o.description = translate("If you have a self-signed certificate,please check the box")
o = s:option(DummyValue, "upload", translate("Upload"))
diff --git a/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/client.lua b/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/client.lua
index ba82e488..b2e67608 100644
--- a/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/client.lua
+++ b/luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/client.lua
@@ -6,7 +6,7 @@ local m, s, sec, o, kcp_enable
local shadowsocksr = "shadowsocksr"
local uci = luci.model.uci.cursor()
m = Map(shadowsocksr, translate("ShadowSocksR Plus+ Settings"),
- translate("
Support SS/SSR/V2RAY/XRAY/TROJAN/NAIVEPROXY/SOCKS5/TUN etc.
"))
+ translate("Support SS/SSR/V2RAY/TROJAN/NAIVEPROXY/SOCKS5/TUN etc.
"))
m:section(SimpleSection).template = "shadowsocksr/status"
diff --git a/luci-app-ssr-plus/po/zh-cn/ssr-plus.po b/luci-app-ssr-plus/po/zh-cn/ssr-plus.po
index b7e5d0ae..d6b9552c 100644
--- a/luci-app-ssr-plus/po/zh-cn/ssr-plus.po
+++ b/luci-app-ssr-plus/po/zh-cn/ssr-plus.po
@@ -421,8 +421,8 @@ msgstr "GFW列表"
msgid "ShadowSocksR Plus+ Settings"
msgstr "ShadowSocksR Plus+ 设置"
-msgid "Support SS/SSR/V2RAY/XRAY/TROJAN/NAIVEPROXY/SOCKS5/TUN etc.
"
-msgstr "支持 SS/SSR/V2RAY/XRAY/TROJAN/NAIVEPROXY/SOCKS5/TUN 等协议
"
+msgid "Support SS/SSR/V2RAY/TROJAN/NAIVEPROXY/SOCKS5/TUN etc.
"
+msgstr "支持 SS/SSR/V2RAY/TROJAN/NAIVEPROXY/SOCKS5/TUN 等协议
"
msgid "Main Server"
msgstr "主服务器"
diff --git a/luci-app-ssr-plus/root/etc/init.d/shadowsocksr b/luci-app-ssr-plus/root/etc/init.d/shadowsocksr
index dedeff17..b102855d 100755
--- a/luci-app-ssr-plus/root/etc/init.d/shadowsocksr
+++ b/luci-app-ssr-plus/root/etc/init.d/shadowsocksr
@@ -114,8 +114,12 @@ find_bin() {
ssr) ret="/usr/bin/ssr-redir" ;;
ssr-local) ret="/usr/bin/ssr-local" ;;
ssr-server) ret="/usr/bin/ssr-server" ;;
- v2ray | vless) ret="/usr/bin/v2ray/v2ray" && [ ! -f "$ret" ] && ret="/usr/bin/v2ray" ;;
- xray) ret="/usr/bin/xray/xray" && [ ! -f "$ret" ] && ret="/usr/bin/xray" ;;
+ v2ray | vless)
+ ret="/usr/bin/xray"
+ [ ! -f "$ret" ] && ret="/usr/bin/xray/xray"
+ [ ! -f "$ret" ] && ret="/usr/bin/v2ray"
+ [ ! -f "$ret" ] && ret="/usr/bin/v2ray/v2ray"
+ ;;
trojan) ret="/usr/sbin/trojan" ;;
naiveproxy) ret="/usr/bin/naive" ;;
socks5 | tun) ret="/usr/sbin/redsocks2" ;;
@@ -188,13 +192,9 @@ gen_config_file() {
EOF
;;
v2ray | vless)
- lua /usr/share/shadowsocksr/gen${type}config.lua $GLOBAL_SERVER tcp $(uci_get_by_name $1 local_port) >/var/etc/v2-ssr-retcp.json
+ lua /usr/share/shadowsocksr/genv2config.lua $GLOBAL_SERVER tcp $(uci_get_by_name $1 local_port) >/var/etc/v2-ssr-retcp.json
sed -i 's/\\//g' /var/etc/v2-ssr-retcp.json
;;
- xray)
- lua /usr/share/shadowsocksr/gen${type}config.lua $GLOBAL_SERVER tcp $(uci_get_by_name $1 local_port) >/var/etc/xray-ssr-retcp.json
- sed -i 's/\\//g' /var/etc/xray-ssr-retcp.json
- ;;
trojan)
lua /usr/share/shadowsocksr/gentrojanconfig.lua $GLOBAL_SERVER nat $(uci_get_by_name $1 local_port) >/var/etc/trojan-ssr-retcp.json
sed -i 's/\\//g' /var/etc/trojan-ssr-retcp.json
@@ -368,10 +368,6 @@ start_redir_tcp() {
$bin -config /var/etc/v2-ssr-retcp.json >/dev/null 2>&1 &
echo "$(date "+%Y-%m-%d %H:%M:%S") Main node:$($bin -version | head -1) Started!" >>/tmp/ssrplus.log
;;
- xray)
- $bin -config /var/etc/xray-ssr-retcp.json >/dev/null 2>&1 &
- echo "$(date "+%Y-%m-%d %H:%M:%S") Main node:$($bin -version | head -1) Started!" >>/tmp/ssrplus.log
- ;;
trojan)
for i in $(seq 1 $threads); do
$bin --config /var/etc/trojan-ssr-retcp.json >/dev/null 2>&1 &
@@ -422,17 +418,11 @@ start_redir_udp() {
echo "$(date "+%Y-%m-%d %H:%M:%S") UDP TPROXY Relay:$name Started!" >>/tmp/ssrplus.log
;;
v2ray | vless)
- lua /usr/share/shadowsocksr/gen${type}config.lua $UDP_RELAY_SERVER udp $(uci_get_by_name $UDP_RELAY_SERVER local_port) >/var/etc/v2-ssr-reudp.json
+ lua /usr/share/shadowsocksr/genv2config.lua $UDP_RELAY_SERVER udp $(uci_get_by_name $UDP_RELAY_SERVER local_port) >/var/etc/v2-ssr-reudp.json
sed -i 's/\\//g' /var/etc/v2-ssr-reudp.json
$bin -config /var/etc/v2-ssr-reudp.json >/dev/null 2>&1 &
echo "$(date "+%Y-%m-%d %H:%M:%S") UDP TPROXY Relay:$($bin -version | head -1) Started!" >>/tmp/ssrplus.log
;;
- xray)
- lua /usr/share/shadowsocksr/gen${type}config.lua $UDP_RELAY_SERVER udp $(uci_get_by_name $UDP_RELAY_SERVER local_port) >/var/etc/xray-ssr-reudp.json
- sed -i 's/\\//g' /var/etc/xray-ssr-reudp.json
- $bin -config /var/etc/xray-ssr-reudp.json >/dev/null 2>&1 &
- echo "$(date "+%Y-%m-%d %H:%M:%S") UDP TPROXY Relay:$($bin -version | head -1) Started!" >>/tmp/ssrplus.log
- ;;
trojan)
lua /usr/share/shadowsocksr/gentrojanconfig.lua $GLOBAL_SERVER client 10801 >/var/etc/trojan-ssr-reudp.json
sed -i 's/\\//g' /var/etc/trojan-ssr-reudp.json
@@ -479,19 +469,12 @@ start_shunt() {
echo "$(date "+%Y-%m-%d %H:%M:%S") Netflix shunt:$name Started!" >>/tmp/ssrplus.log
;;
v2ray | vless)
- lua /usr/share/shadowsocksr/gen${type}config.lua $NETFLIX_SERVER tcp 4321 1088 >/var/etc/v2-ssr-netflix.json
+ lua /usr/share/shadowsocksr/genv2config.lua $NETFLIX_SERVER tcp 4321 1088 >/var/etc/v2-ssr-netflix.json
sed -i 's/\\//g' /var/etc/v2-ssr-netflix.json
$bin -config /var/etc/v2-ssr-netflix.json >/dev/null 2>&1 &
dns2socks 127.0.0.1:1088 8.8.8.8:53 127.0.0.1:5555 -q >/dev/null 2>&1 &
echo "$(date "+%Y-%m-%d %H:%M:%S") Netflix shunt:$($bin -version | head -1) Started!" >>/tmp/ssrplus.log
;;
- xray)
- lua /usr/share/shadowsocksr/gen${type}config.lua $NETFLIX_SERVER tcp 4321 1088 >/var/etc/xray-ssr-netflix.json
- sed -i 's/\\//g' /var/etc/xray-ssr-netflix.json
- $bin -config /var/etc/xray-ssr-netflix.json >/dev/null 2>&1 &
- dns2socks 127.0.0.1:1088 8.8.8.8:53 127.0.0.1:5555 -q >/dev/null 2>&1 &
- echo "$(date "+%Y-%m-%d %H:%M:%S") Netflix shunt:$($bin -version | head -1) Started!" >>/tmp/ssrplus.log
- ;;
trojan)
lua /usr/share/shadowsocksr/gentrojanconfig.lua $NETFLIX_SERVER nat 4321 >/var/etc/trojan-ssr-netflix.json
sed -i 's/\\//g' /var/etc/trojan-ssr-netflix.json
@@ -533,8 +516,8 @@ start_shunt() {
start_local() {
local local_server=$(uci_get_by_type socks5_proxy server nil)
- [ "$local_server" == "nil" ] && return 1
[ "$local_server" == "same" ] && local_server=$GLOBAL_SERVER
+ [ "$local_server" == "nil" ] && return 1
local type=$(uci_get_by_name $local_server type)
local bin=$(find_bin $type)
[ ! -f "$bin" ] && echo "$(date "+%Y-%m-%d %H:%M:%S") Global_Socks5:Can't find $bin program, can't start!" >>/tmp/ssrplus.log && local_enable=0 && return 1
@@ -549,17 +532,11 @@ start_local() {
echo "$(date "+%Y-%m-%d %H:%M:%S") Global_Socks5:$name Started!" >>/tmp/ssrplus.log
;;
v2ray | vless)
- lua /usr/share/shadowsocksr/gen${type}config.lua $local_server tcp 0 $(uci_get_by_type socks5_proxy local_port 1080) >/var/etc/v2-ssr-local.json
+ lua /usr/share/shadowsocksr/genv2config.lua $local_server tcp 0 $(uci_get_by_type socks5_proxy local_port 1080) >/var/etc/v2-ssr-local.json
sed -i 's/\\//g' /var/etc/v2-ssr-local.json
$bin -config /var/etc/v2-ssr-local.json >/dev/null 2>&1 &
echo "$(date "+%Y-%m-%d %H:%M:%S") Global_Socks5:$($bin -version | head -1) Started!" >>/tmp/ssrplus.log
;;
- xray)
- lua /usr/share/shadowsocksr/gen${type}config.lua $local_server tcp 0 $(uci_get_by_type socks5_proxy local_port 1080) >/var/etc/xray-ssr-local.json
- sed -i 's/\\//g' /var/etc/xray-ssr-local.json
- $bin -config /var/etc/xray-ssr-local.json >/dev/null 2>&1 &
- echo "$(date "+%Y-%m-%d %H:%M:%S") Global_Socks5:$($bin -version | head -1) Started!" >>/tmp/ssrplus.log
- ;;
trojan)
lua /usr/share/shadowsocksr/gentrojanconfig.lua $local_server client $(uci_get_by_type socks5_proxy local_port 1080) >/var/etc/trojan-ssr-local.json
sed -i 's/\\//g' /var/etc/trojan-ssr-local.json
diff --git a/luci-app-ssr-plus/root/usr/share/shadowsocksr/genvlessconfig.lua b/luci-app-ssr-plus/root/usr/share/shadowsocksr/genv2config.lua
similarity index 77%
rename from luci-app-ssr-plus/root/usr/share/shadowsocksr/genvlessconfig.lua
rename to luci-app-ssr-plus/root/usr/share/shadowsocksr/genv2config.lua
index d7aef0eb..c958f0a8 100644
--- a/luci-app-ssr-plus/root/usr/share/shadowsocksr/genvlessconfig.lua
+++ b/luci-app-ssr-plus/root/usr/share/shadowsocksr/genv2config.lua
@@ -5,17 +5,7 @@ local proto = arg[2]
local local_port = arg[3] or "0"
local socks_port = arg[4] or "0"
local server = ucursor:get_all("shadowsocksr", server_section)
-local outbound_security = "none"
-
-if (server.xtls == '1')
-then
- outbound_security = "xtls"
-elseif (server.tls == '1')
-then
- outbound_security = "tls"
-end
-
-local vless = {
+local Xray = {
log = {
-- error = "/var/ssrplus.log",
loglevel = "warning"
@@ -46,7 +36,7 @@ inboundDetour = (proto == "tcp" and socks_port ~= "0") and {
} or nil,
-- 传出连接
outbound = {
- protocol = "vless",
+ protocol = (server.type == "v2ray") and "vmess" or "vless",
settings = {
vnext = {
{
@@ -55,8 +45,10 @@ outbound = {
users = {
{
id = server.vmess_id,
+ alterId = (server.type == "v2ray") and tonumber(server.alter_id) or nil,
+ security = (server.type == "v2ray") and server.security or nil,
+ encryption = (server.type == "vless") and server.vless_encryption or nil,
flow = (server.xtls == '1') and (server.vless_flow and server.vless_flow or "xtls-rprx-origin") or nil,
- encryption = server.vless_encryption
}
}
}
@@ -65,9 +57,9 @@ outbound = {
-- 底层传输配置
streamSettings = {
network = server.transport,
- security = outbound_security,
- tlsSettings = (outbound_security == "tls") and {allowInsecure = (server.insecure ~= "0") and true or false,serverName=server.tls_host,} or nil,
- xtlsSettings = (outbound_security == "xtls") and {allowInsecure = (server.insecure ~= "0") and true or false,serverName=server.tls_host,} or nil,
+ security = (server.tls == '1') and ((server.xtls == '1') and "xtls" or "tls") or "none",
+ tlsSettings = (server.tls == '1') and {allowInsecure = (server.insecure ~= "0") and true or false,serverName=server.tls_host,} or nil,
+ xtlsSettings = (server.xtls == '1') and {allowInsecure = (server.insecure ~= "0") and true or false,serverName=server.tls_host,} or nil,
tcpSettings = (server.transport == "tcp") and {
header = {
type = server.tcp_guise,
@@ -110,11 +102,11 @@ outbound = {
}
} or nil
},
- mux = {
+ mux = (server.xtls ~= "1") and {
enabled = (server.mux == "1") and true or false,
concurrency = tonumber(server.concurrency)
}
-},
+} or nil,
-- 额外传出连接
outboundDetour = {
{
@@ -124,4 +116,4 @@ outboundDetour = {
}
}
}
-print(json.stringify(vless, 1))
\ No newline at end of file
+print(json.stringify(Xray, 1))
\ No newline at end of file
diff --git a/luci-app-ssr-plus/root/usr/share/shadowsocksr/genv2rayconfig.lua b/luci-app-ssr-plus/root/usr/share/shadowsocksr/genv2rayconfig.lua
deleted file mode 100644
index d41a77c6..00000000
--- a/luci-app-ssr-plus/root/usr/share/shadowsocksr/genv2rayconfig.lua
+++ /dev/null
@@ -1,116 +0,0 @@
-local ucursor = require "luci.model.uci".cursor()
-local json = require "luci.jsonc"
-local server_section = arg[1]
-local proto = arg[2]
-local local_port = arg[3] or "0"
-local socks_port = arg[4] or "0"
-local server = ucursor:get_all("shadowsocksr", server_section)
-local v2ray = {
-log = {
--- error = "/var/ssrplus.log",
-loglevel = "warning"
-},
--- 传入连接
-inbound = (local_port ~= "0") and {
- port = local_port,
- protocol = "dokodemo-door",
- settings = {
- network = proto,
- followRedirect = true
- },
- sniffing = {
- enabled = true,
- destOverride = { "http", "tls" }
- }
-} or nil,
--- 开启 socks 代理
-inboundDetour = (proto == "tcp" and socks_port ~= "0") and {
- {
- protocol = "socks",
- port = socks_port,
- settings = {
- auth = "noauth",
- udp = true
- }
- }
-} or nil,
--- 传出连接
-outbound = {
- protocol = "vmess",
- settings = {
- vnext = {
- {
- address = server.server,
- port = tonumber(server.server_port),
- users = {
- {
- id = server.vmess_id,
- alterId = tonumber(server.alter_id),
- security = server.security
- }
- }
- }
- }
- },
- -- 底层传输配置
- streamSettings = {
- network = server.transport,
- security = (server.tls == '1') and "tls" or "none",
- tlsSettings = {allowInsecure = (server.insecure ~= "0") and true or false,serverName=server.tls_host,},
- tcpSettings = (server.transport == "tcp") and {
- header = {
- type = server.tcp_guise,
- request = {
- path = server.http_path or {"/"},
- headers = {
- Host = server.http_host or {}
- }
- } or {}
- }
- } or nil,
- kcpSettings = (server.transport == "kcp") and {
- mtu = tonumber(server.mtu),
- tti = tonumber(server.tti),
- uplinkCapacity = tonumber(server.uplink_capacity),
- downlinkCapacity = tonumber(server.downlink_capacity),
- congestion = (server.congestion == "1") and true or false,
- readBufferSize = tonumber(server.read_buffer_size),
- writeBufferSize = tonumber(server.write_buffer_size),
- header = {
- type = server.kcp_guise
- },
- seed = server.seed or nil
- } or nil,
- wsSettings = (server.transport == "ws") and (server.ws_path ~= nil or server.ws_host ~= nil) and {
- path = server.ws_path,
- headers = (server.ws_host ~= nil) and {
- Host = server.ws_host
- } or nil,
- } or nil,
- httpSettings = (server.transport == "h2") and {
- path = server.h2_path,
- host = server.h2_host,
- } or nil,
- quicSettings = (server.transport == "quic") and {
- security = server.quic_security,
- key = server.quic_key,
- header = {
- type = server.quic_guise
- }
- } or nil
- },
- mux = {
- enabled = (server.mux == "1") and true or false,
- concurrency = tonumber(server.concurrency)
- }
-},
--- 额外传出连接
-outboundDetour = {
- {
- protocol = "freedom",
- tag = "direct",
- settings = { keep = "" }
- }
- }
-}
-print(json.stringify(v2ray, 1))
\ No newline at end of file
diff --git a/luci-app-ssr-plus/root/usr/share/shadowsocksr/genxrayconfig.lua b/luci-app-ssr-plus/root/usr/share/shadowsocksr/genxrayconfig.lua
deleted file mode 100644
index c60f5136..00000000
--- a/luci-app-ssr-plus/root/usr/share/shadowsocksr/genxrayconfig.lua
+++ /dev/null
@@ -1,127 +0,0 @@
-local ucursor = require "luci.model.uci".cursor()
-local json = require "luci.jsonc"
-local server_section = arg[1]
-local proto = arg[2]
-local local_port = arg[3] or "0"
-local socks_port = arg[4] or "0"
-local server = ucursor:get_all("shadowsocksr", server_section)
-local outbound_security = "none"
-
-if (server.xtls == '1')
-then
- outbound_security = "xtls"
-elseif (server.tls == '1')
-then
- outbound_security = "tls"
-end
-
-local vless = {
-log = {
--- error = "/var/ssrplus.log",
-loglevel = "warning"
-},
--- 传入连接
-inbound = (local_port ~= "0") and {
- port = local_port,
- protocol = "dokodemo-door",
- settings = {
- network = proto,
- followRedirect = true
- },
- sniffing = {
- enabled = true,
- destOverride = { "http", "tls" }
- }
-} or nil,
--- 开启 socks 代理
-inboundDetour = (proto == "tcp" and socks_port ~= "0") and {
- {
- protocol = "socks",
- port = socks_port,
- settings = {
- auth = "noauth",
- udp = true
- }
- }
-} or nil,
--- 传出连接
-outbound = {
- protocol = "vless",
- settings = {
- vnext = {
- {
- address = server.server,
- port = tonumber(server.server_port),
- users = {
- {
- id = server.vmess_id,
- flow = (server.xtls == '1') and (server.vless_flow and server.vless_flow or "xtls-rprx-origin") or nil,
- encryption = server.vless_encryption
- }
- }
- }
- }
- },
- -- 底层传输配置
- streamSettings = {
- network = server.transport,
- security = outbound_security,
- tlsSettings = (outbound_security == "tls") and {allowInsecure = (server.insecure ~= "0") and true or false,serverName=server.tls_host,} or nil,
- xtlsSettings = (outbound_security == "xtls") and {allowInsecure = (server.insecure ~= "0") and true or false,serverName=server.tls_host,} or nil,
- tcpSettings = (server.transport == "tcp") and {
- header = {
- type = server.tcp_guise,
- request = {
- path = server.http_path or {"/"},
- headers = {
- Host = server.http_host or {}
- }
- } or {}
- }
- } or nil,
- kcpSettings = (server.transport == "kcp") and {
- mtu = tonumber(server.mtu),
- tti = tonumber(server.tti),
- uplinkCapacity = tonumber(server.uplink_capacity),
- downlinkCapacity = tonumber(server.downlink_capacity),
- congestion = (server.congestion == "1") and true or false,
- readBufferSize = tonumber(server.read_buffer_size),
- writeBufferSize = tonumber(server.write_buffer_size),
- header = {
- type = server.kcp_guise
- },
- seed = server.seed or nil
- } or nil,
- wsSettings = (server.transport == "ws") and (server.ws_path ~= nil or server.ws_host ~= nil) and {
- path = server.ws_path,
- headers = (server.ws_host ~= nil) and {
- Host = server.ws_host
- } or nil,
- } or nil,
- httpSettings = (server.transport == "h2") and {
- path = server.h2_path,
- host = server.h2_host,
- } or nil,
- quicSettings = (server.transport == "quic") and {
- security = server.quic_security,
- key = server.quic_key,
- header = {
- type = server.quic_guise
- }
- } or nil
- },
- mux = {
- enabled = (server.mux == "1") and true or false,
- concurrency = tonumber(server.concurrency)
- }
-},
--- 额外传出连接
-outboundDetour = {
- {
- protocol = "freedom",
- tag = "direct",
- settings = { keep = "" }
- }
- }
-}
-print(json.stringify(vless, 1))