Various fixes for iOS (#126)
* Readme update, solution for wireguard make in M1 machines, * import file and restore enabled. * xcode_patcher.rb fixed, Now no need to add openVPN framewrok in Embed frameworks manually. * Now xcode_patcher.rb will add OpenVPN Framework to Embed Frameworks in main target, instead of Network extension. * Update iosvpnprotocol.swift * Protocol wasn't detected because it is working on localized description of tunnel, fixed cases. * Code cleanup * Speed issue fixed for wireguard. * GetDeviceIp and bytes(speed of OpenVPN) fixed. *Device IP method wasn't working as expected, so I replaced. and for speed in OpenVPN we need to handle message seperately for bytes. *QR progress added with progressbar and text.
This commit is contained in:
parent
a9217810e7
commit
814b66c04a
21 changed files with 189 additions and 323 deletions
|
@ -1,3 +1,4 @@
|
|||
#include "qtimer.h"
|
||||
#include <QApplication>
|
||||
#include <QDebug>
|
||||
#include <QFile>
|
||||
|
@ -34,7 +35,10 @@ VpnConnection::VpnConnection(std::shared_ptr<Settings> settings,
|
|||
std::shared_ptr<ServerController> serverController, QObject* parent) : QObject(parent),
|
||||
m_settings(settings),
|
||||
m_configurator(configurator),
|
||||
m_serverController(serverController)
|
||||
m_serverController(serverController),
|
||||
m_receivedBytes(0),
|
||||
m_sentBytes(0),
|
||||
m_isIOSConnected(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -48,11 +52,16 @@ VpnConnection::~VpnConnection()
|
|||
|
||||
void VpnConnection::onBytesChanged(quint64 receivedBytes, quint64 sentBytes)
|
||||
{
|
||||
emit bytesChanged(receivedBytes, sentBytes);
|
||||
emit bytesChanged(receivedBytes - m_receivedBytes, sentBytes - m_sentBytes);
|
||||
|
||||
m_receivedBytes = receivedBytes;
|
||||
m_sentBytes = sentBytes;
|
||||
|
||||
}
|
||||
|
||||
void VpnConnection::onConnectionStateChanged(VpnProtocol::VpnConnectionState state)
|
||||
{
|
||||
|
||||
#ifdef AMNEZIA_DESKTOP
|
||||
if (IpcClient::Interface()) {
|
||||
if (state == VpnProtocol::Connected){
|
||||
|
@ -94,9 +103,35 @@ void VpnConnection::onConnectionStateChanged(VpnProtocol::VpnConnectionState sta
|
|||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_IOS
|
||||
|
||||
qDebug() << state;
|
||||
if(state == VpnProtocol::Connected){
|
||||
m_isIOSConnected = true;
|
||||
checkIOSStatus();
|
||||
}else{
|
||||
|
||||
m_isIOSConnected = false;
|
||||
m_receivedBytes = 0;
|
||||
m_sentBytes = 0;
|
||||
}
|
||||
#endif
|
||||
emit connectionStateChanged(state);
|
||||
}
|
||||
|
||||
void VpnConnection::checkIOSStatus()
|
||||
{
|
||||
QTimer::singleShot(1000, [this]() {
|
||||
|
||||
if(m_isIOSConnected){
|
||||
iosVpnProtocol->checkStatus();
|
||||
checkIOSStatus();
|
||||
}
|
||||
|
||||
} );
|
||||
}
|
||||
|
||||
const QString &VpnConnection::remoteAddress() const
|
||||
{
|
||||
return m_remoteAddress;
|
||||
|
@ -333,7 +368,10 @@ void VpnConnection::connectToVpn(int serverIndex,
|
|||
m_vpnProtocol.reset(androidVpnProtocol);
|
||||
#elif defined Q_OS_IOS
|
||||
Proto proto = ContainerProps::defaultProtocol(container);
|
||||
IOSVpnProtocol *iosVpnProtocol = new IOSVpnProtocol(proto, m_vpnConfiguration);
|
||||
//if (iosVpnProtocol==NULL) {
|
||||
iosVpnProtocol = new IOSVpnProtocol(proto, m_vpnConfiguration);
|
||||
//}
|
||||
// IOSVpnProtocol *iosVpnProtocol = new IOSVpnProtocol(proto, m_vpnConfiguration);
|
||||
if (!iosVpnProtocol->initialize()) {
|
||||
qDebug() << QString("Init failed") ;
|
||||
emit VpnProtocol::Error;
|
||||
|
@ -384,12 +422,19 @@ void VpnConnection::disconnectFromVpn()
|
|||
|
||||
VpnProtocol::VpnConnectionState VpnConnection::connectionState()
|
||||
{
|
||||
|
||||
|
||||
if (!m_vpnProtocol) return VpnProtocol::Disconnected;
|
||||
return m_vpnProtocol->connectionState();
|
||||
|
||||
}
|
||||
|
||||
bool VpnConnection::isConnected() const
|
||||
{
|
||||
#ifdef Q_OS_IOS
|
||||
|
||||
#endif
|
||||
|
||||
if (!m_vpnProtocol.data()) {
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue