From 311ef410a8baf513153e060ec0f60d9e803af28e Mon Sep 17 00:00:00 2001 From: Brian Smith Date: Thu, 5 Apr 2018 12:32:12 -1000 Subject: [PATCH] Proxy: Refactor DNS name parsing and normalization (#673) Proxy: Refactor DNS name parsing and normalization Only the destination service needs normalized names (and even then, that's just temporary). The rest of the code needs the name as it was given, except case-normalized (lowercased). Because DNS fallack isn't implemented in service discovery yet, Outbound still a temporary workaround using FullyQualifiedName to keep things working; thta will be removed once DNS fallback is implemented in service discovery. Signed-off-by: Brian Smith --- proxy/src/config.rs | 4 +- proxy/src/control/discovery.rs | 83 +++++++++----- proxy/src/control/mod.rs | 10 +- proxy/src/dns.rs | 91 +++++++++++++-- proxy/src/fully_qualified_authority.rs | 150 +++++++++---------------- proxy/src/lib.rs | 5 +- proxy/src/outbound.rs | 107 +++++++++--------- proxy/src/transport/connect.rs | 35 ++++-- proxy/src/transport/mod.rs | 2 +- 9 files changed, 280 insertions(+), 207 deletions(-) diff --git a/proxy/src/config.rs b/proxy/src/config.rs index d79bbf746..2ccdd5607 100644 --- a/proxy/src/config.rs +++ b/proxy/src/config.rs @@ -349,7 +349,7 @@ fn parse_url(s: &str) -> Result { // https://github.com/hyperium/http/issues/127. For now just ignore any // fragment that is there. - HostAndPort::try_from(authority) + HostAndPort::normalize(authority, None) .map_err(|e| ParseError::UrlError(UrlError::AuthorityError(e))) } @@ -366,7 +366,7 @@ fn parse(strings: &Strings, name: &str, parse: Parse) -> Result