summaryrefslogtreecommitdiffhomepage
path: root/ios/MullvadVPN/GeneralAPIs/OutgoingConnectionData.swift
blob: 84e35f67f111006958566f23634cab40a2e1c3e0 (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
//
//  OutgoingConnectionData.swift
//  MullvadVPN
//
//  Created by Mojgan on 2023-11-15.
//  Copyright © 2025 Mullvad VPN AB. All rights reserved.
//

import Foundation
import Network

typealias IPV4ConnectionData = OutgoingConnectionData<IPv4Address>
typealias IPV6ConnectionData = OutgoingConnectionData<IPv6Address>

// MARK: - OutgoingConnectionData

struct OutgoingConnectionData<T: Codable & IPAddress>: Codable, Equatable {
    let ip: T
    let exitIP: Bool

    enum CodingKeys: String, CodingKey {
        case ip
        case exitIP = "mullvad_exit_ip"
    }

    static func == (lhs: Self, rhs: Self) -> Bool {
        lhs.ip.rawValue == rhs.ip.rawValue && lhs.exitIP == rhs.exitIP
    }
}