fix imports for non unix target

This commit is contained in:
Σrebe - Romain GERARD 2024-01-12 17:54:56 +01:00
parent c7645a8d9c
commit 56543696b7
No known key found for this signature in database
GPG key ID: 7A42B4B97E0332F4
2 changed files with 11 additions and 3 deletions

View file

@ -823,6 +823,7 @@ async fn main() {
}
});
}
#[cfg(unix)]
LocalProtocol::Unix { path } => {
let path = path.clone();
tokio::spawn(async move {
@ -852,6 +853,10 @@ async fn main() {
}
});
}
#[cfg(not(unix))]
LocalProtocol::Unix { path } => {
panic!("Unix socket is not available for non Unix platform")
}
LocalProtocol::Stdio
| LocalProtocol::TProxyTcp
| LocalProtocol::TProxyUdp { .. }
@ -938,7 +943,7 @@ async fn main() {
});
}
#[cfg(not(unix))]
LocalProtocol::Unix => {
LocalProtocol::Unix { .. } => {
panic!("Unix socket is not available for non Unix platform")
}

View file

@ -11,7 +11,7 @@ use std::sync::Arc;
use std::time::Duration;
use super::{tunnel_to_jwt_token, JwtTunnelConfig, RemoteAddr, JWT_DECODE, JWT_HEADER_PREFIX};
use crate::{socks5, tcp, tls, udp, unix_socket, LocalProtocol, TlsServerConfig, WsServerConfig};
use crate::{socks5, tcp, tls, udp, LocalProtocol, TlsServerConfig, WsServerConfig};
use hyper::body::Incoming;
use hyper::header::{COOKIE, SEC_WEBSOCKET_PROTOCOL};
use hyper::http::HeaderValue;
@ -26,7 +26,7 @@ use crate::socks5::Socks5Stream;
use crate::tunnel::tls_reloader::TlsReloader;
use crate::udp::UdpStream;
use tokio::io::{AsyncRead, AsyncWrite, AsyncWriteExt};
use tokio::net::{TcpListener, TcpStream, UnixStream};
use tokio::net::{TcpListener, TcpStream};
use tokio::select;
use tokio::sync::{mpsc, oneshot};
use tokio_rustls::TlsAcceptor;
@ -135,6 +135,9 @@ async fn run_tunnel(
}
#[cfg(unix)]
LocalProtocol::ReverseUnix { ref path } => {
use crate::unix_socket;
use tokio::net::UnixStream;
#[allow(clippy::type_complexity)]
static SERVERS: Lazy<Mutex<HashMap<(Host<String>, u16), mpsc::Receiver<UnixStream>>>> =
Lazy::new(|| Mutex::new(HashMap::with_capacity(0)));