• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang flag.UintVar函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中flag.UintVar函数的典型用法代码示例。如果您正苦于以下问题:Golang UintVar函数的具体用法?Golang UintVar怎么用?Golang UintVar使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了UintVar函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: main

func main() {
	now := uint(time.Now().Unix())
	yesterday := uint(time.Now().Add(-24 * time.Hour).Unix())
	flag.UintVar(&from, "from", yesterday, "Unix epoch time of the beginning of the requested interval. (default: 24 hours ago)")
	flag.UintVar(&until, "until", now, "Unix epoch time of the end of the requested interval. (default: now)")
	flag.Parse()

	if flag.NArg() != 1 {
		usage()
	}

	path := flag.Args()[0]
	fromTime := uint32(from)
	untilTime := uint32(until)

	w, err := whisper.Open(path)
	if err != nil {
		log.Fatal(err)
	}

	interval, points, err := w.FetchUntil(fromTime, untilTime)

	fmt.Printf("Values in interval %+v\n", interval)
	for i, p := range points {
		fmt.Printf("%d %v\n", i, p)
	}
	return
}
开发者ID:kisielk,项目名称:whisper-go,代码行数:28,代码来源:whisper-fetch.go


示例2: main

func main() {
	flag.StringVar(&url, "u", "", "URL to load test (required)")
	flag.StringVar(&method, "m", "GET", "HTTP method")
	flag.UintVar(&concurrency, "c", 10, "number of concurrent requests")
	flag.UintVar(&requests, "n", 1000, "number of total requests to make")
	flag.UintVar(&timeout, "t", 15, "request timeout in seconds")
	flag.StringVar(&regions, "r", "us-east-1,eu-west-1,ap-northeast-1", "AWS regions to run in (comma separated, no spaces)")
	flag.Parse()

	if url == "" {
		flag.Usage()
		os.Exit(0)
	}

	test, testerr := goad.NewTest(&goad.TestConfig{
		URL:            url,
		Concurrency:    concurrency,
		TotalRequests:  requests,
		RequestTimeout: time.Duration(timeout) * time.Second,
		Regions:        strings.Split(regions, ","),
		Method:         method,
	})
	if testerr != nil {
		fmt.Println(testerr)
		os.Exit(1)
	}

	var finalResult queue.RegionsAggData
	defer printSummary(&finalResult)

	sigChan := make(chan os.Signal, 1)
	signal.Notify(sigChan, syscall.SIGINT, syscall.SIGTERM) // but interrupts from kbd are blocked by termbox

	start(test, &finalResult, sigChan)
}
开发者ID:ernesto-jimenez,项目名称:goad,代码行数:35,代码来源:cli.go


示例3: init

func init() {
	flag.IntVar(&port, "port", 80, "Webserver port.")
	flag.IntVar(&port, "p", 80, "Webserver port (shorthand).")

	flag.BoolVar(&passThrough, "through", false, "Pass serial input to STDOUT.")
	flag.BoolVar(&passThrough, "t", false, "Pass serial input to STDOUT (shorthand).")

	flag.BoolVar(&logging, "log", false, "Log HTTP requests to STDOUT")
	flag.BoolVar(&logging, "l", false, "Log HTTP requests to STDOUT (shorthand).")

	flag.BoolVar(&devMode, "dev", false, "Dev mode")
	flag.BoolVar(&devMode, "d", false, "Dev mode (shorthand).")

	flag.IntVar(&maxLogSize, "num", 180, "Number of previous temperatures to keep in memory.")
	flag.IntVar(&maxLogSize, "n", 180, "Number of previous temperatures to keep in memory (shorthand).")

	flag.UintVar(&baudRate, "baud", 115200, "Serial port baud rate.")
	flag.UintVar(&baudRate, "b", 115200, "Serial port baud rate.")

	flag.StringVar(&serialPort, "serial", "/dev/ttyATH0", "Serial port device.")
	flag.StringVar(&serialPort, "s", "/dev/ttyATH0", "Serial port device.")

	// Dev starting values
	lastDevGrouphead = 100.0
	lastDevBoiler = 180.0

	// Set up hub
	h.Connections = make(map[*socket]bool)
	h.Pipe = make(chan string, 1)
}
开发者ID:gregose,项目名称:PIDuino,代码行数:30,代码来源:PIDuino-ui.go


