rename methods

This commit is contained in:
yggverse 2024-11-28 01:58:17 +02:00
parent 9ebd1e03f6
commit 2079bb1167
2 changed files with 11 additions and 8 deletions

View file

@ -38,7 +38,7 @@ impl Client {
// Connect events // Connect events
socket.connect_event(move |_, event, _, stream| { socket.connect_event(move |_, event, _, stream| {
// This condition have effect only for guest TLS connections // 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 { if event == SocketClientEvent::TlsHandshaking {
// Begin guest certificate validation // Begin guest certificate validation
stream stream
@ -82,7 +82,7 @@ impl Client {
.as_ref(), .as_ref(),
move |result| match result { move |result| match result {
Ok(connection) => { Ok(connection) => {
match Connection::new_for( match Connection::new_wrap(
&connection, &connection,
match certificate { match certificate {
Some(ref certificate) => Some(&certificate.tls_certificate), Some(ref certificate) => Some(&certificate.tls_certificate),

View file

@ -16,7 +16,7 @@ impl Connection {
// Constructors // Constructors
/// Create new `Self` /// Create new `Self`
pub fn new_for( pub fn new_wrap(
socket_connection: &SocketConnection, socket_connection: &SocketConnection,
certificate: Option<&TlsCertificate>, certificate: Option<&TlsCertificate>,
server_identity: Option<&NetworkAddress>, server_identity: Option<&NetworkAddress>,
@ -28,10 +28,13 @@ impl Connection {
Ok(Self { Ok(Self {
socket_connection: socket_connection.clone(), socket_connection: socket_connection.clone(),
tls_client_connection: match certificate { tls_client_connection: match certificate {
Some(certificate) => match auth(socket_connection, certificate, server_identity) { Some(certificate) => {
match new_tls_client_connection(socket_connection, certificate, server_identity)
{
Ok(tls_client_connection) => Some(tls_client_connection), Ok(tls_client_connection) => Some(tls_client_connection),
Err(reason) => return Err(reason), Err(reason) => return Err(reason),
}, }
}
None => None, None => None,
}, },
}) })
@ -49,7 +52,7 @@ impl Connection {
// Tools // Tools
pub fn auth( pub fn new_tls_client_connection(
socket_connection: &SocketConnection, socket_connection: &SocketConnection,
certificate: &TlsCertificate, certificate: &TlsCertificate,
server_identity: Option<&NetworkAddress>, server_identity: Option<&NetworkAddress>,