feat(client): add HttpConnector::set_local_addresses to set both IPv6 and IPv4 local addrs (#2172)

Currently HttpConnector::set_local_address method accepts a single
argument. Server might not support IPv6 or IPv4. Therefore, the only
solution at the moment is to manually perform DNS resolution and pick
appropriate local address family. This is inefficient, as leads to
2 DNS lookups per request. This commit allows specifying both IPv4
and IPv6, so connector can decide which one to use based on DNS
resolution results.
This commit is contained in:
Ivan Nikulin
2020-10-14 00:02:16 +01:00
committed by GitHub
parent 02732bef0c
commit fb19f3a869
3 changed files with 208 additions and 53 deletions

View File

@@ -55,6 +55,9 @@ tokio-util = { version = "0.3", features = ["codec"] }
tower-util = "0.3"
url = "1.0"
[target.'cfg(any(target_os = "linux", target_os = "macos"))'.dev-dependencies]
pnet = "0.25.0"
[features]
default = [
"runtime",