feat: choose final DNS out (#872)

This commit is contained in:
XSalsa20-Poly1305
2023-09-10 10:27:03 +08:00
committed by GitHub
parent 39288bd804
commit 65259e6097
8 changed files with 53 additions and 3 deletions

View File

@@ -328,7 +328,7 @@ namespace NekoGui {
{"queryStrategy", dataStore->routing->direct_dns_strategy},
{"domains", QList2QJsonArray<QString>(status->domainListDNSDirect)},
};
if (dataStore->routing->def_outbound == "bypass") {
if (dataStore->routing->dns_final_out == "bypass") {
dnsServers.prepend(directObj);
} else {
dnsServers.append(directObj);
@@ -867,7 +867,7 @@ namespace NekoGui {
{"address", directDNSAddress.replace("+local://", "://")},
{"detour", "direct"},
};
if (dataStore->routing->def_outbound == "bypass") {
if (dataStore->routing->dns_final_out == "bypass") {
dnsServers.prepend(directObj);
} else {
dnsServers.append(directObj);

View File

@@ -186,7 +186,7 @@ namespace NekoGui {
bean = new NekoGui_fmt::NaiveBean();
} else if (type == "hysteria") {
bean = new NekoGui_fmt::QUICBean(NekoGui_fmt::QUICBean::proxy_Hysteria);
} else if (type == "hysteria2" ) {
} else if (type == "hysteria2") {
bean = new NekoGui_fmt::QUICBean(NekoGui_fmt::QUICBean::proxy_Hysteria2);
} else if (type == "tuic") {
bean = new NekoGui_fmt::QUICBean(NekoGui_fmt::QUICBean::proxy_TUIC);

View File

@@ -21,6 +21,7 @@ namespace NekoGui {
bool dns_routing = true;
bool use_dns_object = false;
QString dns_object = "";
QString dns_final_out = "proxy";
// Misc
QString domain_strategy = "AsIs";

View File

@@ -721,6 +721,10 @@ If the default value does not work, try changing it to &quot;223.5.5.5&quot;.
For more information, see the document &quot;Configuration/DNS&quot;.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Final DNS Out</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>DialogVPNSettings</name>

View File

@@ -724,6 +724,10 @@ If the default value does not work, try changing it to &quot;223.5.5.5&quot;.
For more information, see the document &quot;Configuration/DNS&quot;.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Final DNS Out</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>DialogVPNSettings</name>

View File

@@ -725,6 +725,10 @@ For more information, see the document &quot;Configuration/DNS&quot;.</source>
&quot;223.5.5.5&quot;
&quot;/DNS&quot;</translation>
</message>
<message>
<source>Final DNS Out</source>
<translation> DNS </translation>
</message>
</context>
<context>
<name>DialogVPNSettings</name>

View File

@@ -154,6 +154,7 @@ void DialogManageRoutes::UpdateDisplayRouting(NekoGui::Routing *conf, bool qv) {
ui->remote_dns_strategy->setCurrentText(conf->remote_dns_strategy);
ui->direct_dns->setCurrentText(conf->direct_dns);
ui->direct_dns_strategy->setCurrentText(conf->direct_dns_strategy);
ui->dns_final_out->setCurrentText(conf->dns_final_out);
}
void DialogManageRoutes::SaveDisplayRouting(NekoGui::Routing *conf) {
@@ -176,6 +177,7 @@ void DialogManageRoutes::SaveDisplayRouting(NekoGui::Routing *conf) {
conf->remote_dns_strategy = ui->remote_dns_strategy->currentText();
conf->direct_dns = ui->direct_dns->currentText();
conf->direct_dns_strategy = ui->direct_dns_strategy->currentText();
conf->dns_final_out = ui->dns_final_out->currentText();
}
void DialogManageRoutes::on_load_save_clicked() {

View File

@@ -250,6 +250,40 @@ For more information, see the document &quot;Configuration/DNS&quot;.</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="dns_final_out_l">
<property name="text">
<string>Final DNS Out</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="dns_final_out">
<item>
<property name="text">
<string notr="true">proxy</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">bypass</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
<item row="1" column="2">
@@ -601,6 +635,7 @@ For more information, see the document &quot;Configuration/DNS&quot;.</string>
<tabstop>direct_dns</tabstop>
<tabstop>direct_dns_strategy</tabstop>
<tabstop>dns_routing</tabstop>
<tabstop>dns_final_out</tabstop>
<tabstop>use_dns_object</tabstop>
<tabstop>format_dns_object</tabstop>
<tabstop>dns_document</tabstop>