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 enableProxy;
bool v2rayFreedomDNS;
bool withLocalDNS;
Qv2rayRouteConfig routeConfig;
QList<QString> 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

View File

@ -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));

View File

@ -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;
}

View File

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

View File

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