api/types/container: rename Port to PortMapping

It better describes its purpose, and allows "Port" to be used for
other purposes (e.g. to replace "nat.Port").

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Co-authored-by: Austin Vazquez <austin.vazquez@docker.com>
This commit is contained in:
Sebastiaan van Stijn
2025-08-13 11:46:57 +02:00
committed by Austin Vazquez
parent 606519a171
commit 82ba7fef17
9 changed files with 27 additions and 22 deletions

View File

@@ -309,7 +309,7 @@ func (v *View) transform(ctr *Container) *Snapshot {
ID: ctr.ID,
Names: v.getNames(ctr.ID),
ImageID: ctr.ImageID.String(),
Ports: []container.Port{},
Ports: []container.PortSummary{},
Mounts: ctr.GetMountPoints(),
State: ctr.State.StateString(),
Status: ctr.State.String(),
@@ -366,7 +366,7 @@ func (v *View) transform(ctr *Container) *Snapshot {
snapshot.Command = ctr.Path
}
snapshot.Ports = []container.Port{}
snapshot.Ports = []container.PortSummary{}
networks := make(map[string]*network.EndpointSettings)
if ctr.NetworkSettings != nil {
for name, netw := range ctr.NetworkSettings.Networks {
@@ -400,7 +400,7 @@ func (v *View) transform(ctr *Container) *Snapshot {
continue
}
if len(bindings) == 0 {
snapshot.Ports = append(snapshot.Ports, container.Port{
snapshot.Ports = append(snapshot.Ports, container.PortSummary{
PrivatePort: uint16(p),
Type: proto,
})
@@ -412,7 +412,7 @@ func (v *View) transform(ctr *Container) *Snapshot {
log.G(context.TODO()).WithError(err).Warn("invalid host port map")
continue
}
snapshot.Ports = append(snapshot.Ports, container.Port{
snapshot.Ports = append(snapshot.Ports, container.PortSummary{
PrivatePort: uint16(p),
PublicPort: uint16(h),
Type: proto,