ios fixes
This commit is contained in:
parent
12b079df65
commit
9ae2e3fba2
28 changed files with 149639 additions and 39 deletions
|
@ -24,7 +24,7 @@ win32 {
|
|||
}
|
||||
}
|
||||
|
||||
macx {
|
||||
macx:!ios {
|
||||
message("macOS build")
|
||||
INCLUDEPATH += $$PWD/macos
|
||||
HEADERS += $$PWD/macos/botan_all.h
|
||||
|
@ -51,3 +51,9 @@ android {
|
|||
}
|
||||
}
|
||||
|
||||
ios: {
|
||||
message("ios build")
|
||||
INCLUDEPATH += $$PWD/ios
|
||||
HEADERS += $$PWD/ios/botan_all.h
|
||||
SOURCES += $$PWD/ios/botan_all.cpp
|
||||
}
|
||||
|
|
107484
client/3rd/QtSsh/src/botan/ios/botan_all.cpp
Executable file
107484
client/3rd/QtSsh/src/botan/ios/botan_all.cpp
Executable file
File diff suppressed because it is too large
Load diff
42007
client/3rd/QtSsh/src/botan/ios/botan_all.h
Executable file
42007
client/3rd/QtSsh/src/botan/ios/botan_all.h
Executable file
File diff suppressed because it is too large
Load diff
|
@ -32,6 +32,18 @@
|
|||
#define SSH_GLOBAL_H
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QObject>
|
||||
|
||||
#ifdef Q_OS_IOS
|
||||
class QProcess {
|
||||
public:
|
||||
QProcess(QObject *){}
|
||||
enum ProcessChannel {
|
||||
StandardOutput,
|
||||
StandardError
|
||||
};
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
// For static cmake building removing dll export/import
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include <QPair>
|
||||
#include <QProcess>
|
||||
|
||||
|
||||
namespace QSsh {
|
||||
class SshRemoteProcess;
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@ SshX11InfoRetriever::SshX11InfoRetriever(const QString &displayName, QObject *pa
|
|||
m_xauthProc(new QProcess(this)),
|
||||
m_xauthFile(new QTemporaryFile(this))
|
||||
{
|
||||
#ifndef Q_OS_IOS
|
||||
connect(m_xauthProc, &QProcess::errorOccurred, this,
|
||||
[this] {
|
||||
if (m_xauthProc->error() == QProcess::FailedToStart) {
|
||||
|
@ -133,10 +134,12 @@ SshX11InfoRetriever::SshX11InfoRetriever(const QString &displayName, QObject *pa
|
|||
}
|
||||
}
|
||||
);
|
||||
#endif
|
||||
}
|
||||
|
||||
void SshX11InfoRetriever::start()
|
||||
{
|
||||
#ifndef Q_OS_IOS
|
||||
if (!m_xauthFile->open()) {
|
||||
emitFailure(tr("Could not create temporary file: %1").arg(m_xauthFile->errorString()));
|
||||
return;
|
||||
|
@ -147,6 +150,7 @@ void SshX11InfoRetriever::start()
|
|||
m_xauthFile->fileName(),
|
||||
QStringLiteral("generate"),
|
||||
m_displayName, QString::fromLatin1(xauthProtocol())});
|
||||
#endif
|
||||
}
|
||||
|
||||
void SshX11InfoRetriever::emitFailure(const QString &reason)
|
||||
|
|
|
@ -4,6 +4,8 @@ TARGET = AmneziaVPN
|
|||
TEMPLATE = app
|
||||
#CONFIG += console
|
||||
|
||||
ios:CONFIG += static
|
||||
|
||||
DEFINES += QT_DEPRECATED_WARNINGS
|
||||
|
||||
include("3rd/QtSsh/src/ssh/qssh.pri")
|
||||
|
@ -162,10 +164,11 @@ macx {
|
|||
HEADERS += ui/macos_util.h
|
||||
SOURCES += ui/macos_util.mm
|
||||
|
||||
LIBS += -framework Cocoa -framework ApplicationServices -framework CoreServices -framework Foundation -framework AppKit
|
||||
LIBS += -framework Cocoa -framework ApplicationServices -framework CoreServices -framework Foundation -framework AppKit -framework Security
|
||||
}
|
||||
|
||||
REPC_REPLICA += ../ipc/ipcinterface.rep
|
||||
REPC_REPLICA += ../ipc/ipc_interface.rep
|
||||
!ios: REPC_REPLICA += ../ipc/ipc_process_interface.rep
|
||||
|
||||
DISTFILES += \
|
||||
android/AndroidManifest.xml
|
||||
|
|
|
@ -47,6 +47,7 @@ QProcessEnvironment OpenVpnConfigurator::prepareEnv()
|
|||
|
||||
ErrorCode OpenVpnConfigurator::initPKI(const QString &path)
|
||||
{
|
||||
#ifndef Q_OS_IOS
|
||||
QProcess p;
|
||||
p.setProcessChannelMode(QProcess::MergedChannels);
|
||||
|
||||
|
@ -72,10 +73,14 @@ ErrorCode OpenVpnConfigurator::initPKI(const QString &path)
|
|||
|
||||
if (p.exitCode() == 0) return ErrorCode::NoError;
|
||||
else return ErrorCode::EasyRsaError;
|
||||
#else
|
||||
return ErrorCode::NotImplementedError;
|
||||
#endif
|
||||
}
|
||||
|
||||
ErrorCode OpenVpnConfigurator::genReq(const QString &path, const QString &clientId)
|
||||
{
|
||||
#ifndef Q_OS_IOS
|
||||
QProcess p;
|
||||
p.setProcessChannelMode(QProcess::MergedChannels);
|
||||
|
||||
|
@ -108,6 +113,9 @@ ErrorCode OpenVpnConfigurator::genReq(const QString &path, const QString &client
|
|||
|
||||
if (p.exitCode() == 0) return ErrorCode::NoError;
|
||||
else return ErrorCode::EasyRsaError;
|
||||
#else
|
||||
return ErrorCode::NotImplementedError;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ using namespace QSsh;
|
|||
|
||||
QString SshConfigurator::convertOpenSShKey(const QString &key)
|
||||
{
|
||||
#ifndef Q_OS_IOS
|
||||
QProcess p;
|
||||
p.setProcessChannelMode(QProcess::MergedChannels);
|
||||
|
||||
|
@ -49,10 +50,14 @@ QString SshConfigurator::convertOpenSShKey(const QString &key)
|
|||
tmp.open();
|
||||
|
||||
return tmp.readAll();
|
||||
#else
|
||||
return key;
|
||||
#endif
|
||||
}
|
||||
|
||||
void SshConfigurator::openSshTerminal(const ServerCredentials &credentials)
|
||||
{
|
||||
#ifndef Q_OS_IOS
|
||||
QProcess *p = new QProcess();
|
||||
p->setReadChannelMode(QProcess::SeparateChannels);
|
||||
|
||||
|
@ -74,6 +79,7 @@ void SshConfigurator::openSshTerminal(const ServerCredentials &credentials)
|
|||
#endif
|
||||
|
||||
p->startDetached();
|
||||
#endif
|
||||
}
|
||||
|
||||
QProcessEnvironment SshConfigurator::prepareEnv()
|
||||
|
|
|
@ -41,6 +41,8 @@ WireguardConfigurator::ConnectionData WireguardConfigurator::genClientKeys()
|
|||
program = QDir::toNativeSeparators(QApplication::applicationDirPath()) + "/Contents/MacOS/wg";
|
||||
#endif
|
||||
|
||||
#ifndef Q_OS_IOS
|
||||
|
||||
// Priv
|
||||
{
|
||||
QProcess p;
|
||||
|
@ -76,7 +78,7 @@ WireguardConfigurator::ConnectionData WireguardConfigurator::genClientKeys()
|
|||
connData.clientPubKey.replace("\r", "");
|
||||
connData.clientPubKey.replace("\n", "");
|
||||
}
|
||||
|
||||
#endif
|
||||
return connData;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ bool IpcClient::init()
|
|||
|
||||
QSharedPointer<IpcProcessInterfaceReplica> IpcClient::CreatePrivilegedProcess()
|
||||
{
|
||||
#ifndef Q_OS_IOS
|
||||
if (! Instance().m_ipcClient || ! Instance().m_ipcClient->isReplicaValid()) {
|
||||
qWarning() << "IpcClient::createPrivilegedProcess : IpcClient IpcClient replica is not valid";
|
||||
return nullptr;
|
||||
|
@ -59,6 +60,9 @@ QSharedPointer<IpcProcessInterfaceReplica> IpcClient::CreatePrivilegedProcess()
|
|||
|
||||
auto proccessReplica = QSharedPointer<IpcProcessInterfaceReplica>(pd->ipcProcess);
|
||||
return proccessReplica;
|
||||
#else
|
||||
return QSharedPointer<IpcProcessInterfaceReplica>();
|
||||
#endif
|
||||
}
|
||||
|
||||
IpcClient::IpcClient(QObject *parent) : QObject(parent)
|
||||
|
|
|
@ -5,7 +5,15 @@
|
|||
#include <QObject>
|
||||
|
||||
#include "ipc.h"
|
||||
#include "rep_ipcinterface_replica.h"
|
||||
#include "rep_ipc_interface_replica.h"
|
||||
|
||||
#ifndef Q_OS_IOS
|
||||
#include "rep_ipc_process_interface_replica.h"
|
||||
#else
|
||||
class IpcProcessInterfaceReplica {
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
class IpcClient : public QObject
|
||||
{
|
||||
|
|
|
@ -20,11 +20,14 @@ OpenVpnOverCloakProtocol::~OpenVpnOverCloakProtocol()
|
|||
qDebug() << "OpenVpnOverCloakProtocol::~OpenVpnOverCloakProtocol";
|
||||
OpenVpnOverCloakProtocol::stop();
|
||||
QThread::msleep(200);
|
||||
#ifndef Q_OS_IOS
|
||||
m_ckProcess.close();
|
||||
#endif
|
||||
}
|
||||
|
||||
ErrorCode OpenVpnOverCloakProtocol::start()
|
||||
{
|
||||
#ifndef Q_OS_IOS
|
||||
if (Utils::processIsRunning(Utils::executable("ck-client", false))) {
|
||||
Utils::killProcessByName(Utils::executable("ck-client", false));
|
||||
}
|
||||
|
@ -79,6 +82,7 @@ ErrorCode OpenVpnOverCloakProtocol::start()
|
|||
return OpenVpnProtocol::start();
|
||||
}
|
||||
else return ErrorCode::CloakExecutableMissing;
|
||||
#endif
|
||||
}
|
||||
|
||||
void OpenVpnOverCloakProtocol::stop()
|
||||
|
@ -92,7 +96,9 @@ void OpenVpnOverCloakProtocol::stop()
|
|||
Utils::signalCtrl(m_ckProcess.processId(), CTRL_C_EVENT);
|
||||
#endif
|
||||
|
||||
#ifndef Q_OS_IOS
|
||||
m_ckProcess.terminate();
|
||||
#endif
|
||||
}
|
||||
|
||||
QString OpenVpnOverCloakProtocol::cloakExecPath()
|
||||
|
|
|
@ -23,7 +23,9 @@ private:
|
|||
static QString cloakExecPath();
|
||||
|
||||
private:
|
||||
#ifndef Q_OS_IOS
|
||||
QProcess m_ckProcess;
|
||||
#endif
|
||||
QTemporaryFile m_cloakCfgFile;
|
||||
QMetaObject::Connection m_errorHandlerConnection;
|
||||
};
|
||||
|
|
|
@ -77,9 +77,11 @@ ErrorCode OpenVpnProtocol::checkAndSetupTapDriver()
|
|||
|
||||
void OpenVpnProtocol::killOpenVpnProcess()
|
||||
{
|
||||
#ifndef Q_OS_IOS
|
||||
if (m_openVpnProcess){
|
||||
m_openVpnProcess->close();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void OpenVpnProtocol::readOpenVpnConfiguration(const QJsonObject &configuration)
|
||||
|
@ -151,6 +153,7 @@ QString OpenVpnProtocol::openVpnExecPath() const
|
|||
|
||||
ErrorCode OpenVpnProtocol::start()
|
||||
{
|
||||
#ifndef Q_OS_IOS
|
||||
//qDebug() << "Start OpenVPN connection";
|
||||
OpenVpnProtocol::stop();
|
||||
|
||||
|
@ -214,6 +217,9 @@ ErrorCode OpenVpnProtocol::start()
|
|||
//startTimeoutTimer();
|
||||
|
||||
return ErrorCode::NoError;
|
||||
#else
|
||||
return ErrorCode::NotImplementedError;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool OpenVpnProtocol::sendTermSignal()
|
||||
|
|
|
@ -20,11 +20,14 @@ ShadowSocksVpnProtocol::~ShadowSocksVpnProtocol()
|
|||
qDebug() << "ShadowSocksVpnProtocol::~ShadowSocksVpnProtocol";
|
||||
ShadowSocksVpnProtocol::stop();
|
||||
QThread::msleep(200);
|
||||
#ifndef Q_OS_IOS
|
||||
m_ssProcess.close();
|
||||
#endif
|
||||
}
|
||||
|
||||
ErrorCode ShadowSocksVpnProtocol::start()
|
||||
{
|
||||
#ifndef Q_OS_IOS
|
||||
if (Utils::processIsRunning(Utils::executable("ss-local", false))) {
|
||||
Utils::killProcessByName(Utils::executable("ss-local", false));
|
||||
}
|
||||
|
@ -77,6 +80,9 @@ ErrorCode ShadowSocksVpnProtocol::start()
|
|||
return OpenVpnProtocol::start();
|
||||
}
|
||||
else return ErrorCode::ShadowSocksExecutableMissing;
|
||||
#else
|
||||
return ErrorCode::NotImplementedError;
|
||||
#endif
|
||||
}
|
||||
|
||||
void ShadowSocksVpnProtocol::stop()
|
||||
|
@ -84,7 +90,9 @@ void ShadowSocksVpnProtocol::stop()
|
|||
OpenVpnProtocol::stop();
|
||||
|
||||
qDebug() << "ShadowSocksVpnProtocol::stop()";
|
||||
#ifndef Q_OS_IOS
|
||||
m_ssProcess.terminate();
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
Utils::signalCtrl(m_ssProcess.processId(), CTRL_C_EVENT);
|
||||
|
|
|
@ -24,7 +24,9 @@ private:
|
|||
static QString shadowSocksExecPath();
|
||||
|
||||
private:
|
||||
#ifndef Q_OS_IOS
|
||||
QProcess m_ssProcess;
|
||||
#endif
|
||||
QTemporaryFile m_shadowSocksCfgFile;
|
||||
};
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ WireguardProtocol::~WireguardProtocol()
|
|||
|
||||
void WireguardProtocol::stop()
|
||||
{
|
||||
#ifndef Q_OS_IOS
|
||||
if (!QFileInfo::exists(wireguardExecPath())) {
|
||||
qCritical() << "Wireguard executable missing!";
|
||||
setLastError(ErrorCode::ExecutableMissing);
|
||||
|
@ -67,6 +68,7 @@ void WireguardProtocol::stop()
|
|||
m_wireguardStopProcess->start();
|
||||
|
||||
setConnectionState(VpnProtocol::Disconnected);
|
||||
#endif
|
||||
}
|
||||
|
||||
void WireguardProtocol::readWireguardConfiguration(const QJsonObject &configuration)
|
||||
|
@ -131,6 +133,7 @@ QString WireguardProtocol::wireguardExecPath() const
|
|||
|
||||
ErrorCode WireguardProtocol::start()
|
||||
{
|
||||
#ifndef Q_OS_IOS
|
||||
if (!m_isConfigLoaded) {
|
||||
setLastError(ErrorCode::ConfigMissing);
|
||||
return lastError();
|
||||
|
@ -208,6 +211,9 @@ ErrorCode WireguardProtocol::start()
|
|||
m_wireguardStartProcess->start();
|
||||
|
||||
return ErrorCode::NoError;
|
||||
#else
|
||||
return ErrorCode::NotImplementedError;
|
||||
#endif
|
||||
}
|
||||
|
||||
void WireguardProtocol::updateVpnGateway(const QString &line)
|
||||
|
|
|
@ -58,7 +58,7 @@ QString Autostart::appPath() {
|
|||
return QCoreApplication::applicationFilePath() + " --autostart";
|
||||
}
|
||||
|
||||
#elif defined Q_OS_MAC || defined Q_OS_LINUX
|
||||
#elif defined Q_OS_MACX
|
||||
|
||||
bool Autostart::isAutostart() {
|
||||
QProcess process;
|
||||
|
|
|
@ -99,6 +99,8 @@ bool Utils::processIsRunning(const QString& fileName)
|
|||
|
||||
}
|
||||
return false;
|
||||
#elif defined(Q_OS_IOS)
|
||||
return false;
|
||||
#else
|
||||
QProcess process;
|
||||
process.setProcessChannelMode(QProcess::MergedChannels);
|
||||
|
@ -161,10 +163,12 @@ bool Utils::checkIpSubnetFormat(const QString &ip)
|
|||
}
|
||||
|
||||
void Utils::killProcessByName(const QString &name)
|
||||
{
|
||||
{
|
||||
qDebug().noquote() << "Kill process" << name;
|
||||
#ifdef Q_OS_WIN
|
||||
QProcess::execute(QString("taskkill /im %1 /f").arg(name));
|
||||
#elif defined Q_OS_IOS
|
||||
return;
|
||||
#else
|
||||
QProcess::execute(QString("pkill %1").arg(name));
|
||||
#endif
|
||||
|
|
18
ipc/ipc_interface.rep
Normal file
18
ipc/ipc_interface.rep
Normal file
|
@ -0,0 +1,18 @@
|
|||
#include <QtCore>
|
||||
#include <QString>
|
||||
|
||||
class IpcInterface
|
||||
{
|
||||
SLOT( int createPrivilegedProcess() ); // return local pid
|
||||
//SIGNAL(sendMessage(const QByteArray &message));
|
||||
|
||||
// Route functions
|
||||
SLOT( int routeAddList(const QString &gw, const QStringList &ips) );
|
||||
SLOT( bool clearSavedRoutes() );
|
||||
SLOT( bool routeDeleteList(const QString &gw, const QStringList &ip) );
|
||||
SLOT( void flushDns() );
|
||||
|
||||
SLOT( bool checkAndInstallDriver() );
|
||||
SLOT( QStringList getTapList() );
|
||||
};
|
||||
|
|
@ -1,21 +1,6 @@
|
|||
#include <QtCore>
|
||||
#include <QString>
|
||||
|
||||
class IpcInterface
|
||||
{
|
||||
SLOT( int createPrivilegedProcess() ); // return local pid
|
||||
//SIGNAL(sendMessage(const QByteArray &message));
|
||||
|
||||
// Route functions
|
||||
SLOT( int routeAddList(const QString &gw, const QStringList &ips) );
|
||||
SLOT( bool clearSavedRoutes() );
|
||||
SLOT( bool routeDeleteList(const QString &gw, const QStringList &ip) );
|
||||
SLOT( void flushDns() );
|
||||
|
||||
SLOT( bool checkAndInstallDriver() );
|
||||
SLOT( QStringList getTapList() );
|
||||
};
|
||||
|
||||
class IpcProcessInterface
|
||||
{
|
||||
SLOT( start(const QString &program, const QStringList &args) );
|
|
@ -48,15 +48,15 @@ int IpcServer::createPrivilegedProcess()
|
|||
qDebug() << "QRemoteObjectHost::destroyed";
|
||||
});
|
||||
|
||||
connect(pd.ipcProcess.data(), &IpcServerProcess::finished, this, [this, pid=m_localpid](int exitCode, QProcess::ExitStatus exitStatus){
|
||||
qDebug() << "IpcServerProcess finished" << exitCode << exitStatus;
|
||||
// if (m_processes.contains(pid)) {
|
||||
// m_processes[pid].ipcProcess.reset();
|
||||
// m_processes[pid].serverNode.reset();
|
||||
// m_processes[pid].localServer.reset();
|
||||
// m_processes.remove(pid);
|
||||
// }
|
||||
});
|
||||
// connect(pd.ipcProcess.data(), &IpcServerProcess::finished, this, [this, pid=m_localpid](int exitCode, QProcess::ExitStatus exitStatus){
|
||||
// qDebug() << "IpcServerProcess finished" << exitCode << exitStatus;
|
||||
//// if (m_processes.contains(pid)) {
|
||||
//// m_processes[pid].ipcProcess.reset();
|
||||
//// m_processes[pid].serverNode.reset();
|
||||
//// m_processes[pid].localServer.reset();
|
||||
//// m_processes.remove(pid);
|
||||
//// }
|
||||
// });
|
||||
|
||||
m_processes.insert(m_localpid, pd);
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#include "ipc.h"
|
||||
#include "ipcserverprocess.h"
|
||||
|
||||
#include "rep_ipcinterface_source.h"
|
||||
#include "rep_ipc_interface_source.h"
|
||||
|
||||
class IpcServer : public IpcInterfaceSource
|
||||
{
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#include "ipcserverprocess.h"
|
||||
#include <QProcess>
|
||||
|
||||
#ifndef Q_OS_IOS
|
||||
|
||||
IpcServerProcess::IpcServerProcess(QObject *parent) :
|
||||
IpcProcessInterfaceSource(parent),
|
||||
m_process(QSharedPointer<QProcess>(new QProcess()))
|
||||
|
@ -103,3 +105,5 @@ QByteArray IpcServerProcess::readAllStandardOutput()
|
|||
{
|
||||
return m_process->readAllStandardOutput();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -2,8 +2,9 @@
|
|||
#define IPCSERVERPROCESS_H
|
||||
|
||||
#include <QObject>
|
||||
#include "rep_ipcinterface_source.h"
|
||||
|
||||
#ifndef Q_OS_IOS
|
||||
#include "rep_ipc_process_interface_source.h"
|
||||
|
||||
class IpcServerProcess : public IpcProcessInterfaceSource
|
||||
{
|
||||
|
@ -33,4 +34,14 @@ private:
|
|||
QSharedPointer<QProcess> m_process;
|
||||
};
|
||||
|
||||
#else
|
||||
class IpcServerProcess : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit IpcServerProcess(QObject *parent = nullptr);
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif // IPCSERVERPROCESS_H
|
||||
|
|
|
@ -73,4 +73,5 @@ include(../src/qtservice.pri)
|
|||
|
||||
INCLUDEPATH += "$$PWD/../../client"
|
||||
|
||||
REPC_SOURCE += ../../ipc/ipcinterface.rep
|
||||
REPC_SOURCE += ../../ipc/ipc_interface.rep
|
||||
!ios: REPC_SOURCE += ../../ipc/ipc_process_interface.rep
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
TEMPLATE=subdirs
|
||||
CONFIG += ordered
|
||||
include(common.pri)
|
||||
qtservice-uselib:SUBDIRS=buildlib
|
||||
SUBDIRS+=server
|
||||
!ios {
|
||||
TEMPLATE=subdirs
|
||||
CONFIG += ordered
|
||||
include(common.pri)
|
||||
qtservice-uselib:SUBDIRS=buildlib
|
||||
SUBDIRS+=server
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue