fix(#380): Fix reverse udp tunnel
Correctly set the correct destination in the udp connector
This commit is contained in:
parent
5584972c46
commit
70427227b1
1 changed files with 7 additions and 6 deletions
13
src/main.rs
13
src/main.rs
|
@ -444,7 +444,8 @@ fn parse_local_bind(arg: &str) -> Result<(SocketAddr, &str), io::Error> {
|
||||||
fn parse_tunnel_dest(remaining: &str) -> Result<(Host<String>, u16, BTreeMap<String, String>), io::Error> {
|
fn parse_tunnel_dest(remaining: &str) -> Result<(Host<String>, u16, BTreeMap<String, String>), io::Error> {
|
||||||
use std::io::Error;
|
use std::io::Error;
|
||||||
|
|
||||||
let Ok(remote) = Url::parse(&format!("fake://{}", remaining)) else {
|
// Using http or else the URL lib don't try to fully parse the host into an IPv4/IPv6
|
||||||
|
let Ok(remote) = Url::parse(&format!("https://{}", remaining)) else {
|
||||||
return Err(Error::new(
|
return Err(Error::new(
|
||||||
ErrorKind::InvalidInput,
|
ErrorKind::InvalidInput,
|
||||||
format!("cannot parse remote from {}", remaining),
|
format!("cannot parse remote from {}", remaining),
|
||||||
|
@ -867,8 +868,8 @@ async fn main() -> anyhow::Result<()> {
|
||||||
port,
|
port,
|
||||||
};
|
};
|
||||||
let udp_connector = UdpTunnelConnector::new(
|
let udp_connector = UdpTunnelConnector::new(
|
||||||
&remote.host,
|
&tunnel.remote.0,
|
||||||
remote.port,
|
tunnel.remote.1,
|
||||||
cfg.socket_so_mark,
|
cfg.socket_so_mark,
|
||||||
cfg.timeout_connect,
|
cfg.timeout_connect,
|
||||||
&cfg.dns_resolver,
|
&cfg.dns_resolver,
|
||||||
|
@ -910,14 +911,14 @@ async fn main() -> anyhow::Result<()> {
|
||||||
port,
|
port,
|
||||||
};
|
};
|
||||||
let tcp_connector = TcpTunnelConnector::new(
|
let tcp_connector = TcpTunnelConnector::new(
|
||||||
&remote.host,
|
&tunnel.remote.0,
|
||||||
remote.port,
|
tunnel.remote.1,
|
||||||
cfg.socket_so_mark,
|
cfg.socket_so_mark,
|
||||||
cfg.timeout_connect,
|
cfg.timeout_connect,
|
||||||
&cfg.dns_resolver,
|
&cfg.dns_resolver,
|
||||||
);
|
);
|
||||||
|
|
||||||
if let Err(err) = client.run_reverse_tunnel(remote.clone(), tcp_connector).await {
|
if let Err(err) = client.run_reverse_tunnel(remote, tcp_connector).await {
|
||||||
error!("{:?}", err);
|
error!("{:?}", err);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue