Offset multiplication

pull/43/head
iwilltry42 5 years ago
parent 107700dc98
commit 464d2e23c5
  1. 2
      cli/port.go
  2. 2
      main.go

@ -112,7 +112,7 @@ func (p PublishedPorts) Offset(offset int) *PublishedPorts {
for i, b := range v { for i, b := range v {
port, _ := nat.ParsePort(b.HostPort) port, _ := nat.ParsePort(b.HostPort)
bindings[i].HostIP = b.HostIP bindings[i].HostIP = b.HostIP
bindings[i].HostPort = fmt.Sprintf("%d", port+offset) bindings[i].HostPort = fmt.Sprintf("%d", port*offset)
} }
newPortBindings[k] = bindings newPortBindings[k] = bindings
} }

@ -67,7 +67,7 @@ func main() {
cli.IntFlag{ cli.IntFlag{
Name: "port-auto-offset", Name: "port-auto-offset",
Value: 0, Value: 0,
Usage: "Automatically add an offset (+ worker number) to the chosen host port when using `--publish` to map the same container-port from multiple k3d workers to the host", Usage: "Automatically add an offset (* worker number) to the chosen host port when using `--publish` to map the same container-port from multiple k3d workers to the host",
}, },
cli.StringFlag{ cli.StringFlag{
// TODO: to be deprecated // TODO: to be deprecated

Loading…
Cancel
Save