Exemplo n.º 1
1
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()
}
Exemplo n.º 2
0
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)
		}
	}
}
Exemplo n.º 3
0
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())

}
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")
}
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)
	}
}
Exemplo n.º 6
0
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:
		}
	}
}
Exemplo n.º 7
0
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())
}
Exemplo n.º 8
0
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
}
Exemplo n.º 9
0
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")
}
Exemplo n.º 10
0
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")
}
Exemplo n.º 11
0
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()
}
Exemplo n.º 12
0
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()
}
Exemplo n.º 13
0
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()
}
Exemplo n.º 14
0
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)
}
Exemplo n.º 15
0
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")
}
Exemplo n.º 16
0
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)")
}
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]")
}
Exemplo n.º 18
0
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()
}
Exemplo n.º 19
0
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 = "----"
}
Exemplo n.º 20
0
func init() {
	flag.Int64Var(&count, "count", 10000, "files to generate")
	flag.Int64Var(&bulkSize, "bulk", 10000, "bulk size")
	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.BoolVar(&generate, "generate", false, "generate data")
	flag.BoolVar(&collect, "collect", true, "collect old files")
	flag.BoolVar(&onlyOpen, "only-open", false, "only open db")
	flag.BoolVar(&onlyMemory, "only-memory", false, "only load to memory")
	flag.BoolVar(&onlyMemory, "only-array", false, "only array of hashes")
	flag.StringVar(&dbpath, "dbfile", "db.bolt", "working directory")
	flag.IntVar(&cpus, "cpus", runtime.GOMAXPROCS(0), "cpu to use")
}
Exemplo n.º 21
0
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
}
Exemplo n.º 22
0
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|gree(c|s)2s|none)")
	flag.StringVar(&auth_key, "key", "", "Set authorization key")
	flag.IntVar(&sessionAmount, "size", 100, "session amount")
	flag.StringVar(&sessionUrlPrefix, "url", "", "Session url prefix")
	flag.StringVar(&proxy, "proxy", "none", "Set HTTP proxy (need to specify scheme. e.g. http://127.0.0.1:8888)")
	flag.IntVar(&logIntv, "intv", 6, "Log interval in chart")
	flag.StringVar(&logType, "ltype", "default", "Log type (file|db)")

}
Exemplo n.º 23
0
func init() {
	log.SetFlags(log.Lshortfile | log.LstdFlags)
	flag.IntVar(&_Count, "n", 1, "连接数的大小,最大不能超过64511")
	flag.StringVar(&_Host, "h", "ws://127.0.0.1:1234/ws", "指定远端服务器WebSocket地址")
	flag.StringVar(&_LocalHost, "l", "127.0.0.1,192.168.2.10", "指定本地地址,逗号分隔多个")
	flag.IntVar(&_ConnPerSec, "cps", 0, "限制每秒创建连接,0为无限制")
	flag.DurationVar(&_SendInterval, "i", 30*time.Second, "设置发送的间隔(如:1s, 10us)")
	//flag.Int64Var(&_StartId, "s", 1, "设置id的初始值自动增加1")
	flag.Int64Var(&_StartId, "id", 1, "第一个客户端的id,多个客户端时自动累加")
	//flag.StringVar(&_ToId, "to_id", "", "发送到id,逗号\",\"符连接, 如: 2,3")
	flag.Int64Var(&_SpecifyTo, "to_sid", 0, "发往客户端的指定id,0或to_id中的一项")
	flag.StringVar(&_StatPort, "sh", ":30001", "设置服务器统计日志端口")
	//flag.StringVar(&_SN, "sn", "client1", "设置客户端sn")
	flag.Int64Var(&_SentCount, "sc", -1, "Sent msg count per client")
}
Exemplo n.º 24
0
func init() {
	flag.StringVar(&from_catrel_flag, "from-catrel", "unstable",
		"Actually, only unstable makes sense here.")
	flag.StringVar(&to_catrel_flag, "to-catrel", "bratislava",
		"The testing release.")
	flag.StringVar(&htmlReportDir, "html-report-path",
		"/home/maciej/public_html",
		"Full path to the file where the HTML report will be "+
			"written. If the file already exists, it will be "+
			"overwritten. ")
	flag.StringVar(&htmlReportTemplate, "html-report-template",
		"src/promote-packages/report-template.html",
		"HTML template used to generate the report.")
	flag.StringVar(&packageTimesFilename, "package-times-json-file",
		"/home/maciej/.checkpkg/package-times.json",
		"JSON file with package times state. This file is used "+
			"for persistence: it remembers when each of the packages "+
			"was last modified in the unstable catalog.")
	flag.Int64Var(&daysOldRequired, "required-age-in-days", 14,
		"Packages must be this number of days old before they can "+
			"be integrated.")
	flag.StringVar(&logFile, "log-file",
		"-",
		"The log file contains rollback information.")
}
Exemplo n.º 25
0
func handleStart() error {
	id := stripArgument()
	if id == "" {
		return errors.New("No task id supplied to start")
	}

	var api string
	var timeout int64

	flag.StringVar(&api, "api", "", "API host:port for advertizing.")
	flag.Int64Var(&timeout, "timeout", 30, "Timeout in seconds to wait until the task receives Running status.")

	ParseFlags("start")

	if err := resolveApi(api); err != nil {
		return err
	}

	request := framework.NewApiRequest(framework.Config.Api + "/api/start")
	request.PutString("id", id)
	request.PutInt("timeout", timeout)

	response := request.Get()
	fmt.Println(response.Message)

	return nil
}
Exemplo n.º 26
0
func parseFlags() {
	flag.StringVar(&flagHTTP, "http", flagHTTP, "HTTP")
	flag.Int64Var(&flagMemory, "memory", flagMemory, "Memory")
	flag.StringVar(&flagRedis, "redis", flagRedis, "Redis")
	flag.StringVar(&flagMemcache, "memcache", flagMemcache, "Memcache")
	flag.Parse()
}
Exemplo n.º 27
0
func init() {
	flag.StringVar(&hostname, "hostname", "localhost:9092", "host:port string for the kafka server")
	flag.StringVar(&topic, "topic", "test", "topic to read offsets from")
	flag.IntVar(&partition, "partition", 0, "partition to read offsets from")
	flag.UintVar(&offsets, "offsets", 1, "number of offsets returned")
	flag.Int64Var(&time, "time", -1, "timestamp of the offsets before that:  time(ms)/-1(latest)/-2(earliest)")
}
Exemplo n.º 28
0
func init() {
	flag.StringVar(&address, "address", defaultAddress, addressUsage)
	flag.StringVar(&etcdUrls, "etcd-urls", "", etcdUrlsUsage)
	flag.BoolVar(&insecure, "insecure", false, insecureUsage)
	flag.BoolVar(&proxyPreserveHost, "proxy-preserve-host", false, proxyPreserveHostUsage)
	flag.StringVar(&etcdPrefix, "etcd-prefix", defaultEtcdPrefix, etcdPrefixUsage)
	flag.StringVar(&innkeeperUrl, "innkeeper-url", "", innkeeperUrlUsage)
	flag.Int64Var(&sourcePollTimeout, "source-poll-timeout", defaultSourcePollTimeout, sourcePollTimeoutUsage)
	flag.StringVar(&routesFile, "routes-file", "", routesFileUsage)
	flag.StringVar(&oauthUrl, "oauth-url", "", oauthUrlUsage)
	flag.StringVar(&oauthScope, "oauth-scope", "", oauthScopeUsage)
	flag.StringVar(&oauthCredentialsDir, "oauth-credentials-dir", "", oauthCredentialsDirUsage)
	flag.StringVar(&innkeeperAuthToken, "innkeeper-auth-token", "", innkeeperAuthTokenUsage)
	flag.StringVar(&innkeeperPreRouteFilters, "innkeeper-pre-route-filters", "", innkeeperPreRouteFiltersUsage)
	flag.StringVar(&innkeeperPostRouteFilters, "innkeeper-post-route-filters", "", innkeeperPostRouteFiltersUsage)
	flag.BoolVar(&devMode, "dev-mode", false, devModeUsage)
	flag.StringVar(&metricsListener, "metrics-listener", defaultMetricsListener, metricsListenerUsage)
	flag.StringVar(&metricsPrefix, "metrics-prefix", defaultMetricsPrefix, metricsPrefixUsage)
	flag.BoolVar(&debugGcMetrics, "debug-gc-metrics", false, debugGcMetricsUsage)
	flag.BoolVar(&runtimeMetrics, "runtime-metrics", defaultRuntimeMetrics, runtimeMetricsUsage)
	flag.StringVar(&applicationLog, "application-log", "", applicationLogUsage)
	flag.StringVar(&applicationLogPrefix, "application-log-prefix", defaultApplicationLogPrefix, applicationLogPrefixUsage)
	flag.StringVar(&accessLog, "access-log", "", accessLogUsage)
	flag.BoolVar(&accessLogDisabled, "access-log-disabled", false, accessLogDisabledUsage)
	flag.Parse()
}
Exemplo n.º 29
0
func main() {
	svc := dynamodb.New(session.New(&aws.Config{Region: aws.String("us-east-1")}))
	jar := &CookieManager{}
	var cookieCount int
	var sleepTime int64
	flag.IntVar(&cookieCount, "count", 10, "collect this many cookies")
	flag.Int64Var(&sleepTime, "sleep", 2, "sleep this many between executions")
	flag.Parse()
	for i := 0; i <= cookieCount; i++ {
		jar.jar = make(map[string][]*http.Cookie)
		if resp, err := GetCookie(jar); err == nil {
			t, _ := time.Parse(timeLongForm, resp.Header["Date"][0])
			time_string := strconv.FormatInt(t.Unix(), 10)
			body := resp.Body
			params := ProcessCookies(&InputItem{*jar, time_string, table_name, ScrapePage(&body)})
			svc.PutItem(params)
		} else {
			fmt.Println("Failed to get a response body.  Will retry after timeout.")
		}
		if i%5 == 0 && i != 0 {
			fmt.Printf("Got %d cookies.\n", i)
		}
		time.Sleep(time.Duration(sleepTime) * time.Second) // lets hold firm 2s for niceness
	}
}
Exemplo n.º 30
0
// Command line options parsing --------------------------------------------------
func ReadFlags(config *goDB.GeneralConf) error {
	flag.StringVar(&config.Iface, "i", "", "Interface for which the query should be performed (e.g. eth0, t4_33760, ...)")
	flag.StringVar(&config.Conditions, "c", "", "Logical conditions for the query")
	flag.StringVar(&config.BaseDir, "d", "/usr/local/goProbe/data/db", "Path to database directory. By default, /usr/local/goProbe/data/db is used")
	flag.BoolVar(&config.ListDB, "list", false, "lists on which interfaces data was captured and written to the DB")
	flag.StringVar(&config.Format, "e", "txt", "Output format: {txt|json|csv}")
	flag.BoolVar(&config.Help, "h", false, "Prints the help page")
	flag.BoolVar(&config.HelpAdmin, "help-admin", false, "Prints the advanced help page")
	flag.BoolVar(&config.WipeAdmin, "wipe", false, "wipes the entire database")
	flag.Int64Var(&config.CleanAdmin, "clean", 0, "cleans all entries before indicated timestamp")
	flag.BoolVar(&config.External, "x", false, "Mode for external calls, e.g. from portal")
	flag.BoolVar(&config.Sort, "p", false, "Sort results by accumulated packets instead of bytes")
	flag.BoolVar(&config.SortAscending, "a", false, "Sort results in ascending order")
	flag.BoolVar(&config.Incoming, "in", false, "Take into account incoming data only (received packets/bytes)")
	flag.BoolVar(&config.Outgoing, "out", false, "Take into account outgoing data only (sent packets/bytes)")
	flag.IntVar(&config.NumResults, "n", 10000, "Maximum number of final entries to show. Defaults to 95% of the overall data volume / number of packets (depending on the '-p' parameter)")
	flag.StringVar(&config.First, "f", "0", "Lower bound on flow timestamp")
	flag.StringVar(&config.Last, "l", "9999999999999999", "Upper bound on flow timestamp")
	flag.Parse()

	if flag.NArg() > 1 {
		return errors.New("Query type must be the last argument of the call")
	}

	config.QueryType = (flag.Arg(0))

	return nil
}