I'm need to deploy an authoritative name server using and I've found miekg/dns
package to almost fit the bill but I can't find how to store/persist records (i.e. on disk ). Currently it seems to store everything in a map but I guess it's all gone when the server is shut down. Is there anything I'm missing or an easy way to plugin a persistent storage engine ?
Easiest solution, IMO, is Redis, which has a few libs available. Even if this isn't your long term solution, it works well for prototyping. From there you just need to serialize/deserialize your data into/from a string
/[]byte
and write a simple caching layer that loads a saved state and pushes changes when they happen.
miekg/dns is a library, not a fully functional DNS-server. It has built in support of RFC 1035 zone files (originally used by bind): zscan.go to parse zone file and zgenerate.go to generate zone string.
If you're looking for a complete DNS-server based on this library check Users section in README or take a look to discodns server based on the library that reads zones from etcd.