Skip to content

Commit b051647

Browse files
committed
Address PR feedback
1 parent 682146c commit b051647

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

ios/MullvadRustRuntime/include/mullvad_rust_runtime.h

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
#include <stdint.h>
66
#include <stdlib.h>
77

8+
/**
9+
* SAFETY: `TunnelObfuscatorProtocol` values must either be `0` or `1`
10+
*/
811
enum TunnelObfuscatorProtocol {
912
UdpOverTcp = 0,
1013
Shadowsocks,

ios/MullvadRustRuntimeTests/UnsafeListener.swift

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
import Network
1010

11+
/// > Warning: Do not use this implementation in production code. See the warning in `start()`.
1112
class UnsafeListener<T: Connection> {
1213
private let dispatchQueue = DispatchQueue(label: "com.test.unsafeListener")
1314
private let listener: NWListener

mullvad-ios/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
mod encrypted_dns_proxy;
33
mod ephemeral_peer_proxy;
44
mod shadowsocks_proxy;
5-
mod tunnel_obfuscator_proxy;
5+
pub mod tunnel_obfuscator_proxy;
66

77
#[repr(C)]
88
pub struct ProxyHandle {

mullvad-ios/src/tunnel_obfuscator_proxy/ffi.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use std::{
77

88
static INIT_LOGGING: Once = Once::new();
99

10-
#[allow(dead_code)]
10+
/// SAFETY: `TunnelObfuscatorProtocol` values must either be `0` or `1`
1111
#[repr(u8)]
1212
pub enum TunnelObfuscatorProtocol {
1313
UdpOverTcp = 0,
@@ -35,8 +35,7 @@ pub unsafe extern "C" fn start_tunnel_obfuscator_proxy(
3535
return -1;
3636
};
3737

38-
let result = TunnelObfuscatorRuntime::new(peer_sock_addr, obfuscation_protocol)
39-
.and_then(|runtime| runtime.run());
38+
let result = TunnelObfuscatorRuntime::new(peer_sock_addr, obfuscation_protocol).run();
4039

4140
match result {
4241
Ok((local_endpoint, obfuscator_handle)) => {

mullvad-ios/src/tunnel_obfuscator_proxy/mod.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,7 @@ pub struct TunnelObfuscatorRuntime {
1717
}
1818

1919
impl TunnelObfuscatorRuntime {
20-
pub fn new(
21-
peer: SocketAddr,
22-
obfuscation_protocol: TunnelObfuscatorProtocol,
23-
) -> io::Result<Self> {
20+
pub fn new(peer: SocketAddr, obfuscation_protocol: TunnelObfuscatorProtocol) -> Self {
2421
let settings: ObfuscationSettings = match obfuscation_protocol {
2522
TunnelObfuscatorProtocol::UdpOverTcp => {
2623
ObfuscationSettings::Udp2Tcp(udp2tcp::Settings { peer })
@@ -33,7 +30,7 @@ impl TunnelObfuscatorRuntime {
3330
}
3431
};
3532

36-
Ok(Self { settings })
33+
Self { settings }
3734
}
3835

3936
pub fn run(self) -> io::Result<(SocketAddr, TunnelObfuscatorHandle)> {

0 commit comments

Comments
 (0)