作者:kisiel
项目:whisper-g
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
}
作者:ernesto-jimene
项目:goa
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(®ions, "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)
}
作者:gregos
项目:PIDuin
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)
}
作者:uin5
项目:gatewa
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
}
}
作者:egelme
项目:hgd
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)
}
作者:alphazer
项目:pupp
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)")
}
作者:johnny-morric
项目:amoebethic
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)
}
}
}
}
作者:opus-u
项目:beacon-backen
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()
}
作者:chrisdelre
项目:docker-infoblo
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
}
作者:ernesto-jimene
项目:goa
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(®ion, "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)
}
作者:EricMountain-1
项目:openshift-sd
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")
}
作者:ripplecrippl
项目:gocoi
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()
}
作者:Tenze
项目:explosio
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)
}
}
}
作者:cras
项目:tsuit
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")
}
作者:imjorg
项目:flyn
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)
}
}
作者:foc
项目:webrocke
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()
}
作者:johnny-morric
项目:godelbro
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
}
作者:goadap
项目:goa
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(®ions, "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)
}
作者:spawnri
项目:gonetbenc
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)
}
}
作者:johnny-morric
项目:amoebethic
func getArgs() args {
params := args{}
flag.UintVar(¶ms.sheeplecnt, "sheeple", 0, "Number of sheeple")
flag.UintVar(¶ms.tvcnt, "tv", 0, "Number of TVs")
flag.UintVar(¶ms.itermax, "iterations", 100, "Number of iterations")
flag.Float64Var(¶ms.width, "width", 10, "Torus width")
flag.Float64Var(¶ms.height, "height", 10, "Torus height")
flag.StringVar(¶ms.beliefs, "beliefs", "A,B,C", "Comma separated belief list")
flag.Parse()
return params
}