From 5119877592af716e442652f68b9b9fbff538d581 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CE=A3rebe=20-=20Romain=20GERARD?= Date: Sat, 20 Jul 2024 12:53:33 +0200 Subject: [PATCH] fix remove test forgotten code --- src/main.rs | 9 +-------- src/tcp.rs | 11 +++++++++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/main.rs b/src/main.rs index f7489cf..59226a2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -32,7 +32,7 @@ use std::sync::Arc; use std::time::Duration; use std::{fmt, io}; use tokio::io::{AsyncRead, AsyncWrite}; -use tokio::net::{TcpStream, UdpSocket}; +use tokio::net::TcpStream; use tokio::select; use tokio_rustls::rustls::pki_types::{CertificateDer, DnsName, PrivateKeyDer, ServerName}; @@ -777,13 +777,6 @@ impl WsClientConfig { #[tokio::main] async fn main() { let args = Wstunnel::parse(); - let socket = UdpSocket::bind(SocketAddrV6::new(Ipv6Addr::UNSPECIFIED, 0, 0, 0)) - .await - .unwrap(); - socket - .connect("[2001:4810:0:3::78]:443".parse::().unwrap()) - .await - .unwrap(); // Setup logging let mut env_filter = EnvFilter::builder().parse(&args.log_lvl).expect("Invalid log level"); diff --git a/src/tcp.rs b/src/tcp.rs index 4cf7fe4..bd02ff3 100644 --- a/src/tcp.rs +++ b/src/tcp.rs @@ -75,8 +75,15 @@ pub async fn connect( for (ix, addr) in socket_addrs.into_iter().enumerate() { let socket = match &addr { - SocketAddr::V4(_) => TcpSocket::new_v4()?, - SocketAddr::V6(_) => TcpSocket::new_v6()?, + SocketAddr::V4(_) => TcpSocket::new_v4(), + SocketAddr::V6(_) => TcpSocket::new_v6(), + }; + let socket = match socket { + Ok(s) => s, + Err(err) => { + last_err = Some(err); + continue; + } }; configure_socket(socket2::SockRef::from(&socket), &so_mark)?;