示例4: init

func init() {
	var secret string
	flag.StringVar(&secret, "secret", "", "The passphrase used to decrypt target server address")
	flag.StringVar(&cfgGatewayAddr, "addr", cfgGatewayAddr, "Network address for gateway")
	flag.StringVar(&cfgPprofAddr, "pprof", cfgPprofAddr, "Network address for net/http/pprof")
	flag.BoolVar(&cfgReusePort, "reuse", cfgReusePort, "Enable reuse port feature")
	flag.UintVar(&cfgDialRetry, "retry", cfgDialRetry, "Retry times when dial to target server timeout")
	flag.UintVar(&cfgDialTimeout, "timeout", cfgDialTimeout, "Timeout seconds when dial to targer server")
	flag.UintVar(&cfgBufferSize, "buffer", cfgBufferSize, "Buffer size for io.CopyBuffer()")
	flag.Parse()

	cfgSecret = []byte(secret)

	cfgDialTimeout = uint(time.Second) * cfgDialTimeout

	handshakeBufPool.New = func() interface{} {
		buf := make([]byte, 64)
		return &buf
	}

	copyBufPool.New = func() interface{} {
		buf := make([]byte, cfgBufferSize)
		return &buf
	}
}
开发者ID:uin57,项目名称:gateway,代码行数:25,代码来源:main.go


示例5: init

func init() {
	const (
		defaultPort = 8080
		usagePort   = "port to connect to"

		usageDIR = "dir for HDG configuration files"

		usageInit       = "First time initialisation"
		defaultPassword = ""

		defaultMaxUploadSize = 100
		usageMaxUploadSize   = "Maximum upload size in MB."
	)

	defaultDIR := xdgbase.GetConfigHome() + "/hgd"

	flag.UintVar(&settings.port, "port", defaultPort, usagePort)
	flag.UintVar(&settings.port, "p", defaultPort, usagePort+" (shorthand)")

	flag.StringVar(&settings.dir, "dir", defaultDIR, usageDIR)
	flag.StringVar(&settings.dir, "d", defaultDIR, usageDIR+" (shorthand)")

	flag.StringVar(&initPassword, "init", defaultPassword, usageInit)

	flag.UintVar(&settings.maxUploadSize, "s", defaultMaxUploadSize, usageMaxUploadSize)

	log.SetFlags(log.Lshortfile | log.Ldate | log.Ltime)
}
开发者ID:egelmex,项目名称:hgd2,代码行数:28,代码来源:main.go


示例6: init

func init() {
	flag.StringVar(&conf.fname, "f", conf.fname, "apache log file")
	flag.UintVar(&conf.trafficLimitLow, "tmin", conf.trafficLimitLow, "traffic min threshold ")
	flag.UintVar(&conf.trafficLimitHigh, "tmax", conf.trafficLimitHigh, "traffic max threshold ")
	flag.UintVar(&conf.statPeriodSec, "s", conf.statPeriodSec, "stat snapshot period (sec)")
	flag.UintVar(&conf.alertPeriodMin, "a", conf.alertPeriodMin, "alerts check period (min)")
}
开发者ID:alphazero,项目名称:puppy,代码行数:7,代码来源:puppy.go


示例7: main

func main() {
	count := uint(30)
	width := uint(1920)
	height := uint(1080)
	flag.UintVar(&count, "framecnt", count, "Frames generated per simulation packet")
	flag.UintVar(&width, "width", width, "Width of output surface")
	flag.UintVar(&height, "height", height, "Height of output surface")
	flag.Parse()

	yard := ext.StdExtensions()
	shapes := animate.StdShapes
	groups := animate.StdGroupFacts

	fact := animate.RenderFactory{}
	fact.Width = width
	fact.Height = height
	fact.Yard = yard
	fact.Framecnt = count
	fact.EntShapes = shapes
	fact.EntGroups = groups
	frtun := runFrameTunnel(fact)

	for frch := range frtun {
		for fr := range frch {
			werr := animate.WriteFrame(fr, os.Stdout)
			if werr != nil {
				fmt.Fprintf(os.Stderr, "Warning: %v", werr)
			}
		}
	}
}
开发者ID:johnny-morrice,项目名称:amoebethics,代码行数:31,代码来源:amoenator.go


