diff options
| author | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2019-11-01 20:35:53 +0000 |
|---|---|---|
| committer | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2019-11-04 17:29:17 +0000 |
| commit | b02ea5b346fabfb4d5e257cf9f3f3d3db9aaee5b (patch) | |
| tree | 65d6efcda1a7314e9c85ba14587d6006e69a44ac /talpid-core/src | |
| parent | ea6ca75a2c360048b807ce6108866a655371c2f3 (diff) | |
| download | mullvadvpn-b02ea5b346fabfb4d5e257cf9f3f3d3db9aaee5b.tar.xz mullvadvpn-b02ea5b346fabfb4d5e257cf9f3f3d3db9aaee5b.zip | |
Add `TunProvider::create_tun` method
Can be used to forcefully create (or recreate) the tun device.
Diffstat (limited to 'talpid-core/src')
| -rw-r--r-- | talpid-core/src/tunnel/tun_provider/mod.rs | 8 | ||||
| -rw-r--r-- | talpid-core/src/tunnel/tun_provider/stub.rs | 5 |
2 files changed, 13 insertions, 0 deletions
diff --git a/talpid-core/src/tunnel/tun_provider/mod.rs b/talpid-core/src/tunnel/tun_provider/mod.rs index 3cac459c51..16c9c3f17c 100644 --- a/talpid-core/src/tunnel/tun_provider/mod.rs +++ b/talpid-core/src/tunnel/tun_provider/mod.rs @@ -53,6 +53,14 @@ pub trait TunProvider: Send + 'static { fn get_tun(&mut self, config: TunConfig) -> Result<Box<dyn Tun>, BoxedError>; /// Open a tunnel device using the previous or the default configuration. + /// + /// Will open a new tunnel if there is already an active tunnel. The previous tunnel will be + /// closed. + #[cfg(target_os = "android")] + fn create_tun(&mut self) -> Result<(), BoxedError>; + + /// Open a tunnel device using the previous or the default configuration if there is no + /// currently active tunnel. #[cfg(target_os = "android")] fn create_tun_if_closed(&mut self) -> Result<(), BoxedError>; diff --git a/talpid-core/src/tunnel/tun_provider/stub.rs b/talpid-core/src/tunnel/tun_provider/stub.rs index be985c8045..3cd6dd0ee8 100644 --- a/talpid-core/src/tunnel/tun_provider/stub.rs +++ b/talpid-core/src/tunnel/tun_provider/stub.rs @@ -16,6 +16,11 @@ impl TunProvider for StubTunProvider { } #[cfg(target_os = "android")] + fn create_tun(&mut self) -> Result<(), BoxedError> { + unimplemented!(); + } + + #[cfg(target_os = "android")] fn create_tun_if_closed(&mut self) -> Result<(), BoxedError> { unimplemented!(); } |
