feature/app-split-tunneling (#702)
App Split Tunneling for Windows and Android
This commit is contained in:
parent
e7bd24f065
commit
adab30fc81
48 changed files with 1225 additions and 98 deletions
|
|
@ -22,6 +22,20 @@ namespace amnezia
|
|||
}
|
||||
};
|
||||
|
||||
struct InstalledAppInfo {
|
||||
QString appName;
|
||||
QString packageName;
|
||||
QString appPath;
|
||||
|
||||
bool operator==(const InstalledAppInfo& other) const {
|
||||
if (!packageName.isEmpty()) {
|
||||
return packageName == other.packageName;
|
||||
} else {
|
||||
return appPath == other.appPath;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
enum ErrorCode {
|
||||
// General error codes
|
||||
NoError = 0,
|
||||
|
|
|
|||
12
client/core/installedAppsImageProvider.cpp
Normal file
12
client/core/installedAppsImageProvider.cpp
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
#include "installedAppsImageProvider.h"
|
||||
|
||||
#include "platforms/android/android_controller.h"
|
||||
|
||||
InstalledAppsImageProvider::InstalledAppsImageProvider() : QQuickImageProvider(QQuickImageProvider::Pixmap)
|
||||
{
|
||||
}
|
||||
|
||||
QPixmap InstalledAppsImageProvider::requestPixmap(const QString &id, QSize *size, const QSize &requestedSize)
|
||||
{
|
||||
return AndroidController::instance()->getAppIcon(id, size, requestedSize);
|
||||
}
|
||||
15
client/core/installedAppsImageProvider.h
Normal file
15
client/core/installedAppsImageProvider.h
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
#ifndef INSTALLEDAPPSIMAGEPROVIDER_H
|
||||
#define INSTALLEDAPPSIMAGEPROVIDER_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QQuickImageProvider>
|
||||
|
||||
class InstalledAppsImageProvider : public QQuickImageProvider
|
||||
{
|
||||
public:
|
||||
InstalledAppsImageProvider();
|
||||
|
||||
QPixmap requestPixmap(const QString &id, QSize *size, const QSize &requestedSize) override;
|
||||
};
|
||||
|
||||
#endif // INSTALLEDAPPSIMAGEPROVIDER_H
|
||||
|
|
@ -10,6 +10,8 @@
|
|||
#include <Iptypes.h>
|
||||
#include <WinSock2.h>
|
||||
#include <winsock.h>
|
||||
#include <QNetworkInterface>
|
||||
#include "qendian.h"
|
||||
#endif
|
||||
#ifdef Q_OS_LINUX
|
||||
#include <arpa/inet.h>
|
||||
|
|
@ -159,6 +161,27 @@ bool NetworkUtilities::checkIpSubnetFormat(const QString &ip)
|
|||
return false;
|
||||
}
|
||||
|
||||
// static
|
||||
int NetworkUtilities::AdapterIndexTo(const QHostAddress& dst) {
|
||||
#ifdef Q_OS_WIN
|
||||
qDebug() << "Getting Current Internet Adapter that routes to"
|
||||
<< dst.toString();
|
||||
quint32_be ipBigEndian;
|
||||
quint32 ip = dst.toIPv4Address();
|
||||
qToBigEndian(ip, &ipBigEndian);
|
||||
_MIB_IPFORWARDROW routeInfo;
|
||||
auto result = GetBestRoute(ipBigEndian, 0, &routeInfo);
|
||||
if (result != NO_ERROR) {
|
||||
return -1;
|
||||
}
|
||||
auto adapter =
|
||||
QNetworkInterface::interfaceFromIndex(routeInfo.dwForwardIfIndex);
|
||||
qDebug() << "Internet Adapter:" << adapter.name();
|
||||
return routeInfo.dwForwardIfIndex;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
DWORD GetAdaptersAddressesWrapper(const ULONG Family,
|
||||
const ULONG Flags,
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@
|
|||
#include <QRegularExpression>
|
||||
#include <QRegExp>
|
||||
#include <QString>
|
||||
#include <QHostAddress>
|
||||
|
||||
|
||||
class NetworkUtilities : public QObject
|
||||
{
|
||||
|
|
@ -14,6 +16,8 @@ public:
|
|||
static bool checkIPv4Format(const QString &ip);
|
||||
static bool checkIpSubnetFormat(const QString &ip);
|
||||
static QString getGatewayAndIface();
|
||||
// Returns the Interface Index that could Route to dst
|
||||
static int AdapterIndexTo(const QHostAddress& dst);
|
||||
|
||||
static QRegularExpression ipAddressRegExp();
|
||||
static QRegularExpression ipAddressPortRegExp();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue