buildfix and naming

This commit is contained in:
Mykola Baibuz 2025-04-24 18:31:26 +03:00
parent 6be32445ba
commit 7cc8aad876
5 changed files with 15 additions and 12 deletions

View file

@ -15,9 +15,12 @@
#include "amnezia_application.h" #include "amnezia_application.h"
#include "core/api/apiUtils.h" #include "core/api/apiUtils.h"
#include "utilities.h" #include "utilities.h"
#include "core/ipcclient.h"
#include "core/networkUtilities.h" #include "core/networkUtilities.h"
#ifdef AMNEZIA_DESKTOP
#include "core/ipcclient.h"
#endif
namespace namespace
{ {
namespace configKey namespace configKey
@ -54,12 +57,12 @@ ErrorCode GatewayController::get(const QString &endpoint, QByteArray &responseBo
request.setUrl(QString(endpoint).arg(m_gatewayEndpoint)); request.setUrl(QString(endpoint).arg(m_gatewayEndpoint));
// bypass killSwitch exceptions for API-gateway // bypass killSwitch exceptions for API-gateway
#if defined(Q_OS_LINUX) || defined(Q_OS_MACOS) || defined(Q_OS_WIN) #ifdef AMNEZIA_DESKTOP
{ {
QString host = QUrl(request.url()).host(); QString host = QUrl(request.url()).host();
QString ip = NetworkUtilities::getIPAddress(host); QString ip = NetworkUtilities::getIPAddress(host);
if (!ip.isEmpty()) { if (!ip.isEmpty()) {
IpcClient::Interface()->addKillSwitchExceptions(QStringList{ip}); IpcClient::Interface()->addKillSwitchAllowedRange(QStringList{ip});
} }
} }
#endif #endif
@ -116,12 +119,12 @@ ErrorCode GatewayController::post(const QString &endpoint, const QJsonObject api
request.setUrl(endpoint.arg(m_gatewayEndpoint)); request.setUrl(endpoint.arg(m_gatewayEndpoint));
// bypass killSwitch exceptions for API-gateway // bypass killSwitch exceptions for API-gateway
#if defined(Q_OS_LINUX) || defined(Q_OS_MACOS) || defined(Q_OS_WIN) #ifdef AMNEZIA_DESKTOP
{ {
QString host = QUrl(request.url()).host(); QString host = QUrl(request.url()).host();
QString ip = NetworkUtilities::getIPAddress(host); QString ip = NetworkUtilities::getIPAddress(host);
if (!ip.isEmpty()) { if (!ip.isEmpty()) {
IpcClient::Interface()->addKillSwitchExceptions(QStringList{ip}); IpcClient::Interface()->addKillSwitchAllowedRange(QStringList{ip});
} }
} }
#endif #endif

View file

@ -172,7 +172,7 @@ ErrorCode OpenVpnProtocol::start()
} }
#if defined(Q_OS_LINUX) || defined(Q_OS_MACOS) #if defined(Q_OS_LINUX) || defined(Q_OS_MACOS)
IpcClient::Interface()->addKillSwitchExceptions(QStringList(NetworkUtilities::getIPAddress( IpcClient::Interface()->addKillSwitchAllowedRange(QStringList(NetworkUtilities::getIPAddress(
m_configData.value(amnezia::config_key::hostName).toString()))); m_configData.value(amnezia::config_key::hostName).toString())));
#endif #endif

View file

@ -31,8 +31,8 @@ class IpcInterface
SLOT( bool disableKillSwitch() ); SLOT( bool disableKillSwitch() );
SLOT( bool disableAllTraffic() ); SLOT( bool disableAllTraffic() );
SLOT( bool refreshKillSwitch( bool enabled ) ); SLOT( bool refreshKillSwitch( bool enabled ) );
SLOT( bool allowTrafficTo( const QStringList ranges ) ); SLOT( bool addKillSwitchAllowedRange( const QStringList ranges ) );
SLOT( bool addKillSwitchExceptions( const QStringList ranges ) ); SLOT( bool resetKillSwitchAllowedRange( const QStringList ranges ) );
SLOT( bool enablePeerTraffic( const QJsonObject &configStr) ); SLOT( bool enablePeerTraffic( const QJsonObject &configStr) );
SLOT( bool enableKillSwitch( const QJsonObject &excludeAddr, int vpnAdapterIndex) ); SLOT( bool enableKillSwitch( const QJsonObject &excludeAddr, int vpnAdapterIndex) );
SLOT( bool updateResolvers(const QString& ifname, const QList<QHostAddress>& resolvers) ); SLOT( bool updateResolvers(const QString& ifname, const QList<QHostAddress>& resolvers) );

View file

@ -179,12 +179,12 @@ void IpcServer::setLogsEnabled(bool enabled)
} }
} }
bool IpcServer::allowTrafficTo(QStringList ranges) bool IpcServer::resetKillSwitchAllowedRange(QStringList ranges)
{ {
return KillSwitch::instance()->resetAllowedRange(ranges); return KillSwitch::instance()->resetAllowedRange(ranges);
} }
bool IpcServer::addKillSwitchExceptions(QStringList ranges) bool IpcServer::addKillSwitchAllowedRange(QStringList ranges)
{ {
return KillSwitch::instance()->addAllowedRange(ranges); return KillSwitch::instance()->addAllowedRange(ranges);
} }

View file

@ -35,13 +35,13 @@ public:
virtual void StartRoutingIpv6() override; virtual void StartRoutingIpv6() override;
virtual void StopRoutingIpv6() override; virtual void StopRoutingIpv6() override;
virtual bool disableAllTraffic() override; virtual bool disableAllTraffic() override;
virtual bool allowTrafficTo(QStringList ranges) override; virtual bool addKillSwitchAllowedRange(QStringList ranges) override;
virtual bool resetKillSwitchAllowedRange(QStringList ranges) override;
virtual bool enablePeerTraffic(const QJsonObject &configStr) override; virtual bool enablePeerTraffic(const QJsonObject &configStr) override;
virtual bool enableKillSwitch(const QJsonObject &excludeAddr, int vpnAdapterIndex) override; virtual bool enableKillSwitch(const QJsonObject &excludeAddr, int vpnAdapterIndex) override;
virtual bool disableKillSwitch() override; virtual bool disableKillSwitch() override;
virtual bool refreshKillSwitch( bool enabled ) override; virtual bool refreshKillSwitch( bool enabled ) override;
virtual bool updateResolvers(const QString& ifname, const QList<QHostAddress>& resolvers) override; virtual bool updateResolvers(const QString& ifname, const QList<QHostAddress>& resolvers) override;
virtual bool addKillSwitchExceptions(QStringList ranges) override;
private: private:
int m_localpid = 0; int m_localpid = 0;