mirror of
https://github.com/schollz/croc.git
synced 2025-10-11 05:11:06 +02:00
define relay ports by amount
This commit is contained in:
parent
ce3c65ef1d
commit
6413c1c3e1
1 changed files with 21 additions and 1 deletions
|
@ -90,6 +90,8 @@ func Run() (err error) {
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
&cli.StringFlag{Name: "host", Usage: "host of the relay"},
|
&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.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"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -668,7 +670,25 @@ func relay(c *cli.Context) (err error) {
|
||||||
debugString = "debug"
|
debugString = "debug"
|
||||||
}
|
}
|
||||||
host := c.String("host")
|
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:], ",")
|
tcpPorts := strings.Join(ports[1:], ",")
|
||||||
for i, port := range ports {
|
for i, port := range ports {
|
||||||
if i == 0 {
|
if i == 0 {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue