refactoring: added classes for working with server configs
This commit is contained in:
parent
a2d30efaab
commit
2d22a74b22
34 changed files with 1441 additions and 91 deletions
58
client/core/models/protocols/wireguardProtocolConfig.h
Normal file
58
client/core/models/protocols/wireguardProtocolConfig.h
Normal file
|
@ -0,0 +1,58 @@
|
|||
#ifndef WIREGUARDPROTOCOLCONFIG_H
|
||||
#define WIREGUARDPROTOCOLCONFIG_H
|
||||
|
||||
#include <QJsonObject>
|
||||
#include <QStringList>
|
||||
|
||||
#include "protocolConfig.h"
|
||||
|
||||
namespace wireguard
|
||||
{
|
||||
struct WireGuardData
|
||||
{
|
||||
QStringList allowedIps;
|
||||
|
||||
QString clientIp;
|
||||
QString clientPrivateKey;
|
||||
QString clientPublicKey;
|
||||
QString mtu;
|
||||
QString persistentKeepAlive;
|
||||
QString pskKey;
|
||||
QString serverPubKey;
|
||||
};
|
||||
|
||||
struct ServerProtocolConfig
|
||||
{
|
||||
QString port;
|
||||
QString transportProto;
|
||||
|
||||
QString subnetAddress;
|
||||
};
|
||||
|
||||
struct ClientProtocolConfig
|
||||
{
|
||||
bool isEmpty = true;
|
||||
|
||||
QString clientId;
|
||||
|
||||
WireGuardData wireGuardData;
|
||||
|
||||
QString hostname;
|
||||
int port;
|
||||
|
||||
QString nativeConfig;
|
||||
};
|
||||
}
|
||||
|
||||
class WireGuardProtocolConfig : public ProtocolConfig
|
||||
{
|
||||
public:
|
||||
WireGuardProtocolConfig(const QJsonObject &protocolConfigObject, const QString &protocolName);
|
||||
|
||||
QJsonObject toJson() const override;
|
||||
|
||||
wireguard::ServerProtocolConfig serverProtocolConfig;
|
||||
wireguard::ClientProtocolConfig clientProtocolConfig;
|
||||
};
|
||||
|
||||
#endif // WIREGUARDPROTOCOLCONFIG_H
|
Loading…
Add table
Add a link
Reference in a new issue