mirror of
https://github.com/Qv2ray/Qv2ray.git
synced 2025-05-20 10:50:23 +08:00
[fix] Bumped to version v1.3.7.1 and fixed #64
Former-commit-id: b8fc8a1800
This commit is contained in:
parent
db75d5ec8b
commit
b55340e00e
@ -14,7 +14,7 @@ CONFIG += c++11 openssl openssl-linked lrelease embed_translations
|
||||
win32: QMAKE_TARGET_DESCRIPTION = "Qv2ray, a cross-platform v2ray GUI client."
|
||||
win32: QMAKE_TARGET_PRODUCT = "Qv2ray"
|
||||
|
||||
VERSION = 1.3.7.0
|
||||
VERSION = 1.3.7.1
|
||||
DEFINES += QV_MAJOR_VERSION=\"\\\"$${VERSION}\\\"\"
|
||||
|
||||
SOURCES += \
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
#define QV2RAY_VERSION_STRING "v" QV_MAJOR_VERSION
|
||||
|
||||
#define QV2RAY_CONFIG_VERSION 3
|
||||
#define QV2RAY_CONFIG_VERSION 4
|
||||
// Base folder.
|
||||
#define QV2RAY_CONFIG_DIR_PATH (Qv2ray::Utils::GetConfigDirPath() + "/")
|
||||
#define QV2RAY_CONFIG_FILE_PATH (QV2RAY_CONFIG_DIR_PATH + "Qv2ray.conf")
|
||||
@ -85,7 +85,7 @@ namespace Qv2ray
|
||||
//
|
||||
string ignoredVersion;
|
||||
//
|
||||
bool proxyDefault;
|
||||
bool enableProxy;
|
||||
bool proxyCN;
|
||||
bool withLocalDNS;
|
||||
list<string> dnsList;
|
||||
@ -98,7 +98,7 @@ namespace Qv2ray
|
||||
#endif
|
||||
map<string, string> subscribes;
|
||||
MuxObject mux;
|
||||
Qv2rayConfig(): config_version(QV2RAY_CONFIG_VERSION), runAsRoot(false), logLevel(), proxyDefault(), proxyCN(), withLocalDNS(), inBoundSettings(), configs(), subscribes(), mux() { }
|
||||
Qv2rayConfig(): config_version(QV2RAY_CONFIG_VERSION), runAsRoot(false), logLevel(), enableProxy(), proxyCN(), withLocalDNS(), inBoundSettings(), configs(), subscribes(), mux() { }
|
||||
Qv2rayConfig(string lang, string assetsPath, int log, Qv2rayBasicInboundsConfig _inBoundSettings): Qv2rayConfig()
|
||||
{
|
||||
// These settings below are defaults.
|
||||
@ -114,12 +114,13 @@ namespace Qv2ray
|
||||
dnsList.push_back("1.1.1.1");
|
||||
dnsList.push_back("4.4.4.4");
|
||||
proxyCN = false;
|
||||
proxyDefault = true;
|
||||
enableProxy = true;
|
||||
withLocalDNS = true;
|
||||
}
|
||||
XTOSTRUCT(O(config_version, runAsRoot, logLevel, language, autoStartConfig, ignoredVersion, v2AssetsPath, proxyDefault, proxyCN, withLocalDNS, dnsList, inBoundSettings, mux, configs, subscribes))
|
||||
XTOSTRUCT(O(config_version, runAsRoot, logLevel, language, autoStartConfig, ignoredVersion, v2AssetsPath, enableProxy, proxyCN, withLocalDNS, dnsList, inBoundSettings, mux, configs, subscribes))
|
||||
};
|
||||
|
||||
// Extra header for QvConfigUpgrade.cpp
|
||||
QJsonObject UpgradeConfig(int fromVersion, int toVersion, QJsonObject root);
|
||||
}
|
||||
}
|
||||
|
@ -28,6 +28,7 @@ namespace Qv2ray
|
||||
}
|
||||
|
||||
case 2 : {
|
||||
// We copied those files.
|
||||
auto vCoreFilePath = root["v2CorePath"].toString();
|
||||
auto vCoreDestPath = QV2RAY_V2RAY_CORE_PATH;
|
||||
// We also need v2ctl
|
||||
@ -40,6 +41,16 @@ namespace Qv2ray
|
||||
UPGRADELOG("v2CtlFilePath", v2CtlFilePath.toStdString(), v2CtlDestPath.toStdString())
|
||||
break;
|
||||
}
|
||||
|
||||
case 3 : {
|
||||
// We changed a key name in the config file.
|
||||
//proxyDefault
|
||||
auto oldProxyDefault = root["proxyDefault"].toBool();
|
||||
root.remove("proxyDefault");
|
||||
root["enableProxy"] = oldProxyDefault;
|
||||
//enableProxy
|
||||
UPGRADELOG("key: proxyDefault->enableProxy", to_string(oldProxyDefault), to_string(oldProxyDefault))
|
||||
}
|
||||
}
|
||||
|
||||
root["config_version"] = root["config_version"].toInt() + 1;
|
||||
|
@ -17,7 +17,7 @@ namespace Qv2ray
|
||||
namespace ConfigOperations
|
||||
{
|
||||
// -------------------------- BEGIN CONFIG GENERATIONS ---------------------------------------------
|
||||
QJsonObject GenerateRoutes(bool globalProxy, bool cnProxy);
|
||||
QJsonObject GenerateRoutes(bool enableProxy, bool cnProxy);
|
||||
QJsonObject GenerateSingleRouteRule(QStringList list, bool isDomain, QString outboundTag, QString type = "field");
|
||||
QJsonObject GenerateDNS(bool withLocalhost, QStringList dnsServers);
|
||||
//
|
||||
|
@ -6,23 +6,28 @@ namespace Qv2ray
|
||||
{
|
||||
static const QStringList vLogLevels = {"none", "debug", "info", "warning", "error"};
|
||||
// -------------------------- BEGIN CONFIG GENERATIONS ----------------------------------------------------------------------------
|
||||
QJsonObject GenerateRoutes(bool globalProxy, bool cnProxy)
|
||||
QJsonObject GenerateRoutes(bool enableProxy, bool cnProxy)
|
||||
{
|
||||
DROOT
|
||||
root.insert("domainStrategy", "IPIfNonMatch");
|
||||
//
|
||||
// For Rules list
|
||||
QJsonArray rulesList;
|
||||
//
|
||||
|
||||
if (!enableProxy) {
|
||||
// This is added to disable all proxies, as a alternative influence of #64
|
||||
rulesList.append(GenerateSingleRouteRule(QStringList() << "regexp:.*", true, OUTBOUND_TAG_DIRECT));
|
||||
}
|
||||
|
||||
// Private IPs should always NOT TO PROXY!
|
||||
rulesList.append(GenerateSingleRouteRule(QStringList({"geoip:private"}), false, OUTBOUND_TAG_DIRECT));
|
||||
rulesList.append(GenerateSingleRouteRule(QStringList() << "geoip:private", false, OUTBOUND_TAG_DIRECT));
|
||||
//
|
||||
// Check if CN needs proxy, or direct.
|
||||
rulesList.append(GenerateSingleRouteRule(QStringList({"geoip:cn"}), false, cnProxy ? OUTBOUND_TAG_PROXY : OUTBOUND_TAG_DIRECT));
|
||||
rulesList.append(GenerateSingleRouteRule(QStringList({"geosite:cn"}), true, cnProxy ? OUTBOUND_TAG_PROXY : OUTBOUND_TAG_DIRECT));
|
||||
rulesList.append(GenerateSingleRouteRule(QStringList() << "geoip:cn", false, cnProxy ? OUTBOUND_TAG_PROXY : OUTBOUND_TAG_DIRECT));
|
||||
rulesList.append(GenerateSingleRouteRule(QStringList() << "geosite:cn", true, cnProxy ? OUTBOUND_TAG_PROXY : OUTBOUND_TAG_DIRECT));
|
||||
//
|
||||
// Check global proxy, or direct.
|
||||
rulesList.append(GenerateSingleRouteRule(QStringList({"regexp:.*"}), true, globalProxy ? OUTBOUND_TAG_PROXY : OUTBOUND_TAG_DIRECT));
|
||||
// As a bug fix of #64, this default rule has been disabled.
|
||||
//rulesList.append(GenerateSingleRouteRule(QStringList({"regexp:.*"}), true, globalProxy ? OUTBOUND_TAG_PROXY : OUTBOUND_TAG_DIRECT));
|
||||
root.insert("rules", rulesList);
|
||||
RROOT
|
||||
}
|
||||
@ -76,6 +81,8 @@ namespace Qv2ray
|
||||
QJsonArray servers(QJsonArray::fromStringList(dnsServers));
|
||||
|
||||
if (withLocalhost) {
|
||||
// https://github.com/lhy0403/Qv2ray/issues/64
|
||||
// The fix patch didn't touch this line below.
|
||||
servers.append("localhost");
|
||||
}
|
||||
|
||||
@ -185,11 +192,9 @@ namespace Qv2ray
|
||||
|
||||
// Note: The part below always makes the whole functionality in trouble......
|
||||
// BE EXTREME CAREFUL when changing these code below...
|
||||
//
|
||||
|
||||
// For SOME configs, there is no "route" entries, so, we add some...
|
||||
|
||||
// We don't use QV2RAY_CONFIG_TYPE_FILE to check because not all IMPORTED connections have routings.
|
||||
if (!root.contains("routing")) {
|
||||
if (root["outbounds"].toArray().count() != 1) {
|
||||
// There are no ROUTING but 2 or more outbounds.... This is rare, but possible.
|
||||
@ -198,7 +203,7 @@ namespace Qv2ray
|
||||
}
|
||||
|
||||
LOG(MODULE_CONNECTION, "Current connection has NO ROUTING section, we insert default values.")
|
||||
auto routeObject = GenerateRoutes(gConf.proxyDefault, gConf.proxyCN);
|
||||
auto routeObject = GenerateRoutes(gConf.enableProxy, gConf.proxyCN);
|
||||
root.insert("routing", routeObject);
|
||||
QJsonArray outbounds = root["outbounds"].toArray();
|
||||
outbounds.append(GenerateOutboundEntry("freedom", GenerateFreedomOUT("AsIs", ":0", 0), QJsonObject(), QJsonObject(), "0.0.0.0", OUTBOUND_TAG_DIRECT));
|
||||
|
@ -66,7 +66,7 @@ PrefrencesWindow::PrefrencesWindow(QWidget *parent) : QDialog(parent),
|
||||
ui->muxConcurrencyTxt->setValue(CurrentConfig.mux.concurrency);
|
||||
//
|
||||
ui->proxyCNCb->setChecked(CurrentConfig.proxyCN);
|
||||
ui->proxyDefaultCb->setChecked(CurrentConfig.proxyDefault);
|
||||
ui->proxyDefaultCb->setChecked(CurrentConfig.enableProxy);
|
||||
ui->localDNSCb->setChecked(CurrentConfig.withLocalDNS);
|
||||
//
|
||||
ui->DNSListTxt->clear();
|
||||
@ -242,7 +242,7 @@ void PrefrencesWindow::on_proxyCNCb_stateChanged(int arg1)
|
||||
void PrefrencesWindow::on_proxyDefaultCb_stateChanged(int arg1)
|
||||
{
|
||||
NEEDRESTART
|
||||
CurrentConfig.proxyDefault = arg1 == Qt::Checked;
|
||||
CurrentConfig.enableProxy = arg1 == Qt::Checked;
|
||||
}
|
||||
|
||||
void PrefrencesWindow::on_localDNSCb_stateChanged(int arg1)
|
||||
|
Loading…
Reference in New Issue
Block a user