Explorar o código

luci-app-ssr-plus: Add Xray new version RAW transport (formerly tcp transport) support.
See: https://xtls.github.io/config/transports/raw.html

说明:本次新增的raw传输协议,在使用新版本的Xray情况下,可将旧版本节点的tcp传输协议修改为新版本的RAW传输协议,但旧版本的Xray只能使用tcp传输协议,因此暂不删除旧版本的tcp传输支持。

zxlhhyccc hai 11 meses
pai
achega
65ff69cec9

+ 1 - 1
luci-app-ssr-plus/Makefile

@@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=luci-app-ssr-plus
 PKG_VERSION:=189
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_CONFIG_DEPENDS:= \
 	CONFIG_PACKAGE_$(PKG_NAME)_INCLUDE_NONE_V2RAY \

+ 13 - 0
luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/client-config.lua

@@ -619,6 +619,7 @@ o:depends({type = "v2ray", v2ray_protocol = "socks"})
 -- 传输协议
 o = s:option(ListValue, "transport", translate("Transport"))
 o:value("tcp", "TCP")
+o:value("raw", "RAW")
 o:value("kcp", "mKCP")
 o:value("ws", "WebSocket")
 o:value("httpupgrade", "HTTPUpgrade")
@@ -642,14 +643,24 @@ o:value("none", translate("None"))
 o:value("http", "HTTP")
 o.rmempty = true
 
+-- [[ RAW部分 ]]--
+-- RAW伪装
+o = s:option(ListValue, "raw_guise", translate("Camouflage Type"))
+o:depends("transport", "raw")
+o:value("none", translate("None"))
+o:value("http", "HTTP")
+o.rmempty = true
+
 -- HTTP域名
 o = s:option(Value, "http_host", translate("HTTP Host"))
 o:depends("tcp_guise", "http")
+o:depends("raw_guise", "http")
 o.rmempty = true
 
 -- HTTP路径
 o = s:option(Value, "http_path", translate("HTTP Path"))
 o:depends("tcp_guise", "http")
+o:depends("raw_guise", "http")
 o.rmempty = true
 
 -- [[ WS部分 ]]--
@@ -928,7 +939,9 @@ if is_finded("xray") then
 	end
 	o.rmempty = true
 	o:depends({type = "v2ray", v2ray_protocol = "vless", transport = "tcp", tls = true})
+	o:depends({type = "v2ray", v2ray_protocol = "vless", transport = "raw", tls = true})
 	o:depends({type = "v2ray", v2ray_protocol = "vless", transport = "tcp", reality = true})
+	o:depends({type = "v2ray", v2ray_protocol = "vless", transport = "raw", reality = true})
 
 	-- [[ uTLS ]]--
 	o = s:option(Value, "fingerprint", translate("Finger Print"))

+ 11 - 1
luci-app-ssr-plus/luasrc/view/shadowsocksr/ssrurl.htm

@@ -314,7 +314,10 @@ function import_ssr_url(btn, urlname, sid) {
 			document.getElementsByName('cbid.shadowsocksr.' + sid + '.server')[0].value = url.hostname;
 			document.getElementsByName('cbid.shadowsocksr.' + sid + '.server_port')[0].value = url.port || "80";
 			document.getElementsByName('cbid.shadowsocksr.' + sid + '.vmess_id')[0].value = url.username;
-			document.getElementsByName('cbid.shadowsocksr.' + sid + '.transport')[0].value = params.get("type") == "http" ? "h2" : params.get("type") || "tcp";
+			document.getElementsByName('cbid.shadowsocksr.' + sid + '.transport')[0].value = 
+				params.get("type") == "http" ? "h2" : 
+				(params.get("type") == "raw" ? "raw" : 
+				(params.get("type") || "tcp"));
 			document.getElementsByName('cbid.shadowsocksr.' + sid + '.transport')[0].dispatchEvent(event);
 			document.getElementsByName('cbid.shadowsocksr.' + sid + '.vless_encryption')[0].value = params.get("encryption") || "none";
 			if ([ "tls", "xtls", "reality" ].includes(params.get("security"))) {
@@ -375,6 +378,13 @@ function import_ssr_url(btn, urlname, sid) {
 					document.getElementsByName('cbid.shadowsocksr.' + sid + '.http_host')[0].value = params.get("host") ? decodeURIComponent(params.get("host")) : "";
 					document.getElementsByName('cbid.shadowsocksr.' + sid + '.http_path')[0].value = params.get("path") ? decodeURIComponent(params.get("path")) : "";
 				}
+			case "raw":
+				document.getElementsByName('cbid.shadowsocksr.' + sid + '.raw_guise')[0].value = params.get("headerType") || "none";
+				document.getElementsByName('cbid.shadowsocksr.' + sid + '.raw_guise')[0].dispatchEvent(event);
+				if (params.get("headerType") === "http") {
+					document.getElementsByName('cbid.shadowsocksr.' + sid + '.http_host')[0].value = params.get("host") ? decodeURIComponent(params.get("host")) : "";
+					document.getElementsByName('cbid.shadowsocksr.' + sid + '.http_path')[0].value = params.get("path") ? decodeURIComponent(params.get("path")) : "";
+				}
 				break;
 			}
 			s.innerHTML = "<font style=\'color:green\'><%:Import configuration information successfully.%></font>";

+ 11 - 0
luci-app-ssr-plus/root/usr/share/shadowsocksr/gen_config.lua

@@ -231,6 +231,17 @@ end
 						}
 					}
 				} or nil,
+				rawSettings = (server.transport == "raw" and server.raw_guise == "http") and {
+					-- raw
+					header = {
+						type = server.raw_guise,
+						request = {
+							-- request
+							path = {server.http_path} or {"/"},
+							headers = {Host = {server.http_host} or {}}
+						}
+					}
+				} or nil,
 				kcpSettings = (server.transport == "kcp") and {
 					-- kcp
 					mtu = tonumber(server.mtu),

+ 6 - 0
luci-app-ssr-plus/root/usr/share/shadowsocksr/subscribe.lua

@@ -406,6 +406,12 @@ local function processData(szType, content)
 				result.tcp_host = params.host and UrlDecode(params.host) or nil
 				result.tcp_path = params.path and UrlDecode(params.path) or nil
 			end
+		elseif result.transport == "raw" then
+			result.raw_guise = params.headerType or "none"
+			if result.raw_guise == "http" then
+				result.tcp_host = params.host and UrlDecode(params.host) or nil
+				result.tcp_path = params.path and UrlDecode(params.path) or nil
+			end
 		end
 	end
 	if not result.alias then