Files
amnezia-client/client/core/defs.h
T

82 lines
1.9 KiB
C++
Raw Normal View History

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-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,
2021-01-06 17:12:24 +03:00
// Ssh connection errors
SshSocketError, SshTimeoutError, SshProtocolError,
SshHostKeyError, SshKeyFileError, SshAuthenticationError,
SshClosedByServerError, SshInternalError,
// Ssh remote process errors
SshRemoteProcessCreationError,
FailedToStartRemoteProcessError, RemoteProcessCrashError,
2021-04-04 23:12:36 +03:00
SshSftpError,
2021-01-06 17:12:24 +03:00
// Local errors
FailedToSaveConfigData,
OpenVpnConfigMissing,
OpenVpnManagementServerError,
2021-01-07 20:53:42 +03:00
EasyRsaError,
2021-06-12 11:59:36 +03:00
ConfigMissing,
2021-01-06 17:12:24 +03:00
// Distro errors
OpenVpnExecutableMissing,
2021-01-08 16:51:58 +03:00
EasyRsaExecutableMissing,
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-03-18 18:45:08 +03:00
// 3rd party utils errors
OpenVpnExecutableCrashed,
2021-04-04 23:12:36 +03:00
ShadowSocksExecutableCrashed,
CloakExecutableCrashed
2021-01-06 17:12:24 +03:00
};
2021-02-18 15:00:41 +03:00
namespace config {
// config keys
2021-04-20 02:09:47 +03:00
const char key_openvpn_config_data[] = "openvpn_config_data";
const char key_openvpn_config_path[] = "openvpn_config_path";
const char key_shadowsocks_config_data[] = "shadowsocks_config_data";
const char key_cloak_config_data[] = "cloak_config_data";
2021-06-12 11:59:36 +03:00
const char key_wireguard_config_data[] = "wireguard_config_data";
2021-02-18 15:00:41 +03:00
}
2021-01-06 17:12:24 +03:00
} // namespace amnezia
#endif // DEFS_H