No description
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-06-03 00:11:06 +09:00
TestData feat: Added support for comments in records 2026-06-03 00:11:06 +09:00
.gitignore Initial commit 2026-06-02 23:01:51 +09:00
go.mod Initial commit 2026-06-02 23:01:51 +09:00
LICENSE.txt Initial commit 2026-06-02 23:01:51 +09:00
README.md Initial commit 2026-06-02 23:01:51 +09:00
scanning.go feat: Added support for comments in records 2026-06-03 00:11:06 +09:00
scanning_test.go fix: Deps and cleanup 2026-06-02 23:15:59 +09:00
util.go Initial commit 2026-06-02 23:01:51 +09:00
util_test.go Initial commit 2026-06-02 23:01:51 +09:00
zone.template feat: Added support for comments in records 2026-06-03 00:11:06 +09:00
zonefile.go feat: Added support for comments in records 2026-06-03 00:11:06 +09:00
zonefile_test.go fix: Deps and cleanup 2026-06-02 23:15:59 +09:00
zoneparse.go feat: Added support for comments in records 2026-06-03 00:11:06 +09:00
zoneparse_test.go fix: Deps and cleanup 2026-06-02 23:15:59 +09:00

Zone Parser

Zone Parser is a simple to use Go library that can parse bind like DNS-Zones.

Reading existing zone files

func main() {
	zoneFile, _ := ioutil.ReadFile("myzonefile")
	zone := ParseZone(string(zoneFile))
}

Writing a Zone to a file

Note that ToZoneFile will not preserve the format of zones that where parsed by ParseZone.

func main() {
	zoneFile, _ := ioutil.ReadFile("myzonefile")
	zone := ParseZone(string(zoneFile))
	zoneFile = zone.ToZoneFile() // Returns zone as string
}

Updating the serial

Zone Parser can update the serial of your zone. There are two differend methods of serial updating available. You can use Zone.UpdateSerial for updating the serial with the current UTC UNIX timestamp or Zone.UpdateSerialRFC to update your zone with the RFC compliant serial representation.

func updateSerial(z *Zone) {
		z.UpdateSerial() // z.SOA.Serial -> UNIX timestamp
		z.UpdateSerialRFC() // z.SOA.Serial -> RFC compliant representation (yyyymmdd00)
}