move flags

This commit is contained in:
Zack Scholl 2018-09-22 06:02:26 -07:00
parent f709df4d3e
commit 9d537c42e5
2 changed files with 15 additions and 8 deletions

10
go.mod
View File

@ -1,12 +1,20 @@
module github.com/schollz/croc
require (
github.com/briandowns/spinner v0.0.0-20180822135157-9f016caa1359
github.com/cihub/seelog v0.0.0-20170130134532-f561c5e57575
github.com/dustin/go-humanize v0.0.0-20180713052910-9f541cc9db5d
github.com/fatih/color v1.7.0 // indirect
github.com/gorilla/websocket v1.4.0
github.com/mars9/crypt v0.0.0-20150406101210-65899cf653ff // indirect
github.com/mattn/go-colorable v0.0.9 // indirect
github.com/mattn/go-isatty v0.0.4 // indirect
github.com/pkg/errors v0.8.0
github.com/schollz/mnemonicode v1.0.1
github.com/schollz/pake v1.0.2
github.com/schollz/progressbar v1.0.0
github.com/schollz/peerdiscovery v1.2.1
github.com/schollz/progressbar/v2 v2.5.3
github.com/schollz/utils v1.0.0
github.com/tscholl2/siec v0.0.0-20180721101609-21667da05937
github.com/urfave/cli v1.20.0
golang.org/x/crypto v0.0.0-20180910181607-0e37d006457b

13
main.go
View File

@ -50,11 +50,8 @@ func main() {
Name: "relay",
Usage: "start a croc relay",
Description: "the croc relay will handle websocket and TCP connections",
Flags: []cli.Flag{
cli.StringFlag{Name: "port", Value: "8152", Usage: "port that the websocket listens on"},
cli.StringFlag{Name: "curve", Value: "siec", Usage: "specify elliptic curve to use (p224, p256, p384, p521, siec)"},
},
HelpName: "croc relay",
Flags: []cli.Flag{},
HelpName: "croc relay",
Action: func(c *cli.Context) error {
return relay(c)
},
@ -67,6 +64,8 @@ func main() {
cli.BoolFlag{Name: "debug", Usage: "increase verbosity (a lot)"},
cli.BoolFlag{Name: "yes", Usage: "automatically agree to all prompts"},
cli.BoolFlag{Name: "stdout", Usage: "redirect file to stdout"},
cli.StringFlag{Name: "port", Value: "8152", Usage: "port that the websocket listens on"},
cli.StringFlag{Name: "curve", Value: "siec", Usage: "specify elliptic curve to use (p224, p256, p384, p521, siec)"},
}
app.EnableBashCompletion = true
app.HideHelp = false
@ -86,6 +85,8 @@ func main() {
cr.LocalOnly = c.GlobalBool("local")
cr.NoLocal = c.GlobalBool("no-local")
cr.ShowText = true
cr.ServerPort = c.String("port")
cr.CurveType = c.String("curve")
return nil
}
@ -157,8 +158,6 @@ func receive(c *cli.Context) error {
}
func relay(c *cli.Context) error {
cr.ServerPort = c.String("port")
cr.CurveType = c.String("curve")
return cr.Relay()
}