Skip to main content

secured_client_builder

Function secured_client_builder 

Source
pub fn secured_client_builder(dns_port: u16) -> Result<ClientBuilder>
Expand description

Creates a secured reqwest ClientBuilder with DNS override configured.

This returns a ClientBuilder with the DNS resolver already set, allowing you to add additional configurations before calling .build().

§Parameters

  • dns_port - The port of the local DNS server (obtained from mist::dns_port())

§Returns

Returns a configured reqwest::ClientBuilder with the local DNS resolver.

§Example

use std::time::Duration;

use AirLibrary::HTTP::secured_client_builder;
use Mist;

#[tokio::main]
async fn main() -> anyhow::Result<()> {
	let dns_port = mist::dns_port();
	let client = secured_client_builder(dns_port)?.timeout(Duration::from_secs(30)).build()?;

	// All HTTP requests will use the local DNS server
	Ok(())
}