diff --git a/makespec/BUILDVERSION b/makespec/BUILDVERSION index e650e5aa..b578f07c 100644 --- a/makespec/BUILDVERSION +++ b/makespec/BUILDVERSION @@ -1 +1 @@ -5330 +5331 \ No newline at end of file diff --git a/src/base/models/QvSettingsObject.hpp b/src/base/models/QvSettingsObject.hpp index e0a4f138..03dc86a5 100644 --- a/src/base/models/QvSettingsObject.hpp +++ b/src/base/models/QvSettingsObject.hpp @@ -168,15 +168,17 @@ namespace Qv2ray::base::config { bool bypassCN; bool enableProxy; + bool v2rayFreedomDNS; bool withLocalDNS; Qv2rayRouteConfig routeConfig; QList dnsList; Qv2rayForwardProxyConfig forwardProxyConfig; Qv2rayConnectionConfig() - : bypassCN(true), enableProxy(true), withLocalDNS(false), routeConfig(), dnsList(QStringList{ "8.8.4.4", "1.1.1.1" }) + : bypassCN(true), enableProxy(true), v2rayFreedomDNS(false), withLocalDNS(false), routeConfig(), + dnsList(QStringList{ "8.8.4.4", "1.1.1.1" }) { } - XTOSTRUCT(O(bypassCN, enableProxy, withLocalDNS, dnsList, forwardProxyConfig, routeConfig)) + XTOSTRUCT(O(bypassCN, enableProxy, v2rayFreedomDNS, withLocalDNS, dnsList, forwardProxyConfig, routeConfig)) }; struct Qv2rayAPIConfig diff --git a/src/core/connection/Generation.cpp b/src/core/connection/Generation.cpp index 798a7144..beafd3bb 100644 --- a/src/core/connection/Generation.cpp +++ b/src/core/connection/Generation.cpp @@ -509,7 +509,7 @@ namespace Qv2ray::core::connection #undef fpConf OUTBOUNDS outbounds(root["outbounds"].toArray()); // - const auto freeDS = (GlobalConfig.inboundConfig.useTPROXY && GlobalConfig.inboundConfig.dnsIntercept) ? "UseIP" : "AsIs"; + const auto freeDS = (GlobalConfig.connectionConfig.v2rayFreedomDNS) ? "UseIP" : "AsIs"; // outbounds.append(GenerateOutboundEntry("freedom", GenerateFreedomOUT(freeDS, ":0", 0), {}, {}, "0.0.0.0", OUTBOUND_TAG_DIRECT)); outbounds.append(GenerateOutboundEntry("blackhole", GenerateBlackHoleOUT(false), {}, {}, "0.0.0.0", OUTBOUND_TAG_BLACKHOLE)); diff --git a/src/ui/w_PreferencesWindow.cpp b/src/ui/w_PreferencesWindow.cpp index 5b178e87..63f686a1 100644 --- a/src/ui/w_PreferencesWindow.cpp +++ b/src/ui/w_PreferencesWindow.cpp @@ -129,6 +129,7 @@ PreferencesWindow::PreferencesWindow(QWidget *parent) : QDialog(parent), Current tproxyMode->setCurrentText(CurrentConfig.inboundConfig.tproxy_mode); outboundMark->setValue(CurrentConfig.outboundConfig.mark); dnsIntercept->setChecked(CurrentConfig.inboundConfig.dnsIntercept); + DnsFreedomCb->setChecked(CurrentConfig.connectionConfig.v2rayFreedomDNS); // // vCorePathTxt->setText(CurrentConfig.kernelConfig.KernelPath()); @@ -1296,3 +1297,9 @@ void PreferencesWindow::on_qvProxyNoProxy_clicked() { CurrentConfig.networkConfig.proxyType = Qv2rayNetworkConfig::QVPROXY_NONE; } + +void PreferencesWindow::on_DnsFreedomCb_stateChanged(int arg1) +{ + NEEDRESTART + CurrentConfig.connectionConfig.v2rayFreedomDNS = arg1 == Qt::Checked; +} diff --git a/src/ui/w_PreferencesWindow.hpp b/src/ui/w_PreferencesWindow.hpp index 40f6ed6b..7f57a2bc 100644 --- a/src/ui/w_PreferencesWindow.hpp +++ b/src/ui/w_PreferencesWindow.hpp @@ -202,6 +202,8 @@ class PreferencesWindow void on_qvProxyNoProxy_clicked(); + void on_DnsFreedomCb_stateChanged(int arg1); + private: // RouteSettingsMatrixWidget *routeSettingsWidget; diff --git a/src/ui/w_PreferencesWindow.ui b/src/ui/w_PreferencesWindow.ui index 59f77253..0e202e08 100644 --- a/src/ui/w_PreferencesWindow.ui +++ b/src/ui/w_PreferencesWindow.ui @@ -1171,29 +1171,43 @@ Custom DNS Settings - + - Use Local DNS + Use V2ray Dns for Freedom Outbound - + Enabled + + + Use Local DNS + + + + Custom DNS List - + + + + + Enabled + + + @@ -1213,6 +1227,13 @@ Custom DNS Settings false + + + + Only simple config is supported. + + + @@ -1298,13 +1319,6 @@ Custom DNS Settings - - - - Only simple config is supported. - - - @@ -2052,7 +2066,6 @@ Custom DNS Settings httpAuthPasswordTxt proxyDefaultCb bypassCNCb - localDNSCb DNSListTxt fpGroupBox fpTypeCombo