Code cleanup

This commit is contained in:
pokamest 2021-11-28 19:28:51 +03:00
parent dd427f89bc
commit 340639b3c8
2 changed files with 0 additions and 36 deletions

View file

@ -97,26 +97,11 @@ void WireguardProtocol::readWireguardConfiguration(const QJsonObject &configurat
} }
//bool WireguardProtocol::openVpnProcessIsRunning() const
//{
// return Utils::processIsRunning("openvpn");
//}
QString WireguardProtocol::configPath() const QString WireguardProtocol::configPath() const
{ {
return m_configFileName; return m_configFileName;
} }
void WireguardProtocol::updateRouteGateway(QString line)
{
// TODO: fix for macos
line = line.split("ROUTE_GATEWAY", QString::SkipEmptyParts).at(1);
if (!line.contains("/")) return;
m_routeGateway = line.split("/", QString::SkipEmptyParts).first();
m_routeGateway.replace(" ", "");
qDebug() << "Set VPN route gateway" << m_routeGateway;
}
QString WireguardProtocol::wireguardExecPath() const QString WireguardProtocol::wireguardExecPath() const
{ {
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
@ -238,24 +223,6 @@ ErrorCode WireguardProtocol::start()
#endif #endif
} }
void WireguardProtocol::updateVpnGateway(const QString &line)
{
// // line looks like
// // PUSH: Received control message: 'PUSH_REPLY,route 10.8.0.1,topology net30,ping 10,ping-restart 120,ifconfig 10.8.0.6 10.8.0.5,peer-id 0,cipher AES-256-GCM'
// QStringList params = line.split(",");
// for (const QString &l : params) {
// if (l.contains("ifconfig")) {
// if (l.split(" ").size() == 3) {
// m_vpnLocalAddress = l.split(" ").at(1);
// m_vpnGateway = l.split(" ").at(2);
// qDebug() << QString("Set vpn local address %1, gw %2").arg(m_vpnLocalAddress).arg(vpnGateway());
// }
// }
// }
}
QString WireguardProtocol::serviceName() const QString WireguardProtocol::serviceName() const
{ {
return "AmneziaVPN.WireGuard0"; return "AmneziaVPN.WireGuard0";

View file

@ -24,11 +24,8 @@ public:
private: private:
QString configPath() const; QString configPath() const;
QString wireguardExecPath() const; QString wireguardExecPath() const;
//bool openVpnProcessIsRunning() const;
void readWireguardConfiguration(const QJsonObject &configuration); void readWireguardConfiguration(const QJsonObject &configuration);
void updateRouteGateway(QString line);
void updateVpnGateway(const QString &line);
QString serviceName() const; QString serviceName() const;