示例8: init

func init() {
	flag.UintVar(&port, "port", DEFAULT_PORT, "the app will listen on this port")
	flag.UintVar(&port, "p", DEFAULT_PORT, "the app will listen on this port")
	flag.BoolVar(&showVersion, "version", false, "show version information")
	flag.BoolVar(&devMode, "dev", false, "start in dev mode")
	flag.Parse()
}
开发者ID:opus-ua,项目名称:beacon-backend,代码行数:7,代码来源:main.go


示例9: LoadConfig

func LoadConfig() (config *Config) {
	config = new(Config)

	flag.StringVar(&config.GridHost, "grid-host", "192.168.124.200", "IP of Infoblox Grid Host")
	flag.StringVar(&config.WapiVer, "wapi-version", "2.0", "Infoblox WAPI Version.")
	flag.StringVar(&config.WapiPort, "wapi-port", "443", "Infoblox WAPI Port.")
	flag.StringVar(&config.WapiUsername, "wapi-username", "", "Infoblox WAPI Username")
	flag.StringVar(&config.WapiPassword, "wapi-password", "", "Infoblox WAPI Password")
	flag.StringVar(&config.SslVerify, "ssl-verify", "false", "Specifies whether (true/false) to verify server certificate. If a file path is specified, it is assumed to be a certificate file and will be used to verify server certificate.")
	config.HttpRequestTimeout = HTTP_REQUEST_TIMEOUT
	config.HttpPoolConnections = HTTP_POOL_CONNECTIONS
	config.HttpPoolMaxSize = HTTP_POOL_MAX_SIZE

	flag.StringVar(&config.PluginDir, "plugin-dir", "/run/docker/plugins", "Docker plugin directory where driver socket is created")
	flag.StringVar(&config.DriverName, "driver-name", "mddi", "Name of Infoblox IPAM driver")
	flag.StringVar(&config.GlobalNetview, "global-view", "default", "Infoblox Network View for Global Address Space")
	flag.StringVar(&config.GlobalNetworkContainer, "global-network-container", "172.18.0.0/16", "Subnets will be allocated from this container when --subnet is not specified during network creation")
	flag.UintVar(&config.GlobalPrefixLength, "global-prefix-length", 24, "The default CIDR prefix length when allocating a global subnet.")
	flag.StringVar(&config.LocalNetview, "local-view", "default", "Infoblox Network View for Local Address Space")
	flag.StringVar(&config.LocalNetworkContainer, "local-network-container", "192.168.0.0/16", "Subnets will be allocated from this container when --subnet is not specified during network creation")
	flag.UintVar(&config.LocalPrefixLength, "local-prefix-length", 24, "The default CIDR prefix length when allocating a local subnet.")

	flag.Parse()

	return config
}
开发者ID:chrisdelrey,项目名称:docker-infoblox,代码行数:26,代码来源:config.go


示例10: main

func main() {
	flag.UintVar(&concurrency, "c", 10, "number of concurrent requests")
	flag.UintVar(&requests, "n", 1000, "number of total requests to make")
	flag.UintVar(&timeout, "t", 15, "request timeout in seconds")
	flag.StringVar(&region, "r", "us-east-1", "AWS regions to run in")
	flag.Parse()

	if len(flag.Args()) < 1 {
		fmt.Println("You must specify a URL as a last argument")
		os.Exit(1)
	}

	url = flag.Args()[0]

	test, testerr := goad.NewTest(&goad.TestConfig{
		URL:            url,
		Concurrency:    concurrency,
		TotalRequests:  requests,
		RequestTimeout: time.Duration(timeout) * time.Second,
		Region:         region,
	})
	if testerr != nil {
		fmt.Println(testerr)
		os.Exit(1)
	}

	var finalResult queue.RegionsAggData
	defer printSummary(&finalResult)

	sigChan := make(chan os.Signal, 1)
	signal.Notify(sigChan, syscall.SIGINT, syscall.SIGTERM) // but interrupts from kbd are blocked by termbox

	start(test, &finalResult, sigChan)
}
开发者ID:ernesto-jimenez,项目名称:goad,代码行数:34,代码来源:cli.go


