Skip to content

Commit

Permalink
Cleaning Cloak version files
Browse files Browse the repository at this point in the history
Related to #227
  • Loading branch information
amnezia-developer committed May 4, 2023
1 parent b22280d commit 4013b2c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 60 deletions.
6 changes: 3 additions & 3 deletions client/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
cmake_minimum_required(VERSION 3.25.0 FATAL_ERROR)

set(PROJECT AmneziaVPN)
project(${PROJECT} VERSION 2.1.2)
set(BUILD_ID 1)
project(${PROJECT} VERSION 3.0.5)
set(BUILD_ID 2)
SET(QT_BUILD_TOOLS_WHEN_CROSS_COMPILING ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Expand Down Expand Up @@ -40,7 +40,7 @@ set(LIBS ${LIBS}
Qt6::Core5Compat Qt6::Concurrent
)

qt_standard_project_setup()
#qt_standard_project_setup()

if(IOS)
execute_process(COMMAND bash ${CMAKE_CURRENT_LIST_DIR}/scripts/run-build-cloak.sh)
Expand Down
2 changes: 1 addition & 1 deletion client/containers/containers_defs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ bool ContainerProps::isSupportedByCurrentPlatform(DockerContainer c)
switch (c) {
case DockerContainer::WireGuard: return true;
case DockerContainer::OpenVpn: return true;
case DockerContainer::Cloak: return true;
case DockerContainer::Cloak: return true;
// case DockerContainer::ShadowSocks: return true;
default: return false;
}
Expand Down
55 changes: 1 addition & 54 deletions client/protocols/ios_vpnprotocol.mm
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,12 @@
bool IOSVpnProtocol::initialize()
{
qDebug() << "Initializing Swift Controller";



qDebug() << "RECEIVED CONFIG FROM SERVER SIDE =>";
// qDebug() << QJsonDocument(m_rawConfig).toJson();

if (!m_controller) {
bool ok;
QtJson::JsonObject result = QtJson::parse(QJsonDocument(m_rawConfig).toJson(), ok).toMap();
// QString cloakConfig = result["cloak_config_data"].toMap()();
// qDebug() << "cloakConfig: " << cloakConfig;
if(!ok) {
qDebug() << QString("An error occurred during parsing");
return false;
Expand Down Expand Up @@ -79,9 +75,6 @@
{
bool ok;
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) {
qDebug() << QString("An error occurred during config parsing");
Expand Down Expand Up @@ -160,11 +153,6 @@
{
if (!m_controller) {
qDebug() << "Not correctly initialized";

// dispatch_async(dispatch_get_main_queue(), ^{
// emit connectionStateChanged(Disconnected);
// });

return;
}

Expand Down Expand Up @@ -284,10 +272,6 @@
QString privateKey = config["client_priv_key"].toString();
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 dns = config["config"].toString().split("\n").takeAt(2).split(" = ").takeLast();
QString privkey = config["config"].toString().split("\n").takeAt(3).split(" = ").takeLast();
Expand All @@ -296,18 +280,6 @@
QString allowedips = config["config"].toString().split("\n").takeAt(8).split(" = ").takeLast();
QString endpoint = config["config"].toString().split("\n").takeAt(9).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
privateKey:key.toNSData()
Expand All @@ -329,15 +301,13 @@
}
case ConnectionStateConnected: {
Q_ASSERT(date);
// QDateTime qtDate(QDateTime::fromNSDate(date));
dispatch_async(dispatch_get_main_queue(), ^{
emit connectionStateChanged(VpnConnectionState::Connected);
m_isChangingState = false;
});
return;
}
case ConnectionStateDisconnected:
// Just in case we are connecting, let's call disconnect.
[m_controller disconnect];
dispatch_async(dispatch_get_main_queue(), ^{
emit connectionStateChanged(VpnConnectionState::Disconnected);
Expand Down Expand Up @@ -375,7 +345,6 @@
qDebug() << QJsonDocument(m_rawConfig).toJson();
QtJson::JsonObject ovpn = result["openvpn_config_data"].toMap();
QString ovpnConfig = ovpn["config"].toString();
// qDebug() << ovpn;

m_controller = [[IOSVpnProtocolImpl alloc] initWithBundleID:@VPN_NE_BUNDLEID
config:ovpnConfig.toNSString()
Expand All @@ -395,7 +364,6 @@
}
case ConnectionStateConnected: {
Q_ASSERT(date);
// QDateTime qtDate(QDateTime::fromNSDate(date));
dispatch_async(dispatch_get_main_queue(), ^{
emit connectionStateChanged(VpnConnectionState::Connected);
m_isChangingState = false;
Expand All @@ -404,7 +372,6 @@
}
case ConnectionStateDisconnected:
// Just in case we are connecting, let's call disconnect.
// [m_controller disconnect];
dispatch_async(dispatch_get_main_queue(), ^{
emit connectionStateChanged(VpnConnectionState::Disconnected);
m_isChangingState = false;
Expand Down Expand Up @@ -441,7 +408,6 @@

QtJson::JsonObject ovpn = result["openvpn_config_data"].toMap();
QString ovpnConfig = ovpn["config"].toString();
// qDebug() << ovpn;

m_controller = [[IOSVpnProtocolImpl alloc] initWithBundleID:@VPN_NE_BUNDLEID
config:ovpnConfig.toNSString()
Expand All @@ -461,7 +427,6 @@
}
case ConnectionStateConnected: {
Q_ASSERT(date);
// QDateTime qtDate(QDateTime::fromNSDate(date));
dispatch_async(dispatch_get_main_queue(), ^{
emit connectionStateChanged(VpnConnectionState::Connected);
m_isChangingState = false;
Expand All @@ -470,7 +435,6 @@
}
case ConnectionStateDisconnected:
// Just in case we are connecting, let's call disconnect.
// [m_controller disconnect];
dispatch_async(dispatch_get_main_queue(), ^{
emit connectionStateChanged(VpnConnectionState::Disconnected);
m_isChangingState = false;
Expand Down Expand Up @@ -529,7 +493,6 @@
}
case ConnectionStateConnected: {
Q_ASSERT(date);
// QDateTime qtDate(QDateTime::fromNSDate(date));
dispatch_async(dispatch_get_main_queue(), ^{
emit connectionStateChanged(VpnConnectionState::Connected);
m_isChangingState = false;
Expand All @@ -538,7 +501,6 @@
}
case ConnectionStateDisconnected:
// Just in case we are connecting, let's call disconnect.
// [m_controller disconnect];
dispatch_async(dispatch_get_main_queue(), ^{
emit connectionStateChanged(VpnConnectionState::Disconnected);
m_isChangingState = false;
Expand Down Expand Up @@ -589,13 +551,6 @@
QString pskKey = config["psk_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*> arrayWithCapacity:allowedIPList.length()];
for (const IPAddressRange item : allowedIPList) {
Expand Down Expand Up @@ -723,19 +678,11 @@
QString ssServer = ssConfig["server"].toString();
QString ssPort = ssConfig["server_port"].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();
shadowSocksConfig.insert("local_addr", "127.0.0.1");
shadowSocksConfig.insert("local_port", ssConfig["local_port"].toInt());
shadowSocksConfig.insert("method", ssConfig["method"].toString());
// shadowSocksConfig.insert("method", "aes-256-gcm");
shadowSocksConfig.insert("password", ssConfig["password"].toString());
shadowSocksConfig.insert("server", ssConfig["server"].toString());
shadowSocksConfig.insert("server_port", ssConfig["server_port"].toInt());
Expand Down
4 changes: 2 additions & 2 deletions client/ui/pages_logic/VpnLogic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ VpnLogic::VpnLogic(UiLogic *logic, QObject *parent):
m_labelSpeedSentText{tr("0 Mbps")},
m_labelStateText{},
m_isContainerHaveAuthData{false},
m_isContainerSupportedByCurrentPlatform{true},
m_isContainerSupportedByCurrentPlatform{false},
m_widgetVpnModeEnabled{false}
{
connect(uiLogic()->m_vpnConnection, &VpnConnection::bytesChanged, this, &VpnLogic::onBytesChanged);
Expand Down Expand Up @@ -55,7 +55,7 @@ void VpnLogic::onUpdatePage()
set_isCustomRoutesSupported (selectedContainer == DockerContainer::OpenVpn ||
selectedContainer == DockerContainer::ShadowSocks||
selectedContainer == DockerContainer::Cloak);
// set_isCustomRoutesSupported(true);

set_isContainerHaveAuthData(m_settings->haveAuthData(m_settings->defaultServerIndex()));

set_radioButtonVpnModeAllSitesChecked(mode == Settings::VpnAllSites || !isCustomRoutesSupported());
Expand Down

0 comments on commit 4013b2c

Please sign in to comment.