feat: v2ray freedom strategy

This commit is contained in:
arm64v8a
2023-05-25 09:53:10 +09:00
parent b5e0b16a73
commit ea993d8249
4 changed files with 13 additions and 0 deletions

View File

@@ -241,10 +241,12 @@ namespace NekoGui {
// direct & bypass & block // direct & bypass & block
status->outbounds += QJsonObject{ status->outbounds += QJsonObject{
{"protocol", "freedom"}, {"protocol", "freedom"},
{"domainStrategy", dataStore->core_ray_freedom_domainStrategy},
{"tag", "direct"}, {"tag", "direct"},
}; };
status->outbounds += QJsonObject{ status->outbounds += QJsonObject{
{"protocol", "freedom"}, {"protocol", "freedom"},
{"domainStrategy", dataStore->core_ray_freedom_domainStrategy},
{"tag", "bypass"}, {"tag", "bypass"},
}; };
status->outbounds += QJsonObject{ status->outbounds += QJsonObject{

View File

@@ -277,6 +277,7 @@ namespace NekoGui {
_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)); _add(new configItem("core_box_underlying_dns", &core_box_underlying_dns, itemType::string));
_add(new configItem("core_ray_direct_dns", &core_ray_direct_dns, itemType::boolean)); _add(new configItem("core_ray_direct_dns", &core_ray_direct_dns, itemType::boolean));
_add(new configItem("core_ray_freedom_domainStrategy", &core_ray_freedom_domainStrategy, itemType::boolean));
_add(new configItem("vpn_internal_tun", &vpn_internal_tun, itemType::boolean)); _add(new configItem("vpn_internal_tun", &vpn_internal_tun, itemType::boolean));
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
_add(new configItem("core_ray_windows_disable_auto_interface", &core_ray_windows_disable_auto_interface, itemType::boolean)); _add(new configItem("core_ray_windows_disable_auto_interface", &core_ray_windows_disable_auto_interface, itemType::boolean));

View File

@@ -162,6 +162,7 @@ namespace NekoGui {
QString core_box_underlying_dns = ""; QString core_box_underlying_dns = "";
bool core_ray_direct_dns = false; bool core_ray_direct_dns = false;
bool core_ray_windows_disable_auto_interface = false; bool core_ray_windows_disable_auto_interface = false;
QString core_ray_freedom_domainStrategy = "";
// Other Core // Other Core
ExtraCore *extraCore = new ExtraCore; ExtraCore *extraCore = new ExtraCore;

View File

@@ -404,6 +404,7 @@ void DialogBasicSettings::on_core_settings_clicked() {
MyLineEdit *core_box_underlying_dns; MyLineEdit *core_box_underlying_dns;
QCheckBox *core_ray_direct_dns; QCheckBox *core_ray_direct_dns;
QCheckBox *core_ray_windows_disable_auto_interface; QCheckBox *core_ray_windows_disable_auto_interface;
QComboBox *core_ray_freedom_domainStrategy;
// //
auto core_box_underlying_dns_l = new QLabel(tr("Override underlying DNS")); auto core_box_underlying_dns_l = new QLabel(tr("Override underlying DNS"));
core_box_underlying_dns_l->setToolTip(tr( core_box_underlying_dns_l->setToolTip(tr(
@@ -442,6 +443,13 @@ void DialogBasicSettings::on_core_settings_clicked() {
connect(core_ray_direct_dns, &QCheckBox::clicked, this, [&] { CACHE.needRestart = true; }); connect(core_ray_direct_dns, &QCheckBox::clicked, this, [&] { CACHE.needRestart = true; });
layout->addWidget(core_ray_direct_dns_l, ++line, 0); layout->addWidget(core_ray_direct_dns_l, ++line, 0);
layout->addWidget(core_ray_direct_dns, line, 1); layout->addWidget(core_ray_direct_dns, line, 1);
//
auto core_ray_freedom_domainStrategy_l = new QLabel("Freedom Strategy");
core_ray_freedom_domainStrategy = new QComboBox;
core_ray_freedom_domainStrategy->addItems({"", "AsIs", "UseIP", "UseIPv4", "UseIPv6"});
core_ray_freedom_domainStrategy->setCurrentText(NekoGui::dataStore->core_ray_freedom_domainStrategy);
layout->addWidget(core_ray_freedom_domainStrategy_l, ++line, 0);
layout->addWidget(core_ray_freedom_domainStrategy, line, 1);
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
auto core_ray_windows_disable_auto_interface_l = new QLabel("NKR_CORE_RAY_WINDOWS_DISABLE_AUTO_INTERFACE"); auto core_ray_windows_disable_auto_interface_l = new QLabel("NKR_CORE_RAY_WINDOWS_DISABLE_AUTO_INTERFACE");
core_ray_windows_disable_auto_interface_l->setToolTip(tr("If you VPN mode is not working, try to change this option.")); core_ray_windows_disable_auto_interface_l->setToolTip(tr("If you VPN mode is not working, try to change this option."));
@@ -463,6 +471,7 @@ void DialogBasicSettings::on_core_settings_clicked() {
NekoGui::dataStore->core_box_clash_api_secret = core_box_clash_api_secret->text(); NekoGui::dataStore->core_box_clash_api_secret = core_box_clash_api_secret->text();
} else { } else {
NekoGui::dataStore->core_ray_direct_dns = core_ray_direct_dns->isChecked(); NekoGui::dataStore->core_ray_direct_dns = core_ray_direct_dns->isChecked();
NekoGui::dataStore->core_ray_freedom_domainStrategy = core_ray_freedom_domainStrategy->currentText();
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
NekoGui::dataStore->core_ray_windows_disable_auto_interface = core_ray_windows_disable_auto_interface->isChecked(); NekoGui::dataStore->core_ray_windows_disable_auto_interface = core_ray_windows_disable_auto_interface->isChecked();
#endif #endif