From 9d537c42e5e466659fd184fb578b77fc9956a87d Mon Sep 17 00:00:00 2001 From: Zack Scholl Date: Sat, 22 Sep 2018 06:02:26 -0700 Subject: [PATCH] move flags --- go.mod | 10 +++++++++- main.go | 13 ++++++------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/go.mod b/go.mod index 0264091..88bc314 100644 --- a/go.mod +++ b/go.mod @@ -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 diff --git a/main.go b/main.go index 679ab46..b3b98ed 100644 --- a/main.go +++ b/main.go @@ -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() }