Better error handling in goroutines (#122)

* More robust goroutine error handling using channels

* Fix tests and make startup log msg saner

* Clarification to README and config file
This commit is contained in:
Joona Hoikkala
2018-10-31 00:54:51 +02:00
committed by GitHub
parent a09073da12
commit c2c5c5cd70
6 changed files with 55 additions and 19 deletions

View File

@ -10,7 +10,6 @@ import (
"strings"
"github.com/BurntSushi/toml"
"github.com/miekg/dns"
log "github.com/sirupsen/logrus"
)
@ -108,14 +107,6 @@ func setupLogging(format string, level string) {
// TODO: file logging
}
func startDNS(listen string, proto string) *dns.Server {
// DNS server part
dns.HandleFunc(".", handleRequest)
server := &dns.Server{Addr: listen, Net: proto}
go server.ListenAndServe()
return server
}
func getIPListFromHeader(header string) []string {
iplist := []string{}
for _, v := range strings.Split(header, ",") {