-
Notifications
You must be signed in to change notification settings - Fork 29
/
main.go
50 lines (41 loc) · 1.04 KB
/
main.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
package main
import (
"flag"
"log"
"os"
_ "net/http/pprof"
"github.com/tuna/freedns-go/freedns"
)
func main() {
/*
go func() {
log.Println(http.ListenAndServe("localhost:6060", nil))
}()
*/
var (
fastUpstream string
cleanUpstream string
listen string
logLevel string
// cache bool
)
flag.StringVar(&fastUpstream, "f", "114.114.114.114:53", "The fast/local DNS upstream, ip:port or resolv.conf file")
flag.StringVar(&cleanUpstream, "c", "8.8.8.8:53", "The clean/remote DNS upstream., ip:port or resolv.conf file")
flag.StringVar(&listen, "l", "0.0.0.0:53", "Listening address.")
// flag.BoolVar(&cache, "cache", true, "Enable cache.")
flag.StringVar(&logLevel, "log-level", "", "Set log level: info/warn/error.")
flag.Parse()
s, err := freedns.NewServer(freedns.Config{
FastUpstream: fastUpstream,
CleanUpstream: cleanUpstream,
Listen: listen,
CacheCap: 1024 * 10,
LogLevel: logLevel,
})
if err != nil {
log.Fatalln(err)
os.Exit(-1)
}
log.Fatalln(s.Run())
os.Exit(-1)
}