-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
36 lines (32 loc) · 779 Bytes
/
main.go
File metadata and controls
36 lines (32 loc) · 779 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package main
import (
"flag"
"log"
"strings"
)
type config struct {
debug bool
hosts []string
listen string
}
var c config
// Read our command line args and fire of the workers
func main() {
var hosts string
flag.BoolVar(&c.debug, "debug", false, "enable debug mode")
flag.StringVar(&hosts, "hosts", "", "comma separated list of hosts to connect to")
flag.StringVar(&c.listen, "listen", "localhost:8888", "address:port to listen on")
flag.Parse()
if hosts == "" {
log.Fatal("Hosts list must not be empty. Use -h for help.")
}
c.hosts = strings.Split(hosts, ",")
if len(c.hosts) == 0 {
log.Fatal("Hosts list must not be empty. Use -h for help.")
}
cchan := startCarChan()
for x := range c.hosts {
go startStream(c.hosts[x], cchan)
}
httpserver()
}