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.
gdns/server.go

35 lines
519 B
Go

8 years ago
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
8 years ago
8 years ago
flag.StringVar(&configFile, "c", "", "config file")
flag.Parse()
8 years ago
8 years ago
config, err := parseCfg(configFile)
if err != nil {
log.Println(err)
os.Exit(-1)
}
initRouters(config)
initListeners(config)
8 years ago
8 years ago
select {}
}