jasonwalsh / gozone

Basic DNS Zone-File parsing (in go)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Simple DNS ZoneFile parser

Parse a DNS ZoneFile (as specified in https://www.ietf.org/rfc/rfc1035.txt) into a series of more-easily-processed "Record" structures.

The list of RecordTypes, their values, and meanings, was taken from https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml, which in turn references RFCs:

Example:

stream, _ := os.Open(zonefile)
var record gozone.Record
scanner := gozone.NewScanner(h)

for {
	err := scanner.Next(&record)
	if err != nil {
		break
	}

	fmt.Printf("a '%s' Record for domain/subdomain '%s'",
		record.Type,
		record.DomainName,
	)
}

About

Basic DNS Zone-File parsing (in go)

License:MIT License


Languages

Language:Go 100.0%