Add xhttp mode
This commit is contained in:
@@ -30,6 +30,7 @@ data class ProfileItem(
|
||||
var mode: String? = null,
|
||||
var serviceName: String? = null,
|
||||
var authority: String? = null,
|
||||
var xhttpMode: String? = null,
|
||||
|
||||
var security: String? = null,
|
||||
var sni: String? = null,
|
||||
@@ -87,6 +88,7 @@ data class ProfileItem(
|
||||
&& this.mode == obj.mode
|
||||
&& this.serviceName == obj.serviceName
|
||||
&& this.authority == obj.authority
|
||||
&& this.xhttpMode == obj.xhttpMode
|
||||
|
||||
&& this.security == obj.security
|
||||
&& this.sni == obj.sni
|
||||
|
||||
@@ -278,8 +278,7 @@ data class V2rayConfig(
|
||||
data class XhttpSettingsBean(
|
||||
var path: String? = null,
|
||||
var host: String? = null,
|
||||
val maxUploadSize: Int? = null,
|
||||
val maxConcurrentUploads: Int? = null
|
||||
var mode: String? = null,
|
||||
)
|
||||
|
||||
data class HttpSettingsBean(
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.v2ray.ang.fmt
|
||||
|
||||
import com.v2ray.ang.AppConfig
|
||||
import com.v2ray.ang.dto.NetworkType
|
||||
import com.v2ray.ang.dto.ProfileItem
|
||||
import com.v2ray.ang.extension.isNotNullEmpty
|
||||
@@ -55,11 +54,17 @@ open class FmtBase {
|
||||
config.seed.let { if (it.isNotNullEmpty()) dicQuery["seed"] = it.orEmpty() }
|
||||
}
|
||||
|
||||
NetworkType.WS, NetworkType.HTTP_UPGRADE, NetworkType.SPLIT_HTTP, NetworkType.XHTTP -> {
|
||||
NetworkType.WS, NetworkType.HTTP_UPGRADE -> {
|
||||
config.host.let { if (it.isNotNullEmpty()) dicQuery["host"] = it.orEmpty() }
|
||||
config.path.let { if (it.isNotNullEmpty()) dicQuery["path"] = it.orEmpty() }
|
||||
}
|
||||
|
||||
NetworkType.SPLIT_HTTP, NetworkType.XHTTP -> {
|
||||
config.host.let { if (it.isNotNullEmpty()) dicQuery["host"] = it.orEmpty() }
|
||||
config.path.let { if (it.isNotNullEmpty()) dicQuery["path"] = it.orEmpty() }
|
||||
config.xhttpMode.let { if (it.isNotNullEmpty()) dicQuery["mode"] = it.orEmpty() }
|
||||
}
|
||||
|
||||
NetworkType.HTTP, NetworkType.H2 -> {
|
||||
dicQuery["type"] = "http"
|
||||
config.host.let { if (it.isNotNullEmpty()) dicQuery["host"] = it.orEmpty() }
|
||||
|
||||
@@ -36,6 +36,7 @@ object VlessFmt : FmtBase() {
|
||||
config.mode = queryParam["mode"]
|
||||
config.serviceName = queryParam["serviceName"]
|
||||
config.authority = queryParam["authority"]
|
||||
config.xhttpMode = queryParam["mode"]
|
||||
|
||||
config.security = queryParam["security"]
|
||||
config.insecure = if (queryParam["allowInsecure"].isNullOrEmpty()) {
|
||||
@@ -85,6 +86,7 @@ object VlessFmt : FmtBase() {
|
||||
profileItem.serviceName,
|
||||
profileItem.authority,
|
||||
)
|
||||
outboundBean?.streamSettings?.xhttpSettings?.mode = profileItem.xhttpMode
|
||||
|
||||
outboundBean?.streamSettings?.populateTlsSettings(
|
||||
profileItem.security.orEmpty(),
|
||||
|
||||
@@ -79,6 +79,10 @@ class ServerActivity : BaseActivity() {
|
||||
private val alpns: Array<out String> by lazy {
|
||||
resources.getStringArray(R.array.streamsecurity_alpn)
|
||||
}
|
||||
private val xhttpMode: Array<out String> by lazy {
|
||||
resources.getStringArray(R.array.xhttp_mode)
|
||||
}
|
||||
|
||||
|
||||
// Kotlin synthetics was used, but since it is removed in 1.8. We switch to old manual approach.
|
||||
// We don't use AndroidViewBinding because, it is better to share similar logics for different
|
||||
@@ -150,14 +154,18 @@ class ServerActivity : BaseActivity() {
|
||||
ArrayAdapter(this@ServerActivity, android.R.layout.simple_spinner_item, types)
|
||||
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item)
|
||||
sp_header_type?.adapter = adapter
|
||||
sp_header_type_title?.text = if (networks[position] == "grpc")
|
||||
getString(R.string.server_lab_mode_type) else
|
||||
getString(R.string.server_lab_head_type)
|
||||
sp_header_type_title?.text =
|
||||
when (networks[position]) {
|
||||
"grpc" -> getString(R.string.server_lab_mode_type)
|
||||
"xhttp" -> getString(R.string.server_lab_xhttp_mode)
|
||||
else -> getString(R.string.server_lab_head_type)
|
||||
}.orEmpty()
|
||||
sp_header_type?.setSelection(
|
||||
Utils.arrayFind(
|
||||
types,
|
||||
when (networks[position]) {
|
||||
"grpc" -> config?.mode
|
||||
"xhttp" -> config?.xhttpMode
|
||||
else -> config?.headerType
|
||||
}.orEmpty()
|
||||
)
|
||||
@@ -185,7 +193,7 @@ class ServerActivity : BaseActivity() {
|
||||
"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","xhttp" -> R.string.server_lab_request_host_xhttp
|
||||
"splithttp", "xhttp" -> R.string.server_lab_request_host_xhttp
|
||||
"h2" -> R.string.server_lab_request_host_h2
|
||||
//"quic" -> R.string.server_lab_request_host_quic
|
||||
"grpc" -> R.string.server_lab_request_host_grpc
|
||||
@@ -200,7 +208,7 @@ class ServerActivity : BaseActivity() {
|
||||
"kcp" -> R.string.server_lab_path_kcp
|
||||
"ws" -> R.string.server_lab_path_ws
|
||||
"httpupgrade" -> R.string.server_lab_path_httpupgrade
|
||||
"splithttp","xhttp" -> R.string.server_lab_path_xhttp
|
||||
"splithttp", "xhttp" -> R.string.server_lab_path_xhttp
|
||||
"h2" -> R.string.server_lab_path_h2
|
||||
//"quic" -> R.string.server_lab_path_quic
|
||||
"grpc" -> R.string.server_lab_path_grpc
|
||||
@@ -509,6 +517,7 @@ class ServerActivity : BaseActivity() {
|
||||
profileItem.mode = transportTypes(networks[network])[type]
|
||||
profileItem.serviceName = path
|
||||
profileItem.authority = requestHost
|
||||
profileItem.xhttpMode = transportTypes(networks[network])[type]
|
||||
}
|
||||
|
||||
private fun saveTls(config: ProfileItem) {
|
||||
@@ -552,6 +561,10 @@ class ServerActivity : BaseActivity() {
|
||||
grpcModes
|
||||
}
|
||||
|
||||
"xhttp" -> {
|
||||
xhttpMode
|
||||
}
|
||||
|
||||
else -> {
|
||||
arrayOf("---")
|
||||
}
|
||||
|
||||
@@ -119,6 +119,7 @@
|
||||
<string name="server_lab_port_hop">Port Hopping</string>
|
||||
<string name="server_lab_port_hop_interval">Port Hopping Interval</string>
|
||||
<string name="server_lab_stream_pinsha256">pinSHA256</string>
|
||||
<string name="server_lab_xhttp_mode">XHTTP Mode</string>
|
||||
|
||||
<!-- PerAppProxyActivity -->
|
||||
<string name="msg_dialog_progress">جار التحميل</string>
|
||||
|
||||
@@ -118,6 +118,7 @@
|
||||
<string name="server_lab_port_hop">Port Hopping</string>
|
||||
<string name="server_lab_port_hop_interval">Port Hopping Interval</string>
|
||||
<string name="server_lab_stream_pinsha256">pinSHA256</string>
|
||||
<string name="server_lab_xhttp_mode">XHTTP Mode</string>
|
||||
|
||||
<!-- PerAppProxyActivity -->
|
||||
<string name="msg_dialog_progress">লোড হচ্ছে</string>
|
||||
|
||||
@@ -117,6 +117,7 @@
|
||||
<string name="server_lab_port_hop">پورت گوم (درگا سرورن ز نۊ هؽل اکونه)</string>
|
||||
<string name="server_lab_port_hop_interval">فاسله پورت گوم (سانیه)</string>
|
||||
<string name="server_lab_stream_pinsha256">pinSHA256</string>
|
||||
<string name="server_lab_xhttp_mode">XHTTP Mode</string>
|
||||
|
||||
<!-- PerAppProxyActivity -->
|
||||
<string name="msg_dialog_progress">هون بارونی بۊ</string>
|
||||
|
||||
@@ -112,6 +112,7 @@
|
||||
<string name="server_lab_port_hop">پورت پرش (درگاه سرور را بازنویسی می کند)</string>
|
||||
<string name="server_lab_port_hop_interval">فاصله پورت پرش (ثانیه)</string>
|
||||
<string name="server_lab_stream_pinsha256">pinSHA256</string>
|
||||
<string name="server_lab_xhttp_mode">XHTTP Mode</string>
|
||||
|
||||
<!-- PerAppProxyActivity -->
|
||||
<string name="title_user_asset_add_url">URL را اضافه کنید</string>
|
||||
|
||||
@@ -117,6 +117,7 @@
|
||||
<string name="server_lab_port_hop">Переключение портов</string>
|
||||
<string name="server_lab_port_hop_interval">Интервал переключения портов</string>
|
||||
<string name="server_lab_stream_pinsha256">pinSHA256</string>
|
||||
<string name="server_lab_xhttp_mode">XHTTP Mode</string>
|
||||
|
||||
<!-- PerAppProxyActivity -->
|
||||
<string name="msg_dialog_progress">Загрузка…</string>
|
||||
|
||||
@@ -112,6 +112,7 @@
|
||||
<string name="server_lab_port_hop">Port Hopping</string>
|
||||
<string name="server_lab_port_hop_interval">Port Hopping Interval</string>
|
||||
<string name="server_lab_stream_pinsha256">pinSHA256</string>
|
||||
<string name="server_lab_xhttp_mode">XHTTP Mode</string>
|
||||
|
||||
<!-- PerAppProxyActivity -->
|
||||
<string name="title_user_asset_add_url">Thêm URL nội dung</string>
|
||||
|
||||
@@ -112,6 +112,7 @@
|
||||
<string name="server_lab_port_hop">跳跃端口(会覆盖服务器端口)</string>
|
||||
<string name="server_lab_port_hop_interval">端口跳跃间隔(秒)</string>
|
||||
<string name="server_lab_stream_pinsha256">SHA256证书指纹</string>
|
||||
<string name="server_lab_xhttp_mode">XHTTP 模式</string>
|
||||
|
||||
<!-- PerAppProxyActivity -->
|
||||
<string name="title_user_asset_add_url">添加资产网址</string>
|
||||
|
||||
@@ -112,6 +112,7 @@
|
||||
<string name="server_lab_port_hop">跳躍連接埠(會覆蓋伺服器連接埠)</string>
|
||||
<string name="server_lab_port_hop_interval">連接埠跳躍間隔(秒)</string>
|
||||
<string name="server_lab_stream_pinsha256">SHA256憑證指紋</string>
|
||||
<string name="server_lab_xhttp_mode">XHTTP 模式</string>
|
||||
|
||||
<!-- PerAppProxyActivity -->
|
||||
<string name="title_user_asset_add_url">新增資產網址</string>
|
||||
|
||||
@@ -205,4 +205,10 @@
|
||||
<item>direct</item>
|
||||
<item>block</item>
|
||||
</string-array>
|
||||
</resources>
|
||||
|
||||
<string-array name="xhttp_mode" translatable="false">
|
||||
<item>auto</item>
|
||||
<item>packet-up</item>
|
||||
<item>stream-up</item>
|
||||
</string-array>
|
||||
</resources>
|
||||
@@ -118,6 +118,7 @@
|
||||
<string name="server_lab_port_hop">Port Hopping(will override the port)</string>
|
||||
<string name="server_lab_port_hop_interval">Port Hopping Interval</string>
|
||||
<string name="server_lab_stream_pinsha256">pinSHA256</string>
|
||||
<string name="server_lab_xhttp_mode">XHTTP Mode</string>
|
||||
|
||||
<!-- PerAppProxyActivity -->
|
||||
<string name="msg_dialog_progress">Loading</string>
|
||||
|
||||
Reference in New Issue
Block a user