Added -v option (version)

This commit is contained in:
Russ Magee 2018-05-12 18:41:39 -07:00
parent dfeb0d709e
commit 8f087e9ca1
2 changed files with 16 additions and 0 deletions

View file

@ -66,6 +66,8 @@ func getTermSize() (rows int, cols int, err error) {
func main() {
var wg sync.WaitGroup
version := "0.1pre (NO WARRANTY)"
var vopt bool
var dbg bool
var cAlg string
var hAlg string
@ -79,6 +81,7 @@ func main() {
isInteractive := false
flag.BoolVar(&vopt, "v", false, "show version")
flag.StringVar(&cAlg, "c", "C_AES_256", "cipher [\"C_AES_256\" | \"C_TWOFISH_128\" | \"C_BLOWFISH_64\"]")
flag.StringVar(&hAlg, "h", "H_SHA256", "hmac [\"H_SHA256\"]")
flag.StringVar(&server, "s", "localhost:2000", "server hostname/address[:port]")
@ -91,6 +94,11 @@ func main() {
flag.BoolVar(&dbg, "d", false, "debug logging")
flag.Parse()
if vopt {
fmt.Printf("version v%s\n", version)
os.Exit(0)
}
if dbg {
log.SetOutput(os.Stdout)
} else {

View file

@ -158,12 +158,15 @@ func rejectUserMsg() string {
// Listener and Conns. The KEx and encrypt/decrypt is done within the type.
// Compare to 'serverp.go' in this directory to see the equivalence.
func main() {
version := "0.1pre (NO WARRANTY)"
var vopt bool
var chaffFreqMin uint
var chaffFreqMax uint
var chaffBytesMax uint
var dbg bool
var laddr string
flag.BoolVar(&vopt, "v", false, "show version")
flag.StringVar(&laddr, "l", ":2000", "interface[:port] to listen")
flag.UintVar(&chaffFreqMin, "cfm", 100, "chaff pkt freq min (msecs)")
flag.UintVar(&chaffFreqMax, "cfM", 5000, "chaff pkt freq max (msecs)")
@ -171,6 +174,11 @@ func main() {
flag.BoolVar(&dbg, "d", false, "debug logging")
flag.Parse()
if vopt {
fmt.Printf("version v%s\n", version)
os.Exit(0)
}
if dbg {
log.SetOutput(os.Stdout)
} else {