2023-04-11 09:50:44 -04:00
|
|
|
#ifndef CONTAINERS_DEFS_H
|
|
|
|
|
#define CONTAINERS_DEFS_H
|
2021-09-09 20:15:44 +03:00
|
|
|
|
|
|
|
|
#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;
|
|
|
|
|
|
2023-08-20 13:36:54 +05:00
|
|
|
namespace amnezia
|
2021-09-20 21:51:28 +03:00
|
|
|
{
|
|
|
|
|
|
2023-08-20 13:36:54 +05:00
|
|
|
namespace ContainerEnumNS
|
|
|
|
|
{
|
|
|
|
|
Q_NAMESPACE
|
|
|
|
|
enum DockerContainer {
|
|
|
|
|
None = 0,
|
2023-10-19 01:16:36 +05:00
|
|
|
Awg,
|
|
|
|
|
WireGuard,
|
2023-08-20 13:36:54 +05:00
|
|
|
OpenVpn,
|
|
|
|
|
Cloak,
|
2023-10-19 01:16:36 +05:00
|
|
|
ShadowSocks,
|
2023-08-20 13:36:54 +05:00
|
|
|
Ipsec,
|
|
|
|
|
|
|
|
|
|
// non-vpn
|
|
|
|
|
TorWebSite,
|
|
|
|
|
Dns,
|
|
|
|
|
Sftp
|
|
|
|
|
};
|
|
|
|
|
Q_ENUM_NS(DockerContainer)
|
|
|
|
|
} // namespace ContainerEnumNS
|
|
|
|
|
|
|
|
|
|
using namespace ContainerEnumNS;
|
|
|
|
|
using namespace ProtocolEnumNS;
|
|
|
|
|
|
|
|
|
|
class ContainerProps : public QObject
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
Q_INVOKABLE static amnezia::DockerContainer containerFromString(const QString &container);
|
|
|
|
|
Q_INVOKABLE static QString containerToString(amnezia::DockerContainer container);
|
|
|
|
|
Q_INVOKABLE static QString containerTypeToString(amnezia::DockerContainer c);
|
|
|
|
|
|
|
|
|
|
Q_INVOKABLE static QList<amnezia::DockerContainer> allContainers();
|
|
|
|
|
|
|
|
|
|
Q_INVOKABLE static QMap<amnezia::DockerContainer, QString> containerHumanNames();
|
|
|
|
|
Q_INVOKABLE static QMap<amnezia::DockerContainer, QString> containerDescriptions();
|
|
|
|
|
Q_INVOKABLE static QMap<amnezia::DockerContainer, QString> containerDetailedDescriptions();
|
|
|
|
|
|
|
|
|
|
// these protocols will be displayed in container settings
|
|
|
|
|
Q_INVOKABLE static QVector<amnezia::Proto> protocolsForContainer(amnezia::DockerContainer container);
|
|
|
|
|
|
|
|
|
|
Q_INVOKABLE static amnezia::ServiceType containerService(amnezia::DockerContainer c);
|
|
|
|
|
|
|
|
|
|
// binding between Docker container and main protocol of given container
|
|
|
|
|
// it may be changed fot future containers :)
|
|
|
|
|
Q_INVOKABLE static amnezia::Proto defaultProtocol(amnezia::DockerContainer c);
|
|
|
|
|
|
|
|
|
|
Q_INVOKABLE static bool isSupportedByCurrentPlatform(amnezia::DockerContainer c);
|
|
|
|
|
Q_INVOKABLE static QStringList fixedPortsForContainer(amnezia::DockerContainer c);
|
|
|
|
|
|
|
|
|
|
static bool isEasySetupContainer(amnezia::DockerContainer container);
|
|
|
|
|
static QString easySetupHeader(amnezia::DockerContainer container);
|
|
|
|
|
static QString easySetupDescription(amnezia::DockerContainer container);
|
2023-09-18 21:06:10 +05:00
|
|
|
static int easySetupOrder(amnezia::DockerContainer container);
|
2023-08-22 14:37:29 +05:00
|
|
|
|
|
|
|
|
static bool isShareable(amnezia::DockerContainer container);
|
2023-08-20 13:36:54 +05:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static void declareQmlContainerEnum()
|
|
|
|
|
{
|
|
|
|
|
qmlRegisterUncreatableMetaObject(ContainerEnumNS::staticMetaObject, "ContainerEnum", 1, 0, "ContainerEnum",
|
|
|
|
|
"Error: only enums");
|
|
|
|
|
}
|
2021-09-16 19:49:50 +03:00
|
|
|
|
2021-09-09 20:15:44 +03:00
|
|
|
} // namespace amnezia
|
|
|
|
|
|
|
|
|
|
QDebug operator<<(QDebug debug, const amnezia::DockerContainer &c);
|
|
|
|
|
|
2023-04-11 09:50:44 -04:00
|
|
|
#endif // CONTAINERS_DEFS_H
|