func init() { runtime.GOMAXPROCS(runtime.NumCPU()) flag.Int("vv", 0, "vv") var fs = flag.NewFlagSet("deblocus", flag.ErrorHandling(0xffff)) var null, _ = os.Open(os.DevNull) defer null.Close() fs.SetOutput(null) var v int fs.IntVar(&v, "vv", 0, "log verbose") var deblocusArgs []string deblocusArgs = append(deblocusArgs, os.Args[1:]...) fs.Parse(deblocusArgs) log.Set_output(true, "") log.Set_Verbose(v) cltAddr += strconv.FormatInt(randomRange(1, 1<<13)+3e4, 10) svrAddr += strconv.FormatInt(randomRange(1, 1<<13)+3e4, 10) dstAddr += strconv.FormatInt(randomRange(1, 1<<13)+3e4, 10) fmt.Println("=== deblocus TEST ===") printArgLine("logV", v) printArgLine("cltAddr", cltAddr) printArgLine("svrAddr", svrAddr) printArgLine("dstAddr", dstAddr) fmt.Println("\n") }
func main() { var output, logDir string var showVersion bool flag.Usage = showUsage flag.StringVar(&context.config, "config", "", "indicate Config path if it in nontypical path") flag.StringVar(&output, "o", "", "output file") flag.BoolVar(&context.csc, "csc", false, "Server;;Create Server Config") flag.BoolVar(&context.icc, "icc", false, "Server;;Issue Client Credential for user//-icc <ServerAddress:Port> <User1> <User2>...") flag.BoolVar(&context.isServ, "serv", false, "Server;;run as Server explicitly") flag.BoolVar(&showVersion, "V", false, "show Version") flag.StringVar(&context.verbosity, "v", "", "Verbose log level") flag.StringVar(&logDir, "logdir", "", "write log into the directory") flag.BoolVar(&context.debug, "debug", false, "debug") flag.Parse() if showVersion { fmt.Println(versionString()) return } context.parse() // toStd bool, logDir string log.Set_output(true, logDir) if context.csc { t.Generate_d5sFile(output, nil) return } if context.icc { context.icc_process(output) return } if context.isServ { go context.startServer() } else { go context.startClient() } waitSignal() }