diff --git a/coolDns.go b/coolDns.go index 67113dc..657d6e7 100644 --- a/coolDns.go +++ b/coolDns.go @@ -77,7 +77,7 @@ func loadConfig(configPath string) (*config, error) { func loadZones(configZones []configZone) (zoneMap, error) { zones := make(zoneMap) for _, z := range configZones { - rrs, err := loadZonefile(z.File) + rrs, err := loadZonefile(z.File, z.Zone) if err != nil { return nil, err } @@ -111,14 +111,14 @@ func createRRMap(rrs []dns.RR) rrMap { return rrMap } -func loadZonefile(filepath string) ([]dns.RR, error) { +func loadZonefile(filepath, origin string) ([]dns.RR, error) { file, err := os.Open(filepath) if err != nil { return nil, err } - parser := dns.NewZoneParser(file, "", "") + parser := dns.NewZoneParser(file, origin, filepath) var rrs = make([]dns.RR, 0) @@ -160,7 +160,7 @@ func createServer(zones zoneMap, config config, aclList map[string]*net.IPNet) * remoteIP, _, err := net.SplitHostPort(w.RemoteAddr().String()) ip := net.ParseIP(remoteIP) if err != nil && ip != nil { - log.Printf("Faild to parse remote IP WTF? :%s", err.Error()) + log.Printf("Faild to parse remote IP WTF? :%s\n", err.Error()) return } @@ -188,7 +188,7 @@ func createServer(zones zoneMap, config config, aclList map[string]*net.IPNet) * ip := net.ParseIP(remoteIP) if err != nil && ip != nil { - log.Printf("Faild to parse remote IP WTF? :%s", err.Error()) + log.Printf("Faild to parse remote IP WTF? :%s\n", err.Error()) return }