amnezia-client/client/core/models/protocols/wireguardProtocolConfig.h
2025-07-03 10:20:01 +08:00

61 lines
1.2 KiB
C++

#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;
bool hasEqualServerSettings(const WireGuardProtocolConfig &other) const;
void clearClientSettings();
wireguard::ServerProtocolConfig serverProtocolConfig;
wireguard::ClientProtocolConfig clientProtocolConfig;
};
#endif // WIREGUARDPROTOCOLCONFIG_H