示例11: init

func init() {
	flag.StringVar(&opts.containerNetwork, "container-network", "10.1.0.0/16", "container network")
	flag.UintVar(&opts.containerSubnetLength, "container-subnet-length", 8, "container subnet length")
	flag.StringVar(&opts.serviceNetwork, "service-network", "172.30.0.0/16", "service network")
	flag.UintVar(&opts.mtu, "mtu", 1450, "maximum transmission unit for the overlay network")
	flag.StringVar(&opts.etcdEndpoints, "etcd-endpoints", "http://127.0.0.1:4001", "a comma-delimited list of etcd endpoints")
	flag.StringVar(&opts.etcdPath, "etcd-path", "/registry/sdn/", "etcd path")
	flag.StringVar(&opts.nodePath, "node-path", "/kubernetes.io/minions/", "etcd path that will be watched for node creation/deletion (Note: -sync flag will override this path with -etcd-path)")
	flag.StringVar(&opts.minionPath, "minion-path", "", "Deprecated, use -node-path instead")
	flag.StringVar(&opts.etcdKeyfile, "etcd-keyfile", "", "SSL key file used to secure etcd communication")
	flag.StringVar(&opts.etcdCertfile, "etcd-certfile", "", "SSL certification file used to secure etcd communication")
	flag.StringVar(&opts.etcdCAFile, "etcd-cafile", "", "SSL Certificate Authority file used to secure etcd communication")

	flag.StringVar(&opts.ip, "public-ip", "", "Publicly reachable IP address of this host (for node mode).")
	flag.StringVar(&opts.hostname, "hostname", "", "Hostname as registered with master (for node mode), will default to 'hostname -f'")

	flag.BoolVar(&opts.master, "master", true, "Run in master mode")
	flag.BoolVar(&opts.node, "node", false, "Run in node mode")
	flag.BoolVar(&opts.minion, "minion", false, "Deprecated, use -node instead")
	flag.BoolVar(&opts.skipsetup, "skip-setup", false, "Skip the setup when in node mode")
	flag.BoolVar(&opts.sync, "sync", false, "Sync the nodes directly to etcd-path (Do not wait for PaaS to do so!)")
	flag.BoolVar(&opts.kube, "kube", false, "Use kubernetes hooks for optimal integration with OVS. This option bypasses the Linux bridge. Any docker containers started manually (not through OpenShift/Kubernetes) will stay local and not connect to the SDN.")
	flag.BoolVar(&opts.multitenant, "multitenant", false, "Same as 'kube' but with multitenant capabilities. This option will only be examined if 'kube' option is 'false'.")

	flag.BoolVar(&opts.help, "help", false, "print this message")
}
开发者ID:EricMountain-1A,项目名称:openshift-sdn,代码行数:26,代码来源:main.go


示例12: init

