Skip to content

Commit

Permalink
remove is_WireGuard
Browse files Browse the repository at this point in the history
  • Loading branch information
Macbook authored and Macbook committed Dec 22, 2024
1 parent c862d70 commit 6331658
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions client/platforms/ios/ios_controller.mm
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
namespace {
IosController* s_instance = nullptr;
QTimer *m_handshakeTimer = nullptr;
bool is_WireGuard = false;
}

IosController::IosController() : QObject()
Expand Down Expand Up @@ -207,27 +206,21 @@


if (proto == amnezia::Proto::OpenVpn) {
is_WireGuard = false;
return setupOpenVPN();
}
if (proto == amnezia::Proto::Cloak) {
is_WireGuard = false;
return setupCloak();
}
if (proto == amnezia::Proto::WireGuard) {
is_WireGuard = true;
return setupWireGuard();
}
if (proto == amnezia::Proto::Awg) {
is_WireGuard = true;
return setupAwg();
}
if (proto == amnezia::Proto::Xray) {
is_WireGuard = false;
return setupXray();
}
if (proto == amnezia::Proto::SSXray) {
is_WireGuard = false;
return setupSSXray();
}

Expand Down Expand Up @@ -265,10 +258,10 @@
void IosController::vpnStatusDidChange(void *pNotification)
{
NETunnelProviderSession *session = (NETunnelProviderSession *)pNotification;

NETunnelProviderProtocol *tunnelProtocol = (NETunnelProviderProtocol *)m_currentTunnel.protocolConfiguration;
if (session /* && session == TunnelManager.session */ ) {
qDebug() << "IosController::vpnStatusDidChange" << iosStatusToState(session.status) << session;
if (is_WireGuard && session.status == NEVPNStatusConnected)
if (tunnelProtocol.providerConfiguration[@"wireguard"] != nil && session.status == NEVPNStatusConnected)
{
// use last_handshake_time for check status connected for WireGuard
return;
Expand Down Expand Up @@ -680,6 +673,8 @@
protocolName = @"WireGuard";
} else if (tunnelProtocol.providerConfiguration[@"ovpn"] != nil) {
protocolName = @"OpenVPN";
} else if (tunnelProtocol.providerConfiguration[@"xray"] != nil) {
protocolName = @"XRay";
}

m_rxBytes = 0;
Expand Down Expand Up @@ -884,7 +879,6 @@
}
m_handshakeTimer->deleteLater();
m_handshakeTimer = nullptr;
is_WireGuard = false;

qDebug() << "Handshake monitoring stopped.";
} else {
Expand Down

0 comments on commit 6331658

Please sign in to comment.