-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdnsmonitor.go
59 lines (45 loc) · 1.03 KB
/
dnsmonitor.go
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package main
//go:generate esc -o static.go -ignore .DS_Store -prefix static templates static
import (
"flag"
"fmt"
"log"
"os"
"time"
)
// VERSION is the application version number
var VERSION = "2.1.0"
var buildTime string
var gitVersion string
var (
configFile = flag.String("config", "dnsmonitor.conf", "Configuration file")
showVersionFlag = flag.Bool("version", false, "Show dnsconfig version")
verbose = flag.Bool("verbose", false, "verbose output")
devel = flag.Bool("devel", false, "Use development assets")
)
func init() {
if len(gitVersion) > 0 {
VERSION = VERSION + "/" + gitVersion
}
log.SetPrefix("geodns ")
log.SetFlags(log.Lmicroseconds | log.Lshortfile)
}
func main() {
flag.Parse()
if *showVersionFlag {
fmt.Println("dnsmonitor", VERSION, buildTime)
os.Exit(0)
}
loadBundle()
hub := NewHub()
go startHTTP(2090, hub)
go func() {
for {
log.Println("running configuration...")
configure(hub)
time.Sleep(20 * time.Second)
}
}()
quit := make(chan bool)
<-quit
}