github.com/angenalZZZ/gofunc@v0.0.0-20210507121333-48ff1be3917b/cmd/fastcache1e6/flag.go (about)

     1  package main
     2  
     3  import (
     4  	"flag"
     5  	"fmt"
     6  	"os"
     7  )
     8  
     9  var (
    10  	flagCont   = flag.Int("c", 1, "total threads")
    11  	flagData   = flag.Int("d", 128, "every time request bytes")
    12  	flagTimes  = flag.Int("t", 1000000, "total times")
    13  	flagRemove = flag.Bool("r", true, "delete data files")
    14  	flagProd   = flag.Bool("prod", false, "run production mode")
    15  	flagAddr   = flag.String("a", "", "the server address")
    16  	flagPort   = flag.Int("p", 6060, "the server port")
    17  	flagSvc    = flag.Int("s", 0, "the server IO transmission mode SHM(SharedMemory)/gRPC/TCP/WS(WebSocket)/NatS")
    18  	flagName   = flag.String("name", "cache", "the Cache name")
    19  	flagToken  = flag.String("token", "", "the Token auth string")
    20  	flagTls    = flag.Bool("tls", false, "connection uses TLS if true, else plain TCP")
    21  	flagCert   = flag.String("cert", "", "the TLS cert file")
    22  	flagKey    = flag.String("key", "", "the TLS key file")
    23  )
    24  
    25  func init() {
    26  	flag.Usage = func() {
    27  		fmt.Printf(" Usage of %s:\n", os.Args[0])
    28  		flag.PrintDefaults()
    29  	}
    30  	flag.Parse()
    31  }