-
Notifications
You must be signed in to change notification settings - Fork 384
/
Copy pathNoRelaysSatisfyingConstraintsError.swift
46 lines (41 loc) · 1.3 KB
/
NoRelaysSatisfyingConstraintsError.swift
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
//
// NoRelaysSatisfyingConstraintsError.swift
// MullvadREST
//
// Created by Mojgan on 2024-04-26.
// Copyright © 2024 Mullvad VPN AB. All rights reserved.
//
import Foundation
public enum NoRelaysSatisfyingConstraintsReason {
case filterConstraintNotMatching
case invalidPort
case entryEqualsExit
case multihopInvalidFlow
case noActiveRelaysFound
case noDaitaRelaysFound
case relayConstraintNotMatching
}
public struct NoRelaysSatisfyingConstraintsError: LocalizedError {
public let reason: NoRelaysSatisfyingConstraintsReason
public var errorDescription: String? {
switch reason {
case .filterConstraintNotMatching:
"Filter yields no matching relays"
case .invalidPort:
"Invalid port selected by RelaySelector"
case .entryEqualsExit:
"Entry and exit relays are the same"
case .multihopInvalidFlow:
"Invalid multihop decision flow"
case .noActiveRelaysFound:
"No active relays found"
case .noDaitaRelaysFound:
"No DAITA relays found"
case .relayConstraintNotMatching:
"Invalid constraint created to pick a relay"
}
}
public init(_ reason: NoRelaysSatisfyingConstraintsReason) {
self.reason = reason
}
}