mirror of
https://github.com/MatsuriDayo/nekoray.git
synced 2025-12-17 20:44:38 +03:00
update dns options
This commit is contained in:
@@ -8,6 +8,8 @@
|
|||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
|
|
||||||
|
#define BOX_UNDERLYING_DNS NekoRay::dataStore->core_box_underlying_dns.isEmpty() ? "underlying://0.0.0.0" : NekoRay::dataStore->core_box_underlying_dns
|
||||||
|
|
||||||
namespace NekoRay {
|
namespace NekoRay {
|
||||||
|
|
||||||
// Common
|
// Common
|
||||||
@@ -765,12 +767,9 @@ namespace NekoRay {
|
|||||||
{"detour", tagProxy},
|
{"detour", tagProxy},
|
||||||
};
|
};
|
||||||
|
|
||||||
// neko only
|
|
||||||
auto underlyingStr = status->forExport ? "local" : "underlying://0.0.0.0";
|
|
||||||
|
|
||||||
// Direct
|
// Direct
|
||||||
auto directDNSAddress = dataStore->direct_dns;
|
auto directDNSAddress = dataStore->direct_dns;
|
||||||
if (directDNSAddress == "localhost") directDNSAddress = underlyingStr;
|
if (directDNSAddress == "localhost") directDNSAddress = BOX_UNDERLYING_DNS;
|
||||||
if (!status->forTest)
|
if (!status->forTest)
|
||||||
dnsServers += QJsonObject{
|
dnsServers += QJsonObject{
|
||||||
{"tag", "dns-direct"},
|
{"tag", "dns-direct"},
|
||||||
@@ -783,7 +782,7 @@ namespace NekoRay {
|
|||||||
// Underlying 100% Working DNS
|
// Underlying 100% Working DNS
|
||||||
dnsServers += QJsonObject{
|
dnsServers += QJsonObject{
|
||||||
{"tag", "dns-local"},
|
{"tag", "dns-local"},
|
||||||
{"address", underlyingStr},
|
{"address", BOX_UNDERLYING_DNS},
|
||||||
{"detour", "direct"},
|
{"detour", "direct"},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -914,6 +913,7 @@ namespace NekoRay {
|
|||||||
.replace("%STRICT_ROUTE%", dataStore->vpn_strict_route ? "true" : "false")
|
.replace("%STRICT_ROUTE%", dataStore->vpn_strict_route ? "true" : "false")
|
||||||
.replace("%SOCKS_USER_PASS%", socks_user_pass)
|
.replace("%SOCKS_USER_PASS%", socks_user_pass)
|
||||||
.replace("%FINAL_OUT%", no_match_out)
|
.replace("%FINAL_OUT%", no_match_out)
|
||||||
|
.replace("%DNS_ADDRESS%", BOX_UNDERLYING_DNS)
|
||||||
.replace("%PORT%", Int2String(dataStore->inbound_socks_port));
|
.replace("%PORT%", Int2String(dataStore->inbound_socks_port));
|
||||||
// hook.js
|
// hook.js
|
||||||
auto source = qjs::ReadHookJS();
|
auto source = qjs::ReadHookJS();
|
||||||
|
|||||||
@@ -78,6 +78,7 @@ namespace NekoRay {
|
|||||||
_add(new configItem("core_box_auto_detect_interface", &core_box_auto_detect_interface, itemType::boolean));
|
_add(new configItem("core_box_auto_detect_interface", &core_box_auto_detect_interface, itemType::boolean));
|
||||||
_add(new configItem("core_box_clash_api", &core_box_clash_api, itemType::integer));
|
_add(new configItem("core_box_clash_api", &core_box_clash_api, itemType::integer));
|
||||||
_add(new configItem("core_box_clash_api_secret", &core_box_clash_api_secret, itemType::string));
|
_add(new configItem("core_box_clash_api_secret", &core_box_clash_api_secret, itemType::string));
|
||||||
|
_add(new configItem("core_box_underlying_dns", &core_box_underlying_dns, itemType::string));
|
||||||
#ifndef Q_OS_WIN
|
#ifndef Q_OS_WIN
|
||||||
_add(new configItem("vpn_already_admin", &vpn_already_admin, itemType::boolean));
|
_add(new configItem("vpn_already_admin", &vpn_already_admin, itemType::boolean));
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -153,6 +153,7 @@ namespace NekoRay {
|
|||||||
bool core_box_auto_detect_interface = true;
|
bool core_box_auto_detect_interface = true;
|
||||||
int core_box_clash_api = -9090;
|
int core_box_clash_api = -9090;
|
||||||
QString core_box_clash_api_secret = "";
|
QString core_box_clash_api_secret = "";
|
||||||
|
QString core_box_underlying_dns = "";
|
||||||
|
|
||||||
// Other Core
|
// Other Core
|
||||||
ExtraCore *extraCore = new ExtraCore;
|
ExtraCore *extraCore = new ExtraCore;
|
||||||
|
|||||||
@@ -6,7 +6,11 @@
|
|||||||
<h3>
|
<h3>
|
||||||
<p>Please put your clash dashboard files to "nekoray/config/dashboard" dir.</p>
|
<p>Please put your clash dashboard files to "nekoray/config/dashboard" dir.</p>
|
||||||
<p>For example, you can download from the following URL.</p>
|
<p>For example, you can download from the following URL.</p>
|
||||||
<a href="https://github.com/MetaCubeX/Yacd-meta/archive/refs/heads/gh-pages.zip">Yacd-meta</a>
|
<p>
|
||||||
|
<a href="https://github.com/MetaCubeX/Yacd-meta/archive/refs/heads/gh-pages.zip">Download Yacd-meta</a>
|
||||||
|
or
|
||||||
|
<a href="http://yacd.metacubex.one/">Use online</a>
|
||||||
|
</p>
|
||||||
</h3>
|
</h3>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
"servers": [
|
"servers": [
|
||||||
{
|
{
|
||||||
"tag": "dns-direct",
|
"tag": "dns-direct",
|
||||||
"address": "underlying://0.0.0.0",
|
"address": "%DNS_ADDRESS%",
|
||||||
"detour": "direct"
|
"detour": "direct"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -237,6 +237,16 @@
|
|||||||
<source>Core Options</source>
|
<source>Core Options</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Override underlying DNS</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>It is recommended to leave it blank, but it sometimes does not work, at this time you can set this option.
|
||||||
|
For NekoRay, this rewrites the underlying(localhost) DNS in VPN mode.
|
||||||
|
For NekoBox, this rewrites the underlying(localhost) DNS in VPN mode, normal mode, and also URL Test.</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>DialogEditGroup</name>
|
<name>DialogEditGroup</name>
|
||||||
|
|||||||
@@ -231,6 +231,18 @@
|
|||||||
<source>Core Options</source>
|
<source>Core Options</source>
|
||||||
<translation>核心选项</translation>
|
<translation>核心选项</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Override underlying DNS</source>
|
||||||
|
<translation>覆盖底层 DNS</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>It is recommended to leave it blank, but it sometimes does not work, at this time you can set this option.
|
||||||
|
For NekoRay, this rewrites the underlying(localhost) DNS in VPN mode.
|
||||||
|
For NekoBox, this rewrites the underlying(localhost) DNS in VPN mode, normal mode, and also URL Test.</source>
|
||||||
|
<translation>建议留空,但有时会出现问题,这时可以设置这个选项。
|
||||||
|
对于 NekoRay 来说,在 VPN 模式下会重写 underlying(localhost) DNS。
|
||||||
|
对于 NekoBox 来说,在 VPN 模式、正常模式和 URL 测试中会重写 underlying(localhost) DNS。</translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>DialogEditGroup</name>
|
<name>DialogEditGroup</name>
|
||||||
|
|||||||
@@ -167,8 +167,6 @@ DialogBasicSettings::DialogBasicSettings(QWidget *parent)
|
|||||||
|
|
||||||
// Core
|
// Core
|
||||||
|
|
||||||
if (!IS_NEKO_BOX) ui->core_settings->hide();
|
|
||||||
|
|
||||||
ui->groupBox_core->setTitle(software_core_name);
|
ui->groupBox_core->setTitle(software_core_name);
|
||||||
ui->core_v2ray_asset->setText(NekoRay::dataStore->v2ray_asset_dir);
|
ui->core_v2ray_asset->setText(NekoRay::dataStore->v2ray_asset_dir);
|
||||||
//
|
//
|
||||||
@@ -398,8 +396,21 @@ void DialogBasicSettings::on_core_settings_clicked() {
|
|||||||
auto line = -1;
|
auto line = -1;
|
||||||
QCheckBox *core_box_auto_detect_interface;
|
QCheckBox *core_box_auto_detect_interface;
|
||||||
QCheckBox *core_box_enable_clash_api;
|
QCheckBox *core_box_enable_clash_api;
|
||||||
QLineEdit *core_box_clash_api;
|
MyLineEdit *core_box_clash_api;
|
||||||
QLineEdit *core_box_clash_api_secret;
|
MyLineEdit *core_box_clash_api_secret;
|
||||||
|
MyLineEdit *core_box_underlying_dns;
|
||||||
|
//
|
||||||
|
auto core_box_underlying_dns_l = new QLabel(tr("Override underlying DNS"));
|
||||||
|
core_box_underlying_dns_l->setToolTip(tr(
|
||||||
|
"It is recommended to leave it blank, but it sometimes does not work, at this time you can set this option.\n"
|
||||||
|
"For NekoRay, this rewrites the underlying(localhost) DNS in VPN mode.\n"
|
||||||
|
"For NekoBox, this rewrites the underlying(localhost) DNS in VPN mode, normal mode, and also URL Test."));
|
||||||
|
core_box_underlying_dns = new MyLineEdit;
|
||||||
|
core_box_underlying_dns->setText(NekoRay::dataStore->core_box_underlying_dns);
|
||||||
|
core_box_underlying_dns->setMinimumWidth(300);
|
||||||
|
layout->addWidget(core_box_underlying_dns_l, ++line, 0);
|
||||||
|
layout->addWidget(core_box_underlying_dns, line, 1);
|
||||||
|
//
|
||||||
if (IS_NEKO_BOX) {
|
if (IS_NEKO_BOX) {
|
||||||
auto core_box_auto_detect_interface_l = new QLabel("auto_detect_interface");
|
auto core_box_auto_detect_interface_l = new QLabel("auto_detect_interface");
|
||||||
core_box_auto_detect_interface = new QCheckBox;
|
core_box_auto_detect_interface = new QCheckBox;
|
||||||
@@ -430,6 +441,7 @@ void DialogBasicSettings::on_core_settings_clicked() {
|
|||||||
box->setOrientation(Qt::Horizontal);
|
box->setOrientation(Qt::Horizontal);
|
||||||
box->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::Ok);
|
box->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::Ok);
|
||||||
connect(box, &QDialogButtonBox::accepted, w, [=] {
|
connect(box, &QDialogButtonBox::accepted, w, [=] {
|
||||||
|
NekoRay::dataStore->core_box_underlying_dns = core_box_underlying_dns->text();
|
||||||
if (IS_NEKO_BOX) {
|
if (IS_NEKO_BOX) {
|
||||||
NekoRay::dataStore->core_box_auto_detect_interface = core_box_auto_detect_interface->isChecked();
|
NekoRay::dataStore->core_box_auto_detect_interface = core_box_auto_detect_interface->isChecked();
|
||||||
NekoRay::dataStore->core_box_clash_api = core_box_clash_api->text().toInt() * (core_box_enable_clash_api->isChecked() ? 1 : -1);
|
NekoRay::dataStore->core_box_clash_api = core_box_clash_api->text().toInt() * (core_box_enable_clash_api->isChecked() ? 1 : -1);
|
||||||
@@ -441,6 +453,7 @@ void DialogBasicSettings::on_core_settings_clicked() {
|
|||||||
connect(box, &QDialogButtonBox::rejected, w, &QDialog::reject);
|
connect(box, &QDialogButtonBox::rejected, w, &QDialog::reject);
|
||||||
layout->addWidget(box, ++line, 1);
|
layout->addWidget(box, ++line, 1);
|
||||||
//
|
//
|
||||||
|
ADD_ASTERISK(w)
|
||||||
w->exec();
|
w->exec();
|
||||||
w->deleteLater();
|
w->deleteLater();
|
||||||
refresh_auth();
|
refresh_auth();
|
||||||
|
|||||||
Reference in New Issue
Block a user