HEDNS: Adopt diff2 in compatibility mode
@@ -205,10 +205,14 @@ func (c *hednsProvider) GetDomainCorrections(dc *models.DomainConfig) ([]*models
txtutil.SplitSingleLongTxt(dc.Records) // Autosplit long TXT records
var corrections []*models.Correction
- if !diff2.EnableDiff2 || true { // Remove "|| true" when diff2 version arrives
-
+ var toCreate, toDelete, toModify diff.Changeset
+ if !diff2.EnableDiff2 {
differ := diff.New(dc)
- _, toCreate, toDelete, toModify, err := differ.IncrementalDiff(prunedRecords)
+ _, toCreate, toDelete, toModify, err = differ.IncrementalDiff(prunedRecords)
+ } else {
+ differ := diff.NewCompat(dc)
+ _, toCreate, toDelete, toModify, err = differ.IncrementalDiff(prunedRecords)
+ }
if err != nil {
return nil, err
}
@@ -248,11 +252,6 @@ func (c *hednsProvider) GetDomainCorrections(dc *models.DomainConfig) ([]*models
})
}
- return corrections, err
- }
-
- // Insert Future diff2 version here.
-
return corrections, nil
}
