fix(agent): show all IP:port mappings for containers bound to multiple IPs (#1993)

* feat: support multiple docker ips

* deduplicate wildcard docker bindings

---------

Co-authored-by: henrygd <hank@henrygd.me>
This commit is contained in:
Sven van Ginkel
2026-08-15 17:50:20 +02:00
committed by GitHub
parent 66ac62a125
commit b68acea5a8
2 changed files with 39 additions and 5 deletions

View File

@@ -1920,6 +1920,14 @@ func TestConvertContainerPortsToString(t *testing.T) {
},
expected: "80, 443",
},
{
name: "ipv4 and ipv6 wildcard bindings are deduplicated",
ports: []port{
{PublicPort: 80, IP: "0.0.0.0"},
{PublicPort: 80, IP: "::"},
},
expected: "80",
},
{
name: "multiple ports with different IPs",
ports: []port{
@@ -1928,6 +1936,22 @@ func TestConvertContainerPortsToString(t *testing.T) {
},
expected: "80, 1.2.3.4:443",
},
{
name: "same port bound to multiple IPs shows all entries",
ports: []port{
{PublicPort: 65533, IP: "172.16.151.72"},
{PublicPort: 65533, IP: "172.16.156.25"},
},
expected: "172.16.151.72:65533, 172.16.156.25:65533",
},
{
name: "same port bound to IPv4 and IPv6",
ports: []port{
{PublicPort: 65534, IP: "172.16.151.72"},
{PublicPort: 65534, IP: "fd04:38e2:98c6:3fd::72"},
},
expected: "172.16.151.72:65534, fd04:38e2:98c6:3fd::72:65534",
},
{
name: "ports slice is nilled after call",
ports: []port{