diff --git a/libs/tls/src/cmd.rs b/libs/tls/src/cmd.rs index ebc533cbe..9df851149 100644 --- a/libs/tls/src/cmd.rs +++ b/libs/tls/src/cmd.rs @@ -111,8 +111,7 @@ pub fn shellchat<'a>( .unwrap(); log::info!("connect TCPstream to {}", target); - let url = format!("{}:443", target); - match TcpStream::connect(url) { + match TcpStream::connect((target, 443)) { Ok(mut sock) => { log::info!("tcp connected"); write!(ret, "{}", t!("tls.test_success_tcp", locales::LANG)).ok(); diff --git a/libs/tls/src/lib.rs b/libs/tls/src/lib.rs index 6fd678673..ea6b549ca 100644 --- a/libs/tls/src/lib.rs +++ b/libs/tls/src/lib.rs @@ -311,8 +311,7 @@ impl Tls { let mut conn = rustls::ClientConnection::new(Arc::new(config), server_name).unwrap(); log::info!("connect TCPstream to {}", target); - let url = format!("{}:443", target); - match TcpStream::connect(url) { + match TcpStream::connect((target, 443)) { Ok(mut sock) => { match conn.complete_io(&mut sock) { Ok(_) => log::info!("handshake complete"), diff --git a/services/net/src/tests.rs b/services/net/src/tests.rs index 743ce0157..c1bd41492 100644 --- a/services/net/src/tests.rs +++ b/services/net/src/tests.rs @@ -47,7 +47,7 @@ fn bind_error() { #[test] fn connect_error() { - match TcpStream::connect("0.0.0.0:1") { + match TcpStream::connect(("0.0.0.0",1)) { Ok(..) => panic!(), Err(e) => assert!( e.kind() == ErrorKind::ConnectionRefused diff --git a/services/shellchat/src/nettests.rs b/services/shellchat/src/nettests.rs index d634080c0..fccfd4a78 100644 --- a/services/shellchat/src/nettests.rs +++ b/services/shellchat/src/nettests.rs @@ -180,7 +180,7 @@ fn bind_error() { } fn connect_error() { - match TcpStream::connect("0.0.0.0:1") { + match TcpStream::connect(("0.0.0.0",1)) { Ok(..) => panic!(), Err(e) => { log::info!("connect_error is {:?}", e);