add resolve to blocking client (#1384)
This commit is contained in:
@@ -4,6 +4,7 @@ use std::convert::TryInto;
|
|||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::future::Future;
|
use std::future::Future;
|
||||||
use std::net::IpAddr;
|
use std::net::IpAddr;
|
||||||
|
use std::net::SocketAddr;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::thread;
|
use std::thread;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
@@ -742,6 +743,18 @@ impl ClientBuilder {
|
|||||||
self.with_inner(|inner| inner.https_only(enabled))
|
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
|
// private
|
||||||
|
|
||||||
fn with_inner<F>(mut self, func: F) -> ClientBuilder
|
fn with_inner<F>(mut self, func: F) -> ClientBuilder
|
||||||
|
|||||||
Reference in New Issue
Block a user