From 2079bb11676342f816d38ead6c17266104806b64 Mon Sep 17 00:00:00 2001 From: yggverse Date: Thu, 28 Nov 2024 01:58:17 +0200 Subject: [PATCH] rename methods --- src/client.rs | 4 ++-- src/client/connection.rs | 15 +++++++++------ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/client.rs b/src/client.rs index 13cbc5b..3c8a6c1 100644 --- a/src/client.rs +++ b/src/client.rs @@ -38,7 +38,7 @@ impl Client { // Connect events socket.connect_event(move |_, event, _, stream| { // This condition have effect only for guest TLS connections - // * for user certificates validation, use `Connection` auth + // * for user certificates validation, use `Connection` impl if event == SocketClientEvent::TlsHandshaking { // Begin guest certificate validation stream @@ -82,7 +82,7 @@ impl Client { .as_ref(), move |result| match result { Ok(connection) => { - match Connection::new_for( + match Connection::new_wrap( &connection, match certificate { Some(ref certificate) => Some(&certificate.tls_certificate), diff --git a/src/client/connection.rs b/src/client/connection.rs index 09f5bda..7e9cb5f 100644 --- a/src/client/connection.rs +++ b/src/client/connection.rs @@ -16,7 +16,7 @@ impl Connection { // Constructors /// Create new `Self` - pub fn new_for( + pub fn new_wrap( socket_connection: &SocketConnection, certificate: Option<&TlsCertificate>, server_identity: Option<&NetworkAddress>, @@ -28,10 +28,13 @@ impl Connection { Ok(Self { socket_connection: socket_connection.clone(), tls_client_connection: match certificate { - Some(certificate) => match auth(socket_connection, certificate, server_identity) { - Ok(tls_client_connection) => Some(tls_client_connection), - Err(reason) => return Err(reason), - }, + Some(certificate) => { + match new_tls_client_connection(socket_connection, certificate, server_identity) + { + Ok(tls_client_connection) => Some(tls_client_connection), + Err(reason) => return Err(reason), + } + } None => None, }, }) @@ -49,7 +52,7 @@ impl Connection { // Tools -pub fn auth( +pub fn new_tls_client_connection( socket_connection: &SocketConnection, certificate: &TlsCertificate, server_identity: Option<&NetworkAddress>,