Update allocations.go

This commit is contained in:
TortleWortle 2020-12-02 14:27:37 +01:00
parent e7d93a5248
commit da4c542724

View File

@ -43,17 +43,11 @@ func (a *Allocations) Bindings() nat.PortMap {
HostPort: strconv.Itoa(port), HostPort: strconv.Itoa(port),
} }
if v, ok := out[nat.Port(fmt.Sprintf("%d/tcp", port))]; ok { tcp := nat.Port(fmt.Sprintf("%d/tcp", port))
out[nat.Port(fmt.Sprintf("%d/tcp", port))] = append(v, binding) udp := nat.Port(fmt.Sprintf("%d/udp", port))
} else {
out[nat.Port(fmt.Sprintf("%d/tcp", port))] = []nat.PortBinding{binding}
}
if v, ok := out[nat.Port(fmt.Sprintf("%d/udp", port))]; ok { out[tcp] = append(out[tcp], binding)
out[nat.Port(fmt.Sprintf("%d/udp", port))] = append(v, binding) out[udp] = append(out[udp], binding)
} else {
out[nat.Port(fmt.Sprintf("%d/udp", port))] = []nat.PortBinding{binding}
}
} }
} }