Skip to content

Commit

Permalink
feat: v2ray freedom strategy
Browse files Browse the repository at this point in the history
  • Loading branch information
arm64v8a committed May 25, 2023
1 parent b5e0b16 commit ea993d8
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions db/ConfigBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,10 +241,12 @@ namespace NekoGui {
// direct & bypass & block
status->outbounds += QJsonObject{
{"protocol", "freedom"},
{"domainStrategy", dataStore->core_ray_freedom_domainStrategy},
{"tag", "direct"},
};
status->outbounds += QJsonObject{
{"protocol", "freedom"},
{"domainStrategy", dataStore->core_ray_freedom_domainStrategy},
{"tag", "bypass"},
};
status->outbounds += QJsonObject{
Expand Down
1 change: 1 addition & 0 deletions main/NekoGui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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_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_freedom_domainStrategy", &core_ray_freedom_domainStrategy, itemType::boolean));
_add(new configItem("vpn_internal_tun", &vpn_internal_tun, itemType::boolean));
#ifdef Q_OS_WIN
_add(new configItem("core_ray_windows_disable_auto_interface", &core_ray_windows_disable_auto_interface, itemType::boolean));
Expand Down
1 change: 1 addition & 0 deletions main/NekoGui_DataStore.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ namespace NekoGui {
QString core_box_underlying_dns = "";
bool core_ray_direct_dns = false;
bool core_ray_windows_disable_auto_interface = false;
QString core_ray_freedom_domainStrategy = "";

// Other Core
ExtraCore *extraCore = new ExtraCore;
Expand Down
9 changes: 9 additions & 0 deletions ui/dialog_basic_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,7 @@ void DialogBasicSettings::on_core_settings_clicked() {
MyLineEdit *core_box_underlying_dns;
QCheckBox *core_ray_direct_dns;
QCheckBox *core_ray_windows_disable_auto_interface;
QComboBox *core_ray_freedom_domainStrategy;
//
auto core_box_underlying_dns_l = new QLabel(tr("Override underlying DNS"));
core_box_underlying_dns_l->setToolTip(tr(
Expand Down Expand Up @@ -442,6 +443,13 @@ void DialogBasicSettings::on_core_settings_clicked() {
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, 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
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."));
Expand All @@ -463,6 +471,7 @@ void DialogBasicSettings::on_core_settings_clicked() {
NekoGui::dataStore->core_box_clash_api_secret = core_box_clash_api_secret->text();
} else {
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
NekoGui::dataStore->core_ray_windows_disable_auto_interface = core_ray_windows_disable_auto_interface->isChecked();
#endif
Expand Down

0 comments on commit ea993d8

Please sign in to comment.