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

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