mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
replace direct uses of nat types for api/types/container aliases
Follow-up to 494677f93f, which added
the aliases, but did not yet replace our own use of the nat types.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@@ -43,8 +43,8 @@ type Snapshot struct {
|
||||
Running bool
|
||||
Paused bool
|
||||
Managed bool
|
||||
ExposedPorts nat.PortSet
|
||||
PortBindings nat.PortSet
|
||||
ExposedPorts container.PortSet
|
||||
PortBindings container.PortSet
|
||||
Health container.HealthStatus
|
||||
HostConfig struct {
|
||||
Isolation string
|
||||
@@ -324,8 +324,8 @@ func (v *View) transform(ctr *Container) *Snapshot {
|
||||
Name: ctr.Name,
|
||||
Pid: ctr.Pid,
|
||||
Managed: ctr.Managed,
|
||||
ExposedPorts: make(nat.PortSet),
|
||||
PortBindings: make(nat.PortSet),
|
||||
ExposedPorts: make(container.PortSet),
|
||||
PortBindings: make(container.PortSet),
|
||||
Health: health,
|
||||
Running: ctr.Running,
|
||||
Paused: ctr.Paused,
|
||||
@@ -395,8 +395,9 @@ func (v *View) transform(ctr *Container) *Snapshot {
|
||||
}
|
||||
}
|
||||
}
|
||||
for port, bindings := range ctr.NetworkSettings.Ports {
|
||||
p, err := nat.ParsePort(port.Port())
|
||||
for p, bindings := range ctr.NetworkSettings.Ports {
|
||||
proto, port := nat.SplitProtoPort(string(p))
|
||||
p, err := nat.ParsePort(port)
|
||||
if err != nil {
|
||||
log.G(context.TODO()).WithError(err).Warn("invalid port map")
|
||||
continue
|
||||
@@ -404,7 +405,7 @@ func (v *View) transform(ctr *Container) *Snapshot {
|
||||
if len(bindings) == 0 {
|
||||
snapshot.Ports = append(snapshot.Ports, container.Port{
|
||||
PrivatePort: uint16(p),
|
||||
Type: port.Proto(),
|
||||
Type: proto,
|
||||
})
|
||||
continue
|
||||
}
|
||||
@@ -417,7 +418,7 @@ func (v *View) transform(ctr *Container) *Snapshot {
|
||||
snapshot.Ports = append(snapshot.Ports, container.Port{
|
||||
PrivatePort: uint16(p),
|
||||
PublicPort: uint16(h),
|
||||
Type: port.Proto(),
|
||||
Type: proto,
|
||||
IP: binding.HostIP,
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user