Skip to content

Commit

Permalink
Remove trailing spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
acb-mv committed Mar 21, 2024
1 parent cf18096 commit 68ad708
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
4 changes: 2 additions & 2 deletions ios/PacketTunnelCore/Actor/PacketTunnelActor+KeyPolicy.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ extension PacketTunnelActor {
func cacheActiveKey(lastKeyRotation: Date?) {
// There should be a way to rationalise these two identical functions into one.
state.mutateAssociatedData { stateData in
guard
guard
stateData.keyPolicy == .useCurrent,
let currentKey = stateData.currentKey
else { return }
// Key policy is preserved between states and key rotation may still happen while in blocked state.
// Therefore perform the key switch as normal with one exception that it shouldn't reconnect the tunnel
// automatically.
stateData.lastKeyRotation = lastKeyRotation

// Move currentKey into keyPolicy.
stateData.keyPolicy = .usePrior(currentKey, startKeySwitchTask())
stateData.currentKey = nil
Expand Down
4 changes: 2 additions & 2 deletions ios/PacketTunnelCore/Actor/State+Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,12 @@ extension State {
var associatedData: StateAssociatedData = connState
modifier(&associatedData)
self = self.replacingConnectionData(with: associatedData as! ConnectionData)

case let .error(blockedState):
var associatedData: StateAssociatedData = blockedState
modifier(&associatedData)
self = .error(associatedData as! BlockingData)

default:
break
}
Expand Down
19 changes: 9 additions & 10 deletions ios/PacketTunnelCore/Actor/State.swift
Original file line number Diff line number Diff line change
Expand Up @@ -109,39 +109,39 @@ extension State {
struct ConnectionData: Equatable, StateAssociatedData {
/// Current selected relay.
public var selectedRelay: SelectedRelay

/// Last relay constraints read from settings.
/// This is primarily used by packet tunnel for updating constraints in tunnel provider.
public var relayConstraints: RelayConstraints

/// Last WG key read from settings.
/// Can be `nil` if moved to `keyPolicy`.
public var currentKey: PrivateKey?

/// Policy describing the current key that should be used by the tunnel.
public var keyPolicy: KeyPolicy

/// Whether network connectivity outside of tunnel is available.
public var networkReachability: NetworkReachability

/// Connection attempt counter.
/// Reset to zero once connection is established.
public var connectionAttemptCount: UInt

/// Last time packet tunnel rotated the key.
public var lastKeyRotation: Date?

/// Increment connection attempt counter by one, wrapping to zero on overflow.
public mutating func incrementAttemptCount() {
let (value, isOverflow) = connectionAttemptCount.addingReportingOverflow(1)
connectionAttemptCount = isOverflow ? 0 : value
}

/// The actual endpoint fed to WireGuard, can be a local endpoint if obfuscation is used.
public let connectedEndpoint: MullvadEndpoint
/// Via which transport protocol was the connection made to the relay
public let transportLayer: TransportLayer

/// The remote port that was chosen to connect to `connectedEndpoint`
public let remotePort: UInt16
}
Expand Down Expand Up @@ -178,7 +178,6 @@ extension State {
}
}


/// Reason why packet tunnel entered error state.
public enum BlockedStateReason: String, Codable, Equatable {
/// Device is locked.
Expand Down

0 comments on commit 68ad708

Please sign in to comment.