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),
}
if v, ok := out[nat.Port(fmt.Sprintf("%d/tcp", port))]; ok {
out[nat.Port(fmt.Sprintf("%d/tcp", port))] = append(v, binding)
} else {
out[nat.Port(fmt.Sprintf("%d/tcp", port))] = []nat.PortBinding{binding}
}
tcp := nat.Port(fmt.Sprintf("%d/tcp", port))
udp := nat.Port(fmt.Sprintf("%d/udp", port))
if v, ok := out[nat.Port(fmt.Sprintf("%d/udp", port))]; ok {
out[nat.Port(fmt.Sprintf("%d/udp", port))] = append(v, binding)
} else {
out[nat.Port(fmt.Sprintf("%d/udp", port))] = []nat.PortBinding{binding}
}
out[tcp] = append(out[tcp], binding)
out[udp] = append(out[udp], binding)
}
}