mirror of
https://github.com/MatsuriDayo/nekoray.git
synced 2025-12-17 20:44:38 +03:00
urltest: use dns
This commit is contained in:
@@ -523,21 +523,22 @@ namespace NekoGui {
|
||||
};
|
||||
|
||||
// Direct
|
||||
auto directDNSAddress = dataStore->routing->direct_dns;
|
||||
if (!status->forTest) {
|
||||
QJsonObject directObj{
|
||||
{"tag", "dns-direct"},
|
||||
{"address_resolver", "dns-local"},
|
||||
{"strategy", dataStore->routing->direct_dns_strategy},
|
||||
{"address", directDNSAddress.replace("+local://", "://")},
|
||||
{"detour", "direct"},
|
||||
};
|
||||
if (dataStore->routing->dns_final_out == "bypass") {
|
||||
dnsServers.prepend(directObj);
|
||||
} else {
|
||||
dnsServers.append(directObj);
|
||||
}
|
||||
QJsonObject directObj{
|
||||
{"tag", "dns-direct"},
|
||||
{"address_resolver", "dns-local"},
|
||||
{"strategy", dataStore->routing->direct_dns_strategy},
|
||||
{"address", dataStore->routing->direct_dns},
|
||||
{"detour", "direct"},
|
||||
};
|
||||
if (dataStore->routing->dns_final_out == "bypass") {
|
||||
dnsServers.prepend(directObj);
|
||||
} else {
|
||||
dnsServers.append(directObj);
|
||||
}
|
||||
dnsRules.append(QJsonObject{
|
||||
{"outbound", "any"},
|
||||
{"server", "direct"},
|
||||
});
|
||||
|
||||
// block
|
||||
if (!status->forTest)
|
||||
@@ -687,7 +688,7 @@ namespace NekoGui {
|
||||
QJSONARRAY_ADD(routingRules, status->routingRules)
|
||||
auto routeObj = QJsonObject{
|
||||
{"rules", routingRules},
|
||||
{"auto_detect_interface", dataStore->spmode_vpn},
|
||||
{"auto_detect_interface", dataStore->spmode_vpn}, // TODO force enable?
|
||||
{
|
||||
"geoip",
|
||||
QJsonObject{
|
||||
|
||||
@@ -1214,18 +1214,18 @@ void MainWindow::on_menu_export_config_triggered() {
|
||||
|
||||
QMessageBox msg(QMessageBox::Information, tr("Config copied"), config_core);
|
||||
msg.addButton("Copy core config", QMessageBox::YesRole);
|
||||
msg.addButton("Copy test config", QMessageBox::YesRole);
|
||||
msg.addButton("Copy test config", QMessageBox::NoRole);
|
||||
msg.addButton(QMessageBox::Ok);
|
||||
msg.setEscapeButton(QMessageBox::Ok);
|
||||
msg.setDefaultButton(QMessageBox::Ok);
|
||||
auto ret = msg.exec();
|
||||
if (ret == 0) {
|
||||
if (ret == 2) {
|
||||
result = BuildConfig(ent, false, false);
|
||||
config_core = QJsonObject2QString(result->coreConfig, true);
|
||||
config_core = QJsonObject2QString(result->coreConfig, false);
|
||||
QApplication::clipboard()->setText(config_core);
|
||||
} else if (ret == 1) {
|
||||
} else if (ret == 3) {
|
||||
result = BuildConfig(ent, true, false);
|
||||
config_core = QJsonObject2QString(result->coreConfig, true);
|
||||
config_core = QJsonObject2QString(result->coreConfig, false);
|
||||
QApplication::clipboard()->setText(config_core);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ void MainWindow::speedtest_current_group(int mode) {
|
||||
//
|
||||
libcore::TestReq req;
|
||||
req.set_mode((libcore::TestMode) mode);
|
||||
req.set_timeout(5000);
|
||||
req.set_timeout(10 * 1000);
|
||||
req.set_url(NekoGui::dataStore->test_latency_url.toStdString());
|
||||
|
||||
//
|
||||
@@ -181,7 +181,7 @@ void MainWindow::speedtest_current_group(int mode) {
|
||||
}
|
||||
//
|
||||
auto config = new libcore::LoadConfigReq;
|
||||
config->set_core_config(QJsonObject2QString(c->coreConfig, true).toStdString());
|
||||
config->set_core_config(QJsonObject2QString(c->coreConfig, false).toStdString());
|
||||
req.set_allocated_config(config);
|
||||
req.set_in_address(profile->bean->serverAddress.toStdString());
|
||||
|
||||
@@ -250,7 +250,7 @@ void MainWindow::speedtest_current() {
|
||||
runOnNewThread([=] {
|
||||
libcore::TestReq req;
|
||||
req.set_mode(libcore::UrlTest);
|
||||
req.set_timeout(5000);
|
||||
req.set_timeout(10 * 1000);
|
||||
req.set_url(NekoGui::dataStore->test_latency_url.toStdString());
|
||||
|
||||
bool rpcOK;
|
||||
@@ -306,7 +306,7 @@ void MainWindow::neko_start(int _id) {
|
||||
auto neko_start_stage2 = [=] {
|
||||
#ifndef NKR_NO_GRPC
|
||||
libcore::LoadConfigReq req;
|
||||
req.set_core_config(QJsonObject2QString(result->coreConfig, true).toStdString());
|
||||
req.set_core_config(QJsonObject2QString(result->coreConfig, false).toStdString());
|
||||
req.set_enable_nekoray_connections(NekoGui::dataStore->connection_statistics);
|
||||
if (NekoGui::dataStore->traffic_loop_interval > 0) {
|
||||
req.add_stats_outbounds("proxy");
|
||||
|
||||
Reference in New Issue
Block a user