From 44496e424a158307131c0e7ec051ca58e7616dce Mon Sep 17 00:00:00 2001 From: leetthewire Date: Tue, 9 Aug 2022 18:44:05 +0400 Subject: [PATCH] errors for containers --- client/core/errorstrings.cpp | 2 ++ client/protocols/openvpnovercloakprotocol.cpp | 6 ++++++ client/protocols/shadowsocksvpnprotocol.cpp | 7 +++++++ 3 files changed, 15 insertions(+) diff --git a/client/core/errorstrings.cpp b/client/core/errorstrings.cpp index 23e4e36e2..f571c91a9 100644 --- a/client/core/errorstrings.cpp +++ b/client/core/errorstrings.cpp @@ -39,6 +39,8 @@ QString errorString(ErrorCode code){ // Distro errors case (OpenVpnExecutableMissing): return QObject::tr("OpenVPN executable missing"); + case (ShadowSocksExecutableMissing): return QObject::tr("ShadowSocks (ss-local) executable missing"); + case (CloakExecutableMissing): return QObject::tr("Cloak (ck-client) executable missing"); case (AmneziaServiceConnectionFailed): return QObject::tr("Amnezia helper service error"); case (OpenSslFailed): return QObject::tr("OpenSSL failed"); diff --git a/client/protocols/openvpnovercloakprotocol.cpp b/client/protocols/openvpnovercloakprotocol.cpp index 01afb4cad..2e9d77e85 100644 --- a/client/protocols/openvpnovercloakprotocol.cpp +++ b/client/protocols/openvpnovercloakprotocol.cpp @@ -27,6 +27,10 @@ OpenVpnOverCloakProtocol::~OpenVpnOverCloakProtocol() ErrorCode OpenVpnOverCloakProtocol::start() { + if (!QFileInfo::exists(cloakExecPath())) { + setLastError(ErrorCode::CloakExecutableMissing); + return lastError(); + } #ifndef Q_OS_IOS if (Utils::processIsRunning(Utils::executable("ck-client", false))) { Utils::killProcessByName(Utils::executable("ck-client", false)); @@ -106,6 +110,8 @@ QString OpenVpnOverCloakProtocol::cloakExecPath() { #ifdef Q_OS_WIN return Utils::executable(QString("cloak/ck-client"), true); +#elif defined Q_OS_LINUX + return Utils::usrExecutable("ck-client"); #else return Utils::executable(QString("/ck-client"), true); #endif diff --git a/client/protocols/shadowsocksvpnprotocol.cpp b/client/protocols/shadowsocksvpnprotocol.cpp index e2465c1fd..bc4947776 100644 --- a/client/protocols/shadowsocksvpnprotocol.cpp +++ b/client/protocols/shadowsocksvpnprotocol.cpp @@ -27,6 +27,13 @@ ShadowSocksVpnProtocol::~ShadowSocksVpnProtocol() ErrorCode ShadowSocksVpnProtocol::start() { + + if (!QFileInfo::exists(shadowSocksExecPath())) { + setLastError(ErrorCode::ShadowSocksExecutableMissing); + return lastError(); + } + + #ifndef Q_OS_IOS if (Utils::processIsRunning(Utils::executable("ss-local", false))) { Utils::killProcessByName(Utils::executable("ss-local", false));