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
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),

View file

@ -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>,