2021-05-10 02:33:31 +03:00
|
|
|
#ifndef VPN_CONFIGURATOR_H
|
|
|
|
|
#define VPN_CONFIGURATOR_H
|
|
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
|
|
2022-08-25 17:35:28 +03:00
|
|
|
#include "configurator_base.h"
|
2021-05-10 02:33:31 +03:00
|
|
|
#include "core/defs.h"
|
2022-08-25 17:35:28 +03:00
|
|
|
|
|
|
|
|
class OpenVpnConfigurator;
|
|
|
|
|
class ShadowSocksConfigurator;
|
|
|
|
|
class CloakConfigurator;
|
|
|
|
|
class WireguardConfigurator;
|
|
|
|
|
class Ikev2Configurator;
|
|
|
|
|
class SshConfigurator;
|
2023-10-06 17:19:44 +05:00
|
|
|
class AwgConfigurator;
|
2021-05-10 02:33:31 +03:00
|
|
|
|
2021-10-04 19:07:49 +03:00
|
|
|
// Retrieve connection settings from server
|
2023-11-21 20:13:51 +07:00
|
|
|
class VpnConfigurator : public ConfiguratorBase
|
2021-05-10 02:33:31 +03:00
|
|
|
{
|
2022-08-25 17:35:28 +03:00
|
|
|
Q_OBJECT
|
2021-05-10 02:33:31 +03:00
|
|
|
public:
|
2023-09-27 00:40:01 +05:00
|
|
|
explicit VpnConfigurator(std::shared_ptr<Settings> settings, QObject *parent = nullptr);
|
2021-05-10 02:33:31 +03:00
|
|
|
|
2022-08-25 17:35:28 +03:00
|
|
|
QString genVpnProtocolConfig(const ServerCredentials &credentials, DockerContainer container,
|
2023-11-21 20:13:51 +07:00
|
|
|
const QJsonObject &containerConfig, Proto proto, QString &clientId,
|
|
|
|
|
ErrorCode *errorCode = nullptr);
|
2021-09-24 13:14:35 +03:00
|
|
|
|
2022-08-25 17:35:28 +03:00
|
|
|
QPair<QString, QString> getDnsForConfig(int serverIndex);
|
|
|
|
|
QString &processConfigWithDnsSettings(int serverIndex, DockerContainer container, Proto proto, QString &config);
|
2022-02-01 19:48:59 +03:00
|
|
|
|
2022-08-25 17:35:28 +03:00
|
|
|
QString &processConfigWithLocalSettings(int serverIndex, DockerContainer container, Proto proto, QString &config);
|
|
|
|
|
QString &processConfigWithExportSettings(int serverIndex, DockerContainer container, Proto proto, QString &config);
|
2021-10-02 21:56:47 +03:00
|
|
|
|
2023-04-11 09:50:44 -04:00
|
|
|
// workaround for containers which is not support normal configuration
|
2023-11-21 20:13:51 +07:00
|
|
|
void updateContainerConfigAfterInstallation(DockerContainer container, QJsonObject &containerConfig,
|
|
|
|
|
const QString &stdOut);
|
2021-09-24 13:14:35 +03:00
|
|
|
|
2022-08-25 17:35:28 +03:00
|
|
|
std::shared_ptr<OpenVpnConfigurator> openVpnConfigurator;
|
|
|
|
|
std::shared_ptr<ShadowSocksConfigurator> shadowSocksConfigurator;
|
|
|
|
|
std::shared_ptr<CloakConfigurator> cloakConfigurator;
|
|
|
|
|
std::shared_ptr<WireguardConfigurator> wireguardConfigurator;
|
|
|
|
|
std::shared_ptr<Ikev2Configurator> ikev2Configurator;
|
|
|
|
|
std::shared_ptr<SshConfigurator> sshConfigurator;
|
2023-10-06 17:19:44 +05:00
|
|
|
std::shared_ptr<AwgConfigurator> awgConfigurator;
|
2023-11-21 20:13:51 +07:00
|
|
|
|
|
|
|
|
signals:
|
|
|
|
|
void newVpnConfigCreated(const QString &clientId, const QString &clientName, const DockerContainer container,
|
|
|
|
|
ServerCredentials credentials);
|
2021-05-10 02:33:31 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif // VPN_CONFIGURATOR_H
|