Files

54 lines
1.4 KiB
C++
Raw Permalink Normal View History

2021-08-04 10:08:00 -07:00
#ifndef ROUTERLINUX_H
#define ROUTERLINUX_H
#include <QTimer>
#include <QString>
#include <QSettings>
#include <QHash>
#include <QDebug>
#include <QObject>
2024-03-27 11:02:34 +00:00
#include "../client/platforms/linux/daemon/dnsutilslinux.h"
2021-08-04 10:08:00 -07:00
/**
* @brief The Router class - General class for handling ip routing
*/
class RouterLinux : public QObject
{
Q_OBJECT
public:
2023-08-08 16:41:00 -07:00
struct Route {
QString dst;
QString gw;
};
2021-08-04 10:08:00 -07:00
static RouterLinux& Instance();
bool routeAdd(const QString &ip, const QString &gw, const int &sock);
int routeAddList(const QString &gw, const QStringList &ips);
bool clearSavedRoutes();
bool routeDelete(const QString &ip, const QString &gw, const int &sock);
bool routeDeleteList(const QString &gw, const QStringList &ips);
2023-09-17 17:06:24 -04:00
QString getgatewayandiface();
2025-11-30 18:49:16 -08:00
bool flushDns();
2024-03-27 11:02:34 +00:00
bool createTun(const QString &dev, const QString &subnet);
bool deleteTun(const QString &dev);
2025-11-30 18:49:16 -08:00
bool StartRoutingIpv6();
bool StopRoutingIpv6();
2024-03-27 11:02:34 +00:00
bool updateResolvers(const QString& ifname, const QList<QHostAddress>& resolvers);
2025-10-02 14:58:53 +02:00
bool restoreResolvers();
2021-08-04 10:08:00 -07:00
public slots:
private:
2024-03-27 11:02:34 +00:00
RouterLinux() {m_dnsUtil = new DnsUtilsLinux(this);}
2021-08-04 10:08:00 -07:00
RouterLinux(RouterLinux const &) = delete;
RouterLinux& operator= (RouterLinux const&) = delete;
bool isServiceActive(const QString &serviceName);
2023-08-08 16:41:00 -07:00
QList<Route> m_addedRoutes;
2024-03-27 11:02:34 +00:00
DnsUtilsLinux *m_dnsUtil;
2021-08-04 10:08:00 -07:00
};
#endif // ROUTERLINUX_H