Skip to content

Commit 313921c

Browse files
authored
Merge pull request #43 from ngrok/bob/windont
rust/tokio do not include unixstream at all on windows
2 parents bbc9f75 + d9a4c03 commit 313921c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

ngrok/src/tunnel_ext.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#[cfg(not(target_os = "windows"))]
2+
use std::path::Path;
13
#[cfg(feature = "hyper")]
24
use std::{
35
convert::Infallible,
@@ -6,7 +8,6 @@ use std::{
68
use std::{
79
io,
810
net::SocketAddr,
9-
path::Path,
1011
};
1112

1213
use async_trait::async_trait;
@@ -19,6 +20,8 @@ use hyper::{
1920
Response,
2021
StatusCode,
2122
};
23+
#[cfg(not(target_os = "windows"))]
24+
use tokio::net::UnixStream;
2225
use tokio::{
2326
io::{
2427
AsyncRead,
@@ -29,7 +32,6 @@ use tokio::{
2932
net::{
3033
TcpStream,
3134
ToSocketAddrs,
32-
UnixStream,
3335
},
3436
task::JoinHandle,
3537
};
@@ -69,6 +71,7 @@ pub trait TunnelExt: Tunnel {
6971
}
7072

7173
/// Forward incoming tunnel connections to the provided Unix socket path.
74+
#[cfg(not(target_os = "windows"))]
7275
#[instrument(level = "debug", skip_all, fields(path))]
7376
async fn forward_unix(&mut self, addr: String) -> Result<(), io::Error> {
7477
forward_unix_conns(self, addr, |_, _| {}).await
@@ -95,6 +98,7 @@ where
9598
Ok(())
9699
}
97100

101+
#[cfg(not(target_os = "windows"))]
98102
async fn forward_unix_conns<T, F>(
99103
this: &mut T,
100104
addr: String,
@@ -193,6 +197,7 @@ where
193197
Ok(true)
194198
}
195199

200+
#[cfg(not(target_os = "windows"))]
196201
#[instrument(level = "debug", skip_all, fields(remote_addr, local_addr))]
197202
async fn handle_one_unix<T, F>(this: &mut T, addr: &Path, on_error: F) -> Result<bool, io::Error>
198203
where

0 commit comments

Comments
 (0)