Skip to content

Commit

Permalink
Merge pull request #763 from tnothy/ports-and-transfers
Browse files Browse the repository at this point in the history
define relay ports by amount
  • Loading branch information
schollz authored Jul 28, 2024
2 parents e439b65 + 6413c1c commit 5da253e
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion src/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ func Run() (err error) {
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 +670,25 @@ func relay(c *cli.Context) (err error) {
debugString = "debug"
}
host := c.String("host")
ports := strings.Split(c.String("ports"), ",")
var ports []string

if c.IsSet("ports") {
ports = strings.Split(c.String("ports"), ",")
} else {
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 5da253e

Please sign in to comment.