feat: implement (full) DNS server App, provider as ACMEDNSProvider

This is a rewrite of almost everything. The provided modules no longer
rely on undocumented/deprecated behavior.
It's no longer possible to have multiple DNS "servers" on different
sockets, but the new version allows serving arbitrary records. Records
can be defined in the config or Caddyfile.
The provider communicates with the Server via a channel.
This commit is contained in:
xaos 2023-03-22 16:23:11 +01:00
parent a6d39a06aa
commit 15a4840b03
5 changed files with 639 additions and 215 deletions

26
log.go
View file

@ -222,3 +222,29 @@ func log_libdns_record(record *libdns.Record) zapcore.ObjectMarshaler {
return zapcore.ObjectMarshalerFunc(f)
}
// MarshalLogObject satisfies the zapcore.ObjectMarshaler interface.
func (r request) MarshalLogObject(enc zapcore.ObjectEncoder) error {
enc.AddString("zone", r.zone)
if r.append {
enc.AddString("type", "append")
} else {
enc.AddString("type", "delete")
}
if len(r.records) > 0 {
array := func(arr zapcore.ArrayEncoder) error {
for _, r := range r.records {
object := func(obj zapcore.ObjectEncoder) error {
log_RR(obj, r)
return nil
}
arr.AppendObject(zapcore.ObjectMarshalerFunc(object))
}
return nil
}
enc.AddArray("records", zapcore.ArrayMarshalerFunc(array))
}
return nil
}