func init() {
	// Fill in default values
	CFG.Net.ListenTCP = true
	CFG.Net.MaxOutCons = 9
	CFG.Net.MaxInCons = 10
	CFG.Net.MaxBlockAtOnce = 3

	CFG.WebUI.Interface = "127.0.0.1:8833"
	CFG.WebUI.AllowedIP = "127.0.0.1"
	CFG.WebUI.ShowBlocks = 25

	CFG.TXPool.Enabled = true
	CFG.TXPool.AllowMemInputs = true
	CFG.TXPool.FeePerByte = 10
	CFG.TXPool.MaxTxSize = 10e3
	CFG.TXPool.MinVoutValue = 0
	CFG.TXPool.TxExpireMinPerKB = 100
	CFG.TXPool.TxExpireMaxHours = 12

	CFG.TXRoute.Enabled = true
	CFG.TXRoute.FeePerByte = 10
	CFG.TXRoute.MaxTxSize = 10e3
	CFG.TXRoute.MinVoutValue = 500 * CFG.TXRoute.FeePerByte // Equivalent of 500 bytes tx fee

	CFG.Memory.GCPercTrshold = 100 // 100%

	CFG.MiningStatHours = 24
	CFG.UserAgent = DefaultUserAgent
	CFG.PayCommandName = "pay_cmd.txt"

	cfgfilecontent, e := ioutil.ReadFile(ConfigFile)
	if e == nil {
		e = json.Unmarshal(cfgfilecontent, &CFG)
		if e != nil {
			println("Error in", ConfigFile, e.Error())
			os.Exit(1)
		}
	}

	flag.BoolVar(&FLAG.Rescan, "r", false, "Rebuild the unspent DB (fixes 'Unknown input TxID' errors)")
	flag.BoolVar(&CFG.Testnet, "t", CFG.Testnet, "Use Testnet3")
	flag.StringVar(&CFG.ConnectOnly, "c", CFG.ConnectOnly, "Connect only to this host and nowhere else")
	flag.BoolVar(&CFG.Net.ListenTCP, "l", CFG.Net.ListenTCP, "Listen for incomming TCP connections (on default port)")
	flag.StringVar(&CFG.Datadir, "d", CFG.Datadir, "Specify Gocoin's database root folder")
	flag.UintVar(&CFG.Net.MaxUpKBps, "ul", CFG.Net.MaxUpKBps, "Upload limit in KB/s (0 for no limit)")
	flag.UintVar(&CFG.Net.MaxDownKBps, "dl", CFG.Net.MaxDownKBps, "Download limit in KB/s (0 for no limit)")
	flag.StringVar(&CFG.WebUI.Interface, "webui", CFG.WebUI.Interface, "Serve WebUI from the given interface")
	flag.StringVar(&CFG.Beeps.MinerID, "miner", CFG.Beeps.MinerID, "Monitor new blocks with the string in their coinbase TX")
	flag.BoolVar(&CFG.TXRoute.Enabled, "txp", CFG.TXPool.Enabled, "Enable Memory Pool")
	flag.BoolVar(&CFG.TXRoute.Enabled, "txr", CFG.TXRoute.Enabled, "Enable Transaction Routing")

	if flag.Lookup("h") != nil {
		flag.PrintDefaults()
		os.Exit(0)
	}
	flag.Parse()

	Reset()
}
开发者ID:ripplecripple,项目名称:gocoin,代码行数:59,代码来源:config.go


示例13: main

func main() {
	heightInt, widthInt, _ := pty.Getsize(os.Stdout)

	var width uint
	var height uint

	// The three subtracted lines is to have room for command, file name and prompt after explosion
	flag.UintVar(&width, "w", uint(widthInt), "Maximum width of output in number of columns")
	flag.UintVar(&height, "h", uint((heightInt-3)*2), "Maximum height of output in number of half lines")
	flag.Usage = func() {
		fmt.Fprintf(os.Stderr, "Usage: %s [options] [file | - ...]\n\n", os.Args[0])
		fmt.Fprintln(os.Stderr, "  Specify \"-\" or just noting to read from stdin.")
		fmt.Fprintln(os.Stderr)
		fmt.Fprintln(os.Stderr, "Options:")
		flag.PrintDefaults()
	}
	flag.Parse()

	filenames := flag.Args()
	if len(filenames) == 0 {
		fmt.Println("stdin:")
		sourceImage, _, err := image.Decode(os.Stdin)
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error:", err)
		} else {
			printImage(sourceImage, width, height)
		}
	} else {
		for i, filename := range filenames {
			if i > 0 {
				fmt.Println()
			}

			var file *os.File
			var err error

			if filename == "-" {
				fmt.Println("stdin:")
				file = os.Stdin
			} else {
				fmt.Printf("%s:\n", filename)
				file, err = os.Open(filename)
				if err != nil {
					fmt.Fprintln(os.Stderr, "Error:", err)
					continue
				}
			}

			sourceImage, _, err := image.Decode(file)
			_ = file.Close()
			if err != nil {
				fmt.Fprintln(os.Stderr, "Error:", err)
				continue
			}

			printImage(sourceImage, width, height)
		}
	}
}
开发者ID:Tenzer,项目名称:explosion,代码行数:59,代码来源:explosion.go


