Skip to content

Commit

Permalink
Review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkw committed Feb 27, 2018
1 parent abec410 commit 86a641a
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions proxy/src/fully_qualified_authority.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,16 @@ use std::str::FromStr;

use http::uri::Authority;

/// A fully qualified authority according to Kubernetes service naming
/// conventions.
/// A normalized `Authority`.
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
pub struct FullyQualifiedAuthority(Authority);

/// A fully qualified authority, and whether or not the `Destination` service
/// should be queried for that name.
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
pub struct NamedAddress {
pub name: FullyQualifiedAuthority,
pub use_destination_service: bool
}

impl NamedAddress {
#[inline]
pub fn without_trailing_dot(&self) -> &Authority {
self.name.without_trailing_dot()
}
}

impl FullyQualifiedAuthority {
/// Normalizes the name according to Kubernetes service naming conventions.
/// Case folding is not done; that is done internally inside `Authority`.
Expand Down Expand Up @@ -186,7 +176,7 @@ mod tests {
let output = super::FullyQualifiedAuthority::normalize(
&input, default_namespace, default_zone);
assert_eq!(output.use_destination_service, true);
output.without_trailing_dot().as_str().into()
output.name.without_trailing_dot().as_str().into()
}

fn external(input: &str, default_namespace: Option<&str>,
Expand All @@ -198,7 +188,7 @@ mod tests {
let output = super::FullyQualifiedAuthority::normalize(
&input, default_namespace, default_zone);
assert_eq!(output.use_destination_service, false);
assert_eq!(output.without_trailing_dot().as_str(), input);
assert_eq!(output.name.without_trailing_dot().as_str(), input);
}

external("name", None, None);
Expand Down

0 comments on commit 86a641a

Please sign in to comment.