Skip to content

Commit

Permalink
define relay ports by amount
Browse files Browse the repository at this point in the history
  • Loading branch information
tnothy committed Jul 27, 2024
1 parent ce3c65e commit 2937505
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ func Run() (err error) {
Action: relay,
Flags: []cli.Flag{
&cli.StringFlag{Name: "host", Usage: "host of the relay"},
&cli.StringFlag{Name: "ports", Value: "9009,9010,9011,9012,9013", Usage: "ports of the relay"},
&cli.IntFlag{Name: "port", Value: 9009, Usage: "base port for the relay"},
&cli.IntFlag{Name: "transfers", Value: 5, Usage: "number of ports to use for relay"},
},
},
}
Expand Down Expand Up @@ -668,7 +669,18 @@ func relay(c *cli.Context) (err error) {
debugString = "debug"
}
host := c.String("host")
ports := strings.Split(c.String("ports"), ",")
portString := c.Int("port")
if portString == 0 {
portString = 9009
}
transfersString := c.Int("transfers")
if transfersString == 0 {
transfersString = 4
}
ports := make([]string, transfersString)
for i := range ports {
ports[i] = strconv.Itoa(portString + i)
}
tcpPorts := strings.Join(ports[1:], ",")
for i, port := range ports {
if i == 0 {
Expand Down

0 comments on commit 2937505

Please sign in to comment.