Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rust/tokio do not include unixstream at all on windows #43

Merged
merged 1 commit into from
Jan 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions ngrok/src/tunnel_ext.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#[cfg(not(target_os = "windows"))]
use std::path::Path;
#[cfg(feature = "hyper")]
use std::{
convert::Infallible,
Expand All @@ -6,7 +8,6 @@ use std::{
use std::{
io,
net::SocketAddr,
path::Path,
};

use async_trait::async_trait;
Expand All @@ -19,6 +20,8 @@ use hyper::{
Response,
StatusCode,
};
#[cfg(not(target_os = "windows"))]
use tokio::net::UnixStream;
use tokio::{
io::{
AsyncRead,
Expand All @@ -29,7 +32,6 @@ use tokio::{
net::{
TcpStream,
ToSocketAddrs,
UnixStream,
},
task::JoinHandle,
};
Expand Down Expand Up @@ -69,6 +71,7 @@ pub trait TunnelExt: Tunnel {
}

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

#[cfg(not(target_os = "windows"))]
async fn forward_unix_conns<T, F>(
this: &mut T,
addr: String,
Expand Down Expand Up @@ -193,6 +197,7 @@ where
Ok(true)
}

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