Get data from wg show command (#764)

Get data from wg show command
This commit is contained in:
Vladyslav Miachkov 2024-04-28 16:03:41 +03:00 committed by GitHub
parent 5211cdd4c0
commit cf8a0efd0d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 165 additions and 4 deletions

View file

@ -14,7 +14,18 @@ class ClientManagementModel : public QAbstractListModel
public:
enum Roles {
ClientNameRole = Qt::UserRole + 1,
CreationDateRole
CreationDateRole,
LatestHandshakeRole,
DataReceivedRole,
DataSentRole
};
struct WgShowData
{
QString clientId;
QString latestHandshake;
QString dataReceived;
QString dataSent;
};
ClientManagementModel(std::shared_ptr<Settings> settings, QObject *parent = nullptr);
@ -57,6 +68,9 @@ private:
ErrorCode getWireGuardClients(const DockerContainer container, const ServerCredentials &credentials,
const QSharedPointer<ServerController> &serverController, int &count);
ErrorCode wgShow(const DockerContainer container, const ServerCredentials &credentials,
const QSharedPointer<ServerController> &serverController, std::vector<WgShowData> &data);
QJsonArray m_clientsTable;
std::shared_ptr<Settings> m_settings;