parent
f6acec53c0
commit
ba4237f1dd
64 changed files with 1933 additions and 336 deletions
|
|
@ -13,6 +13,7 @@ namespace amnezia {
|
|||
enum PermittedProcess {
|
||||
OpenVPN,
|
||||
Wireguard,
|
||||
Tun2Socks,
|
||||
CertUtil
|
||||
};
|
||||
|
||||
|
|
@ -24,6 +25,8 @@ inline QString permittedProcessPath(PermittedProcess pid)
|
|||
return Utils::wireguardExecPath();
|
||||
} else if (pid == PermittedProcess::CertUtil) {
|
||||
return Utils::certUtilPath();
|
||||
} else if (pid == PermittedProcess::Tun2Socks) {
|
||||
return Utils::tun2socksPath();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#include <QtCore>
|
||||
#include <QString>
|
||||
#include <QJsonObject>
|
||||
#include <QHostAddress>
|
||||
#include "../client/daemon/interfaceconfig.h"
|
||||
|
||||
class IpcInterface
|
||||
|
|
@ -21,8 +22,15 @@ class IpcInterface
|
|||
SLOT( void cleanUp() );
|
||||
SLOT( void setLogsEnabled(bool enabled) );
|
||||
|
||||
SLOT( bool createTun(const QString &dev, const QString &subnet) );
|
||||
SLOT( bool deleteTun(const QString &dev) );
|
||||
|
||||
SLOT( void StartRoutingIpv6() );
|
||||
SLOT( void StopRoutingIpv6() );
|
||||
|
||||
SLOT( bool disableKillSwitch() );
|
||||
SLOT( bool enablePeerTraffic( const QJsonObject &configStr) );
|
||||
SLOT( bool enableKillSwitch( const QJsonObject &excludeAddr, int vpnAdapterIndex) );
|
||||
SLOT( bool updateResolvers(const QString& ifname, const QList<QHostAddress>& resolvers) );
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -160,6 +160,30 @@ void IpcServer::cleanUp()
|
|||
Logger::cleanUp();
|
||||
}
|
||||
|
||||
bool IpcServer::createTun(const QString &dev, const QString &subnet)
|
||||
{
|
||||
return Router::createTun(dev, subnet);
|
||||
}
|
||||
|
||||
bool IpcServer::deleteTun(const QString &dev)
|
||||
{
|
||||
return Router::deleteTun(dev);
|
||||
}
|
||||
|
||||
bool IpcServer::updateResolvers(const QString& ifname, const QList<QHostAddress>& resolvers)
|
||||
{
|
||||
return Router::updateResolvers(ifname, resolvers);
|
||||
}
|
||||
|
||||
void IpcServer::StartRoutingIpv6()
|
||||
{
|
||||
Router::StartRoutingIpv6();
|
||||
}
|
||||
void IpcServer::StopRoutingIpv6()
|
||||
{
|
||||
Router::StopRoutingIpv6();
|
||||
}
|
||||
|
||||
void IpcServer::setLogsEnabled(bool enabled)
|
||||
{
|
||||
#ifdef MZ_DEBUG
|
||||
|
|
@ -223,6 +247,7 @@ bool IpcServer::enableKillSwitch(const QJsonObject &configStr, int vpnAdapterInd
|
|||
LinuxFirewall::setAnchorEnabled(LinuxFirewall::IPv6, QStringLiteral("250.blockIPv6"), true);
|
||||
LinuxFirewall::setAnchorEnabled(LinuxFirewall::Both, QStringLiteral("290.allowDHCP"), true);
|
||||
LinuxFirewall::setAnchorEnabled(LinuxFirewall::Both, QStringLiteral("300.allowLAN"), true);
|
||||
LinuxFirewall::setAnchorEnabled(LinuxFirewall::IPv4, QStringLiteral("310.blockDNS"), true);
|
||||
QStringList dnsServers;
|
||||
dnsServers.append(configStr.value(amnezia::config_key::dns1).toString());
|
||||
dnsServers.append(configStr.value(amnezia::config_key::dns2).toString());
|
||||
|
|
|
|||
|
|
@ -27,9 +27,14 @@ public:
|
|||
virtual QStringList getTapList() override;
|
||||
virtual void cleanUp() override;
|
||||
virtual void setLogsEnabled(bool enabled) override;
|
||||
virtual bool createTun(const QString &dev, const QString &subnet) override;
|
||||
virtual bool deleteTun(const QString &dev) override;
|
||||
virtual void StartRoutingIpv6() override;
|
||||
virtual void StopRoutingIpv6() override;
|
||||
virtual bool enablePeerTraffic(const QJsonObject &configStr) override;
|
||||
virtual bool enableKillSwitch(const QJsonObject &excludeAddr, int vpnAdapterIndex) override;
|
||||
virtual bool disableKillSwitch() override;
|
||||
virtual bool updateResolvers(const QString& ifname, const QList<QHostAddress>& resolvers) override;
|
||||
|
||||
private:
|
||||
int m_localpid = 0;
|
||||
|
|
|
|||
|
|
@ -32,6 +32,8 @@ void IpcServerProcess::start()
|
|||
if (m_process->program().isEmpty()) {
|
||||
qDebug() << "IpcServerProcess failed to start, program is empty";
|
||||
}
|
||||
|
||||
Utils::killProcessByName(m_process->program());
|
||||
m_process->start();
|
||||
qDebug() << "IpcServerProcess started, " << m_process->program() << m_process->arguments();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue