From f839b26ff331c8c8e3d59bc977950c229ad9b4a0 Mon Sep 17 00:00:00 2001 From: Misaka-blog Date: Wed, 1 Nov 2023 15:33:31 +0800 Subject: [PATCH] fix: fix bug for generate httpupgrade in v2raytransport --- .../java/io/nekohasekai/sagernet/fmt/v2ray/V2RayFmt.kt | 10 +++++++++- app/src/main/java/moe/matsuri/nb4a/SingBoxOptions.java | 9 +++++++++ buildScript/lib/core/get_source_env.sh | 2 +- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/io/nekohasekai/sagernet/fmt/v2ray/V2RayFmt.kt b/app/src/main/java/io/nekohasekai/sagernet/fmt/v2ray/V2RayFmt.kt index 8e935c18..d5cb15fc 100644 --- a/app/src/main/java/io/nekohasekai/sagernet/fmt/v2ray/V2RayFmt.kt +++ b/app/src/main/java/io/nekohasekai/sagernet/fmt/v2ray/V2RayFmt.kt @@ -454,7 +454,7 @@ fun StandardV2RayBean.toUriVMessVLESSTrojan(isTrojan: Boolean): String { when (type) { "tcp" -> {} - "ws", "http" -> { + "ws", "http", "httpupgrade" -> { if (host.isNotBlank()) { builder.addQueryParameter("host", host) } @@ -582,6 +582,14 @@ fun buildSingBoxOutboundStreamSettings(bean: StandardV2RayBean): V2RayTransportO service_name = bean.path } } + + "httpupgrade" -> { + return V2RayTransportOptions_HTTPUpgradeOptions().apply { + type = "httpupgrade" + host = bean.host + path = bean.path + } + } } // if (needKeepAliveInterval) { diff --git a/app/src/main/java/moe/matsuri/nb4a/SingBoxOptions.java b/app/src/main/java/moe/matsuri/nb4a/SingBoxOptions.java index 38d3232b..a42fada4 100644 --- a/app/src/main/java/moe/matsuri/nb4a/SingBoxOptions.java +++ b/app/src/main/java/moe/matsuri/nb4a/SingBoxOptions.java @@ -4585,4 +4585,13 @@ public static class V2RayTransportOptions_GRPCOptions extends V2RayTransportOpti } + public static class V2RayTransportOptions_HTTPUpgradeOptions extends V2RayTransportOptions { + + public String host; + + public String path; + + + } + } diff --git a/buildScript/lib/core/get_source_env.sh b/buildScript/lib/core/get_source_env.sh index c03c80ba..8a574089 100644 --- a/buildScript/lib/core/get_source_env.sh +++ b/buildScript/lib/core/get_source_env.sh @@ -1,5 +1,5 @@ if [ ! -z $ENV_NB4A ]; then - export COMMIT_SING_BOX_EXTRA="2f8e1bdb842ec2138c1699101a84950617c3cbb8" + export COMMIT_SING_BOX_EXTRA="5e69e4d38b195721b9e991c88d64ecdf9dcc51c5" fi if [ ! -z $ENV_SING_BOX_EXTRA ]; then