aboutsummaryrefslogtreecommitdiff
path: root/lib/dns
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2023-08-06 17:29:04 +0700
committerShulhan <ms@kilabit.info>2023-08-06 17:35:24 +0700
commita20aaf1f220821574ea41de52d5aa61fa598cd43 (patch)
tree9e2dcda5fb8fac083808e2911335a42d13757e5c /lib/dns
parentb10788dc819858b152c814cd4ab065e00bca0089 (diff)
downloadpakakeh.go-a20aaf1f220821574ea41de52d5aa61fa598cd43.tar.xz
lib/dns: changes the return key on LoadZoneDir
Previously, the LoadZoneDir return the key as file name of zone. This changes return the key as Zone Origin to prevent same zones defined in different files.
Diffstat (limited to 'lib/dns')
-rw-r--r--lib/dns/zone.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/dns/zone.go b/lib/dns/zone.go
index deed4e70..052bc132 100644
--- a/lib/dns/zone.go
+++ b/lib/dns/zone.go
@@ -48,7 +48,7 @@ func NewZone(file, origin string) (zone *Zone) {
// LoadZoneDir load DNS record from zone formatted files in
// directory "dir".
-// On success, it will return map of file name and Zone content as list
+// On success, it will return map of zone Origin and its content as list
// of Message.
// On fail, it will return possible partially parse zone file and an error.
func LoadZoneDir(dir string) (zoneFiles map[string]*Zone, err error) {
@@ -99,7 +99,7 @@ func LoadZoneDir(dir string) (zoneFiles map[string]*Zone, err error) {
return zoneFiles, fmt.Errorf("LoadZoneDir %q: %w", dir, err)
}
- zoneFiles[name] = zone
+ zoneFiles[zone.Origin] = zone
}
err = d.Close()