Skip to content

Commit

Permalink
Feat: Add support for httpupgrade transport
Browse files Browse the repository at this point in the history
  • Loading branch information
Misaka-blog committed Nov 2, 2023
1 parent 32ef100 commit 7538075
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 5 deletions.
3 changes: 3 additions & 0 deletions fmt/Bean2CoreObj_box.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ namespace NekoGui_fmt {
if (!host.isEmpty()) transport["host"] = QList2QJsonArray(host.split(","));
} else if (network == "grpc") {
if (!path.isEmpty()) transport["service_name"] = path;
} else if (network == "httpupgrade") {
if (!path.isEmpty()) transport["path"] = path;
if (!host.isEmpty()) transport["host"] = host;
}
outbound->insert("transport", transport);
} else if (header_type == "http") {
Expand Down
4 changes: 2 additions & 2 deletions fmt/Bean2Link.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ namespace NekoGui_fmt {
// type
query.addQueryItem("type", stream->network);

if (stream->network == "ws" || stream->network == "http") {
if (stream->network == "ws" || stream->network == "http" || stream->network == "httpupgrade") {
if (!stream->path.isEmpty()) query.addQueryItem("path", stream->path);
if (!stream->host.isEmpty()) query.addQueryItem("host", stream->host);
} else if (stream->network == "grpc") {
Expand Down Expand Up @@ -152,7 +152,7 @@ namespace NekoGui_fmt {
// type
query.addQueryItem("type", stream->network);

if (stream->network == "ws" || stream->network == "http") {
if (stream->network == "ws" || stream->network == "http" || stream->network == "httpupgrade") {
if (!stream->path.isEmpty()) query.addQueryItem("path", stream->path);
if (!stream->host.isEmpty()) query.addQueryItem("host", stream->host);
} else if (stream->network == "grpc") {
Expand Down
6 changes: 6 additions & 0 deletions fmt/Link2Bean.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ namespace NekoGui_fmt {
} else if (stream->network == "http") {
stream->path = GetQueryValue(query, "path", "");
stream->host = GetQueryValue(query, "host", "").replace("|", ",");
} else if (stream->network == "httpupgrade") {
stream->path = GetQueryValue(query, "path", "");
stream->host = GetQueryValue(query, "host", "");
} else if (stream->network == "grpc") {
stream->path = GetQueryValue(query, "serviceName", "");
} else if (stream->network == "tcp") {
Expand Down Expand Up @@ -199,6 +202,9 @@ namespace NekoGui_fmt {
} else if (stream->network == "http") {
stream->path = GetQueryValue(query, "path", "");
stream->host = GetQueryValue(query, "host", "").replace("|", ",");
} else if (stream->network == "httpupgrade") {
stream->path = GetQueryValue(query, "path", "");
stream->host = GetQueryValue(query, "host", "");
} else if (stream->network == "grpc") {
stream->path = GetQueryValue(query, "serviceName", "");
} else if (stream->network == "tcp") {
Expand Down
2 changes: 1 addition & 1 deletion fmt/V2RayStreamSettings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace NekoGui_fmt {
QString network = "tcp";
QString security = "";
QString packet_encoding = "";
// ws/http/grpc/tcp-http
// ws/http/grpc/tcp-http/httpupgrade
QString path = "";
QString host = "";
// kcp/quic/tcp-http
Expand Down
2 changes: 1 addition & 1 deletion libs/get_source_env.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
if [ ! -z $ENV_NEKORAY ]; then
export COMMIT_SING_BOX_EXTRA="2f8e1bdb842ec2138c1699101a84950617c3cbb8"
export COMMIT_SING_BOX_EXTRA="b13bae46e9fcd330c26e66caedf5640ba31f4505"
export COMMIT_MATSURI_XRAY="01208225ee7e508044cca8eb6776a117bcecd997"
fi

Expand Down
2 changes: 1 addition & 1 deletion ui/edit/dialog_edit_profile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ DialogEditProfile::DialogEditProfile(const QString &_type, int profileOrGroupId,
ui->path_l->setVisible(true);
ui->host->setVisible(false);
ui->host_l->setVisible(false);
} else if (txt == "ws" || txt == "http") {
} else if (txt == "ws" || txt == "http" || txt == "httpupgrade") {
ui->header_type->setVisible(false);
ui->header_type_l->setVisible(false);
ui->path->setVisible(true);
Expand Down
5 changes: 5 additions & 0 deletions ui/edit/dialog_edit_profile.ui
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,11 @@
<string notr="true">quic</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">httpupgrade</string>
</property>
</item>
</widget>
</item>
<item row="2" column="1">
Expand Down

0 comments on commit 7538075

Please sign in to comment.