Update implemented.

This commit is contained in:
angeloxx 2024-02-26 22:27:13 +01:00
parent bab7a84f11
commit 2f7f6390d0

View File

@ -262,12 +262,6 @@ func (r rfc2136Provider) RemoveReverseRecord(ip string, hostname string) error {
return r.ApplyChanges(context.Background(), &plan.Changes{Delete: changes}) return r.ApplyChanges(context.Background(), &plan.Changes{Delete: changes})
} }
// @TODO: Implement UpdateReverseRecord
func (r rfc2136Provider) UpdateReverseRecord(ip string, hostname string) error {
changes := r.GenerateReverseRecord(ip, hostname)
return r.ApplyChanges(context.Background(), &plan.Changes{UpdateNew: changes})
}
func (r rfc2136Provider) GenerateReverseRecord(ip string, hostname string) []*endpoint.Endpoint { func (r rfc2136Provider) GenerateReverseRecord(ip string, hostname string) []*endpoint.Endpoint {
// Find the zone for the PTR record // Find the zone for the PTR record
// zone := findMsgZone(&endpoint.Endpoint{DNSName: ip}, p.ptrZoneNames) // zone := findMsgZone(&endpoint.Endpoint{DNSName: ip}, p.ptrZoneNames)
@ -352,6 +346,10 @@ func (r rfc2136Provider) ApplyChanges(ctx context.Context, changes *plan.Changes
m[zone].SetUpdate(zone) m[zone].SetUpdate(zone)
r.UpdateRecord(m[zone], changes.UpdateOld[i], ep) r.UpdateRecord(m[zone], changes.UpdateOld[i], ep)
if r.createPTR && (ep.RecordType == "A" || ep.RecordType == "AAAA") {
r.RemoveReverseRecord(changes.UpdateOld[i].Targets[0], ep.DNSName)
r.AddReverseRecord(ep.Targets[0], ep.DNSName)
}
} }
// only send if there are records available // only send if there are records available