mirror of
https://github.com/MatsuriDayo/NekoBoxForAndroid.git
synced 2025-12-19 14:40:06 +08:00
fix: v2ray tcp header
This commit is contained in:
parent
140f067ab8
commit
eb39cfa651
@ -100,6 +100,7 @@ fun parseV2Ray(link: String): StandardV2RayBean {
|
|||||||
bean.host = it.split("|").joinToString(",")
|
bean.host = it.split("|").joinToString(",")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
"ws" -> {
|
"ws" -> {
|
||||||
url.queryParameter("path")?.let {
|
url.queryParameter("path")?.let {
|
||||||
bean.path = it
|
bean.path = it
|
||||||
@ -108,6 +109,7 @@ fun parseV2Ray(link: String): StandardV2RayBean {
|
|||||||
bean.host = it
|
bean.host = it
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
"grpc" -> {
|
"grpc" -> {
|
||||||
url.queryParameter("serviceName")?.let {
|
url.queryParameter("serviceName")?.let {
|
||||||
bean.path = it
|
bean.path = it
|
||||||
@ -177,6 +179,7 @@ fun StandardV2RayBean.parseDuckSoft(url: HttpUrl) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
"http" -> {
|
"http" -> {
|
||||||
url.queryParameter("host")?.let {
|
url.queryParameter("host")?.let {
|
||||||
host = it
|
host = it
|
||||||
@ -185,6 +188,7 @@ fun StandardV2RayBean.parseDuckSoft(url: HttpUrl) {
|
|||||||
path = it
|
path = it
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
"ws" -> {
|
"ws" -> {
|
||||||
url.queryParameter("host")?.let {
|
url.queryParameter("host")?.let {
|
||||||
host = it
|
host = it
|
||||||
@ -200,6 +204,7 @@ fun StandardV2RayBean.parseDuckSoft(url: HttpUrl) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
"grpc" -> {
|
"grpc" -> {
|
||||||
url.queryParameter("serviceName")?.let {
|
url.queryParameter("serviceName")?.let {
|
||||||
path = it
|
path = it
|
||||||
@ -443,6 +448,7 @@ fun StandardV2RayBean.toUriVMessVLESSTrojan(isTrojan: Boolean): String {
|
|||||||
builder.addQueryParameter("headerType", "http")
|
builder.addQueryParameter("headerType", "http")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
"grpc" -> {
|
"grpc" -> {
|
||||||
if (path.isNotBlank()) {
|
if (path.isNotBlank()) {
|
||||||
builder.setQueryParameter("serviceName", path)
|
builder.setQueryParameter("serviceName", path)
|
||||||
@ -482,6 +488,7 @@ fun StandardV2RayBean.toUriVMessVLESSTrojan(isTrojan: Boolean): String {
|
|||||||
1 -> {
|
1 -> {
|
||||||
builder.addQueryParameter("packetEncoding", "packet")
|
builder.addQueryParameter("packetEncoding", "packet")
|
||||||
}
|
}
|
||||||
|
|
||||||
2 -> {
|
2 -> {
|
||||||
builder.addQueryParameter("packetEncoding", "xudp")
|
builder.addQueryParameter("packetEncoding", "xudp")
|
||||||
}
|
}
|
||||||
@ -499,6 +506,7 @@ fun buildSingBoxOutboundStreamSettings(bean: StandardV2RayBean): V2RayTransportO
|
|||||||
"tcp" -> {
|
"tcp" -> {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
"ws" -> {
|
"ws" -> {
|
||||||
return V2RayTransportOptions_WebsocketOptions().apply {
|
return V2RayTransportOptions_WebsocketOptions().apply {
|
||||||
type = "ws"
|
type = "ws"
|
||||||
@ -525,20 +533,24 @@ fun buildSingBoxOutboundStreamSettings(bean: StandardV2RayBean): V2RayTransportO
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
"http" -> {
|
"http" -> {
|
||||||
return V2RayTransportOptions_HTTPOptions().apply {
|
return V2RayTransportOptions_HTTPOptions().apply {
|
||||||
type = "http"
|
type = "http"
|
||||||
|
if (!bean.isTLS()) method = "GET" // v2ray tcp header
|
||||||
if (bean.host.isNotBlank()) {
|
if (bean.host.isNotBlank()) {
|
||||||
host = bean.host.split(",")
|
host = bean.host.split(",")
|
||||||
}
|
}
|
||||||
path = bean.path.takeIf { it.isNotBlank() } ?: "/"
|
path = bean.path.takeIf { it.isNotBlank() } ?: "/"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
"quic" -> {
|
"quic" -> {
|
||||||
return V2RayTransportOptions().apply {
|
return V2RayTransportOptions().apply {
|
||||||
type = "quic"
|
type = "quic"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
"grpc" -> {
|
"grpc" -> {
|
||||||
return V2RayTransportOptions_GRPCOptions().apply {
|
return V2RayTransportOptions_GRPCOptions().apply {
|
||||||
type = "grpc"
|
type = "grpc"
|
||||||
@ -592,6 +604,7 @@ fun buildSingBoxOutboundStandardV2RayBean(bean: StandardV2RayBean): Outbound {
|
|||||||
tls = buildSingBoxOutboundTLS(bean)
|
tls = buildSingBoxOutboundTLS(bean)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
is VMessBean -> {
|
is VMessBean -> {
|
||||||
if (bean.isVLESS) return Outbound_VLESSOptions().apply {
|
if (bean.isVLESS) return Outbound_VLESSOptions().apply {
|
||||||
type = "vless"
|
type = "vless"
|
||||||
@ -625,6 +638,7 @@ fun buildSingBoxOutboundStandardV2RayBean(bean: StandardV2RayBean): Outbound {
|
|||||||
transport = buildSingBoxOutboundStreamSettings(bean)
|
transport = buildSingBoxOutboundStreamSettings(bean)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
is TrojanBean -> {
|
is TrojanBean -> {
|
||||||
return Outbound_TrojanOptions().apply {
|
return Outbound_TrojanOptions().apply {
|
||||||
type = "trojan"
|
type = "trojan"
|
||||||
@ -635,6 +649,7 @@ fun buildSingBoxOutboundStandardV2RayBean(bean: StandardV2RayBean): Outbound {
|
|||||||
transport = buildSingBoxOutboundStreamSettings(bean)
|
transport = buildSingBoxOutboundStreamSettings(bean)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> throw IllegalStateException("can't reach")
|
else -> throw IllegalStateException("can't reach")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user