Skip to content

Commit

Permalink
refactor!: drop previously deprecated get_host_ip_address (#628)
Browse files Browse the repository at this point in the history
  • Loading branch information
DDtKey authored May 12, 2024
1 parent acec69d commit 4d612de
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 24 deletions.
1 change: 0 additions & 1 deletion testcontainers/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ bollard = { version = "0.16.1", features = ["ssl"] }
bollard-stubs = "=1.44.0-rc.2"
conquer-once = { version = "0.4", optional = true }
dirs = "5.0.1"
dns-lookup = "2.0.4"
docker_credential = "1.3.1"
futures = "0.3"
log = "0.4"
Expand Down
16 changes: 0 additions & 16 deletions testcontainers/src/core/containers/async_container.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,22 +165,6 @@ where
.unwrap_or_else(|_| panic!("container {} has invalid bridge IP", self.id))
}

/// Returns the host ip address of docker container
#[deprecated(since = "0.16.6", note = "Please use `get_host` instead")]
pub async fn get_host_ip_address(&self) -> IpAddr {
let host_name = self.docker_client.docker_hostname().await;

match host_name {
// todo: drop `dns_lookup` dependency after dropping this method
url::Host::Domain(domain) => dns_lookup::lookup_host(&domain)
.ok()
.and_then(|ips| ips.into_iter().next())
.unwrap_or(IpAddr::from([127, 0, 0, 1])),
url::Host::Ipv4(ip) => ip.into(),
url::Host::Ipv6(ip) => ip.into(),
}
}

/// Returns the host that this container may be reached on (may not be the local machine)
/// Suitable for use in URL
pub async fn get_host(&self) -> url::Host {
Expand Down
7 changes: 0 additions & 7 deletions testcontainers/src/core/containers/sync_container.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,6 @@ where
.block_on(self.async_impl().get_bridge_ip_address())
}

/// Returns the host ip address of docker container
#[deprecated(since = "0.16.6", note = "Please use `get_host` instead")]
pub fn get_host_ip_address(&self) -> IpAddr {
#[allow(deprecated)]
self.rt().block_on(self.async_impl().get_host_ip_address())
}

/// Returns the host that this container may be reached on (may not be the local machine)
/// Suitable for use in URL
pub fn get_host(&self) -> url::Host {
Expand Down

0 comments on commit 4d612de

Please sign in to comment.