add: use v2ray DNS for freedom outbound

This commit is contained in:
Qv2ray-dev 2020-04-26 22:30:13 +08:00
parent f08ea62e47
commit 8411ea9f68
6 changed files with 40 additions and 16 deletions

View File

@ -1 +1 @@
5330 5331

View File

@ -168,15 +168,17 @@ namespace Qv2ray::base::config
{ {
bool bypassCN; bool bypassCN;
bool enableProxy; bool enableProxy;
bool v2rayFreedomDNS;
bool withLocalDNS; bool withLocalDNS;
Qv2rayRouteConfig routeConfig; Qv2rayRouteConfig routeConfig;
QList<QString> dnsList; QList<QString> dnsList;
Qv2rayForwardProxyConfig forwardProxyConfig; Qv2rayForwardProxyConfig forwardProxyConfig;
Qv2rayConnectionConfig() 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 struct Qv2rayAPIConfig

View File

@ -509,7 +509,7 @@ namespace Qv2ray::core::connection
#undef fpConf #undef fpConf
OUTBOUNDS outbounds(root["outbounds"].toArray()); 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("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)); outbounds.append(GenerateOutboundEntry("blackhole", GenerateBlackHoleOUT(false), {}, {}, "0.0.0.0", OUTBOUND_TAG_BLACKHOLE));

View File

@ -129,6 +129,7 @@ PreferencesWindow::PreferencesWindow(QWidget *parent) : QDialog(parent), Current
tproxyMode->setCurrentText(CurrentConfig.inboundConfig.tproxy_mode); tproxyMode->setCurrentText(CurrentConfig.inboundConfig.tproxy_mode);
outboundMark->setValue(CurrentConfig.outboundConfig.mark); outboundMark->setValue(CurrentConfig.outboundConfig.mark);
dnsIntercept->setChecked(CurrentConfig.inboundConfig.dnsIntercept); dnsIntercept->setChecked(CurrentConfig.inboundConfig.dnsIntercept);
DnsFreedomCb->setChecked(CurrentConfig.connectionConfig.v2rayFreedomDNS);
// //
// //
vCorePathTxt->setText(CurrentConfig.kernelConfig.KernelPath()); vCorePathTxt->setText(CurrentConfig.kernelConfig.KernelPath());
@ -1296,3 +1297,9 @@ void PreferencesWindow::on_qvProxyNoProxy_clicked()
{ {
CurrentConfig.networkConfig.proxyType = Qv2rayNetworkConfig::QVPROXY_NONE; CurrentConfig.networkConfig.proxyType = Qv2rayNetworkConfig::QVPROXY_NONE;
} }
void PreferencesWindow::on_DnsFreedomCb_stateChanged(int arg1)
{
NEEDRESTART
CurrentConfig.connectionConfig.v2rayFreedomDNS = arg1 == Qt::Checked;
}

View File

@ -202,6 +202,8 @@ class PreferencesWindow
void on_qvProxyNoProxy_clicked(); void on_qvProxyNoProxy_clicked();
void on_DnsFreedomCb_stateChanged(int arg1);
private: private:
// //
RouteSettingsMatrixWidget *routeSettingsWidget; RouteSettingsMatrixWidget *routeSettingsWidget;

View File

@ -1171,29 +1171,43 @@ Custom DNS Settings</string>
</widget> </widget>
</item> </item>
<item row="2" column="0"> <item row="2" column="0">
<widget class="QLabel" name="label_18"> <widget class="QLabel" name="label_75">
<property name="text"> <property name="text">
<string>Use Local DNS</string> <string>Use V2ray Dns for Freedom Outbound</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="1"> <item row="2" column="1">
<widget class="QCheckBox" name="localDNSCb"> <widget class="QCheckBox" name="DnsFreedomCb">
<property name="text"> <property name="text">
<string>Enabled</string> <string>Enabled</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="0"> <item row="3" column="0">
<widget class="QLabel" name="label_18">
<property name="text">
<string>Use Local DNS</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_21"> <widget class="QLabel" name="label_21">
<property name="text"> <property name="text">
<string>Custom DNS List</string> <string>Custom DNS List</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="1"> <item row="4" column="1">
<widget class="QPlainTextEdit" name="DNSListTxt"/> <widget class="QPlainTextEdit" name="DNSListTxt"/>
</item> </item>
<item row="3" column="1">
<widget class="QCheckBox" name="localDNSCb">
<property name="text">
<string>Enabled</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
@ -1213,6 +1227,13 @@ Custom DNS Settings</string>
<bool>false</bool> <bool>false</bool>
</property> </property>
<layout class="QFormLayout" name="formLayout_8"> <layout class="QFormLayout" name="formLayout_8">
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="label_65">
<property name="text">
<string>Only simple config is supported.</string>
</property>
</widget>
</item>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QLabel" name="label_49"> <widget class="QLabel" name="label_49">
<property name="text"> <property name="text">
@ -1298,13 +1319,6 @@ Custom DNS Settings</string>
<item row="6" column="1"> <item row="6" column="1">
<widget class="QLineEdit" name="fpPasswordTx"/> <widget class="QLineEdit" name="fpPasswordTx"/>
</item> </item>
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="label_65">
<property name="text">
<string>Only simple config is supported.</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
@ -2052,7 +2066,6 @@ Custom DNS Settings</string>
<tabstop>httpAuthPasswordTxt</tabstop> <tabstop>httpAuthPasswordTxt</tabstop>
<tabstop>proxyDefaultCb</tabstop> <tabstop>proxyDefaultCb</tabstop>
<tabstop>bypassCNCb</tabstop> <tabstop>bypassCNCb</tabstop>
<tabstop>localDNSCb</tabstop>
<tabstop>DNSListTxt</tabstop> <tabstop>DNSListTxt</tabstop>
<tabstop>fpGroupBox</tabstop> <tabstop>fpGroupBox</tabstop>
<tabstop>fpTypeCombo</tabstop> <tabstop>fpTypeCombo</tabstop>