fix imports for non unix target
This commit is contained in:
parent
c7645a8d9c
commit
56543696b7
2 changed files with 11 additions and 3 deletions
|
@ -823,6 +823,7 @@ async fn main() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
#[cfg(unix)]
|
||||||
LocalProtocol::Unix { path } => {
|
LocalProtocol::Unix { path } => {
|
||||||
let path = path.clone();
|
let path = path.clone();
|
||||||
tokio::spawn(async move {
|
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::Stdio
|
||||||
| LocalProtocol::TProxyTcp
|
| LocalProtocol::TProxyTcp
|
||||||
| LocalProtocol::TProxyUdp { .. }
|
| LocalProtocol::TProxyUdp { .. }
|
||||||
|
@ -938,7 +943,7 @@ async fn main() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
#[cfg(not(unix))]
|
#[cfg(not(unix))]
|
||||||
LocalProtocol::Unix => {
|
LocalProtocol::Unix { .. } => {
|
||||||
panic!("Unix socket is not available for non Unix platform")
|
panic!("Unix socket is not available for non Unix platform")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ use std::sync::Arc;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
use super::{tunnel_to_jwt_token, JwtTunnelConfig, RemoteAddr, JWT_DECODE, JWT_HEADER_PREFIX};
|
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::body::Incoming;
|
||||||
use hyper::header::{COOKIE, SEC_WEBSOCKET_PROTOCOL};
|
use hyper::header::{COOKIE, SEC_WEBSOCKET_PROTOCOL};
|
||||||
use hyper::http::HeaderValue;
|
use hyper::http::HeaderValue;
|
||||||
|
@ -26,7 +26,7 @@ use crate::socks5::Socks5Stream;
|
||||||
use crate::tunnel::tls_reloader::TlsReloader;
|
use crate::tunnel::tls_reloader::TlsReloader;
|
||||||
use crate::udp::UdpStream;
|
use crate::udp::UdpStream;
|
||||||
use tokio::io::{AsyncRead, AsyncWrite, AsyncWriteExt};
|
use tokio::io::{AsyncRead, AsyncWrite, AsyncWriteExt};
|
||||||
use tokio::net::{TcpListener, TcpStream, UnixStream};
|
use tokio::net::{TcpListener, TcpStream};
|
||||||
use tokio::select;
|
use tokio::select;
|
||||||
use tokio::sync::{mpsc, oneshot};
|
use tokio::sync::{mpsc, oneshot};
|
||||||
use tokio_rustls::TlsAcceptor;
|
use tokio_rustls::TlsAcceptor;
|
||||||
|
@ -135,6 +135,9 @@ async fn run_tunnel(
|
||||||
}
|
}
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
LocalProtocol::ReverseUnix { ref path } => {
|
LocalProtocol::ReverseUnix { ref path } => {
|
||||||
|
use crate::unix_socket;
|
||||||
|
use tokio::net::UnixStream;
|
||||||
|
|
||||||
#[allow(clippy::type_complexity)]
|
#[allow(clippy::type_complexity)]
|
||||||
static SERVERS: Lazy<Mutex<HashMap<(Host<String>, u16), mpsc::Receiver<UnixStream>>>> =
|
static SERVERS: Lazy<Mutex<HashMap<(Host<String>, u16), mpsc::Receiver<UnixStream>>>> =
|
||||||
Lazy::new(|| Mutex::new(HashMap::with_capacity(0)));
|
Lazy::new(|| Mutex::new(HashMap::with_capacity(0)));
|
||||||
|
|
Loading…
Reference in a new issue