Leaking `bollard::models::PortBinding` through the `RunningContainer::ports`
I don't think we should leak this type, and should find a way to expose the required information from the RunningContainer
. The PortBinding is looked up based on protocol/port, e.g, "tcp/80", where the PortBinding returned is the ip of the localhost where the port is bound.
I suggest we try to unify the an API to retrieve the IpAddr and host port, based on both Composition::port_map
and Composition::publish_all_ports
, where the exported port is used as an argument. Thus, we can create a unified experience when the host is involved. An open question is whether or not we should address the protocol part..
An example may look like this:
impl RunningContainer {
pub fn host_proxied_network(&self, exposed_port: u16) -> Option<(IpAddr, u16)>;
}