Allow validating a custom name other than 'server'
This commit is contained in:
parent
5e88240183
commit
912f8c4fbf
@ -48,11 +48,19 @@ async fn main() -> anyhow::Result<()> {
|
|||||||
.next()
|
.next()
|
||||||
.ok_or_else(|| anyhow!("No socket addresses found for connect_to string. Perhaps no DNS resolution?"))?;
|
.ok_or_else(|| anyhow!("No socket addresses found for connect_to string. Perhaps no DNS resolution?"))?;
|
||||||
|
|
||||||
|
let server_name = config
|
||||||
|
.connection
|
||||||
|
.alternative_name
|
||||||
|
.as_ref()
|
||||||
|
.map(|s| s.as_str())
|
||||||
|
.unwrap_or(config.connection.connect_to.split(':').next().unwrap());
|
||||||
|
|
||||||
let requester_internal = requester::RequesterInternal::connect(
|
let requester_internal = requester::RequesterInternal::connect(
|
||||||
&config.connection.ca_certificate,
|
&config.connection.ca_certificate,
|
||||||
&config.connection.client_certificate,
|
&config.connection.client_certificate,
|
||||||
&config.connection.client_key,
|
&config.connection.client_key,
|
||||||
socket_addr,
|
socket_addr,
|
||||||
|
server_name,
|
||||||
config.connection.timeout,
|
config.connection.timeout,
|
||||||
config.connection.keep_alive,
|
config.connection.keep_alive,
|
||||||
)
|
)
|
||||||
|
@ -49,6 +49,7 @@ impl RequesterInternal {
|
|||||||
cert_path: &Path,
|
cert_path: &Path,
|
||||||
cert_key_path: &Path,
|
cert_key_path: &Path,
|
||||||
server_endpoint: SocketAddr,
|
server_endpoint: SocketAddr,
|
||||||
|
server_name: &str,
|
||||||
timeout: u32,
|
timeout: u32,
|
||||||
keep_alive: u32,
|
keep_alive: u32,
|
||||||
) -> anyhow::Result<RequesterInternal> {
|
) -> anyhow::Result<RequesterInternal> {
|
||||||
@ -84,7 +85,7 @@ impl RequesterInternal {
|
|||||||
|
|
||||||
client_endpoint.set_default_client_config(client_config);
|
client_endpoint.set_default_client_config(client_config);
|
||||||
let new_connection = client_endpoint
|
let new_connection = client_endpoint
|
||||||
.connect(server_endpoint, "server")
|
.connect(server_endpoint, server_name)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
Loading…
Reference in New Issue
Block a user