Merge branch 'dev' of github.com:amnezia-vpn/amnezia-client into HEAD
This commit is contained in:
commit
18bb045e9a
37 changed files with 2112 additions and 57 deletions
|
|
@ -6,9 +6,10 @@ project(${PROJECT})
|
|||
set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
find_package(Qt6 REQUIRED COMPONENTS Core Network Widgets RemoteObjects Core5Compat)
|
||||
find_package(Qt6 REQUIRED COMPONENTS DBus Core Network Widgets RemoteObjects Core5Compat)
|
||||
qt_standard_project_setup()
|
||||
|
||||
|
||||
configure_file(${CMAKE_SOURCE_DIR}/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/version.h)
|
||||
|
||||
set(HEADERS
|
||||
|
|
@ -91,7 +92,7 @@ if(UNIX)
|
|||
)
|
||||
endif()
|
||||
|
||||
if (WIN32 OR APPLE)
|
||||
if (WIN32 OR APPLE OR LINUX)
|
||||
set(HEADERS ${HEADERS}
|
||||
${CMAKE_CURRENT_LIST_DIR}/../../client/daemon/daemon.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/../../client/daemon/daemonlocalserver.h
|
||||
|
|
@ -198,12 +199,30 @@ if(APPLE)
|
|||
endif()
|
||||
|
||||
if(LINUX)
|
||||
|
||||
set(HEADERS ${HEADERS}
|
||||
${CMAKE_CURRENT_LIST_DIR}/router_linux.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../client/platforms/linux/linuxnetworkwatcher.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../client/platforms/linux/linuxnetworkwatcherworker.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../client/platforms/linux/linuxdependencies.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../client/platforms/linux/daemon/iputilslinux.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../client/platforms/linux/daemon/dbustypeslinux.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../client/platforms/linux/daemon/linuxdaemon.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../client/platforms/linux/daemon/dnsutilslinux.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../client/platforms/linux/daemon/wireguardutilslinux.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../client/platforms/linux/daemon/linuxroutemonitor.h
|
||||
)
|
||||
|
||||
set(SOURCES ${SOURCES}
|
||||
${CMAKE_CURRENT_LIST_DIR}/router_linux.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../client/platforms/linux/linuxnetworkwatcher.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../client/platforms/linux/linuxnetworkwatcherworker.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../client/platforms/linux/linuxdependencies.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../client/platforms/linux/daemon/dnsutilslinux.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../client/platforms/linux/daemon/iputilslinux.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../client/platforms/linux/daemon/linuxdaemon.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../client/platforms/linux/daemon/wireguardutilslinux.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../client/platforms/linux/daemon/linuxroutemonitor.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
|
|
@ -217,7 +236,7 @@ include_directories(
|
|||
)
|
||||
|
||||
add_executable(${PROJECT} ${SOURCES} ${HEADERS})
|
||||
target_link_libraries(${PROJECT} PRIVATE Qt6::Core Qt6::Widgets Qt6::Network Qt6::RemoteObjects Qt6::Core5Compat ${LIBS})
|
||||
target_link_libraries(${PROJECT} PRIVATE Qt6::Core Qt6::Widgets Qt6::Network Qt6::RemoteObjects Qt6::Core5Compat Qt6::DBus ${LIBS})
|
||||
target_compile_definitions(${PROJECT} PRIVATE "MZ_$<UPPER_CASE:${MZ_PLATFORM_NAME}>")
|
||||
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
|
|
|
|||
|
|
@ -40,12 +40,16 @@ LocalServer::LocalServer(QObject *parent) : QObject(parent),
|
|||
}
|
||||
});
|
||||
|
||||
#if defined(Q_OS_MAC) || defined(Q_OS_WIN)
|
||||
// Init Mozilla Wireguard Daemon
|
||||
if (!server.initialize()) {
|
||||
logger.error() << "Failed to initialize the server";
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
// Signal handling for a proper shutdown.
|
||||
QObject::connect(qApp, &QCoreApplication::aboutToQuit,
|
||||
[]() { LinuxDaemon::instance()->deactivate(); });
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
|
|
|
|||
|
|
@ -10,13 +10,18 @@
|
|||
|
||||
#include "ipcserver.h"
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#include "../../client/daemon/daemonlocalserver.h"
|
||||
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#include "windows/daemon/windowsdaemon.h"
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
#include "linux/daemon/linuxdaemon.h"
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
#include "../../client/daemon/daemonlocalserver.h"
|
||||
#include "macos/daemon/macosdaemon.h"
|
||||
#endif
|
||||
|
||||
|
|
@ -31,13 +36,14 @@ class LocalServer : public QObject
|
|||
public:
|
||||
explicit LocalServer(QObject* parent = nullptr);
|
||||
~LocalServer();
|
||||
|
||||
QSharedPointer<QLocalServer> m_server;
|
||||
|
||||
IpcServer m_ipcServer;
|
||||
QRemoteObjectHost m_serverNode;
|
||||
bool m_isRemotingEnabled = false;
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
DaemonLocalServer server{qApp};
|
||||
LinuxDaemon daemon;
|
||||
#endif
|
||||
#ifdef Q_OS_WIN
|
||||
DaemonLocalServer server{qApp};
|
||||
WindowsDaemon daemon;
|
||||
|
|
|
|||
|
|
@ -54,9 +54,9 @@ bool RouterLinux::routeAdd(const QString &ipWithSubnet, const QString &gw, const
|
|||
if (int err = ioctl(sock, SIOCADDRT, &route) < 0)
|
||||
{
|
||||
qDebug().noquote() << "route add error: gw "
|
||||
<< ((struct sockaddr_in *)&route.rt_gateway)->sin_addr.s_addr
|
||||
<< " ip " << ((struct sockaddr_in *)&route.rt_dst)->sin_addr.s_addr
|
||||
<< " mask " << ((struct sockaddr_in *)&route.rt_genmask)->sin_addr.s_addr << " " << err;
|
||||
<< ((struct sockaddr_in *)&route.rt_gateway)->sin_addr.s_addr
|
||||
<< " ip " << ((struct sockaddr_in *)&route.rt_dst)->sin_addr.s_addr
|
||||
<< " mask " << ((struct sockaddr_in *)&route.rt_genmask)->sin_addr.s_addr << " " << err;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ public:
|
|||
bool clearSavedRoutes();
|
||||
bool routeDelete(const QString &ip, const QString &gw, const int &sock);
|
||||
bool routeDeleteList(const QString &gw, const QStringList &ips);
|
||||
QString getgatewayandiface();
|
||||
void flushDns();
|
||||
|
||||
public slots:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue