zoneparsing improvment and log newline
This commit is contained in:
parent
0da61804f7
commit
1771ca2a53
10
coolDns.go
10
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
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user