diff --git a/coolDns.go b/coolDns.go index 3bfb0da..09f281e 100644 --- a/coolDns.go +++ b/coolDns.go @@ -137,8 +137,16 @@ func createServer(zones []zone, config config, aclList map[string]*net.IPNet) *d for _, z := range zones { srv.HandleFunc(z.zone, func(w dns.ResponseWriter, r *dns.Msg) { - remoteIP, _, _ := net.SplitHostPort(w.RemoteAddr().String()) + // Parse IP + remoteIP, _, err := net.SplitHostPort(w.RemoteAddr().String()) + if err != nil { + log.Printf("Faild to parse remote IP WTF? :%s", err.Error()) + return + } + ip := net.ParseIP(remoteIP) + + // Check ACL rules if len(z.acl) != 0 { passed := false for _, rule := range z.acl {