-
Notifications
You must be signed in to change notification settings - Fork 354
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Swiftlint warnings (file length) in files related to simulator tu…
…nnel
- Loading branch information
1 parent
97a10b1
commit 7cc3621
Showing
5 changed files
with
369 additions
and
326 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
ios/MullvadVPN/SimulatorTunnelProvider/SimulatorTunnelInfo.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// | ||
// SimulatorTunnelInfo.swift | ||
// MullvadVPN | ||
// | ||
// Created by Jon Petersson on 2023-09-07. | ||
// Copyright © 2023 Mullvad VPN AB. All rights reserved. | ||
// | ||
|
||
#if targetEnvironment(simulator) | ||
|
||
import Foundation | ||
import NetworkExtension | ||
|
||
final class SimulatorTunnelProviderSession: SimulatorVPNConnection, VPNTunnelProviderSessionProtocol { | ||
func sendProviderMessage(_ messageData: Data, responseHandler: ((Data?) -> Void)?) throws { | ||
SimulatorTunnelProvider.shared.handleAppMessage( | ||
messageData, | ||
completionHandler: responseHandler | ||
) | ||
} | ||
} | ||
|
||
/// A mock struct for tunnel configuration and connection | ||
struct SimulatorTunnelInfo { | ||
/// A unique identifier for the configuration | ||
var identifier = UUID().uuidString | ||
|
||
/// An associated VPN connection. | ||
/// Intentionally initialized with a `SimulatorTunnelProviderSession` subclass which | ||
/// implements the necessary protocol | ||
var connection: SimulatorVPNConnection = SimulatorTunnelProviderSession() | ||
|
||
/// Whether configuration is enabled | ||
var isEnabled = false | ||
|
||
/// Whether on-demand VPN is enabled | ||
var isOnDemandEnabled = false | ||
|
||
/// On-demand VPN rules | ||
var onDemandRules = [NEOnDemandRule]() | ||
|
||
/// Protocol configuration | ||
var protocolConfiguration: NEVPNProtocol? { | ||
didSet { | ||
connection.protocolConfiguration = protocolConfiguration ?? NEVPNProtocol() | ||
} | ||
} | ||
|
||
/// Tunnel description | ||
var localizedDescription: String? | ||
|
||
/// Designated initializer | ||
init() {} | ||
} | ||
|
||
#endif |
Oops, something went wrong.