fix: fix grpc transport

This commit is contained in:
parhelia512 2025-12-05 02:15:25 +08:00
parent 8393bddf79
commit 195826f887
3 changed files with 22 additions and 6 deletions

View File

@ -476,6 +476,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

@ -126,10 +126,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") {
@ -76,6 +76,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);
@ -307,6 +314,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->reality_pbk->setText(tls->reality->public_key);
@ -424,6 +432,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();
tls->reality->public_key = ui->reality_pbk->text();