Skip to content

Commit

Permalink
fix(#333): Reverse Unix socket is now available for non Unix client
Browse files Browse the repository at this point in the history
  • Loading branch information
erebe committed Aug 15, 2024
1 parent f556435 commit 74434da
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
7 changes: 1 addition & 6 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -913,7 +913,6 @@ async fn main() -> anyhow::Result<()> {
}
});
}
#[cfg(unix)]
LocalProtocol::ReverseUnix { path } => {
let path = path.clone();
tokio::spawn(async move {
Expand All @@ -928,7 +927,7 @@ async fn main() -> anyhow::Result<()> {

let (host, port) = to_host_port(tunnel.local);
let remote = RemoteAddr {
protocol: LocalProtocol::ReverseUnix { path: path.clone() },
protocol: LocalProtocol::ReverseUnix { path },
host,
port,
};
Expand All @@ -937,10 +936,6 @@ async fn main() -> anyhow::Result<()> {
}
});
}
#[cfg(not(unix))]
LocalProtocol::ReverseUnix { .. } => {
panic!("Unix socket is not available for non Unix platform")
}
LocalProtocol::Stdio { .. }
| LocalProtocol::TProxyTcp
| LocalProtocol::TProxyUdp { .. }
Expand Down
2 changes: 1 addition & 1 deletion src/tunnel/server/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ impl WsServer {
let remote_port = find_mapped_port(remote.port, restriction);
let local_srv = (remote.host, remote_port);
let bind = try_to_sock_addr(local_srv.clone())?;
let listening_server = async { UnixTunnelListener::new(path, local_srv.clone(), false).await };
let listening_server = async { UnixTunnelListener::new(path, local_srv, false).await };
let ((local_rx, local_tx), remote) = SERVERS.run_listening_server(bind, listening_server).await?;

Ok((remote, Box::pin(local_rx), Box::pin(local_tx)))
Expand Down

0 comments on commit 74434da

Please sign in to comment.