update ports

This commit is contained in:
Zack Scholl 2019-05-01 13:48:09 -06:00
parent 77b11e3c3f
commit 868051bc2a
1 changed files with 13 additions and 9 deletions

View File

@ -42,6 +42,7 @@ func Run() (err error) {
ArgsUsage: "[filename]",
Flags: []cli.Flag{
cli.StringFlag{Name: "code, c", Usage: "codephrase used to connect to relay"},
cli.StringFlag{Name: "ports", Value: "9009,9010,9011,9012,9013", Usage: "ports of the local relay (optional)"},
},
HelpName: "croc send",
Action: func(c *cli.Context) error {
@ -55,6 +56,9 @@ func Run() (err error) {
Action: func(c *cli.Context) error {
return relay(c)
},
Flags: []cli.Flag{
cli.StringFlag{Name: "ports", Value: "9009,9010,9011,9012,9013", Usage: "ports of the relay"},
},
},
}
app.Flags = []cli.Flag{
@ -63,7 +67,6 @@ func Run() (err error) {
cli.BoolFlag{Name: "stdout", Usage: "redirect file to stdout"},
cli.StringFlag{Name: "relay", Value: "198.199.67.130:9009", Usage: "address of the relay"},
cli.StringFlag{Name: "out", Value: ".", Usage: "specify an output folder to receive the file"},
cli.StringFlag{Name: "ports", Value: "9009,9010,9011,9012,9013", Usage: "ports of the relay"},
}
app.EnableBashCompletion = true
app.HideHelp = false
@ -164,7 +167,7 @@ func send(c *cli.Context) (err error) {
NoPrompt: c.GlobalBool("yes"),
RelayAddress: c.GlobalString("relay"),
Stdout: c.GlobalBool("stdout"),
RelayPorts: strings.Split(c.GlobalString("ports"), ","),
RelayPorts: strings.Split(c.String("ports"), ","),
})
if err != nil {
return
@ -194,12 +197,13 @@ func receive(c *cli.Context) (err error) {
}
cr, err := croc.New(croc.Options{
SharedSecret: sharedSecret,
IsSender: false,
Debug: c.GlobalBool("debug"),
NoPrompt: c.GlobalBool("yes"),
RelayAddress: c.GlobalString("relay"),
Stdout: c.GlobalBool("stdout"),
SharedSecret: sharedSecret,
IsSender: false,
Debug: c.GlobalBool("debug"),
NoPrompt: c.GlobalBool("yes"),
RelayAddress: c.GlobalString("relay"),
Stdout: c.GlobalBool("stdout"),
PathToReceive: c.GlobalString("out"),
})
if err != nil {
return
@ -213,7 +217,7 @@ func relay(c *cli.Context) (err error) {
if c.GlobalBool("debug") {
debugString = "debug"
}
ports := strings.Split(c.GlobalString("ports"), ",")
ports := strings.Split(c.String("ports"), ",")
tcpPorts := strings.Join(ports[1:], ",")
for i, port := range ports {
if i == 0 {