-
Notifications
You must be signed in to change notification settings - Fork 359
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Relay selector should use overridden IP addresses for relays
- Loading branch information
Jon Petersson
committed
Feb 1, 2024
1 parent
1b17b2e
commit aeca222
Showing
11 changed files
with
256 additions
and
45 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
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,29 @@ | ||
// | ||
// AnyRelay.swift | ||
// MullvadREST | ||
// | ||
// Created by Jon Petersson on 2024-01-31. | ||
// Copyright © 2024 Mullvad VPN AB. All rights reserved. | ||
// | ||
|
||
import MullvadTypes | ||
import Network | ||
|
||
public protocol AnyRelay { | ||
var hostname: String { get } | ||
var owned: Bool { get } | ||
var location: String { get } | ||
var provider: String { get } | ||
var weight: UInt64 { get } | ||
var active: Bool { get } | ||
var includeInCountry: Bool { get } | ||
|
||
func copyWith(ipv4AddrIn: IPv4Address?, ipv6AddrIn: IPv6Address?) -> Self | ||
} | ||
|
||
extension REST.ServerRelay: AnyRelay {} | ||
extension REST.BridgeRelay: AnyRelay { | ||
public func copyWith(ipv4AddrIn: IPv4Address?, ipv6AddrIn: IPv6Address?) -> REST.BridgeRelay { | ||
copyWith(ipv4AddrIn: ipv4AddrIn) | ||
} | ||
} |
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
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
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
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
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
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
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,33 @@ | ||
// | ||
// IPOverrideRepositoryStub.swift | ||
// MullvadVPNTests | ||
// | ||
// Created by Jon Petersson on 2024-01-31. | ||
// Copyright © 2024 Mullvad VPN AB. All rights reserved. | ||
// | ||
|
||
import MullvadSettings | ||
|
||
struct IPOverrideRepositoryStub: IPOverrideRepositoryProtocol { | ||
let overrides: [IPOverride] | ||
|
||
init(overrides: [IPOverride] = []) { | ||
self.overrides = overrides | ||
} | ||
|
||
func add(_ overrides: [IPOverride]) {} | ||
|
||
func fetchAll() -> [IPOverride] { | ||
overrides | ||
} | ||
|
||
func fetchByHostname(_ hostname: String) -> IPOverride? { | ||
nil | ||
} | ||
|
||
func deleteAll() {} | ||
|
||
func parse(data: Data) throws -> [IPOverride] { | ||
overrides | ||
} | ||
} |
Oops, something went wrong.