本文整理汇总了Golang中flag.Int64Var函数的典型用法代码示例。如果您正苦于以下问题:Golang Int64Var函数的具体用法?Golang Int64Var怎么用?Golang Int64Var使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Int64Var函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: main
func main() {
laddr := flag.String("listen", ":8001", "listen address")
baddr := flag.String("backend", "127.0.0.1:1234", "backend address")
secret := flag.String("secret", "the answer to life, the universe and everything", "tunnel secret")
tunnels := flag.Uint("tunnels", 1, "low level tunnel count, 0 if work as server")
flag.Int64Var(&tunnel.Timeout, "timeout", 10, "tunnel read/write timeout")
flag.UintVar(&tunnel.LogLevel, "log", 1, "log level")
flag.Usage = usage
flag.Parse()
app := &tunnel.App{
Listen: *laddr,
Backend: *baddr,
Secret: *secret,
Tunnels: *tunnels,
}
err := app.Start()
if err != nil {
fmt.Fprintf(os.Stderr, "start failed:%s\n", err.Error())
return
}
go handleSignal(app)
app.Wait()
}
开发者ID:xiaobodu,项目名称:gotunnel,代码行数:26,代码来源:main.go
示例2: main
func main() {
var options Options
flag.Var(&options.SourceDirs, "folder", "The folder to inspect for documents, can be provided multiple times")
flag.StringVar(&options.Agency, "agency", "", "The agency to use if it's not available in the folder structure")
flag.StringVar(&options.Component, "component", "", "The component to use if it's not available in the folder structure")
flag.StringVar(&options.HtmlReport, "report", "report.html", "The file in which to store the HTML report")
flag.StringVar(&options.PhpDataFile, "phpDataFile", "", "The file in which to store the file information as PHP data")
flag.StringVar(&options.PhpVarName, "phpVarName", "$FILES", "The PHP variable to assign the file data to")
flag.BoolVar(&options.WarnOnMissingAgency, "warnOnMissingAgency", false, "Should we warn if a agency is missing from folder structure?")
flag.BoolVar(&options.WarnOnMissingComponent, "warnOnMissingComponent", false, "Should we warn if a component is missing from folder structure?")
flag.Int64Var(&options.ErrorSingleFileSizeBytes, "errorSingleFileSizeBytes", 1024*500, "Display an error for any files larger than this size")
flag.Int64Var(&options.WarnAverageFileSizeBytes, "warnAverageFileSizeBytes", 1024*384, "Display a warning if average size of files in the download exceeds this threshold")
//options.SourceDirs.Set("C:\\Projects\\MAX-OGE\\docs-generator\\generated-files")
options.Extensions = map[string]bool{".pdf": true}
options.FieldsSeparator = ';'
if options.validate() {
var results Results
results.Options = options
results.walkSourceDirs()
fmt.Println(results.LastFileIndex, "documents found in", len(results.DirsWalked), "folders.")
results.createReport("HTML Report", htmlReportTemplate, options.HtmlReport)
if len(options.PhpDataFile) > 0 {
results.createReport("PHP Data", phpDataTemplate, options.PhpDataFile)
}
}
}
开发者ID:shah,项目名称:docs-admin,代码行数:29,代码来源:docs-admin.go
示例3: main
func main() {
flag.StringVar(&target.Address, "a", "", "address of sink")
flag.Int64Var(&target.Counter, "c", 0, "initial packet counter")
flag.Int64Var(&target.Next, "t", 0, "initial update timestamp")
keyFile := flag.String("k", "decrypt.pub", "sink's decryption public key")
flag.Parse()
if target.Address == "" {
fmt.Fprintf(os.Stderr, "[!] no address provided.\n")
os.Exit(1)
}
in, err := ioutil.ReadFile(*keyFile)
checkError(err)
if len(in) != 32 {
fmt.Fprintf(os.Stderr, "[!] invalid Curve25519 public key.\n")
}
target.Public = in
buf := &bytes.Buffer{}
out, err := json.Marshal(target)
checkError(err)
err = json.Indent(buf, out, "", "\t")
checkError(err)
fmt.Printf("%s\n", buf.Bytes())
}
开发者ID:postfix,项目名称:entropyshare,代码行数:30,代码来源:target.go
示例4: init
func init() {
flag.Int64Var(&first, "first", 0, "first uid")
flag.Int64Var(&last, "last", 0, "last uid")
flag.StringVar(&local_ip, "local_ip", "0.0.0.0", "local ip")
flag.StringVar(&host, "host", "127.0.0.1", "host")
flag.IntVar(&port, "port", 23000, "port")
}
开发者ID:ZhangTingkuo,项目名称:im_service,代码行数:7,代码来源:benchmark_connection.go
示例5: main
func main() {
var (
S_SERVERS string
S_LISTEN string
S_ACCESS string
timeout int
max_entries int64
expire_interval int64
)
flag.StringVar(&S_SERVERS, "proxy", "127.0.0.1:53", "we proxy requests to those servers")
flag.StringVar(&S_LISTEN, "listen", "[::1]:5353,127.0.0.1:5353",
"listen on (both tcp and udp), [ipv6address]:port, ipv4address:port")
flag.StringVar(&S_ACCESS, "access", "0.0.0.0/0", "allow those networks, use 0.0.0.0/0 to allow everything")
flag.IntVar(&timeout, "timeout", 5, "timeout")
flag.Int64Var(&expire_interval, "expire_interval", 300, "delete expired entries every N seconds")
flag.BoolVar(&DEBUG, "debug", false, "enable/disable debug")
flag.Int64Var(&max_entries, "max_cache_entries", 2000000, "max cache entries")
flag.Parse()
servers := strings.Split(S_SERVERS, ",")
proxyer := ServerProxy{
giant: new(sync.RWMutex),
ACCESS: make([]*net.IPNet, 0),
SERVERS: servers,
s_len: len(servers),
NOW: time.Now().UTC().Unix(),
entries: 0,
timeout: time.Duration(timeout) * time.Second,
max_entries: max_entries}
for _, mask := range strings.Split(S_ACCESS, ",") {
_, cidr, err := net.ParseCIDR(mask)
if err != nil {
panic(err)
}
_D("added access for %s\n", mask)
proxyer.ACCESS = append(proxyer.ACCESS, cidr)
}
for _, addr := range strings.Split(S_LISTEN, ",") {
_D("listening @ :%s\n", addr)
go func() {
if err := dns.ListenAndServe(addr, "udp", proxyer); err != nil {
log.Fatal(err)
}
}()
go func() {
if err := dns.ListenAndServe(addr, "tcp", proxyer); err != nil {
log.Fatal(err)
}
}()
}
for {
proxyer.NOW = time.Now().UTC().Unix()
time.Sleep(time.Duration(1) * time.Second)
}
}
开发者ID:yiyuandao,项目名称:DNS-layer-Fragmentation,代码行数:60,代码来源:ServerProxy.go
示例6: main
func main() {
dev := flag.String("d", "/dev/input/by-id/usb-0810_Twin_USB_Joystick-event-joystick", "The GH controller event device")
flag.Int64Var(&baseNote, "b", 48, "The base midi note with no button pressed")
flag.Int64Var(&vel, "v", 100, "Midi note velocity")
flag.Int64Var(&midiChan, "c", 1, "Midi channel")
flag.Parse()
portmidi.Initialize()
out, err := portmidi.NewOutputStream(portmidi.GetDefaultOutputDeviceId(), 32, 0)
if err != nil {
fmt.Println(err)
return
}
c := make(chan *evdev.InputEvent)
e := make(chan error)
go ReadGuitar(c, e, *dev)
for {
select {
case but := <-c:
switch but.Code {
case butGreen, butRed, butYellow, butBlue, butOrange:
SetNote(butMap[but.Code], but.Value)
if playing != -1 {
SwapNote(out, baseNote+butState+octave, vel)
}
case butStrumbar:
if but.Value == 255 || but.Value == 0 {
NoteOn(out, baseNote+butState+octave, vel)
} else if !hold {
NoteOff(out, playing, vel)
}
case butSelect:
if but.Value != 0 {
hold = !hold
if !hold {
NoteOff(out, playing, vel)
}
}
case butTilt:
if but.Value == 1 {
octave += 12
} else {
octave -= 12
}
if playing != -1 {
SwapNote(out, baseNote+butState+octave, vel)
}
case butStart:
AllNotesOff(out)
}
case err := <-e:
fmt.Println(err)
close(c)
close(e)
return
default:
}
}
}
开发者ID:rbino,项目名称:gotar-hero,代码行数:60,代码来源:gotar-hero.go
示例7: init
func init() {
flag.StringVar(&topic, "topic", "sangrenel", "Topic to publish to")
flag.Int64Var(&msgSize, "size", 300, "Message size in bytes")
flag.Int64Var(&msgRate, "rate", 100000000, "Apply a global message rate limit")
flag.IntVar(&batchSize, "batch", 0, "Max messages per batch. Defaults to unlimited (0).")
flag.StringVar(&compressionOpt, "compression", "none", "Message compression: none, gzip, snappy")
flag.BoolVar(&noop, "noop", false, "Test message generation performance, do not transmit messages")
flag.IntVar(&clients, "clients", 1, "Number of Kafka client workers")
flag.IntVar(&producers, "producers", 5, "Number of producer instances per client")
brokerString := flag.String("brokers", "localhost:9092", "Comma delimited list of Kafka brokers")
flag.Parse()
brokers = strings.Split(*brokerString, ",")
switch compressionOpt {
case "gzip":
compression = kafka.CompressionGZIP
case "snappy":
compression = kafka.CompressionSnappy
case "none":
compression = kafka.CompressionNone
default:
fmt.Printf("Invalid compression option: %s\n", compressionOpt)
os.Exit(1)
}
sentCntr <- 0
runtime.GOMAXPROCS(runtime.NumCPU())
}
开发者ID:prezi,项目名称:sangrenel,代码行数:29,代码来源:sangrenel.go
示例8: MakeConfigFromCmdline
func MakeConfigFromCmdline() *Config {
tc := &Config{}
flag.StringVar(&tc.ClientType, "client_type", "consul", "Type of client to connect with")
flag.StringVar(&tc.BenchType, "bench_type", "read", "Type of test to run")
flag.BoolVar(&tc.Setup, "setup", false, "Initialize the servers for test type")
flag.Int64Var(&tc.Iterations, "iterations", 10, "Number of times to read")
flag.Float64Var(&tc.ArrivalRate, "arrival_rate", 2, "Number of operations per second")
flag.Int64Var(&tc.Seed, "seed", time.Now().UnixNano(), "Random number seed (defaults to current nanoseconds)")
flag.BoolVar(&tc.Debug, "debug", false, "Enable verbose output")
flag.StringVar(&tc.ServerHost, "server_host", "", "Override of server host:port")
flag.Parse()
if tc.ClientType != "consul" &&
tc.ClientType != "etcd" &&
tc.ClientType != "zookeeper" {
fmt.Printf("Error: invalid client_type '%s'\n", tc.ClientType)
}
if tc.Debug {
fmt.Printf("server_type = %s\n", tc.ClientType)
fmt.Printf("server_host = %s\n", tc.ServerHost)
fmt.Printf("setup = %t\n", tc.Setup)
fmt.Printf("bench_type = %s\n", tc.BenchType)
fmt.Printf("iterations = %d\n", tc.Iterations)
fmt.Printf("arrival_rate = %f\n", tc.ArrivalRate)
fmt.Printf("seed = %d\n", tc.Seed)
fmt.Printf("debug = %t\n", tc.Debug)
}
return tc
}
开发者ID:mannesma,项目名称:bench,代码行数:31,代码来源:config.go
示例9: init
func init() {
flag.StringVar(&username, "username", os.Getenv("HIVEKIT_USER"), "Hive Home web service username (usually an email address)")
flag.StringVar(&password, "password", os.Getenv("HIVEKIT_PASS"), "Hive Home web service password")
flag.StringVar(&pin, "pin", os.Getenv("HIVEKIT_PIN"), "The HomeKit accessory pin (8 numeric chars)")
flag.BoolVar(&verbose, "verbose", false, "Enable verbose logging")
flag.Int64Var(&boostDuration, "boost-duration", 60, "Duration (minutes) to boost heating")
flag.Int64Var(&hotWaterDuration, "boost-water", 60, "Duration (minutes) to boost hot water")
}
开发者ID:njpatel,项目名称:hivekit,代码行数:8,代码来源:main.go
示例10: init
func init() {
flag.Int64Var(&count, "count", 100, "files to generate")
flag.Int64Var(&sizeMax, "size-max", 1024*100, "maximum file size in bytes")
flag.Int64Var(&sizeMin, "size-min", 1024*5, "minimum file size in bytes")
flag.IntVar(&resMax, "res-max", 1980, "maximum ephemeral resolution")
flag.IntVar(&resMin, "res-min", 500, "minumum ephemeral resolution")
flag.IntVar(&workers, "workers", 1, "concurrent workers")
flag.StringVar(&dir, "dir", "", "working directory")
}
开发者ID:RyuaNerin,项目名称:hath,代码行数:9,代码来源:main.go
示例11: parseFlags
func parseFlags() {
flag.StringVar(&flagHTTPAddr, "http", flagHTTPAddr, "HTTP addr")
flag.StringVar(&flagGitHubWebhookSecret, "github-webhook-secret", flagGitHubWebhookSecret, "GitHub webhook secret")
flag.Int64Var(&flagGroupcache, "groupcache", flagGroupcache, "Groupcache")
flag.StringVar(&flagGroupcacheSelf, "groupcache-self", flagGroupcacheSelf, "Groupcache self")
flag.StringVar(&flagGroupcachePeers, "groupcache-peers", flagGroupcachePeers, "Groupcache peers")
flag.Int64Var(&flagCacheMemory, "cache-memory", flagCacheMemory, "Cache memory")
flag.Parse()
}
开发者ID:cautio,项目名称:imageserver,代码行数:9,代码来源:advanced.go
示例12: init
func init() {
flag.StringVar(&httpHost, "host", "0.0.0.0", "Host to bind HTTP server to")
flag.StringVar(&httpPort, "port", "1080", "Port to bind HTTP server to")
flag.Int64Var(&maxSize, "max-size", 0, "Maximum size of uploads in bytes")
flag.StringVar(&dir, "dir", "./data", "Directory to store uploads in")
flag.Int64Var(&storeSize, "store-size", 0, "Size of disk space allowed to storage")
flag.StringVar(&basepath, "base-path", "/files/", "Basepath of the hTTP server")
flag.Parse()
}
开发者ID:wix-user01,项目名称:tusd,代码行数:10,代码来源:main.go
示例13: init
func init() {
flag.StringVar(&Mode, "mode", "client", "client/server, start as client or server mode")
flag.StringVar(&ServerUrl, "server", "http://www.baidu.com", "client mode: assign server url to test")
flag.Int64Var(&DurationSec, "ds", 1, "client mode: request duration (milli sec)")
flag.Int64Var(&DurationMilliSec, "dms", 100, "client mode: request duration (sec), it will replace DurationMilliSec")
flag.Int64Var(&IntervalMilliSec, "ims", 10, "client mode: request interval (milli sec)")
flag.StringVar(&FileSize, "filesize", "10m", "file size when request \"/\" url, default 10MB, k/kb/m/mb/g/gb all accepted")
flag.Parse()
}
开发者ID:oscarzhao,项目名称:network-tester,代码行数:10,代码来源:httpTester.go
示例14: main
func main() {
//
// The purpose of this program is to demonstrate that when CloseWrite is called on a connection
// opened across the loopback interface that received (but not acknowledged) packets will be
// be acknowledged with an incorrect ack sequence number and so prevent the arrival of
// packets sent after that time.
//
// The server waits for connections on the specified interface and port.
// When it receives a connection it reads parameters from the connection. The parameters are:
// * the number of bytes in each burst
// * the number of milliseconds to delay between each burst
// * the number of bursts to generate
//
// It then enters a loop and generates the specified number of bursts of specified number of characters, with a delay
// of the specified amount between each burst.
//
// The client:
// * connects to the server
// * sends the parameters for the connection to the server
// * creates a goroutine to copy the connections output to stdout and count the response bytes
// * delays for a specified number of milliseconds, then issues a CloseWrite on the connection
// * waits for the copying goroutine to finish
//
var role string
var connection ConnectionParams
var program Program
var closeDelay int
flag.StringVar(&role, "role", "client", "The role of this program - either client (default) or server")
flag.StringVar(&connection.addr, "addr", "127.0.0.1:19622", "The connection address.")
flag.Int64Var(&program.BurstSize, "burstSize", 5, "The number of bytes in each burst.")
flag.Int64Var(&program.BurstDelay, "burstDelay", 1000, "The number of milliseconds between each burst.")
flag.Int64Var(&program.InitialDelay, "initialDelay", 200, "The number of milliseconds to wait before the initial burst.")
flag.Int64Var(&program.BurstCount, "burstCount", 2, "The number of bursts to issue before closing the connection.")
flag.Int64Var(&program.PreambleSize, "preambleSize", 69, "The number of bytes of preamble to generate prior to the initial response burst.")
flag.IntVar(&closeDelay, "closeDelay", 0, "The number of milliseconds delay before shutting down the write side of the client's socket.")
flag.Parse()
var exit int
if role == "server" {
//
exit = server(connection)
} else {
exit = client(connection, program, closeDelay)
}
os.Exit(exit)
}
开发者ID:jonseymour,项目名称:vbox-portforward,代码行数:54,代码来源:vbox-portforward.go
示例15: init
func init() {
flag.StringVar(&config_url, "url", "", "url to fetch (like https://www.mydomain.com/content/)")
flag.StringVar(&config_cert, "cert", "", "x509 certificate file to use")
flag.StringVar(&config_key, "key", "", "RSA key file to use")
flag.Int64Var(&config_requests, "requests", 10, "Number of requests to perform")
flag.Int64Var(&config_workers, "workers", 5, "Number of workers to use")
flag.IntVar(&config_cpus, "cpus", runtime.NumCPU(), "Number of CPUs to use (defaults to all)")
flag.BoolVar(&config_head_method, "head", false, "Whether to use HTTP HEAD (default is GET)")
flag.BoolVar(&config_fail_quit, "fail", false, "Whether to exit on a non-OK response")
flag.BoolVar(&config_quiet, "quiet", false, "do not print all responses")
}
开发者ID:vbatts,项目名称:rc,代码行数:11,代码来源:reqconcur.go
示例16: init
func init() {
flag.Int64Var(&requests, "r", -1, "Number of requests per client")
flag.IntVar(&clients, "c", 100, "Number of concurrent clients")
flag.StringVar(&url, "u", "", "URL")
flag.StringVar(&urlsFilePath, "f", "", "URL's file path (line seperated)")
flag.BoolVar(&keepAlive, "k", true, "Do HTTP keep-alive")
flag.StringVar(&postDataFilePath, "d", "", "HTTP POST data file path")
flag.Int64Var(&period, "t", -1, "Period of time (in seconds)")
flag.IntVar(&connectTimeout, "tc", 5000, "Connect timeout (in milliseconds)")
flag.IntVar(&writeTimeout, "tw", 5000, "Write timeout (in milliseconds)")
flag.IntVar(&readTimeout, "tr", 5000, "Read timeout (in milliseconds)")
}
开发者ID:jwhitley,项目名称:gobench,代码行数:12,代码来源:gobench.go
示例17: init
func init() {
flag.StringVar(&streamName, "stream-name", "your_stream", "the kinesis stream to read from")
flag.StringVar(&workerID, "id", "", "the unique id for this consumer")
flag.StringVar(&consumerGroup, "consumer-group", "example", "the name for this consumer group")
flag.StringVar(&iteratorType, "iterator-type", "LATEST", "valid options are LATEST or TRIM_HORIZON which is how this consumer group will initial start handling the kinesis stream")
flag.BoolVar(&verbose, "v", false, "verbose mode")
flag.Int64Var(&consumerExpirationSeconds, "consumer-expiration-seconds", 15, "amount of time until another consumer starts processing this shard")
flag.IntVar(&totalToConsume, "consume-total", -1, "total number of records to count as consumed before closing consumer")
flag.Int64Var(&numRecords, "num-records", 5000, "total number of records to consumer per iteration")
flag.IntVar(&bufferSize, "buffer-size", 100000, "size of the internal buffer that holds records to process")
flag.Var(queryFreq, "query-freq", "how frequently to query kinesis for records [default: 1s]")
}
开发者ID:delicioussandwiches,项目名称:kinesis_client_library,代码行数:12,代码来源:kinesis_consumer.go
示例18: FlagsParse
func FlagsParse() {
flag.StringVar(&Port, "port", "50000", "node port")
flag.StringVar(&Host, "host", "127.0.0.1", "node address")
flag.Uint64Var(&MinWorkers, "minWorkers", 2, "min workers")
flag.Uint64Var(&MinPartitionsPerWorker, "ppw", 1, "min partitions per worker")
flag.Int64Var(&MessageThreshold, "mthresh", 1000, "message threshold")
flag.Int64Var(&VertexThreshold, "vthresh", 1000, "vertex threshold")
flag.StringVar(&LoadPath, "loadPath", "data", "data load path")
flag.StringVar(&PersistPath, "persistPath", "persist", "data persist path")
flag.Parse()
}
开发者ID:dforsyth,项目名称:syrup,代码行数:12,代码来源:setup.go
示例19: init
func init() {
flag.Int64Var(&rps, "rps", 500, "Set Request Per Second")
flag.StringVar(&profileFile, "profile", "", "The path to the traffic profile")
flag.Int64Var(&slowThreshold, "threshold", 200, "Set slowness standard (in millisecond)")
flag.StringVar(&profileType, "type", "default", "Profile type (default|session|your session type)")
flag.BoolVar(&debug, "debug", false, "debug flag (true|false)")
flag.StringVar(&auth_method, "auth", "none", "Set authorization flag (oauth|simple(c|s)2s|none)")
flag.IntVar(&sessionAmount, "size", 100, "session amount")
flag.StringVar(&proxy, "proxy", "none", "Set HTTP proxy (need to specify scheme. e.g. http://127.0.0.1:8888)")
simple_client.C2S_Secret = "----"
simple_client.S2S_Secret = "----"
}
开发者ID:rzh,项目名称:hammer.go,代码行数:13,代码来源:hammer.go
示例20: parse_args
func parse_args() (int64, int64, int64, *base_comp) {
var length int64
var level int64
var nr int64
var p string
// Process simple command line parameters:
flag.Int64Var(&length, "l", 10000, "Length of the generated random sequence.")
flag.Int64Var(&level, "e", 10, "Expression level.")
flag.Int64Var(&nr, "n", 1000, "Number of transcripts.")
flag.StringVar(&p, "p", "A:1.0, T:1.0, G:1.0, C:1.0", "Base composition.")
flag.Parse()
bc := parse_base_comp(p)
return length, level, nr, bc
}
开发者ID:sbotond,项目名称:rlsim,代码行数:15,代码来源:gen_ref.go
注:本文中的flag.Int64Var函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论