示例14: init

func init() {
	flag.StringVar(&localAddr, "l", ":7777", "set local address")
	flag.StringVar(&remoteAddr, "r", "localhost:7777", "set remote address")
	flag.UintVar(&inputDelay, "id", 0, "set input delay ")
	flag.UintVar(&outputDelay, "od", 0, "set output delay ")
	flag.StringVar(&inputFile, "if", "/dev/stdout", "set input log")
	flag.StringVar(&outputFile, "of", "/dev/stdout", "set output log")
}
开发者ID:crask,项目名称:tsuite,代码行数:8,代码来源:main.go


示例15: main

func main() {
	var config Config
	config.Backend.Type = "vxlan"
	if backend := os.Getenv("BACKEND"); backend != "" {
		config.Backend.Type = backend
	}
	config.Network = os.Getenv("NETWORK")
	if config.Network == "" {
		config.Network = "100.100.0.0/16"
	}
	flag.StringVar(&config.SubnetMin, "subnet-min", "", "container network min subnet")
	flag.StringVar(&config.SubnetMax, "subnet-max", "", "container network max subnet")
	flag.UintVar(&config.SubnetLen, "subnet-len", 0, "container network subnet length")
	flag.UintVar(&config.Backend.VNI, "vni", 0, "vxlan network identifier")
	flag.UintVar(&config.Backend.Port, "port", 0, "vxlan communication port (UDP)")
	flag.Parse()

	// wait for discoverd to come up
	status, err := cluster.WaitForHostStatus(os.Getenv("EXTERNAL_IP"), func(status *host.HostStatus) bool {
		return status.Discoverd != nil && status.Discoverd.URL != ""
	})
	if err != nil {
		log.Fatal(err)
	}

	// create service and config if not present
	client := discoverd.NewClientWithURL(status.Discoverd.URL)
	if err := client.AddService(serviceName, nil); err != nil && !hh.IsObjectExistsError(err) {
		log.Fatalf("error creating discoverd service: %s", err)
	}
	data, err := json.Marshal(map[string]Config{"config": config})
	if err != nil {
		log.Fatal(err)
	}
	err = client.Service(serviceName).SetMeta(&discoverd.ServiceMeta{Data: data})
	if err != nil && !hh.IsObjectExistsError(err) {
		log.Fatalf("error creating discoverd service metadata: %s", err)
	}

	flanneld, err := exec.LookPath("flanneld")
	if err != nil {
		log.Fatal(err)
	}

	if err := syscall.Exec(
		flanneld,
		[]string{
			flanneld,
			"-discoverd-url=" + status.Discoverd.URL,
			"-iface=" + os.Getenv("EXTERNAL_IP"),
			"-http-port=" + os.Getenv("PORT"),
			fmt.Sprintf("-notify-url=http://%s:1113/host/network", os.Getenv("EXTERNAL_IP")),
		},
		os.Environ(),
	); err != nil {
		log.Fatal(err)
	}
}
开发者ID:imjorge,项目名称:flynn,代码行数:58,代码来源:runner.go


示例16: init

func init() {
	flag.StringVar(&conf.WsHost, "websocket-host", "", "bind websocket endpoint with given interface")
	flag.UintVar(&conf.WsPort, "websocket-port", 8080, "websocket endpoint will listen on this port")
	flag.StringVar(&conf.BackHost, "backend-host", "", "bind backend endpoint with given interface")
	flag.UintVar(&conf.BackPort, "backend-port", 8081, "backend endpoint will listen on this port")
	flag.StringVar(&conf.CertFile, "cert", "", "path to server certificate")
	flag.StringVar(&conf.KeyFile, "key", "", "private key")
	flag.Parse()
}
开发者ID:foca,项目名称:webrocket,代码行数:9,代码来源:main.go


