mirror of
https://github.com/amnezia-vpn/amnezia-client.git
synced 2026-06-23 02:00:20 +07:00
Cleaning Cloak version files
Related to https://github.com/amnezia-vpn/amnezia-client/pull/227
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
cmake_minimum_required(VERSION 3.25.0 FATAL_ERROR)
|
cmake_minimum_required(VERSION 3.25.0 FATAL_ERROR)
|
||||||
|
|
||||||
set(PROJECT AmneziaVPN)
|
set(PROJECT AmneziaVPN)
|
||||||
project(${PROJECT} VERSION 2.1.2)
|
project(${PROJECT} VERSION 3.0.5)
|
||||||
set(BUILD_ID 1)
|
set(BUILD_ID 2)
|
||||||
SET(QT_BUILD_TOOLS_WHEN_CROSS_COMPILING ON)
|
SET(QT_BUILD_TOOLS_WHEN_CROSS_COMPILING ON)
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
@@ -40,7 +40,7 @@ set(LIBS ${LIBS}
|
|||||||
Qt6::Core5Compat Qt6::Concurrent
|
Qt6::Core5Compat Qt6::Concurrent
|
||||||
)
|
)
|
||||||
|
|
||||||
qt_standard_project_setup()
|
#qt_standard_project_setup()
|
||||||
|
|
||||||
if(IOS)
|
if(IOS)
|
||||||
execute_process(COMMAND bash ${CMAKE_CURRENT_LIST_DIR}/scripts/run-build-cloak.sh)
|
execute_process(COMMAND bash ${CMAKE_CURRENT_LIST_DIR}/scripts/run-build-cloak.sh)
|
||||||
|
|||||||
@@ -38,15 +38,11 @@ bool IOSVpnProtocol::initialize()
|
|||||||
{
|
{
|
||||||
qDebug() << "Initializing Swift Controller";
|
qDebug() << "Initializing Swift Controller";
|
||||||
|
|
||||||
|
|
||||||
qDebug() << "RECEIVED CONFIG FROM SERVER SIDE =>";
|
qDebug() << "RECEIVED CONFIG FROM SERVER SIDE =>";
|
||||||
// qDebug() << QJsonDocument(m_rawConfig).toJson();
|
|
||||||
|
|
||||||
if (!m_controller) {
|
if (!m_controller) {
|
||||||
bool ok;
|
bool ok;
|
||||||
QtJson::JsonObject result = QtJson::parse(QJsonDocument(m_rawConfig).toJson(), ok).toMap();
|
QtJson::JsonObject result = QtJson::parse(QJsonDocument(m_rawConfig).toJson(), ok).toMap();
|
||||||
// QString cloakConfig = result["cloak_config_data"].toMap()();
|
|
||||||
// qDebug() << "cloakConfig: " << cloakConfig;
|
|
||||||
if(!ok) {
|
if(!ok) {
|
||||||
qDebug() << QString("An error occurred during parsing");
|
qDebug() << QString("An error occurred during parsing");
|
||||||
return false;
|
return false;
|
||||||
@@ -79,9 +75,6 @@ ErrorCode IOSVpnProtocol::start()
|
|||||||
{
|
{
|
||||||
bool ok;
|
bool ok;
|
||||||
QtJson::JsonObject result = QtJson::parse(QJsonDocument(m_rawConfig).toJson(), ok).toMap();
|
QtJson::JsonObject result = QtJson::parse(QJsonDocument(m_rawConfig).toJson(), ok).toMap();
|
||||||
qDebug() << "current protocol: " << currentProto;
|
|
||||||
qDebug() << "new protocol: " << m_protocol;
|
|
||||||
qDebug() << "config: " << result.toStdMap();
|
|
||||||
|
|
||||||
if(!ok) {
|
if(!ok) {
|
||||||
qDebug() << QString("An error occurred during config parsing");
|
qDebug() << QString("An error occurred during config parsing");
|
||||||
@@ -160,11 +153,6 @@ void IOSVpnProtocol::stop()
|
|||||||
{
|
{
|
||||||
if (!m_controller) {
|
if (!m_controller) {
|
||||||
qDebug() << "Not correctly initialized";
|
qDebug() << "Not correctly initialized";
|
||||||
|
|
||||||
// dispatch_async(dispatch_get_main_queue(), ^{
|
|
||||||
// emit connectionStateChanged(Disconnected);
|
|
||||||
// });
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -284,10 +272,6 @@ void IOSVpnProtocol::setupWireguardProtocol(const QtJson::JsonObject &result)
|
|||||||
QString privateKey = config["client_priv_key"].toString();
|
QString privateKey = config["client_priv_key"].toString();
|
||||||
QByteArray key = QByteArray::fromBase64(privateKey.toLocal8Bit());
|
QByteArray key = QByteArray::fromBase64(privateKey.toLocal8Bit());
|
||||||
|
|
||||||
qDebug() << " - " << "client_priv_key: " << config["client_priv_key"].toString();
|
|
||||||
qDebug() << " - " << "client_pub_key: " << config["client_pub_key"].toString();
|
|
||||||
qDebug() << " - " << "interface config: " << config["config"].toString();
|
|
||||||
|
|
||||||
QString addr = config["config"].toString().split("\n").takeAt(1).split(" = ").takeLast();
|
QString addr = config["config"].toString().split("\n").takeAt(1).split(" = ").takeLast();
|
||||||
QString dns = config["config"].toString().split("\n").takeAt(2).split(" = ").takeLast();
|
QString dns = config["config"].toString().split("\n").takeAt(2).split(" = ").takeLast();
|
||||||
QString privkey = config["config"].toString().split("\n").takeAt(3).split(" = ").takeLast();
|
QString privkey = config["config"].toString().split("\n").takeAt(3).split(" = ").takeLast();
|
||||||
@@ -296,18 +280,6 @@ void IOSVpnProtocol::setupWireguardProtocol(const QtJson::JsonObject &result)
|
|||||||
QString allowedips = config["config"].toString().split("\n").takeAt(8).split(" = ").takeLast();
|
QString allowedips = config["config"].toString().split("\n").takeAt(8).split(" = ").takeLast();
|
||||||
QString endpoint = config["config"].toString().split("\n").takeAt(9).split(" = ").takeLast();
|
QString endpoint = config["config"].toString().split("\n").takeAt(9).split(" = ").takeLast();
|
||||||
QString keepalive = config["config"].toString().split("\n").takeAt(10).split(" = ").takeLast();
|
QString keepalive = config["config"].toString().split("\n").takeAt(10).split(" = ").takeLast();
|
||||||
qDebug() << " - " << "[Interface] address: " << addr;
|
|
||||||
qDebug() << " - " << "[Interface] dns: " << dns;
|
|
||||||
qDebug() << " - " << "[Interface] private key: " << privkey;
|
|
||||||
qDebug() << " - " << "[Peer] public key: " << pubkey;
|
|
||||||
qDebug() << " - " << "[Peer] preshared key: " << presharedkey;
|
|
||||||
qDebug() << " - " << "[Peer] allowed ips: " << allowedips;
|
|
||||||
qDebug() << " - " << "[Peer] endpoint: " << endpoint;
|
|
||||||
qDebug() << " - " << "[Peer] keepalive: " << keepalive;
|
|
||||||
|
|
||||||
qDebug() << " - " << "hostName: " << config["hostName"].toString();
|
|
||||||
qDebug() << " - " << "psk_key: " << config["psk_key"].toString();
|
|
||||||
qDebug() << " - " << "server_pub_key: " << config["server_pub_key"].toString();
|
|
||||||
|
|
||||||
m_controller = [[IOSVpnProtocolImpl alloc] initWithBundleID:@VPN_NE_BUNDLEID
|
m_controller = [[IOSVpnProtocolImpl alloc] initWithBundleID:@VPN_NE_BUNDLEID
|
||||||
privateKey:key.toNSData()
|
privateKey:key.toNSData()
|
||||||
@@ -329,7 +301,6 @@ void IOSVpnProtocol::setupWireguardProtocol(const QtJson::JsonObject &result)
|
|||||||
}
|
}
|
||||||
case ConnectionStateConnected: {
|
case ConnectionStateConnected: {
|
||||||
Q_ASSERT(date);
|
Q_ASSERT(date);
|
||||||
// QDateTime qtDate(QDateTime::fromNSDate(date));
|
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
emit connectionStateChanged(VpnConnectionState::Connected);
|
emit connectionStateChanged(VpnConnectionState::Connected);
|
||||||
m_isChangingState = false;
|
m_isChangingState = false;
|
||||||
@@ -337,7 +308,6 @@ void IOSVpnProtocol::setupWireguardProtocol(const QtJson::JsonObject &result)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case ConnectionStateDisconnected:
|
case ConnectionStateDisconnected:
|
||||||
// Just in case we are connecting, let's call disconnect.
|
|
||||||
[m_controller disconnect];
|
[m_controller disconnect];
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
emit connectionStateChanged(VpnConnectionState::Disconnected);
|
emit connectionStateChanged(VpnConnectionState::Disconnected);
|
||||||
@@ -375,7 +345,6 @@ void IOSVpnProtocol::setupCloakProtocol(const QtJson::JsonObject &result)
|
|||||||
qDebug() << QJsonDocument(m_rawConfig).toJson();
|
qDebug() << QJsonDocument(m_rawConfig).toJson();
|
||||||
QtJson::JsonObject ovpn = result["openvpn_config_data"].toMap();
|
QtJson::JsonObject ovpn = result["openvpn_config_data"].toMap();
|
||||||
QString ovpnConfig = ovpn["config"].toString();
|
QString ovpnConfig = ovpn["config"].toString();
|
||||||
// qDebug() << ovpn;
|
|
||||||
|
|
||||||
m_controller = [[IOSVpnProtocolImpl alloc] initWithBundleID:@VPN_NE_BUNDLEID
|
m_controller = [[IOSVpnProtocolImpl alloc] initWithBundleID:@VPN_NE_BUNDLEID
|
||||||
config:ovpnConfig.toNSString()
|
config:ovpnConfig.toNSString()
|
||||||
@@ -395,7 +364,6 @@ void IOSVpnProtocol::setupCloakProtocol(const QtJson::JsonObject &result)
|
|||||||
}
|
}
|
||||||
case ConnectionStateConnected: {
|
case ConnectionStateConnected: {
|
||||||
Q_ASSERT(date);
|
Q_ASSERT(date);
|
||||||
// QDateTime qtDate(QDateTime::fromNSDate(date));
|
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
emit connectionStateChanged(VpnConnectionState::Connected);
|
emit connectionStateChanged(VpnConnectionState::Connected);
|
||||||
m_isChangingState = false;
|
m_isChangingState = false;
|
||||||
@@ -404,7 +372,6 @@ void IOSVpnProtocol::setupCloakProtocol(const QtJson::JsonObject &result)
|
|||||||
}
|
}
|
||||||
case ConnectionStateDisconnected:
|
case ConnectionStateDisconnected:
|
||||||
// Just in case we are connecting, let's call disconnect.
|
// Just in case we are connecting, let's call disconnect.
|
||||||
// [m_controller disconnect];
|
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
emit connectionStateChanged(VpnConnectionState::Disconnected);
|
emit connectionStateChanged(VpnConnectionState::Disconnected);
|
||||||
m_isChangingState = false;
|
m_isChangingState = false;
|
||||||
@@ -441,7 +408,6 @@ void IOSVpnProtocol::setupOpenVPNProtocol(const QtJson::JsonObject &result)
|
|||||||
|
|
||||||
QtJson::JsonObject ovpn = result["openvpn_config_data"].toMap();
|
QtJson::JsonObject ovpn = result["openvpn_config_data"].toMap();
|
||||||
QString ovpnConfig = ovpn["config"].toString();
|
QString ovpnConfig = ovpn["config"].toString();
|
||||||
// qDebug() << ovpn;
|
|
||||||
|
|
||||||
m_controller = [[IOSVpnProtocolImpl alloc] initWithBundleID:@VPN_NE_BUNDLEID
|
m_controller = [[IOSVpnProtocolImpl alloc] initWithBundleID:@VPN_NE_BUNDLEID
|
||||||
config:ovpnConfig.toNSString()
|
config:ovpnConfig.toNSString()
|
||||||
@@ -461,7 +427,6 @@ void IOSVpnProtocol::setupOpenVPNProtocol(const QtJson::JsonObject &result)
|
|||||||
}
|
}
|
||||||
case ConnectionStateConnected: {
|
case ConnectionStateConnected: {
|
||||||
Q_ASSERT(date);
|
Q_ASSERT(date);
|
||||||
// QDateTime qtDate(QDateTime::fromNSDate(date));
|
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
emit connectionStateChanged(VpnConnectionState::Connected);
|
emit connectionStateChanged(VpnConnectionState::Connected);
|
||||||
m_isChangingState = false;
|
m_isChangingState = false;
|
||||||
@@ -470,7 +435,6 @@ void IOSVpnProtocol::setupOpenVPNProtocol(const QtJson::JsonObject &result)
|
|||||||
}
|
}
|
||||||
case ConnectionStateDisconnected:
|
case ConnectionStateDisconnected:
|
||||||
// Just in case we are connecting, let's call disconnect.
|
// Just in case we are connecting, let's call disconnect.
|
||||||
// [m_controller disconnect];
|
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
emit connectionStateChanged(VpnConnectionState::Disconnected);
|
emit connectionStateChanged(VpnConnectionState::Disconnected);
|
||||||
m_isChangingState = false;
|
m_isChangingState = false;
|
||||||
@@ -529,7 +493,6 @@ void IOSVpnProtocol::setupShadowSocksProtocol(const QtJson::JsonObject &result)
|
|||||||
}
|
}
|
||||||
case ConnectionStateConnected: {
|
case ConnectionStateConnected: {
|
||||||
Q_ASSERT(date);
|
Q_ASSERT(date);
|
||||||
// QDateTime qtDate(QDateTime::fromNSDate(date));
|
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
emit connectionStateChanged(VpnConnectionState::Connected);
|
emit connectionStateChanged(VpnConnectionState::Connected);
|
||||||
m_isChangingState = false;
|
m_isChangingState = false;
|
||||||
@@ -538,7 +501,6 @@ void IOSVpnProtocol::setupShadowSocksProtocol(const QtJson::JsonObject &result)
|
|||||||
}
|
}
|
||||||
case ConnectionStateDisconnected:
|
case ConnectionStateDisconnected:
|
||||||
// Just in case we are connecting, let's call disconnect.
|
// Just in case we are connecting, let's call disconnect.
|
||||||
// [m_controller disconnect];
|
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
emit connectionStateChanged(VpnConnectionState::Disconnected);
|
emit connectionStateChanged(VpnConnectionState::Disconnected);
|
||||||
m_isChangingState = false;
|
m_isChangingState = false;
|
||||||
@@ -589,13 +551,6 @@ void IOSVpnProtocol::launchWireguardTunnel(const QtJson::JsonObject &result)
|
|||||||
QString pskKey = config["psk_key"].toString();
|
QString pskKey = config["psk_key"].toString();
|
||||||
QString serverPubKey = config["server_pub_key"].toString();
|
QString serverPubKey = config["server_pub_key"].toString();
|
||||||
|
|
||||||
qDebug() << "IOSVPNProtocol starts for" << hostname;
|
|
||||||
qDebug() << "DNS:" << dnsServersList.takeFirst().toNSString();
|
|
||||||
qDebug() << "serverPublicKey:" << serverPubKey.toNSString();
|
|
||||||
qDebug() << "serverIpv4AddrIn:" << serverAddr.toNSString();
|
|
||||||
qDebug() << "serverPort:" << (uint32_t)port.toInt();
|
|
||||||
qDebug() << "allowed ip list" << allowedIPList;
|
|
||||||
|
|
||||||
NSMutableArray<VPNIPAddressRange*>* allowedIPAddressRangesNS =
|
NSMutableArray<VPNIPAddressRange*>* allowedIPAddressRangesNS =
|
||||||
[NSMutableArray<VPNIPAddressRange*> arrayWithCapacity:allowedIPList.length()];
|
[NSMutableArray<VPNIPAddressRange*> arrayWithCapacity:allowedIPList.length()];
|
||||||
for (const IPAddressRange item : allowedIPList) {
|
for (const IPAddressRange item : allowedIPList) {
|
||||||
@@ -723,19 +678,11 @@ QString IOSVpnProtocol::serializeSSConfig(const QtJson::JsonObject &ssConfig) {
|
|||||||
QString ssServer = ssConfig["server"].toString();
|
QString ssServer = ssConfig["server"].toString();
|
||||||
QString ssPort = ssConfig["server_port"].toString();
|
QString ssPort = ssConfig["server_port"].toString();
|
||||||
QString ssTimeout = ssConfig["timeout"].toString();
|
QString ssTimeout = ssConfig["timeout"].toString();
|
||||||
qDebug() << "\n\nSS CONFIG:";
|
|
||||||
qDebug() << " local port -" << ssLocalPort;
|
|
||||||
qDebug() << " method -" << ssMethod;
|
|
||||||
qDebug() << " password -" << ssPassword;
|
|
||||||
qDebug() << " server -" << ssServer;
|
|
||||||
qDebug() << " port -" << ssPort;
|
|
||||||
qDebug() << " timeout -" << ssTimeout;
|
|
||||||
|
|
||||||
QJsonObject shadowSocksConfig = QJsonObject();
|
QJsonObject shadowSocksConfig = QJsonObject();
|
||||||
shadowSocksConfig.insert("local_addr", "127.0.0.1");
|
shadowSocksConfig.insert("local_addr", "127.0.0.1");
|
||||||
shadowSocksConfig.insert("local_port", ssConfig["local_port"].toInt());
|
shadowSocksConfig.insert("local_port", ssConfig["local_port"].toInt());
|
||||||
shadowSocksConfig.insert("method", ssConfig["method"].toString());
|
shadowSocksConfig.insert("method", ssConfig["method"].toString());
|
||||||
// shadowSocksConfig.insert("method", "aes-256-gcm");
|
|
||||||
shadowSocksConfig.insert("password", ssConfig["password"].toString());
|
shadowSocksConfig.insert("password", ssConfig["password"].toString());
|
||||||
shadowSocksConfig.insert("server", ssConfig["server"].toString());
|
shadowSocksConfig.insert("server", ssConfig["server"].toString());
|
||||||
shadowSocksConfig.insert("server_port", ssConfig["server_port"].toInt());
|
shadowSocksConfig.insert("server_port", ssConfig["server_port"].toInt());
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ VpnLogic::VpnLogic(UiLogic *logic, QObject *parent):
|
|||||||
m_labelSpeedSentText{tr("0 Mbps")},
|
m_labelSpeedSentText{tr("0 Mbps")},
|
||||||
m_labelStateText{},
|
m_labelStateText{},
|
||||||
m_isContainerHaveAuthData{false},
|
m_isContainerHaveAuthData{false},
|
||||||
m_isContainerSupportedByCurrentPlatform{true},
|
m_isContainerSupportedByCurrentPlatform{false},
|
||||||
m_widgetVpnModeEnabled{false}
|
m_widgetVpnModeEnabled{false}
|
||||||
{
|
{
|
||||||
connect(uiLogic()->m_vpnConnection, &VpnConnection::bytesChanged, this, &VpnLogic::onBytesChanged);
|
connect(uiLogic()->m_vpnConnection, &VpnConnection::bytesChanged, this, &VpnLogic::onBytesChanged);
|
||||||
@@ -55,7 +55,7 @@ void VpnLogic::onUpdatePage()
|
|||||||
set_isCustomRoutesSupported (selectedContainer == DockerContainer::OpenVpn ||
|
set_isCustomRoutesSupported (selectedContainer == DockerContainer::OpenVpn ||
|
||||||
selectedContainer == DockerContainer::ShadowSocks||
|
selectedContainer == DockerContainer::ShadowSocks||
|
||||||
selectedContainer == DockerContainer::Cloak);
|
selectedContainer == DockerContainer::Cloak);
|
||||||
// set_isCustomRoutesSupported(true);
|
|
||||||
set_isContainerHaveAuthData(m_settings->haveAuthData(m_settings->defaultServerIndex()));
|
set_isContainerHaveAuthData(m_settings->haveAuthData(m_settings->defaultServerIndex()));
|
||||||
|
|
||||||
set_radioButtonVpnModeAllSitesChecked(mode == Settings::VpnAllSites || !isCustomRoutesSupported());
|
set_radioButtonVpnModeAllSitesChecked(mode == Settings::VpnAllSites || !isCustomRoutesSupported());
|
||||||
|
|||||||
Reference in New Issue
Block a user