2021-09-09 20:15:44 +03:00
|
|
|
#ifndef CONTAIERNS_DEFS_H
|
|
|
|
|
#define CONTAIERNS_DEFS_H
|
|
|
|
|
|
|
|
|
|
#include <QObject>
|
2021-09-16 19:49:50 +03:00
|
|
|
#include <QQmlEngine>
|
2021-09-09 20:15:44 +03:00
|
|
|
|
|
|
|
|
#include "../protocols/protocols_defs.h"
|
|
|
|
|
|
|
|
|
|
using namespace amnezia;
|
|
|
|
|
|
|
|
|
|
namespace amnezia {
|
|
|
|
|
|
2021-09-16 19:49:50 +03:00
|
|
|
namespace ContainerEnumNS {
|
|
|
|
|
Q_NAMESPACE
|
2021-09-20 21:51:28 +03:00
|
|
|
enum DockerContainer {
|
|
|
|
|
None = 0,
|
2021-09-09 20:15:44 +03:00
|
|
|
OpenVpn,
|
2021-09-20 21:51:28 +03:00
|
|
|
ShadowSocks,
|
|
|
|
|
Cloak,
|
|
|
|
|
WireGuard,
|
2021-10-04 19:07:49 +03:00
|
|
|
Ipsec,
|
2021-09-20 21:51:28 +03:00
|
|
|
|
|
|
|
|
//non-vpn
|
2021-09-21 01:49:28 +03:00
|
|
|
TorWebSite,
|
2021-09-20 21:51:28 +03:00
|
|
|
Dns,
|
2021-11-17 23:42:17 +03:00
|
|
|
//FileShare,
|
2021-09-22 14:49:08 +03:00
|
|
|
Sftp
|
2021-09-09 20:15:44 +03:00
|
|
|
};
|
2021-09-16 16:19:14 +03:00
|
|
|
Q_ENUM_NS(DockerContainer)
|
2021-09-16 19:49:50 +03:00
|
|
|
} // namespace ContainerEnumNS
|
|
|
|
|
|
|
|
|
|
using namespace ContainerEnumNS;
|
|
|
|
|
using namespace ProtocolEnumNS;
|
2021-09-09 20:15:44 +03:00
|
|
|
|
2021-09-20 21:51:28 +03:00
|
|
|
class ContainerProps : public QObject
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
Q_INVOKABLE static DockerContainer containerFromString(const QString &container);
|
|
|
|
|
Q_INVOKABLE static QString containerToString(DockerContainer container);
|
|
|
|
|
|
|
|
|
|
Q_INVOKABLE static QList<DockerContainer> allContainers();
|
|
|
|
|
|
|
|
|
|
Q_INVOKABLE static QMap<DockerContainer, QString> containerHumanNames();
|
|
|
|
|
Q_INVOKABLE static QMap<DockerContainer, QString> containerDescriptions();
|
2021-09-09 20:15:44 +03:00
|
|
|
|
2021-09-22 14:49:08 +03:00
|
|
|
// these protocols will be displayed in container settings
|
2021-11-30 16:56:24 +04:00
|
|
|
Q_INVOKABLE static QVector<Proto> protocolsForContainer(DockerContainer container);
|
2021-09-20 21:51:28 +03:00
|
|
|
|
|
|
|
|
Q_INVOKABLE static ServiceType containerService(DockerContainer c);
|
|
|
|
|
|
|
|
|
|
// binding between Docker container and main protocol of given container
|
|
|
|
|
// it may be changed fot future containers :)
|
2021-11-30 16:56:24 +04:00
|
|
|
Q_INVOKABLE static Proto defaultProtocol(DockerContainer c);
|
2021-12-08 15:55:36 +04:00
|
|
|
|
|
|
|
|
Q_INVOKABLE static bool isWorkingOnPlatform(DockerContainer c);
|
2021-09-20 21:51:28 +03:00
|
|
|
};
|
2021-09-09 20:15:44 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-09-20 21:51:28 +03:00
|
|
|
static void declareQmlContainerEnum() {
|
2021-09-16 19:49:50 +03:00
|
|
|
qmlRegisterUncreatableMetaObject(
|
|
|
|
|
ContainerEnumNS::staticMetaObject,
|
|
|
|
|
"ContainerEnum",
|
|
|
|
|
1, 0,
|
|
|
|
|
"ContainerEnum",
|
|
|
|
|
"Error: only enums"
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-09 20:15:44 +03:00
|
|
|
} // namespace amnezia
|
|
|
|
|
|
|
|
|
|
QDebug operator<<(QDebug debug, const amnezia::DockerContainer &c);
|
|
|
|
|
|
|
|
|
|
#endif // CONTAIERNS_DEFS_H
|