summaryrefslogtreecommitdiffhomepage
path: root/mullvad-rpc/src/lib.rs
diff options
context:
space:
mode:
authorJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2018-04-16 13:22:49 -0300
committerJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2018-04-17 07:56:25 -0300
commit4df4c6c48950f6a5652ea0a4e0cd7da33d2aa554 (patch)
tree1e61a84e0fcc12b5b86e72332c479e6e8f340433 /mullvad-rpc/src/lib.rs
parent41a5db158de9ade895f85dd252e8cbba37080e30 (diff)
downloadmullvadvpn-4df4c6c48950f6a5652ea0a4e0cd7da33d2aa554.tar.xz
mullvadvpn-4df4c6c48950f6a5652ea0a4e0cd7da33d2aa554.zip
Configure SNI domain for TLS handshake with master
Diffstat (limited to 'mullvad-rpc/src/lib.rs')
-rw-r--r--mullvad-rpc/src/lib.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/mullvad-rpc/src/lib.rs b/mullvad-rpc/src/lib.rs
index 6a1a682a1b..82f26b9f28 100644
--- a/mullvad-rpc/src/lib.rs
+++ b/mullvad-rpc/src/lib.rs
@@ -46,6 +46,9 @@ pub mod rest;
mod cached_dns_resolver;
use cached_dns_resolver::CachedDnsResolver;
+mod https_client_with_sni;
+use https_client_with_sni::HttpsClientWithSni;
+
static MASTER_API_HOST: &str = "api.mullvad.net";
@@ -77,7 +80,8 @@ impl MullvadRpcFactory {
/// Spawns a tokio core on a new thread and returns a `HttpHandle` running on that core.
pub fn new_connection(&mut self) -> Result<HttpHandle, HttpError> {
- self.setup_connection(HttpTransport::new()?)
+ let client = HttpsClientWithSni::new(MASTER_API_HOST.to_owned());
+ self.setup_connection(HttpTransport::with_client(client)?)
}
/// Create and returns a `HttpHandle` running on the given core handle.
@@ -85,7 +89,8 @@ impl MullvadRpcFactory {
&mut self,
handle: &Handle,
) -> Result<HttpHandle, HttpError> {
- self.setup_connection(HttpTransport::shared(handle)?)
+ let client = HttpsClientWithSni::new(MASTER_API_HOST.to_owned());
+ self.setup_connection(HttpTransport::with_client_shared(client, handle)?)
}
fn setup_connection(&mut self, transport: HttpTransport) -> Result<HttpHandle, HttpError> {