Skip to content

Commit

Permalink
add resolve to blocking client (#1384)
Browse files Browse the repository at this point in the history
  • Loading branch information
niuhuan committed Nov 19, 2021
1 parent 0ef1a2e commit 161d731
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/blocking/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use std::convert::TryInto;
use std::fmt;
use std::future::Future;
use std::net::IpAddr;
use std::net::SocketAddr;
use std::sync::Arc;
use std::thread;
use std::time::Duration;
Expand Down Expand Up @@ -742,6 +743,18 @@ impl ClientBuilder {
self.with_inner(|inner| inner.https_only(enabled))
}

/// Override DNS resolution for specific domains to particular IP addresses.
///
/// Warning
///
/// Since the DNS protocol has no notion of ports, if you wish to send
/// traffic to a particular port you must include this port in the URL
/// itself, any port in the overridden addr will be ignored and traffic sent
/// to the conventional port for the given scheme (e.g. 80 for http).
pub fn resolve(self, domain: &str, addr: SocketAddr) -> ClientBuilder {
self.with_inner(|inner| inner.resolve(domain, addr))
}

// private

fn with_inner<F>(mut self, func: F) -> ClientBuilder
Expand Down

0 comments on commit 161d731

Please sign in to comment.