2021-01-06 17:12:24 +03:00
|
|
|
#ifndef DEFS_H
|
|
|
|
|
#define DEFS_H
|
|
|
|
|
|
2021-04-20 02:09:47 +03:00
|
|
|
#include <QMetaEnum>
|
2021-01-06 17:12:24 +03:00
|
|
|
#include <QObject>
|
|
|
|
|
|
|
|
|
|
namespace amnezia {
|
2021-01-15 23:36:35 +03:00
|
|
|
|
2021-12-20 02:29:23 +03:00
|
|
|
constexpr const qint16 qrMagicCode = 1984;
|
|
|
|
|
|
2021-01-06 17:12:24 +03:00
|
|
|
struct ServerCredentials
|
|
|
|
|
{
|
|
|
|
|
QString hostName;
|
|
|
|
|
QString userName;
|
|
|
|
|
QString password;
|
|
|
|
|
int port = 22;
|
2021-03-14 21:19:11 +03:00
|
|
|
|
2021-06-12 11:59:36 +03:00
|
|
|
bool isValid() const { return !hostName.isEmpty() && !userName.isEmpty() && !password.isEmpty() && port > 0; }
|
2021-01-06 17:12:24 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum ErrorCode
|
|
|
|
|
{
|
|
|
|
|
// General error codes
|
|
|
|
|
NoError = 0,
|
|
|
|
|
UnknownError,
|
|
|
|
|
InternalError,
|
|
|
|
|
NotImplementedError,
|
|
|
|
|
|
2021-02-18 15:00:41 +03:00
|
|
|
// Server errors
|
2021-01-06 17:12:24 +03:00
|
|
|
ServerCheckFailed,
|
2021-02-18 15:00:41 +03:00
|
|
|
ServerPortAlreadyAllocatedError,
|
2021-05-07 23:28:37 +03:00
|
|
|
ServerContainerMissingError,
|
2021-06-19 16:38:35 +03:00
|
|
|
ServerDockerFailedError,
|
2023-01-02 17:32:27 +03:00
|
|
|
ServerCancelInstallation,
|
2021-01-06 17:12:24 +03:00
|
|
|
|
|
|
|
|
// Ssh connection errors
|
2022-12-23 14:50:48 +03:00
|
|
|
SshRequsetDeniedError, SshInterruptedError, SshInternalError,
|
2023-04-05 09:45:03 +03:00
|
|
|
SshPrivateKeyError, SshPrivateKeyFormatError,
|
2022-12-23 14:50:48 +03:00
|
|
|
|
|
|
|
|
// Ssh sftp errors
|
|
|
|
|
SshSftpEofError, SshSftpNoSuchFileError, SshSftpPermissionDeniedError,
|
|
|
|
|
SshSftpFailureError, SshSftpBadMessageError, SshSftpNoConnectionError,
|
|
|
|
|
SshSftpConnectionLostError, SshSftpOpUnsupportedError, SshSftpInvalidHandleError,
|
|
|
|
|
SshSftpNoSuchPathError, SshSftpFileAlreadyExistsError, SshSftpWriteProtectError,
|
|
|
|
|
SshSftpNoMediaError,
|
2021-01-06 17:12:24 +03:00
|
|
|
|
|
|
|
|
// Local errors
|
|
|
|
|
FailedToSaveConfigData,
|
|
|
|
|
OpenVpnConfigMissing,
|
|
|
|
|
OpenVpnManagementServerError,
|
2021-06-12 11:59:36 +03:00
|
|
|
ConfigMissing,
|
2021-01-06 17:12:24 +03:00
|
|
|
|
|
|
|
|
// Distro errors
|
|
|
|
|
OpenVpnExecutableMissing,
|
2021-02-21 09:44:53 -08:00
|
|
|
ShadowSocksExecutableMissing,
|
2021-04-04 23:12:36 +03:00
|
|
|
CloakExecutableMissing,
|
2021-01-08 16:51:58 +03:00
|
|
|
AmneziaServiceConnectionFailed,
|
2021-06-12 11:59:36 +03:00
|
|
|
ExecutableMissing,
|
2021-01-08 16:51:58 +03:00
|
|
|
|
|
|
|
|
// VPN errors
|
|
|
|
|
OpenVpnAdaptersInUseError,
|
2021-03-18 18:45:08 +03:00
|
|
|
OpenVpnUnknownError,
|
2021-06-03 20:23:44 +03:00
|
|
|
OpenVpnTapAdapterError,
|
2021-12-25 21:14:55 +03:00
|
|
|
AddressPoolError,
|
2021-03-18 18:45:08 +03:00
|
|
|
|
|
|
|
|
// 3rd party utils errors
|
2021-10-17 07:00:00 -07:00
|
|
|
OpenSslFailed,
|
2021-03-18 18:45:08 +03:00
|
|
|
OpenVpnExecutableCrashed,
|
2021-04-04 23:12:36 +03:00
|
|
|
ShadowSocksExecutableCrashed,
|
|
|
|
|
CloakExecutableCrashed
|
2021-01-06 17:12:24 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace amnezia
|
|
|
|
|
|
2021-09-30 15:56:48 +03:00
|
|
|
Q_DECLARE_METATYPE(amnezia::ErrorCode)
|
|
|
|
|
|
2021-01-06 17:12:24 +03:00
|
|
|
#endif // DEFS_H
|