File tree 5 files changed +9
-9
lines changed
MullvadRustRuntime/include
5 files changed +9
-9
lines changed Original file line number Diff line number Diff line change 5
5
#include <stdint.h>
6
6
#include <stdlib.h>
7
7
8
+ /**
9
+ * SAFETY: `TunnelObfuscatorProtocol` values must either be `0` or `1`
10
+ */
8
11
enum TunnelObfuscatorProtocol {
9
12
UdpOverTcp = 0 ,
10
13
Shadowsocks ,
Original file line number Diff line number Diff line change 8
8
9
9
import Network
10
10
11
+ /// > Warning: Do not use this implementation in production code. See the warning in `start()`.
11
12
class UnsafeListener < T: Connection > {
12
13
private let dispatchQueue = DispatchQueue ( label: " com.test.unsafeListener " )
13
14
private let listener : NWListener
Original file line number Diff line number Diff line change 2
2
mod encrypted_dns_proxy;
3
3
mod ephemeral_peer_proxy;
4
4
mod shadowsocks_proxy;
5
- mod tunnel_obfuscator_proxy;
5
+ pub mod tunnel_obfuscator_proxy;
6
6
7
7
#[ repr( C ) ]
8
8
pub struct ProxyHandle {
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ use std::{
7
7
8
8
static INIT_LOGGING : Once = Once :: new ( ) ;
9
9
10
- # [ allow ( dead_code ) ]
10
+ /// SAFETY: `TunnelObfuscatorProtocol` values must either be `0` or `1`
11
11
#[ repr( u8 ) ]
12
12
pub enum TunnelObfuscatorProtocol {
13
13
UdpOverTcp = 0 ,
@@ -35,8 +35,7 @@ pub unsafe extern "C" fn start_tunnel_obfuscator_proxy(
35
35
return -1 ;
36
36
} ;
37
37
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 ( ) ;
40
39
41
40
match result {
42
41
Ok ( ( local_endpoint, obfuscator_handle) ) => {
Original file line number Diff line number Diff line change @@ -17,10 +17,7 @@ pub struct TunnelObfuscatorRuntime {
17
17
}
18
18
19
19
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 {
24
21
let settings: ObfuscationSettings = match obfuscation_protocol {
25
22
TunnelObfuscatorProtocol :: UdpOverTcp => {
26
23
ObfuscationSettings :: Udp2Tcp ( udp2tcp:: Settings { peer } )
@@ -33,7 +30,7 @@ impl TunnelObfuscatorRuntime {
33
30
}
34
31
} ;
35
32
36
- Ok ( Self { settings } )
33
+ Self { settings }
37
34
}
38
35
39
36
pub fn run ( self ) -> io:: Result < ( SocketAddr , TunnelObfuscatorHandle ) > {
You can’t perform that action at this time.
0 commit comments