Skip to content

Commit

Permalink
Clarify use of server_id to server_name in rustls client
Browse files Browse the repository at this point in the history
  • Loading branch information
olix0r committed Nov 7, 2023
1 parent 897d53a commit 127bb94
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions linkerd/meshtls/rustls/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub struct NewClient {
/// A `Service` that initiates client-side TLS connections.
#[derive(Clone)]
pub struct Connect {
server_id: rustls::ServerName,
server_name: rustls::ServerName,
config: Arc<ClientConfig>,
}

Expand Down Expand Up @@ -68,10 +68,13 @@ impl Connect {
}
};

let server_id = rustls::ServerName::try_from(&*client_tls.server_id.to_str())
let server_name = rustls::ServerName::try_from(client_tls.server_name.as_str())
.expect("identity must be a valid DNS name");

Self { server_id, config }
Self {
server_name,
config,
}
}
}

Expand All @@ -89,8 +92,7 @@ where

fn call(&mut self, io: I) -> Self::Future {
tokio_rustls::TlsConnector::from(self.config.clone())
// XXX(eliza): it's a bummer that the server name has to be cloned here...
.connect(self.server_id.clone(), io)
.connect(self.server_name.clone(), io)
.map_ok(ClientIo)
}
}
Expand Down

0 comments on commit 127bb94

Please sign in to comment.