-
Notifications
You must be signed in to change notification settings - Fork 354
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'move-transportstrategy-into-mullvadtransport-ios-28'
- Loading branch information
Showing
87 changed files
with
264 additions
and
985 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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Large diffs are not rendered by default.
Oops, something went wrong.
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
File renamed without changes.
File renamed without changes.
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 |
---|---|---|
|
@@ -7,7 +7,6 @@ | |
// | ||
|
||
import Foundation | ||
import MullvadREST | ||
import MullvadTypes | ||
|
||
public protocol RelayCacheProtocol { | ||
|
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 |
---|---|---|
|
@@ -7,7 +7,6 @@ | |
// | ||
|
||
import Foundation | ||
import MullvadREST | ||
import MullvadTypes | ||
|
||
private let defaultPort: UInt16 = 53 | ||
|
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 @@ | ||
// | ||
// Jittered.swift | ||
// MullvadREST | ||
// | ||
// Created by Mojgan on 2023-12-08. | ||
// Copyright © 2023 Mullvad VPN AB. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
import MullvadTypes | ||
|
||
struct Jittered<InnerIterator: IteratorProtocol>: IteratorProtocol | ||
where InnerIterator.Element == Duration { | ||
private var inner: InnerIterator | ||
|
||
init(_ inner: InnerIterator) { | ||
self.inner = inner | ||
} | ||
|
||
mutating func next() -> Duration? { | ||
guard let interval = inner.next() else { return nil } | ||
|
||
let jitter = Double.random(in: 0.0 ... 1.0) | ||
let millis = interval.milliseconds | ||
let millisWithJitter = millis.saturatingAddition(Int(Double(millis) * jitter)) | ||
|
||
return .milliseconds(millisWithJitter) | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
ios/MullvadREST/RESTRetryStrategy.swift → ...vadREST/RetryStrategy/RetryStrategy.swift
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
// | ||
// RESTRetryStrategy.swift | ||
// RetryStrategy.swift | ||
// MullvadREST | ||
// | ||
// Created by pronebird on 09/12/2021. | ||
|
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,36 @@ | ||
#include <stdarg.h> | ||
#include <stdbool.h> | ||
#include <stdint.h> | ||
#include <stdlib.h> | ||
|
||
typedef struct ProxyHandle { | ||
void *context; | ||
uint16_t port; | ||
} ProxyHandle; | ||
|
||
/** | ||
* # Safety | ||
* `addr`, `password`, `cipher` must be valid for the lifetime of this function call and they must | ||
* be backed by the amount of bytes as stored in the respective `*_len` parameters. | ||
* | ||
* `proxy_config` must be pointing to a valid memory region for the size of a `ProxyHandle` | ||
* instance. | ||
*/ | ||
int32_t start_shadowsocks_proxy(const uint8_t *forward_address, | ||
uintptr_t forward_address_len, | ||
uint16_t forward_port, | ||
const uint8_t *addr, | ||
uintptr_t addr_len, | ||
uint16_t port, | ||
const uint8_t *password, | ||
uintptr_t password_len, | ||
const uint8_t *cipher, | ||
uintptr_t cipher_len, | ||
struct ProxyHandle *proxy_config); | ||
|
||
/** | ||
* # Safety | ||
* `proxy_config` must be pointing to a valid instance of a `ProxyInstance`, as instantiated by | ||
* `start_shadowsocks_proxy`. | ||
*/ | ||
int32_t stop_shadowsocks_proxy(struct ProxyHandle *proxy_config); |
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
2 changes: 1 addition & 1 deletion
2
ios/MullvadREST/RESTTransportStrategy.swift → ...vadREST/Transport/TransportStrategy.swift
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.