Merge pull request #1008 from throneproj/dev

feat: support xhttp transport
This commit is contained in:
parhelia512 2025-12-05 02:29:42 +08:00 committed by GitHub
commit 8d6e3e213c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 22 additions and 6 deletions

View File

@ -481,6 +481,16 @@
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="service_name_l">
<property name="text">
<string>Service Name</string>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="MyLineEdit" name="service_name"/>
</item>
<item row="5" column="1">
<widget class="MyLineEdit" name="ws_early_data_name"/>
</item>

View File

@ -137,10 +137,7 @@ namespace Configs {
QJsonObject object;
if (type.isEmpty() || type == "tcp") return object;
if (!type.isEmpty()) object["type"] = type;
if (!path.isEmpty()) {
if (type == "grpc") object["service_name"] = path;
else object["path"] = path;
}
if (!path.isEmpty()) object["path"] = path;
if (!method.isEmpty()) object["method"] = method;
if (!headers.isEmpty()) {
object["headers"] = qStringListToJsonObject(headers);

View File

@ -44,8 +44,8 @@ DialogEditProfile::DialogEditProfile(const QString &_type, int profileOrGroupId,
ui->headers_l->setVisible(false);
ui->method->setVisible(false);
ui->method_l->setVisible(false);
ui->path->setVisible(true);
ui->path_l->setVisible(true);
ui->path->setVisible(false);
ui->path_l->setVisible(false);
ui->host->setVisible(false);
ui->host_l->setVisible(false);
} else if (txt == "ws" || txt == "httpupgrade") {
@ -85,6 +85,13 @@ DialogEditProfile::DialogEditProfile(const QString &_type, int profileOrGroupId,
ui->host->setVisible(false);
ui->host_l->setVisible(false);
}
if (txt == "grpc") {
ui->service_name->setVisible(true);
ui->service_name_l->setVisible(true);
} else {
ui->service_name->setVisible(false);
ui->service_name_l->setVisible(false);
}
if (txt == "ws") {
ui->ws_early_data_length->setVisible(true);
ui->ws_early_data_length_l->setVisible(true);
@ -327,6 +334,7 @@ void DialogEditProfile::typeSelected(const QString &newType) {
ui->tls_rec_frag->setChecked(tls->record_fragment);
ui->insecure->setChecked(tls->insecure);
ui->headers->setText(transport->getHeadersString());
ui->service_name->setText(transport->service_name);
ui->ws_early_data_name->setText(transport->early_data_header_name);
ui->ws_early_data_length->setText(Int2String(transport->max_early_data));
ui->xhttp_mode->setCurrentText(transport->xhttp_mode);
@ -446,6 +454,7 @@ bool DialogEditProfile::onEnd() {
tls->insecure = ui->insecure->isChecked();
transport->headers = transport->getHeaderPairs(ui->headers->text());
transport->method = ui->method->text();
transport->service_name = ui->service_name->text();
transport->early_data_header_name = ui->ws_early_data_name->text();
transport->max_early_data = ui->ws_early_data_length->text().toInt();
transport->xhttp_mode = ui->xhttp_mode->currentText();