mirror of
https://github.com/Qv2ray/Qv2ray.git
synced 2025-05-20 19:00:22 +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_DESCRIPTION = "Qv2ray, a cross-platform v2ray GUI client."
|
||||||
win32: QMAKE_TARGET_PRODUCT = "Qv2ray"
|
win32: QMAKE_TARGET_PRODUCT = "Qv2ray"
|
||||||
|
|
||||||
VERSION = 1.3.7.0
|
VERSION = 1.3.7.1
|
||||||
DEFINES += QV_MAJOR_VERSION=\"\\\"$${VERSION}\\\"\"
|
DEFINES += QV_MAJOR_VERSION=\"\\\"$${VERSION}\\\"\"
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
#define QV2RAY_VERSION_STRING "v" QV_MAJOR_VERSION
|
#define QV2RAY_VERSION_STRING "v" QV_MAJOR_VERSION
|
||||||
|
|
||||||
#define QV2RAY_CONFIG_VERSION 3
|
#define QV2RAY_CONFIG_VERSION 4
|
||||||
// Base folder.
|
// Base folder.
|
||||||
#define QV2RAY_CONFIG_DIR_PATH (Qv2ray::Utils::GetConfigDirPath() + "/")
|
#define QV2RAY_CONFIG_DIR_PATH (Qv2ray::Utils::GetConfigDirPath() + "/")
|
||||||
#define QV2RAY_CONFIG_FILE_PATH (QV2RAY_CONFIG_DIR_PATH + "Qv2ray.conf")
|
#define QV2RAY_CONFIG_FILE_PATH (QV2RAY_CONFIG_DIR_PATH + "Qv2ray.conf")
|
||||||
@ -85,7 +85,7 @@ namespace Qv2ray
|
|||||||
//
|
//
|
||||||
string ignoredVersion;
|
string ignoredVersion;
|
||||||
//
|
//
|
||||||
bool proxyDefault;
|
bool enableProxy;
|
||||||
bool proxyCN;
|
bool proxyCN;
|
||||||
bool withLocalDNS;
|
bool withLocalDNS;
|
||||||
list<string> dnsList;
|
list<string> dnsList;
|
||||||
@ -98,7 +98,7 @@ namespace Qv2ray
|
|||||||
#endif
|
#endif
|
||||||
map<string, string> subscribes;
|
map<string, string> subscribes;
|
||||||
MuxObject mux;
|
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()
|
Qv2rayConfig(string lang, string assetsPath, int log, Qv2rayBasicInboundsConfig _inBoundSettings): Qv2rayConfig()
|
||||||
{
|
{
|
||||||
// These settings below are defaults.
|
// These settings below are defaults.
|
||||||
@ -114,12 +114,13 @@ namespace Qv2ray
|
|||||||
dnsList.push_back("1.1.1.1");
|
dnsList.push_back("1.1.1.1");
|
||||||
dnsList.push_back("4.4.4.4");
|
dnsList.push_back("4.4.4.4");
|
||||||
proxyCN = false;
|
proxyCN = false;
|
||||||
proxyDefault = true;
|
enableProxy = true;
|
||||||
withLocalDNS = 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);
|
QJsonObject UpgradeConfig(int fromVersion, int toVersion, QJsonObject root);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@ namespace Qv2ray
|
|||||||
}
|
}
|
||||||
|
|
||||||
case 2 : {
|
case 2 : {
|
||||||
|
// We copied those files.
|
||||||
auto vCoreFilePath = root["v2CorePath"].toString();
|
auto vCoreFilePath = root["v2CorePath"].toString();
|
||||||
auto vCoreDestPath = QV2RAY_V2RAY_CORE_PATH;
|
auto vCoreDestPath = QV2RAY_V2RAY_CORE_PATH;
|
||||||
// We also need v2ctl
|
// We also need v2ctl
|
||||||
@ -40,6 +41,16 @@ namespace Qv2ray
|
|||||||
UPGRADELOG("v2CtlFilePath", v2CtlFilePath.toStdString(), v2CtlDestPath.toStdString())
|
UPGRADELOG("v2CtlFilePath", v2CtlFilePath.toStdString(), v2CtlDestPath.toStdString())
|
||||||
break;
|
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;
|
root["config_version"] = root["config_version"].toInt() + 1;
|
||||||
|
@ -17,7 +17,7 @@ namespace Qv2ray
|
|||||||
namespace ConfigOperations
|
namespace ConfigOperations
|
||||||
{
|
{
|
||||||
// -------------------------- BEGIN CONFIG GENERATIONS ---------------------------------------------
|
// -------------------------- 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 GenerateSingleRouteRule(QStringList list, bool isDomain, QString outboundTag, QString type = "field");
|
||||||
QJsonObject GenerateDNS(bool withLocalhost, QStringList dnsServers);
|
QJsonObject GenerateDNS(bool withLocalhost, QStringList dnsServers);
|
||||||
//
|
//
|
||||||
|
@ -6,23 +6,28 @@ namespace Qv2ray
|
|||||||
{
|
{
|
||||||
static const QStringList vLogLevels = {"none", "debug", "info", "warning", "error"};
|
static const QStringList vLogLevels = {"none", "debug", "info", "warning", "error"};
|
||||||
// -------------------------- BEGIN CONFIG GENERATIONS ----------------------------------------------------------------------------
|
// -------------------------- BEGIN CONFIG GENERATIONS ----------------------------------------------------------------------------
|
||||||
QJsonObject GenerateRoutes(bool globalProxy, bool cnProxy)
|
QJsonObject GenerateRoutes(bool enableProxy, bool cnProxy)
|
||||||
{
|
{
|
||||||
DROOT
|
DROOT
|
||||||
root.insert("domainStrategy", "IPIfNonMatch");
|
root.insert("domainStrategy", "IPIfNonMatch");
|
||||||
//
|
//
|
||||||
// For Rules list
|
// For Rules list
|
||||||
QJsonArray rulesList;
|
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!
|
// 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.
|
// 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() << "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() << "geosite:cn", true, cnProxy ? OUTBOUND_TAG_PROXY : OUTBOUND_TAG_DIRECT));
|
||||||
//
|
//
|
||||||
// Check global proxy, or 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));
|
//rulesList.append(GenerateSingleRouteRule(QStringList({"regexp:.*"}), true, globalProxy ? OUTBOUND_TAG_PROXY : OUTBOUND_TAG_DIRECT));
|
||||||
root.insert("rules", rulesList);
|
root.insert("rules", rulesList);
|
||||||
RROOT
|
RROOT
|
||||||
}
|
}
|
||||||
@ -76,6 +81,8 @@ namespace Qv2ray
|
|||||||
QJsonArray servers(QJsonArray::fromStringList(dnsServers));
|
QJsonArray servers(QJsonArray::fromStringList(dnsServers));
|
||||||
|
|
||||||
if (withLocalhost) {
|
if (withLocalhost) {
|
||||||
|
// https://github.com/lhy0403/Qv2ray/issues/64
|
||||||
|
// The fix patch didn't touch this line below.
|
||||||
servers.append("localhost");
|
servers.append("localhost");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -185,11 +192,9 @@ namespace Qv2ray
|
|||||||
|
|
||||||
// Note: The part below always makes the whole functionality in trouble......
|
// Note: The part below always makes the whole functionality in trouble......
|
||||||
// BE EXTREME CAREFUL when changing these code below...
|
// BE EXTREME CAREFUL when changing these code below...
|
||||||
//
|
|
||||||
|
|
||||||
// For SOME configs, there is no "route" entries, so, we add some...
|
// 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.contains("routing")) {
|
||||||
if (root["outbounds"].toArray().count() != 1) {
|
if (root["outbounds"].toArray().count() != 1) {
|
||||||
// There are no ROUTING but 2 or more outbounds.... This is rare, but possible.
|
// 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.")
|
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);
|
root.insert("routing", routeObject);
|
||||||
QJsonArray outbounds = root["outbounds"].toArray();
|
QJsonArray outbounds = root["outbounds"].toArray();
|
||||||
outbounds.append(GenerateOutboundEntry("freedom", GenerateFreedomOUT("AsIs", ":0", 0), QJsonObject(), QJsonObject(), "0.0.0.0", OUTBOUND_TAG_DIRECT));
|
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->muxConcurrencyTxt->setValue(CurrentConfig.mux.concurrency);
|
||||||
//
|
//
|
||||||
ui->proxyCNCb->setChecked(CurrentConfig.proxyCN);
|
ui->proxyCNCb->setChecked(CurrentConfig.proxyCN);
|
||||||
ui->proxyDefaultCb->setChecked(CurrentConfig.proxyDefault);
|
ui->proxyDefaultCb->setChecked(CurrentConfig.enableProxy);
|
||||||
ui->localDNSCb->setChecked(CurrentConfig.withLocalDNS);
|
ui->localDNSCb->setChecked(CurrentConfig.withLocalDNS);
|
||||||
//
|
//
|
||||||
ui->DNSListTxt->clear();
|
ui->DNSListTxt->clear();
|
||||||
@ -242,7 +242,7 @@ void PrefrencesWindow::on_proxyCNCb_stateChanged(int arg1)
|
|||||||
void PrefrencesWindow::on_proxyDefaultCb_stateChanged(int arg1)
|
void PrefrencesWindow::on_proxyDefaultCb_stateChanged(int arg1)
|
||||||
{
|
{
|
||||||
NEEDRESTART
|
NEEDRESTART
|
||||||
CurrentConfig.proxyDefault = arg1 == Qt::Checked;
|
CurrentConfig.enableProxy = arg1 == Qt::Checked;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrefrencesWindow::on_localDNSCb_stateChanged(int arg1)
|
void PrefrencesWindow::on_localDNSCb_stateChanged(int arg1)
|
||||||
|
Loading…
Reference in New Issue
Block a user