feat: Add supports for HTTPUpgrade

This commit is contained in:
Misaka-blog 2023-11-01 10:41:15 +08:00
parent a82e5b4f2c
commit e805fe7ab9
5 changed files with 45 additions and 1 deletions

View File

@ -14,7 +14,7 @@ public abstract class StandardV2RayBean extends AbstractBean {
//////// End of VMess & VLESS ////////
// "V2Ray Transport" tcp/http/ws/quic/grpc
// "V2Ray Transport" tcp/http/ws/quic/grpc/httpupgrade
public String type;
public String host;
@ -133,6 +133,11 @@ public abstract class StandardV2RayBean extends AbstractBean {
case "grpc": {
output.writeString(path);
}
case "httpupgrade": {
output.writeString(host);
output.writeString(path);
}
}
output.writeString(security);
@ -180,6 +185,10 @@ public abstract class StandardV2RayBean extends AbstractBean {
case "grpc": {
path = input.readString();
}
case "httpupgrade": {
host = input.readString();
path = input.readString();
}
}
security = input.readString();

View File

@ -116,6 +116,15 @@ fun parseV2Ray(link: String): StandardV2RayBean {
bean.path = it
}
}
"httpupgrade" -> {
url.queryParameter("path")?.let {
bean.path = it
}
url.queryParameter("host")?.let {
bean.host = it
}
}
}
} else {
// also vless format
@ -215,6 +224,15 @@ fun StandardV2RayBean.parseDuckSoft(url: HttpUrl) {
path = it
}
}
"httpupgrade" -> {
url.queryParameter("host")?.let {
host = it
}
url.queryParameter("path")?.let {
path = it
}
}
}
// maybe from matsuri vmess exoprt

View File

@ -170,6 +170,12 @@ abstract class StandardV2RaySettingsActivity : ProfileSettingsActivity<StandardV
path.preference.setTitle(R.string.grpc_service_name)
path.preference.isVisible = true
}
"httpupgrade" -> {
host.preference.setTitle("HTTPUpgrade Host")
path.preference.setTitle("HTTPUpgrade Path")
host.preference.isVisible = true
path.preference.isVisible = true
}
}
}

View File

@ -2447,6 +2447,16 @@ public class SingBoxOptions {
}
public static class V2RayHTTPUpgradeOptions extends SingBoxOption {
public String host;
public String path;
public Map<String, String> headers;
}
public static class VLESSInboundOptions extends SingBoxOption {
// Generate note: nested type ListenOptions

View File

@ -263,6 +263,7 @@
<item>http</item>
<item>quic</item>
<item>grpc</item>
<item>httpupgrade</item>
</string-array>
<string-array name="trojan_go_networks_entry">