示例17: readArgs

func readArgs() params {
	args := params{}
	flag.UintVar(&args.jobs, "jobs", 1, "Number of concurrent render jobs")
	flag.UintVar(&args.port, "port", 9898, "Port for webservice")
	flag.StringVar(&args.bind, "bind", "127.0.0.1", "Interface to bind against")
	flag.StringVar(&args.origins, "origins", "", "Comma separated CORS client origins")
	flag.BoolVar(&args.debug, "debug", false, "Verbose logging")
	flag.Parse()
	return args
}
开发者ID:johnny-morrice,项目名称:godelbrot,代码行数:10,代码来源:restfulbrot.go


示例18: main

func main() {
	var printVersion bool

	flag.StringVar(&url, "u", "", "URL to load test (required)")
	flag.StringVar(&method, "m", "GET", "HTTP method")
	flag.StringVar(&body, "b", "", "HTTP request body")
	flag.UintVar(&concurrency, "c", 10, "number of concurrent requests")
	flag.UintVar(&requests, "n", 1000, "number of total requests to make")
	flag.UintVar(&timeout, "t", 15, "request timeout in seconds")
	flag.StringVar(&regions, "r", "us-east-1,eu-west-1,ap-northeast-1", "AWS regions to run in (comma separated, no spaces)")
	flag.StringVar(&awsProfile, "p", "", "AWS named profile to use")
	flag.StringVar(&outputFile, "o", "", "Optional path to JSON file for result storage")
	flag.Var(&headers, "H", "List of headers")
	flag.BoolVar(&printVersion, "version", false, "print the current Goad version")
	flag.Parse()

	if printVersion {
		fmt.Println(version.Version)
		os.Exit(0)
	}

	if url == "" {
		flag.Usage()
		os.Exit(0)
	}

	test, testerr := goad.NewTest(&goad.TestConfig{
		URL:            url,
		Concurrency:    concurrency,
		TotalRequests:  requests,
		RequestTimeout: time.Duration(timeout) * time.Second,
		Regions:        strings.Split(regions, ","),
		Method:         method,
		Body:           body,
		Headers:        headers,
		AwsProfile:     awsProfile,
	})
	if testerr != nil {
		fmt.Println(testerr)
		os.Exit(1)
	}

	var finalResult queue.RegionsAggData
	defer printSummary(&finalResult)

	if outputFile != "" {
		defer saveJSONSummary(outputFile, &finalResult)
	}

	sigChan := make(chan os.Signal, 1)
	signal.Notify(sigChan, syscall.SIGINT, syscall.SIGTERM) // but interrupts from kbd are blocked by termbox

	start(test, &finalResult, sigChan)
}
开发者ID:goadapp,项目名称:goad,代码行数:54,代码来源:cli.go


示例19: init

func init() {
	flag.UintVar(&Num, "n", 10, "number of concurrent clients")
	flag.UintVar(&Size, "s", 1, "packet size (in bytes)")
	flag.Parse()

	Addr = flag.Arg(0)
	if Addr == "" {
		usage()
		os.Exit(1)
	}
}
开发者ID:spawnris,项目名称:gonetbench,代码行数:11,代码来源:main.go


示例20: getArgs

func getArgs() args {
	params := args{}
	flag.UintVar(&params.sheeplecnt, "sheeple", 0, "Number of sheeple")
	flag.UintVar(&params.tvcnt, "tv", 0, "Number of TVs")
	flag.UintVar(&params.itermax, "iterations", 100, "Number of iterations")
	flag.Float64Var(&params.width, "width", 10, "Torus width")
	flag.Float64Var(&params.height, "height", 10, "Torus height")
	flag.StringVar(&params.beliefs, "beliefs", "A,B,C", "Comma separated belief list")
	flag.Parse()
	return params
}
开发者ID:johnny-morrice,项目名称:amoebethics,代码行数:11,代码来源:amoeconf.go



注:本文中的flag.UintVar函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang flag.Usage函数代码示例发布时间:2022-05-24
下一篇:
Golang flag.Uint64Var函数代码示例发布时间:2022-05-24
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap