Parametrized connection
This commit is contained in:
parent
bd954eeaf1
commit
553ec9aa12
1 changed files with 16 additions and 5 deletions
|
@ -204,10 +204,21 @@ func main(){
|
||||||
}
|
}
|
||||||
|
|
||||||
app.Flags = []cli.Flag{
|
app.Flags = []cli.Flag{
|
||||||
cli.BoolFlag{
|
cli.StringFlag{
|
||||||
Name: "serve, s",
|
Name: "from, f",
|
||||||
Usage: "list local addresses",
|
Value: "127.0.0.1:8000",
|
||||||
|
EnvVar: "FWD_FROM",
|
||||||
|
Usage: "source HOST:PORT",
|
||||||
},
|
},
|
||||||
|
cli.StringFlag{
|
||||||
|
Name: "to, t",
|
||||||
|
EnvVar: "FWD_TO",
|
||||||
|
Usage: "destination HOST:PORT",
|
||||||
|
},
|
||||||
|
cli.BoolFlag{
|
||||||
|
Name: "serve, s",
|
||||||
|
Usage: "list local addresses",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
color.Set(color.FgGreen)
|
color.Set(color.FgGreen)
|
||||||
|
@ -215,9 +226,9 @@ app.Flags = []cli.Flag{
|
||||||
color.Unset()
|
color.Unset()
|
||||||
app.Action = func(c *cli.Context) error {
|
app.Action = func(c *cli.Context) error {
|
||||||
if c.Bool("serve"){
|
if c.Bool("serve"){
|
||||||
serveServer("localhost:10100","localhost:10200")
|
serveServer(c.String("from"),c.String("to"))
|
||||||
}else{
|
}else{
|
||||||
serveClient("localhost:10000","localhost:10100")
|
serveClient(c.String("from"),c.String("to"))
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue