From 518ef1e0ecb102e00531fc07b9dc938c4406fdab Mon Sep 17 00:00:00 2001 From: 2dust <31833384+2dust@users.noreply.github.com> Date: Fri, 21 Jun 2024 20:18:04 +0800 Subject: [PATCH] Add splithttp transport for xray --- .../kotlin/com/v2ray/ang/dto/V2rayConfig.kt | 18 +++++++++++ .../kotlin/com/v2ray/ang/ui/ServerActivity.kt | 32 +++++++++++++++++++ .../com/v2ray/ang/util/fmt/TrojanFmt.kt | 2 +- .../kotlin/com/v2ray/ang/util/fmt/VlessFmt.kt | 2 +- .../layout/activity_server_shadowsocks.xml | 2 ++ .../res/layout/activity_server_trojan.xml | 2 ++ .../main/res/layout/activity_server_vless.xml | 2 ++ .../main/res/layout/activity_server_vmess.xml | 2 ++ .../app/src/main/res/values-ar/strings.xml | 18 +++++++++-- .../app/src/main/res/values-fa/strings.xml | 18 +++++++++-- .../app/src/main/res/values-ru/strings.xml | 18 +++++++++-- .../app/src/main/res/values-vi/strings.xml | 18 +++++++++-- .../src/main/res/values-zh-rCN/strings.xml | 18 +++++++++-- .../src/main/res/values-zh-rTW/strings.xml | 18 +++++++++-- V2rayNG/app/src/main/res/values/arrays.xml | 1 + V2rayNG/app/src/main/res/values/strings.xml | 18 +++++++++-- 16 files changed, 173 insertions(+), 16 deletions(-) diff --git a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/dto/V2rayConfig.kt b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/dto/V2rayConfig.kt index fe5c7919..e15f5e4a 100644 --- a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/dto/V2rayConfig.kt +++ b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/dto/V2rayConfig.kt @@ -139,6 +139,7 @@ data class V2rayConfig( var kcpSettings: KcpSettingsBean? = null, var wsSettings: WsSettingsBean? = null, var httpupgradeSettings: HttpupgradeSettingsBean? = null, + var splithttpSettings: SplithttpSettingsBean? = null, var httpSettings: HttpSettingsBean? = null, var tlsSettings: TlsSettingsBean? = null, var quicSettings: QuicSettingBean? = null, @@ -192,6 +193,10 @@ data class V2rayConfig( var host: String = "", val acceptProxyProtocol: Boolean? = null) + data class SplithttpSettingsBean(var path: String = "", + var host: String = "", + val maxUploadSize: Int? = null, + val maxConcurrentUploads: Int? = null) data class HttpSettingsBean(var host: List = ArrayList(), var path: String = "") @@ -279,6 +284,13 @@ data class V2rayConfig( httpupgradeSetting.path = path ?: "/" httpupgradeSettings = httpupgradeSetting } + "splithttp" -> { + val splithttpSetting = SplithttpSettingsBean() + splithttpSetting.host = host ?: "" + sni = splithttpSetting.host + splithttpSetting.path = path ?: "/" + splithttpSettings = splithttpSetting + } "h2", "http" -> { network = "h2" val h2Setting = HttpSettingsBean() @@ -418,6 +430,12 @@ data class V2rayConfig( httpupgradeSetting.host, httpupgradeSetting.path) } + "splithttp" -> { + val splithttpSetting = streamSettings?.splithttpSettings ?: return null + listOf("", + splithttpSetting.host, + splithttpSetting.path) + } "h2" -> { val h2Setting = streamSettings?.httpSettings ?: return null listOf("", diff --git a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/ui/ServerActivity.kt b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/ui/ServerActivity.kt index abec724f..40eb9b22 100644 --- a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/ui/ServerActivity.kt +++ b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/ui/ServerActivity.kt @@ -110,7 +110,9 @@ class ServerActivity : BaseActivity() { private val sp_network: Spinner? by lazy { findViewById(R.id.sp_network) } private val sp_header_type: Spinner? by lazy { findViewById(R.id.sp_header_type) } private val sp_header_type_title: TextView? by lazy { findViewById(R.id.sp_header_type_title) } + private val tv_request_host: TextView? by lazy { findViewById(R.id.tv_request_host) } private val et_request_host: EditText? by lazy { findViewById(R.id.et_request_host) } + private val tv_path: TextView? by lazy { findViewById(R.id.tv_path) } private val et_path: EditText? by lazy { findViewById(R.id.et_path) } private val sp_stream_alpn: Spinner? by lazy { findViewById(R.id.sp_stream_alpn) } //uTLS private val container_alpn: LinearLayout? by lazy { findViewById(R.id.l4) } @@ -162,6 +164,36 @@ class ServerActivity : BaseActivity() { et_request_host?.text = Utils.getEditable(transportDetails[1]) et_path?.text = Utils.getEditable(transportDetails[2]) } + + tv_request_host?.text = Utils.getEditable( + getString( + when (networks[position]) { + "tcp" -> R.string.server_lab_request_host_http + "ws" -> R.string.server_lab_request_host_ws + "httpupgrade" -> R.string.server_lab_request_host_httpupgrade + "splithttp" -> R.string.server_lab_request_host_splithttp + "h2" -> R.string.server_lab_request_host_h2 + "quic" -> R.string.server_lab_request_host_quic + "grpc" -> R.string.server_lab_request_host_grpc + else -> R.string.server_lab_request_host + } + ) + ) + + tv_path?.text = Utils.getEditable( + getString( + when (networks[position]) { + "kcp" -> R.string.server_lab_path_kcp + "ws" -> R.string.server_lab_path_ws + "httpupgrade" -> R.string.server_lab_path_httpupgrade + "splithttp" -> R.string.server_lab_path_splithttp + "h2" -> R.string.server_lab_path_h2 + "quic" -> R.string.server_lab_path_quic + "grpc" -> R.string.server_lab_path_grpc + else -> R.string.server_lab_path + } + ) + ) } override fun onNothingSelected(parent: AdapterView<*>?) { diff --git a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/util/fmt/TrojanFmt.kt b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/util/fmt/TrojanFmt.kt index 0a42f8bd..5f50b137 100644 --- a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/util/fmt/TrojanFmt.kt +++ b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/util/fmt/TrojanFmt.kt @@ -123,7 +123,7 @@ object TrojanFmt { } } - "ws", "httpupgrade" -> { + "ws", "httpupgrade", "splithttp" -> { if (!TextUtils.isEmpty(transportDetails[1])) { dicQuery["host"] = Utils.urlEncode(transportDetails[1]) } diff --git a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/util/fmt/VlessFmt.kt b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/util/fmt/VlessFmt.kt index 6ab3003b..9c5fb6b3 100644 --- a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/util/fmt/VlessFmt.kt +++ b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/util/fmt/VlessFmt.kt @@ -123,7 +123,7 @@ object VlessFmt { } } - "ws", "httpupgrade" -> { + "ws", "httpupgrade", "splithttp" -> { if (!TextUtils.isEmpty(transportDetails[1])) { dicQuery["host"] = Utils.urlEncode(transportDetails[1]) } diff --git a/V2rayNG/app/src/main/res/layout/activity_server_shadowsocks.xml b/V2rayNG/app/src/main/res/layout/activity_server_shadowsocks.xml index d861295c..1cf58010 100644 --- a/V2rayNG/app/src/main/res/layout/activity_server_shadowsocks.xml +++ b/V2rayNG/app/src/main/res/layout/activity_server_shadowsocks.xml @@ -173,6 +173,7 @@ android:orientation="vertical"> @@ -192,6 +193,7 @@ android:orientation="vertical"> diff --git a/V2rayNG/app/src/main/res/layout/activity_server_trojan.xml b/V2rayNG/app/src/main/res/layout/activity_server_trojan.xml index 88eb70f7..60c0d617 100644 --- a/V2rayNG/app/src/main/res/layout/activity_server_trojan.xml +++ b/V2rayNG/app/src/main/res/layout/activity_server_trojan.xml @@ -154,6 +154,7 @@ android:orientation="vertical"> @@ -173,6 +174,7 @@ android:orientation="vertical"> diff --git a/V2rayNG/app/src/main/res/layout/activity_server_vless.xml b/V2rayNG/app/src/main/res/layout/activity_server_vless.xml index 8e70bd02..0d11f7e8 100644 --- a/V2rayNG/app/src/main/res/layout/activity_server_vless.xml +++ b/V2rayNG/app/src/main/res/layout/activity_server_vless.xml @@ -193,6 +193,7 @@ android:orientation="vertical"> @@ -212,6 +213,7 @@ android:orientation="vertical"> diff --git a/V2rayNG/app/src/main/res/layout/activity_server_vmess.xml b/V2rayNG/app/src/main/res/layout/activity_server_vmess.xml index ebfeb7e1..7569a2da 100644 --- a/V2rayNG/app/src/main/res/layout/activity_server_vmess.xml +++ b/V2rayNG/app/src/main/res/layout/activity_server_vmess.xml @@ -192,6 +192,7 @@ android:orientation="vertical"> @@ -211,6 +212,7 @@ android:orientation="vertical"> diff --git a/V2rayNG/app/src/main/res/values-ar/strings.xml b/V2rayNG/app/src/main/res/values-ar/strings.xml index ba5f54d9..27cbba7a 100644 --- a/V2rayNG/app/src/main/res/values-ar/strings.xml +++ b/V2rayNG/app/src/main/res/values-ar/strings.xml @@ -48,8 +48,22 @@ النقل نوع الرأس وضع gRPC - مضيف الطلب (مضيف/مضيف ws/مضيف httpupgrade/مضيف h2)/أمان QUIC/جهة gRPC - المسار (مسار ws/مسار httpupgrade/مسار h2)/مفتاح QUIC/بذرة kcp/خدمة gRPC + host + http host + ws host + httpupgrade host + splithttp host + h2 host + QUIC security + gRPC Authority + path + ws path + httpupgrade path + splithttp path + h2 path + QUIC key + kcp seed + gRPC serviceName TLS البصمة بروتوكول الطبقة الآخرى التالية (ALPN) diff --git a/V2rayNG/app/src/main/res/values-fa/strings.xml b/V2rayNG/app/src/main/res/values-fa/strings.xml index 7f6d6e6d..3392deaa 100644 --- a/V2rayNG/app/src/main/res/values-fa/strings.xml +++ b/V2rayNG/app/src/main/res/values-fa/strings.xml @@ -46,8 +46,22 @@ انتقال نوع head حالت gRPC - gRPC Authority/میزبان درخواست (host/host ws/host h2)/امنیت QUIC - مسیر (مسیر ws/ مسیر h2) کلید QUIC/دانه kcp/نام‌خدمات gRPC + host + http host + ws host + httpupgrade host + splithttp host + h2 host + QUIC security + gRPC Authority + path + ws path + httpupgrade path + splithttp path + h2 path + QUIC key + kcp seed + gRPC serviceName TLS مجوز ناامن SNI diff --git a/V2rayNG/app/src/main/res/values-ru/strings.xml b/V2rayNG/app/src/main/res/values-ru/strings.xml index c2b561ba..2fb3a18a 100644 --- a/V2rayNG/app/src/main/res/values-ru/strings.xml +++ b/V2rayNG/app/src/main/res/values-ru/strings.xml @@ -46,8 +46,22 @@ Другие параметры Тип заголовка Режим gRPC - Запрос узла (WS/H2)/HTTPUpgrade/Шифрование QUIC/Полномочия gRPC - Путь (WS/H2)/HTTPUpgrade/Ключ QUIC/Сид KCP/Сервис gRPC + host + http host + ws host + httpupgrade host + splithttp host + h2 host + QUIC security + gRPC Authority + path + ws path + httpupgrade path + splithttp path + h2 path + QUIC key + kcp seed + gRPC serviceName TLS Разрешать небезопасные SNI diff --git a/V2rayNG/app/src/main/res/values-vi/strings.xml b/V2rayNG/app/src/main/res/values-vi/strings.xml index 33acfa67..2bd3ac28 100644 --- a/V2rayNG/app/src/main/res/values-vi/strings.xml +++ b/V2rayNG/app/src/main/res/values-vi/strings.xml @@ -46,8 +46,22 @@ Nâng cao Kiểu ngụy trang (Type) Chế độ gRPC - Yêu cầu Host (Host / WS Host / H2 Host) / Bảo mật QUIC / gRPC Authority - Đường dẫn (WS Path / H2 Path) / Khóa QUIC / KCP Seed / Dịch vụ gRPC + host + http host + ws host + httpupgrade host + splithttp host + h2 host + QUIC security + gRPC Authority + path + ws path + httpupgrade path + splithttp path + h2 path + QUIC key + kcp seed + gRPC serviceName TLS Bỏ qua xác minh chứng chỉ SNI diff --git a/V2rayNG/app/src/main/res/values-zh-rCN/strings.xml b/V2rayNG/app/src/main/res/values-zh-rCN/strings.xml index ff3d54a7..cac77acc 100644 --- a/V2rayNG/app/src/main/res/values-zh-rCN/strings.xml +++ b/V2rayNG/app/src/main/res/values-zh-rCN/strings.xml @@ -46,8 +46,22 @@ 底层传输方式(transport) 伪装类型(type) gRPC 传输模式(mode) - 伪装域名(host)(host/ws host/httpupgrade host/h2 host)/QUIC 加密方式/gRPC Authority - path(ws path/httpupgrade path/h2 path)/QUIC 加密密钥/kcp seed/gRPC serviceName + 伪装域名(host) + http host + ws host + httpupgrade host + splithttp host + h2 host + QUIC 加密方式 + gRPC Authority + path + ws path + httpupgrade path + splithttp path + h2 path + QUIC 加密密钥 + kcp seed + gRPC serviceName 传输层安全(TLS) 跳过证书验证(allowInsecure) SNI diff --git a/V2rayNG/app/src/main/res/values-zh-rTW/strings.xml b/V2rayNG/app/src/main/res/values-zh-rTW/strings.xml index a63e2a3d..b4b7724c 100644 --- a/V2rayNG/app/src/main/res/values-zh-rTW/strings.xml +++ b/V2rayNG/app/src/main/res/values-zh-rTW/strings.xml @@ -46,8 +46,22 @@ 底層傳輸方式 (transport) 標頭類型 gRPC 傳輸模式 (mode) - 要求主機 (host)(host/ws host/httpupgrade host/h2 host)/QUIC 加密方式/gRPC Authority - path(ws path/httpupgrade path/h2 path)/QUIC 加密金鑰/kcp seed/gRPC serviceName + 要求主機 (host) + http host + ws host + httpupgrade host + splithttp host + h2 host + QUIC 加密方式 + gRPC Authority + path + ws path + httpupgrade path + splithttp path + h2 path + QUIC 加密金鑰 + kcp seed + gRPC serviceName 傳輸層安全 (TLS) 跳過憑證驗證 (allowInsecure) SNI diff --git a/V2rayNG/app/src/main/res/values/arrays.xml b/V2rayNG/app/src/main/res/values/arrays.xml index b5eef4df..2adc0c35 100644 --- a/V2rayNG/app/src/main/res/values/arrays.xml +++ b/V2rayNG/app/src/main/res/values/arrays.xml @@ -26,6 +26,7 @@ kcp ws httpupgrade + splithttp h2 quic grpc diff --git a/V2rayNG/app/src/main/res/values/strings.xml b/V2rayNG/app/src/main/res/values/strings.xml index c38dcf63..d6adb90b 100644 --- a/V2rayNG/app/src/main/res/values/strings.xml +++ b/V2rayNG/app/src/main/res/values/strings.xml @@ -47,8 +47,22 @@ Transport head type gRPC mode - request host(host/ws host/httpupgrade host/h2 host)/QUIC security/gRPC Authority - path(ws path/httpupgrade path/h2 path)/QUIC key/kcp seed/gRPC serviceName + host + http host + ws host + httpupgrade host + splithttp host + h2 host + QUIC security + gRPC Authority + path + ws path + httpupgrade path + splithttp path + h2 path + QUIC key + kcp seed + gRPC serviceName TLS Fingerprint Alpn