You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
519 B
Go
35 lines
519 B
Go
package main
|
|
|
|
import (
|
|
"flag"
|
|
"github.com/miekg/dns"
|
|
"log"
|
|
"os"
|
|
)
|
|
|
|
func initListeners(c *cfg) {
|
|
for _, a := range c.listen {
|
|
log.Printf("Listen on %s %s...\n", a.network, a.addr)
|
|
s := dns.Server{Addr: a.addr, Net: a.network}
|
|
go s.ListenAndServe()
|
|
}
|
|
}
|
|
|
|
func main() {
|
|
var configFile string
|
|
|
|
flag.StringVar(&configFile, "c", "", "config file")
|
|
flag.Parse()
|
|
|
|
config, err := parseCfg(configFile)
|
|
if err != nil {
|
|
log.Println(err)
|
|
os.Exit(-1)
|
|
}
|
|
|
|
initRouters(config)
|
|
initListeners(config)
|
|
|
|
select {}
|
|
}
|