summaryrefslogtreecommitdiffhomepage
path: root/ios/PacketTunnel/PacketTunnelProvider/NEProviderStopReason+Debug.swift
blob: 8d04e5d4f6e341d381214fdc901d3783ffcd4a58 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//
//  NEProviderStopReason+Debug.swift
//  PacketTunnel
//
//  Created by pronebird on 14/04/2020.
//  Copyright © 2025 Mullvad VPN AB. All rights reserved.
//

import Foundation
import NetworkExtension

struct ProviderStopReasonWrapper: CustomStringConvertible {
    let reason: NEProviderStopReason

    public var description: String {
        switch reason {
        case .none:
            return "none"
        case .userInitiated:
            return "user initiated"
        case .providerFailed:
            return "provider failed"
        case .noNetworkAvailable:
            return "no network available"
        case .unrecoverableNetworkChange:
            return "unrecoverable network change"
        case .providerDisabled:
            return "provider disabled"
        case .authenticationCanceled:
            return "authentication cancelled"
        case .configurationFailed:
            return "configuration failed"
        case .idleTimeout:
            return "idle timeout"
        case .configurationDisabled:
            return "configuration disabled"
        case .configurationRemoved:
            return "configuration removed"
        case .superceded:
            return "superceded"
        case .userLogout:
            return "user logout"
        case .userSwitch:
            return "user switch"
        case .connectionFailed:
            return "connection failed"
        case .sleep:
            return "sleep"
        case .appUpdate:
            return "app update"
        case .internalError:
            return "internal error"
        @unknown default:
            return "unknown value (\(reason.rawValue))"
        }
    }
}