Files
amnezia-client/service/server/router.cpp
T

55 lines
1.1 KiB
C++
Raw Normal View History

2020-12-03 23:27:56 +03:00
#include "router.h"
2021-02-21 09:44:53 -08:00
#ifdef Q_OS_WIN
#include "router_win.h"
#elif defined (Q_OS_MAC)
#include "router_mac.h"
#endif
2020-12-03 23:27:56 +03:00
2021-05-27 22:18:36 +03:00
bool Router::routeAdd(const QString &ip, const QString &gw)
2020-12-03 23:27:56 +03:00
{
#ifdef Q_OS_WIN
2021-05-27 22:18:36 +03:00
return RouterWin::Instance().routeAdd(ip, gw);
2021-02-21 09:44:53 -08:00
#elif defined (Q_OS_MAC)
2021-05-27 22:18:36 +03:00
return RouterMac::Instance().routeAdd(ip, gw);
2020-12-04 00:45:21 +03:00
#endif
2020-12-03 23:27:56 +03:00
}
int Router::routeAddList(const QString &gw, const QStringList &ips)
{
2020-12-04 00:45:21 +03:00
#ifdef Q_OS_WIN
2021-02-21 09:44:53 -08:00
return RouterWin::Instance().routeAddList(gw, ips);
#elif defined (Q_OS_MAC)
return RouterMac::Instance().routeAddList(gw, ips);
2020-12-04 00:45:21 +03:00
#endif
2020-12-03 23:27:56 +03:00
}
bool Router::clearSavedRoutes()
{
2020-12-04 00:45:21 +03:00
#ifdef Q_OS_WIN
2021-02-21 09:44:53 -08:00
return RouterWin::Instance().clearSavedRoutes();
#elif defined (Q_OS_MAC)
return RouterMac::Instance().clearSavedRoutes();
2020-12-04 00:45:21 +03:00
#endif
2020-12-03 23:27:56 +03:00
}
2021-03-18 22:13:05 +03:00
bool Router::routeDelete(const QString &ip, const QString &gw)
2020-12-03 23:27:56 +03:00
{
#ifdef Q_OS_WIN
2021-03-18 22:13:05 +03:00
return RouterWin::Instance().routeDelete(ip, gw);
2021-02-21 09:44:53 -08:00
#elif defined (Q_OS_MAC)
2021-04-19 14:34:47 +03:00
return RouterMac::Instance().routeDelete(ip, gw);
2021-02-21 09:44:53 -08:00
#endif
2020-12-03 23:27:56 +03:00
}
void Router::flushDns()
{
#ifdef Q_OS_WIN
2021-02-21 09:44:53 -08:00
RouterWin::Instance().flushDns();
#elif defined (Q_OS_MAC)
RouterMac::Instance().flushDns();
2020-12-03 23:27:56 +03:00
#endif
}
2021-02-21 09:44:53 -08:00