mirror of
https://github.com/schollz/croc.git
synced 2024-11-28 01:16:10 +03:00
Merge pull request #662 from qk-santi/ports-and-transfers
define ports by amount, not individually - v2
This commit is contained in:
commit
508e0be335
@ -72,7 +72,8 @@ func Run() (err error) {
|
|||||||
&cli.BoolFlag{Name: "no-local", Usage: "disable local relay when sending"},
|
&cli.BoolFlag{Name: "no-local", Usage: "disable local relay when sending"},
|
||||||
&cli.BoolFlag{Name: "no-multi", Usage: "disable multiplexing"},
|
&cli.BoolFlag{Name: "no-multi", Usage: "disable multiplexing"},
|
||||||
&cli.BoolFlag{Name: "git", Usage: "enable .gitignore respect / don't send ignored files"},
|
&cli.BoolFlag{Name: "git", Usage: "enable .gitignore respect / don't send ignored files"},
|
||||||
&cli.StringFlag{Name: "ports", Value: "9009,9010,9011,9012,9013", Usage: "ports of the local relay (optional)"},
|
&cli.IntFlag{Name: "port", Value: 9009, Usage: "base port for the relay"},
|
||||||
|
&cli.IntFlag{Name: "transfers", Value: 4, Usage: "number of ports to use for transfers"},
|
||||||
},
|
},
|
||||||
HelpName: "croc send",
|
HelpName: "croc send",
|
||||||
Action: send,
|
Action: send,
|
||||||
@ -174,10 +175,21 @@ func send(c *cli.Context) (err error) {
|
|||||||
setDebugLevel(c)
|
setDebugLevel(c)
|
||||||
comm.Socks5Proxy = c.String("socks5")
|
comm.Socks5Proxy = c.String("socks5")
|
||||||
comm.HttpProxy = c.String("connect")
|
comm.HttpProxy = c.String("connect")
|
||||||
portsString := c.String("ports")
|
|
||||||
if portsString == "" {
|
portParam := c.Int("port")
|
||||||
portsString = "9009,9010,9011,9012,9013"
|
if portParam == 0 {
|
||||||
|
portParam = 9009
|
||||||
}
|
}
|
||||||
|
transfersParam := c.Int("transfers")
|
||||||
|
if transfersParam == 0 {
|
||||||
|
transfersParam = 4
|
||||||
|
}
|
||||||
|
|
||||||
|
ports := make([]string, transfersParam+1)
|
||||||
|
for i := 0; i <= transfersParam; i++ {
|
||||||
|
ports[i] = strconv.Itoa(portParam + i)
|
||||||
|
}
|
||||||
|
|
||||||
crocOptions := croc.Options{
|
crocOptions := croc.Options{
|
||||||
SharedSecret: c.String("code"),
|
SharedSecret: c.String("code"),
|
||||||
IsSender: true,
|
IsSender: true,
|
||||||
@ -189,7 +201,7 @@ func send(c *cli.Context) (err error) {
|
|||||||
DisableLocal: c.Bool("no-local"),
|
DisableLocal: c.Bool("no-local"),
|
||||||
OnlyLocal: c.Bool("local"),
|
OnlyLocal: c.Bool("local"),
|
||||||
IgnoreStdin: c.Bool("ignore-stdin"),
|
IgnoreStdin: c.Bool("ignore-stdin"),
|
||||||
RelayPorts: strings.Split(portsString, ","),
|
RelayPorts: ports,
|
||||||
Ask: c.Bool("ask"),
|
Ask: c.Bool("ask"),
|
||||||
NoMultiplexing: c.Bool("no-multi"),
|
NoMultiplexing: c.Bool("no-multi"),
|
||||||
RelayPassword: determinePass(c),
|
RelayPassword: determinePass(c),
|
||||||
|
Loading…
Reference in New Issue
Block a user