mirror of
https://github.com/Qv2ray/Qv2ray.git
synced 2025-05-20 19:00:22 +08:00
refactor: refactors for V2rayIntegration
This commit is contained in:
parent
553dc49cf3
commit
0abf4fc9da
@ -1 +1 @@
|
|||||||
5675
|
5676
|
||||||
|
@ -265,7 +265,7 @@ namespace Qv2ray::base::objects
|
|||||||
QList<QString> alpn;
|
QList<QString> alpn;
|
||||||
QList<CertificateObject> certificates;
|
QList<CertificateObject> certificates;
|
||||||
bool disableSystemRoot;
|
bool disableSystemRoot;
|
||||||
TLSObject() : serverName(), allowInsecure(), allowInsecureCiphers(), disableSessionResumption(), certificates(), disableSystemRoot(){};
|
TLSObject() : serverName(), allowInsecure(), allowInsecureCiphers(), disableSessionResumption(true), certificates(), disableSystemRoot(){};
|
||||||
JSONSTRUCT_REGISTER(TLSObject, F(serverName, allowInsecure, allowInsecureCiphers, disableSessionResumption, alpn, certificates, disableSystemRoot))
|
JSONSTRUCT_REGISTER(TLSObject, F(serverName, allowInsecure, allowInsecureCiphers, disableSessionResumption, alpn, certificates, disableSystemRoot))
|
||||||
};
|
};
|
||||||
} // namespace transfer
|
} // namespace transfer
|
||||||
|
@ -94,9 +94,9 @@ namespace Qv2ray::base::config
|
|||||||
struct Qv2rayConfig_Advanced
|
struct Qv2rayConfig_Advanced
|
||||||
{
|
{
|
||||||
bool setAllowInsecure;
|
bool setAllowInsecure;
|
||||||
bool setAllowInsecureCiphers;
|
bool setSessionResumption;
|
||||||
bool testLatencyPeriodcally;
|
bool testLatencyPeriodcally;
|
||||||
JSONSTRUCT_REGISTER(Qv2rayConfig_Advanced, F(setAllowInsecure, setAllowInsecureCiphers, testLatencyPeriodcally))
|
JSONSTRUCT_REGISTER(Qv2rayConfig_Advanced, F(setAllowInsecure, setSessionResumption, testLatencyPeriodcally))
|
||||||
};
|
};
|
||||||
|
|
||||||
enum Qv2rayLatencyTestingMethod
|
enum Qv2rayLatencyTestingMethod
|
||||||
|
@ -16,11 +16,11 @@ namespace Qv2ray::core::connection
|
|||||||
QList<QPair<QString, CONFIGROOT>> connectionConf;
|
QList<QPair<QString, CONFIGROOT>> connectionConf;
|
||||||
const auto mkAllowInsecure = [](QJsonObject &conf) {
|
const auto mkAllowInsecure = [](QJsonObject &conf) {
|
||||||
auto allowI = GlobalConfig.advancedConfig.setAllowInsecure;
|
auto allowI = GlobalConfig.advancedConfig.setAllowInsecure;
|
||||||
auto allowIC = GlobalConfig.advancedConfig.setAllowInsecureCiphers;
|
auto allowSR = GlobalConfig.advancedConfig.setSessionResumption;
|
||||||
if (allowI || allowIC)
|
if (allowI || allowSR)
|
||||||
{
|
{
|
||||||
QJsonIO::SetValue(conf, allowI, "outbounds", 0, "streamSettings", "tlsSettings", "allowInsecure");
|
QJsonIO::SetValue(conf, allowI, "outbounds", 0, "streamSettings", "tlsSettings", "allowInsecure");
|
||||||
QJsonIO::SetValue(conf, allowIC, "outbounds", 0, "streamSettings", "tlsSettings", "allowInsecureCiphers");
|
QJsonIO::SetValue(conf, !allowSR, "outbounds", 0, "streamSettings", "tlsSettings", "disableSessionResumption");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (link.startsWith("vmess://") && link.contains("@"))
|
if (link.startsWith("vmess://") && link.contains("@"))
|
||||||
|
@ -36,31 +36,51 @@ namespace Qv2ray::core::handler
|
|||||||
StopConnection();
|
StopConnection();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<QString> KernelInstanceHandler::StartConnection(const ConnectionGroupPair &id, CONFIGROOT fullConfig)
|
std::optional<QString> KernelInstanceHandler::CheckPort(QMap<QString, QString> hosts, QMap<QString, int> ports, int plugins)
|
||||||
{
|
{
|
||||||
StopConnection();
|
|
||||||
inboundPorts = GetConfigInboundPorts(fullConfig);
|
|
||||||
inboundHosts = GetConfigInboundHosts(fullConfig);
|
|
||||||
//
|
//
|
||||||
// Check inbound port allocation issue.
|
// Check inbound port allocation issue.
|
||||||
QStringList portDetectionErrorMessage;
|
QStringList portDetectionErrorMessage;
|
||||||
auto portDetectionMsg = tr("Another process is using the port required to start the connection:") + NEWLINE + NEWLINE;
|
auto portDetectionMsg = tr("Another process is using the port required to start the connection:") + NEWLINE + NEWLINE;
|
||||||
for (const auto &key : inboundPorts.keys())
|
for (const auto &key : ports.keys())
|
||||||
{
|
{
|
||||||
auto result = components::port::CheckTCPPortStatus(inboundHosts[key], inboundPorts[key]);
|
auto result = components::port::CheckTCPPortStatus(hosts[key], ports[key]);
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
portDetectionErrorMessage << tr("Port: %1 for listening IP: %2 for inbound tag: \"%3\"") //
|
portDetectionErrorMessage << tr("Port: %1 for listening IP: %2 for inbound tag: \"%3\"") //
|
||||||
.arg(inboundPorts[key])
|
.arg(ports[key])
|
||||||
.arg(inboundHosts[key])
|
.arg(hosts[key])
|
||||||
.arg(key);
|
.arg(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (GlobalConfig.pluginConfig.v2rayIntegration)
|
||||||
|
{
|
||||||
|
for (int i = 0; i <= plugins; i++)
|
||||||
|
{
|
||||||
|
auto result = components::port::CheckTCPPortStatus("127.0.0.1", GlobalConfig.pluginConfig.portAllocationStart + i);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
portDetectionErrorMessage << tr("Port: %1 for listening IP: 127.0.0.1 for plugin integration.")
|
||||||
|
.arg(GlobalConfig.pluginConfig.portAllocationStart + i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (!portDetectionErrorMessage.isEmpty())
|
if (!portDetectionErrorMessage.isEmpty())
|
||||||
{
|
{
|
||||||
portDetectionMsg += portDetectionErrorMessage.join(NEWLINE);
|
portDetectionMsg += portDetectionErrorMessage.join(NEWLINE);
|
||||||
return portDetectionMsg;
|
return portDetectionMsg;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return std::nullopt;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::optional<QString> KernelInstanceHandler::StartConnection(const ConnectionGroupPair &id, CONFIGROOT fullConfig)
|
||||||
|
{
|
||||||
|
StopConnection();
|
||||||
|
inboundPorts = GetConfigInboundPorts(fullConfig);
|
||||||
|
inboundHosts = GetConfigInboundHosts(fullConfig);
|
||||||
//
|
//
|
||||||
PluginHost->Send_ConnectivityEvent({ GetDisplayName(id.connectionId), inboundPorts, Events::Connectivity::Connecting });
|
PluginHost->Send_ConnectivityEvent({ GetDisplayName(id.connectionId), inboundPorts, Events::Connectivity::Connecting });
|
||||||
QList<std::tuple<QString, int, QString>> inboundInfo;
|
QList<std::tuple<QString, int, QString>> inboundInfo;
|
||||||
@ -70,7 +90,7 @@ namespace Qv2ray::core::handler
|
|||||||
inboundInfo.push_back({ inbound["protocol"].toString(), inbound["port"].toInt(), inbound["tag"].toString() });
|
inboundInfo.push_back({ inbound["protocol"].toString(), inbound["port"].toInt(), inbound["tag"].toString() });
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
using k = Qv2rayPlugin::QvPluginKernel;
|
using _k_ = Qv2rayPlugin::QvPluginKernel;
|
||||||
if (GlobalConfig.pluginConfig.v2rayIntegration)
|
if (GlobalConfig.pluginConfig.v2rayIntegration)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@ -105,104 +125,112 @@ namespace Qv2ray::core::handler
|
|||||||
//
|
//
|
||||||
QMap<QvPluginKernel::KernelSetting, QVariant> _inboundSettings;
|
QMap<QvPluginKernel::KernelSetting, QVariant> _inboundSettings;
|
||||||
|
|
||||||
_inboundSettings[k::KERNEL_HTTP_ENABLED] = false;
|
_inboundSettings[_k_::KERNEL_HTTP_ENABLED] = false;
|
||||||
_inboundSettings[k::KERNEL_SOCKS_ENABLED] = true;
|
_inboundSettings[_k_::KERNEL_SOCKS_ENABLED] = true;
|
||||||
_inboundSettings.insert(k::KERNEL_SOCKS_PORT, pluginPort);
|
_inboundSettings.insert(_k_::KERNEL_SOCKS_PORT, pluginPort);
|
||||||
LOG(MODULE_VCORE, "V2rayIntegration: " + QSTRN(pluginPort) + "=" + outProtocol)
|
LOG(MODULE_VCORE, "V2rayIntegration: " + QSTRN(pluginPort) + "=" + outProtocol)
|
||||||
|
//
|
||||||
const auto pluginOutSettings = GenerateHTTPSOCKSOut("127.0.0.1", pluginPort, false, "", "");
|
const auto pluginOutSettings = GenerateHTTPSOCKSOut("127.0.0.1", pluginPort, false, "", "");
|
||||||
const auto pluginOut = GenerateOutboundEntry("socks", pluginOutSettings, {}, {}, "0.0.0.0", outbound["tag"].toString());
|
const auto pluginOut = GenerateOutboundEntry("socks", pluginOutSettings, {}, {}, "0.0.0.0", outbound["tag"].toString());
|
||||||
//
|
//
|
||||||
// Add the integration outbound to the list.
|
// Add the integration outbound to the list.
|
||||||
processedOutbounds.push_back(pluginOut);
|
processedOutbounds.push_back(pluginOut);
|
||||||
|
|
||||||
pluginPort++;
|
pluginPort++;
|
||||||
|
//
|
||||||
_inboundSettings[k::KERNEL_SOCKS_UDP_ENABLED] = GlobalConfig.inboundConfig.socksSettings.enableUDP;
|
_inboundSettings[_k_::KERNEL_SOCKS_UDP_ENABLED] = GlobalConfig.inboundConfig.socksSettings.enableUDP;
|
||||||
_inboundSettings[k::KERNEL_SOCKS_LOCAL_ADDRESS] = GlobalConfig.inboundConfig.socksSettings.localIP;
|
_inboundSettings[_k_::KERNEL_SOCKS_LOCAL_ADDRESS] = GlobalConfig.inboundConfig.socksSettings.localIP;
|
||||||
_inboundSettings[k::KERNEL_LISTEN_ADDRESS] = "127.0.0.1";
|
_inboundSettings[_k_::KERNEL_LISTEN_ADDRESS] = "127.0.0.1";
|
||||||
LOG(MODULE_CONNECTION, "Sending connection settings to kernel.")
|
LOG(MODULE_CONNECTION, "Sending connection settings to kernel.")
|
||||||
activeKernels[outProtocol]->SetConnectionSettings(_inboundSettings, outbound["settings"].toObject());
|
activeKernels[outProtocol]->SetConnectionSettings(_inboundSettings, outbound["settings"].toObject());
|
||||||
}
|
}
|
||||||
LOG(MODULE_CONNECTION, "Applying new outbound settings.")
|
LOG(MODULE_CONNECTION, "Applying new outbound settings.")
|
||||||
fullConfig["outbounds"] = processedOutbounds;
|
fullConfig["outbounds"] = processedOutbounds;
|
||||||
}
|
}
|
||||||
//
|
RemoveEmptyMuxFilter(fullConfig);
|
||||||
// Process routing entries
|
}
|
||||||
//
|
//
|
||||||
// No needs to process routing entries since each plugin is map to an unique outbound with the same tag.
|
// ======================================================================= Start Kernels
|
||||||
//
|
//
|
||||||
// ================================================================================================
|
{
|
||||||
//
|
const auto portResult = CheckPort(inboundHosts, inboundPorts, activeKernels.size());
|
||||||
bool hasAllKernelStarted = true;
|
if (portResult)
|
||||||
for (auto &[kernel, kernelObject] : activeKernels)
|
|
||||||
{
|
{
|
||||||
LOG(MODULE_CONNECTION, "Starting kernel: " + kernel)
|
LOG(MODULE_CONNECTION, ACCESS_OPTIONAL_VALUE(portResult))
|
||||||
bool status = kernelObject->StartKernel();
|
return portResult;
|
||||||
connect(kernelObject.get(), &QvPluginKernel::OnKernelCrashed, this, &KernelInstanceHandler::OnKernelCrashed_p);
|
}
|
||||||
connect(kernelObject.get(), &QvPluginKernel::OnKernelLogAvailable, this, &KernelInstanceHandler::OnKernelLog_p);
|
auto firstOutbound = fullConfig["outbounds"].toArray().first().toObject();
|
||||||
hasAllKernelStarted = hasAllKernelStarted && status;
|
const auto firstOutboundProtocol = firstOutbound["protocol"].toString();
|
||||||
if (!status)
|
if (GlobalConfig.pluginConfig.v2rayIntegration)
|
||||||
|
{
|
||||||
|
LOG(MODULE_VCORE, "Starting kernels with V2rayIntegration.")
|
||||||
|
bool hasAllKernelStarted = true;
|
||||||
|
for (auto &[kernel, kernelObject] : activeKernels)
|
||||||
{
|
{
|
||||||
LOG(MODULE_CONNECTION, "Plugin Kernel: " + kernel + " failed to start.")
|
LOG(MODULE_CONNECTION, "Starting kernel: " + kernel)
|
||||||
break;
|
bool status = kernelObject->StartKernel();
|
||||||
|
connect(kernelObject.get(), &QvPluginKernel::OnKernelCrashed, this, &KernelInstanceHandler::OnKernelCrashed_p);
|
||||||
|
connect(kernelObject.get(), &QvPluginKernel::OnKernelLogAvailable, this, &KernelInstanceHandler::OnKernelLog_p);
|
||||||
|
hasAllKernelStarted = hasAllKernelStarted && status;
|
||||||
|
if (!status)
|
||||||
|
{
|
||||||
|
LOG(MODULE_CONNECTION, "Plugin Kernel: " + kernel + " failed to start.")
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!hasAllKernelStarted)
|
||||||
|
{
|
||||||
|
StopConnection();
|
||||||
|
return tr("A plugin kernel failed to start. Please check the outbound settings.");
|
||||||
|
}
|
||||||
|
currentId = id;
|
||||||
|
//
|
||||||
|
// Also start V2ray-core.
|
||||||
|
auto result = vCoreInstance->StartConnection(fullConfig);
|
||||||
|
//
|
||||||
|
if (result.has_value())
|
||||||
|
{
|
||||||
|
StopConnection();
|
||||||
|
PluginHost->Send_ConnectivityEvent({ GetDisplayName(id.connectionId), inboundPorts, Events::Connectivity::Disconnected });
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
emit OnConnected(id);
|
||||||
|
PluginHost->Send_ConnectivityEvent({ GetDisplayName(id.connectionId), inboundPorts, Events::Connectivity::Connected });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!hasAllKernelStarted)
|
else if (outboundKernelMap.contains(firstOutboundProtocol))
|
||||||
{
|
{
|
||||||
StopConnection();
|
LOG(MODULE_CONNECTION, "Starting kernel " + firstOutboundProtocol + " without V2ray Integration")
|
||||||
return tr("A plugin kernel failed to start. Please check the outbound settings.");
|
|
||||||
}
|
|
||||||
currentId = id;
|
|
||||||
//
|
|
||||||
// Also start V2ray-core.
|
|
||||||
auto result = vCoreInstance->StartConnection(fullConfig);
|
|
||||||
//
|
|
||||||
if (result.has_value())
|
|
||||||
{
|
|
||||||
StopConnection();
|
|
||||||
PluginHost->Send_ConnectivityEvent({ GetDisplayName(id.connectionId), inboundPorts, Events::Connectivity::Disconnected });
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
emit OnConnected(id);
|
|
||||||
PluginHost->Send_ConnectivityEvent({ GetDisplayName(id.connectionId), inboundPorts, Events::Connectivity::Connected });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
LOG(MODULE_CONNECTION, "Starting kernel without V2ray Integration")
|
|
||||||
auto firstOutbound = fullConfig["outbounds"].toArray().first().toObject();
|
|
||||||
const auto protocol = firstOutbound["protocol"].toString();
|
|
||||||
if (outboundKernelMap.contains(protocol))
|
|
||||||
{
|
|
||||||
LOG(MODULE_CONNECTION, "Found existing kernel for: " + protocol)
|
|
||||||
{
|
{
|
||||||
auto kernel = PluginHost->CreatePluginKernel(outboundKernelMap[firstOutbound["protocol"].toString()]);
|
auto kernel = PluginHost->CreatePluginKernel(outboundKernelMap[firstOutbound["protocol"].toString()]);
|
||||||
activeKernels[protocol] = std::move(kernel);
|
activeKernels[firstOutboundProtocol] = std::move(kernel);
|
||||||
}
|
}
|
||||||
|
#define kernel (activeKernels[firstOutboundProtocol].get())
|
||||||
|
connect(kernel, &QvPluginKernel::OnKernelStatsAvailable, this, &KernelInstanceHandler::OnStatsDataRcvd_p);
|
||||||
|
connect(kernel, &QvPluginKernel::OnKernelCrashed, this, &KernelInstanceHandler::OnKernelCrashed_p);
|
||||||
|
connect(kernel, &QvPluginKernel::OnKernelLogAvailable, this, &KernelInstanceHandler::OnKernelLog_p);
|
||||||
|
#undef kernel
|
||||||
|
currentId = id;
|
||||||
|
//
|
||||||
QMap<QvPluginKernel::KernelSetting, QVariant> pluginInboundPort;
|
QMap<QvPluginKernel::KernelSetting, QVariant> pluginInboundPort;
|
||||||
|
|
||||||
for (const auto &[_protocol, _port, _tag] : inboundInfo)
|
for (const auto &[_protocol, _port, _tag] : inboundInfo)
|
||||||
{
|
{
|
||||||
if (_protocol != "http" && _protocol != "socks")
|
if (_protocol != "http" && _protocol != "socks")
|
||||||
continue;
|
continue;
|
||||||
pluginInboundPort[k::KERNEL_HTTP_ENABLED] = pluginInboundPort[k::KERNEL_HTTP_ENABLED].toBool() || _protocol == "http";
|
pluginInboundPort[_k_::KERNEL_HTTP_ENABLED] = pluginInboundPort[_k_::KERNEL_HTTP_ENABLED].toBool() || _protocol == "http";
|
||||||
pluginInboundPort[k::KERNEL_SOCKS_ENABLED] = pluginInboundPort[k::KERNEL_SOCKS_ENABLED].toBool() || _protocol == "socks";
|
pluginInboundPort[_k_::KERNEL_SOCKS_ENABLED] = pluginInboundPort[_k_::KERNEL_SOCKS_ENABLED].toBool() || _protocol == "socks";
|
||||||
pluginInboundPort.insert(_protocol.toLower() == "http" ? k::KERNEL_HTTP_PORT : k::KERNEL_SOCKS_PORT, _port);
|
pluginInboundPort.insert(_protocol.toLower() == "http" ? _k_::KERNEL_HTTP_PORT : _k_::KERNEL_SOCKS_PORT, _port);
|
||||||
}
|
}
|
||||||
connect(activeKernels[protocol].get(), &QvPluginKernel::OnKernelStatsAvailable, this, &KernelInstanceHandler::OnStatsDataRcvd_p);
|
|
||||||
connect(activeKernels[protocol].get(), &QvPluginKernel::OnKernelCrashed, this, &KernelInstanceHandler::OnKernelCrashed_p);
|
|
||||||
connect(activeKernels[protocol].get(), &QvPluginKernel::OnKernelLogAvailable, this, &KernelInstanceHandler::OnKernelLog_p);
|
|
||||||
currentId = id;
|
|
||||||
//
|
|
||||||
pluginInboundPort[k::KERNEL_SOCKS_UDP_ENABLED] = GlobalConfig.inboundConfig.socksSettings.enableUDP;
|
|
||||||
pluginInboundPort[k::KERNEL_SOCKS_LOCAL_ADDRESS] = GlobalConfig.inboundConfig.socksSettings.localIP;
|
|
||||||
pluginInboundPort[k::KERNEL_LISTEN_ADDRESS] = GlobalConfig.inboundConfig.listenip;
|
|
||||||
//
|
|
||||||
activeKernels[protocol]->SetConnectionSettings(pluginInboundPort, firstOutbound["settings"].toObject());
|
|
||||||
|
|
||||||
bool kernelStarted = activeKernels[protocol]->StartKernel();
|
pluginInboundPort[_k_::KERNEL_SOCKS_UDP_ENABLED] = GlobalConfig.inboundConfig.socksSettings.enableUDP;
|
||||||
|
pluginInboundPort[_k_::KERNEL_SOCKS_LOCAL_ADDRESS] = GlobalConfig.inboundConfig.socksSettings.localIP;
|
||||||
|
pluginInboundPort[_k_::KERNEL_LISTEN_ADDRESS] = GlobalConfig.inboundConfig.listenip;
|
||||||
|
//
|
||||||
|
activeKernels[firstOutboundProtocol]->SetConnectionSettings(pluginInboundPort, firstOutbound["settings"].toObject());
|
||||||
|
|
||||||
|
bool kernelStarted = activeKernels[firstOutboundProtocol]->StartKernel();
|
||||||
if (kernelStarted)
|
if (kernelStarted)
|
||||||
{
|
{
|
||||||
emit OnConnected(id);
|
emit OnConnected(id);
|
||||||
@ -216,7 +244,7 @@ namespace Qv2ray::core::handler
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LOG(MODULE_CONNECTION, "Starting V2ray without kernel")
|
LOG(MODULE_CONNECTION, "Starting V2ray without plugin.")
|
||||||
currentId = id;
|
currentId = id;
|
||||||
auto result = vCoreInstance->StartConnection(fullConfig);
|
auto result = vCoreInstance->StartConnection(fullConfig);
|
||||||
if (result.has_value())
|
if (result.has_value())
|
||||||
|
@ -20,6 +20,10 @@ namespace Qv2ray::core::handler
|
|||||||
{
|
{
|
||||||
return currentId;
|
return currentId;
|
||||||
}
|
}
|
||||||
|
int ActivePluginKernelsCount() const
|
||||||
|
{
|
||||||
|
return activeKernels.size();
|
||||||
|
}
|
||||||
const QMap<QString, int> InboundPorts() const
|
const QMap<QString, int> InboundPorts() const
|
||||||
{
|
{
|
||||||
return inboundPorts;
|
return inboundPorts;
|
||||||
@ -41,6 +45,9 @@ namespace Qv2ray::core::handler
|
|||||||
void OnKernelLog_p(const QString &log);
|
void OnKernelLog_p(const QString &log);
|
||||||
void OnStatsDataRcvd_p(const quint64 uploadSpeed, const quint64 downloadSpeed);
|
void OnStatsDataRcvd_p(const quint64 uploadSpeed, const quint64 downloadSpeed);
|
||||||
|
|
||||||
|
private:
|
||||||
|
static std::optional<QString> CheckPort(QMap<QString, QString> hosts, QMap<QString, int> ports, int plugins);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QMap<QString, QString> outboundKernelMap;
|
QMap<QString, QString> outboundKernelMap;
|
||||||
// Since QMap does not support std::unique_ptr, we use std::map<>
|
// Since QMap does not support std::unique_ptr, we use std::map<>
|
||||||
|
@ -143,6 +143,7 @@ PreferencesWindow::PreferencesWindow(QWidget *parent) : QvDialog(parent), Curren
|
|||||||
//
|
//
|
||||||
pluginKernelV2rayIntegrationCB->setChecked(CurrentConfig.pluginConfig.v2rayIntegration);
|
pluginKernelV2rayIntegrationCB->setChecked(CurrentConfig.pluginConfig.v2rayIntegration);
|
||||||
pluginKernelPortAllocateCB->setValue(CurrentConfig.pluginConfig.portAllocationStart);
|
pluginKernelPortAllocateCB->setValue(CurrentConfig.pluginConfig.portAllocationStart);
|
||||||
|
pluginKernelPortAllocateCB->setEnabled(CurrentConfig.pluginConfig.v2rayIntegration);
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
latencyTCPingRB->setChecked(CurrentConfig.networkConfig.latencyTestingMethod == TCPING);
|
latencyTCPingRB->setChecked(CurrentConfig.networkConfig.latencyTestingMethod == TCPING);
|
||||||
@ -163,7 +164,7 @@ PreferencesWindow::PreferencesWindow(QWidget *parent) : QvDialog(parent), Curren
|
|||||||
//
|
//
|
||||||
// Advanced config.
|
// Advanced config.
|
||||||
setAllowInsecureCB->setChecked(CurrentConfig.advancedConfig.setAllowInsecure);
|
setAllowInsecureCB->setChecked(CurrentConfig.advancedConfig.setAllowInsecure);
|
||||||
setAllowInsecureCiphersCB->setChecked(CurrentConfig.advancedConfig.setAllowInsecureCiphers);
|
setSessionResumptionCB->setChecked(CurrentConfig.advancedConfig.setSessionResumption);
|
||||||
setTestLatenctCB->setChecked(CurrentConfig.advancedConfig.testLatencyPeriodcally);
|
setTestLatenctCB->setChecked(CurrentConfig.advancedConfig.testLatencyPeriodcally);
|
||||||
//
|
//
|
||||||
dnsSettingsWidget = new DnsSettingsWidget(this);
|
dnsSettingsWidget = new DnsSettingsWidget(this);
|
||||||
@ -854,12 +855,17 @@ void PreferencesWindow::on_updateChannelCombo_currentIndexChanged(int index)
|
|||||||
void PreferencesWindow::on_pluginKernelV2rayIntegrationCB_stateChanged(int arg1)
|
void PreferencesWindow::on_pluginKernelV2rayIntegrationCB_stateChanged(int arg1)
|
||||||
{
|
{
|
||||||
LOADINGCHECK
|
LOADINGCHECK
|
||||||
|
if (KernelInstance->ActivePluginKernelsCount() > 0)
|
||||||
|
NEEDRESTART;
|
||||||
CurrentConfig.pluginConfig.v2rayIntegration = arg1 == Qt::Checked;
|
CurrentConfig.pluginConfig.v2rayIntegration = arg1 == Qt::Checked;
|
||||||
|
pluginKernelPortAllocateCB->setEnabled(arg1 == Qt::Checked);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PreferencesWindow::on_pluginKernelPortAllocateCB_valueChanged(int arg1)
|
void PreferencesWindow::on_pluginKernelPortAllocateCB_valueChanged(int arg1)
|
||||||
{
|
{
|
||||||
LOADINGCHECK
|
LOADINGCHECK
|
||||||
|
if (KernelInstance->ActivePluginKernelsCount() > 0)
|
||||||
|
NEEDRESTART;
|
||||||
CurrentConfig.pluginConfig.portAllocationStart = arg1;
|
CurrentConfig.pluginConfig.portAllocationStart = arg1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -901,14 +907,14 @@ void PreferencesWindow::on_setTestLatenctCB_stateChanged(int arg1)
|
|||||||
CurrentConfig.advancedConfig.testLatencyPeriodcally = arg1 == Qt::Checked;
|
CurrentConfig.advancedConfig.testLatencyPeriodcally = arg1 == Qt::Checked;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PreferencesWindow::on_setAllowInsecureCiphersCB_stateChanged(int arg1)
|
void PreferencesWindow::on_setSessionResumptionCB_stateChanged(int arg1)
|
||||||
{
|
{
|
||||||
LOADINGCHECK
|
LOADINGCHECK
|
||||||
if (arg1 == Qt::Checked)
|
if (arg1 == Qt::Checked)
|
||||||
{
|
{
|
||||||
QvMessageBoxWarn(this, tr("Dangerous Operation"), tr("You will lose the advantage of TLS and make your connection under MITM attack."));
|
QvMessageBoxWarn(this, tr("Dangerous Operation"), tr("This will make your TLS fingerpring different from common golang programs."));
|
||||||
}
|
}
|
||||||
CurrentConfig.advancedConfig.setAllowInsecureCiphers = arg1 == Qt::Checked;
|
CurrentConfig.advancedConfig.setSessionResumption = arg1 == Qt::Checked;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PreferencesWindow::on_quietModeCB_stateChanged(int arg1)
|
void PreferencesWindow::on_quietModeCB_stateChanged(int arg1)
|
||||||
|
@ -97,7 +97,7 @@ class PreferencesWindow
|
|||||||
void on_qvProxyPortCB_valueChanged(int arg1);
|
void on_qvProxyPortCB_valueChanged(int arg1);
|
||||||
void on_setAllowInsecureCB_stateChanged(int arg1);
|
void on_setAllowInsecureCB_stateChanged(int arg1);
|
||||||
void on_setTestLatenctCB_stateChanged(int arg1);
|
void on_setTestLatenctCB_stateChanged(int arg1);
|
||||||
void on_setAllowInsecureCiphersCB_stateChanged(int arg1);
|
void on_setSessionResumptionCB_stateChanged(int arg1);
|
||||||
void on_quietModeCB_stateChanged(int arg1);
|
void on_quietModeCB_stateChanged(int arg1);
|
||||||
void on_tproxGroupBox_toggled(bool arg1);
|
void on_tproxGroupBox_toggled(bool arg1);
|
||||||
void on_tProxyPort_valueChanged(int arg1);
|
void on_tProxyPort_valueChanged(int arg1);
|
||||||
|
@ -608,7 +608,7 @@ But could damage your server if improperly used.</string>
|
|||||||
<item row="2" column="0">
|
<item row="2" column="0">
|
||||||
<widget class="QLabel" name="label_85">
|
<widget class="QLabel" name="label_85">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Set AllowInsecureCiphers By Default</string>
|
<string>Enable SessionResumption By Default</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="textFormat">
|
<property name="textFormat">
|
||||||
<enum>Qt::PlainText</enum>
|
<enum>Qt::PlainText</enum>
|
||||||
@ -616,7 +616,7 @@ But could damage your server if improperly used.</string>
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="1">
|
<item row="2" column="1">
|
||||||
<widget class="QCheckBox" name="setAllowInsecureCiphersCB">
|
<widget class="QCheckBox" name="setSessionResumptionCB">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Enabled</string>
|
<string>Enabled</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -1341,7 +1341,7 @@ But could dramatically damage your server if improperly used.</source>
|
|||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Set AllowInsecureCiphers By Default</source>
|
<source>Enable SessionResumption By Default</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
@ -1765,6 +1765,10 @@ Custom DNS Settings</source>
|
|||||||
<source>You will lose the advantage of TLS and make your connection under MITM attack.</source>
|
<source>You will lose the advantage of TLS and make your connection under MITM attack.</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>This will make your TLS fingerpring different from common golang programs.</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>This will (probably) make it easy to fingerprint your connection.</source>
|
<source>This will (probably) make it easy to fingerprint your connection.</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
|
@ -1462,6 +1462,10 @@
|
|||||||
<source>You will lose the advantage of TLS and make your connection under MITM attack.</source>
|
<source>You will lose the advantage of TLS and make your connection under MITM attack.</source>
|
||||||
<translation>TLSの保護を失い、MITMの攻撃を受ける可能性が高くなります。</translation>
|
<translation>TLSの保護を失い、MITMの攻撃を受ける可能性が高くなります。</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>This will make your TLS fingerpring different from common golang programs.</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>This will (probably) make it easy to fingerprint your connection.</source>
|
<source>This will (probably) make it easy to fingerprint your connection.</source>
|
||||||
<translation>そのため、(おそらく)あなたの接続が特定しやすくなります。</translation>
|
<translation>そのため、(おそらく)あなたの接続が特定しやすくなります。</translation>
|
||||||
@ -1789,8 +1793,8 @@ But could dramatically damage your server if improperly used.</source>
|
|||||||
しかし、不適切な使用の場合、不都合が生じる可能性があります。</translation>
|
しかし、不適切な使用の場合、不都合が生じる可能性があります。</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Set AllowInsecureCiphers By Default</source>
|
<source>Enable SessionResumption By Default</source>
|
||||||
<translation>デフォルトで AllowInsecureCiphers を設定する</translation>
|
<translation>デフォルトで SessionResumption を有効にする</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>IPv4 address, e.g. '127.0.0.1'</source>
|
<source>IPv4 address, e.g. '127.0.0.1'</source>
|
||||||
|
@ -1458,6 +1458,10 @@
|
|||||||
<source>You will lose the advantage of TLS and make your connection under MITM attack.</source>
|
<source>You will lose the advantage of TLS and make your connection under MITM attack.</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>This will make your TLS fingerpring different from common golang programs.</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>This will (probably) make it easy to fingerprint your connection.</source>
|
<source>This will (probably) make it easy to fingerprint your connection.</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
@ -1780,7 +1784,7 @@ But could dramatically damage your server if improperly used.</source>
|
|||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Set AllowInsecureCiphers By Default</source>
|
<source>Enable SessionResumption By Default</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
|
@ -1442,6 +1442,10 @@
|
|||||||
<source>You will lose the advantage of TLS and make your connection under MITM attack.</source>
|
<source>You will lose the advantage of TLS and make your connection under MITM attack.</source>
|
||||||
<translation>你会失去 TLS 的保护,并可能使您的连接受害于中间人攻击(MitM)。</translation>
|
<translation>你会失去 TLS 的保护,并可能使您的连接受害于中间人攻击(MitM)。</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>这将使你的 TLS 指纹与常见的 golang 程序不同。</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>This will (probably) make it easy to fingerprint your connection.</source>
|
<source>This will (probably) make it easy to fingerprint your connection.</source>
|
||||||
<translation>这将让 GFW 更容易识别出您的连接。</translation>
|
<translation>这将让 GFW 更容易识别出您的连接。</translation>
|
||||||
@ -1789,8 +1793,8 @@ But could dramatically damage your server if improperly used.</source>
|
|||||||
但若使用不当,可能会造成负面影响。</translation>
|
但若使用不当,可能会造成负面影响。</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Set AllowInsecureCiphers By Default</source>
|
<source>Enable SessionResumption By Default</source>
|
||||||
<translation>默认设置 AllowInsecureCiphers</translation>
|
<translation>默认允许 SessionResumption</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>IPv4 address, e.g. '127.0.0.1'</source>
|
<source>IPv4 address, e.g. '127.0.0.1'</source>
|
||||||
|
Loading…
Reference in New Issue
Block a user