Skip to content

Commit b78024c

Browse files
committed
Update go modules and dnscontrol to v4.29.0
1 parent 43542b7 commit b78024c

30 files changed

Lines changed: 1242 additions & 582 deletions

go.mod

Lines changed: 149 additions & 94 deletions
Large diffs are not rendered by default.

go.sum

Lines changed: 485 additions & 463 deletions
Large diffs are not rendered by default.

internal/adapters/dnscontrol-correction.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,20 +61,20 @@ func DNSControlCorrectionKindFromMessage(msg string) (kind happydns.CorrectionKi
6161
return
6262
}
6363

64-
func DNSControlDiffByRecord(oldrrs []happydns.Record, newrrs []happydns.Record, origin string) ([]*happydns.Correction, error) {
64+
func DNSControlDiffByRecord(oldrrs []happydns.Record, newrrs []happydns.Record, origin string) ([]*happydns.Correction, int, error) {
6565
oldrecords, err := DNSControlRRtoRC(oldrrs, origin)
6666
if err != nil {
67-
return nil, err
67+
return nil, 0, err
6868
}
6969

7070
newdc, err := NewDNSControlDomainConfig(origin, newrrs)
7171
if err != nil {
72-
return nil, err
72+
return nil, 0, err
7373
}
7474

75-
corrections, err := diff2.ByRecord(oldrecords, newdc, nil)
75+
corrections, nbCorrections, err := diff2.ByRecord(oldrecords, newdc, nil)
7676
if err != nil {
77-
return nil, err
77+
return nil, nbCorrections, err
7878
}
7979

8080
ret := make([]*happydns.Correction, len(corrections))
@@ -85,7 +85,7 @@ func DNSControlDiffByRecord(oldrrs []happydns.Record, newrrs []happydns.Record,
8585
}
8686
}
8787

88-
return ret, nil
88+
return ret, nbCorrections, nil
8989
}
9090

9191
func DNSControlRRtoRC(rrs []happydns.Record, origin string) (dnscontrol.Records, error) {

internal/adapters/dnscontrol-providers.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import (
2828
"strings"
2929

3030
"github.com/StackExchange/dnscontrol/v4/models"
31-
dnscontrol "github.com/StackExchange/dnscontrol/v4/providers"
31+
dnscontrol "github.com/StackExchange/dnscontrol/v4/pkg/providers"
3232
"github.com/miekg/dns"
3333

3434
"git.happydns.org/happyDomain/model"
@@ -147,7 +147,7 @@ func (p *DNSControlAdapterNSProvider) GetZoneRecords(domain string) (ret []happy
147147
return
148148
}
149149

150-
func (p *DNSControlAdapterNSProvider) GetZoneCorrections(domain string, rrs []happydns.Record) (ret []*happydns.Correction, err error) {
150+
func (p *DNSControlAdapterNSProvider) GetZoneCorrections(domain string, rrs []happydns.Record) (ret []*happydns.Correction, nbCorrections int, err error) {
151151
var dc *models.DomainConfig
152152
dc, err = NewDNSControlDomainConfig(strings.TrimSuffix(domain, "."), rrs)
153153
if err != nil {
@@ -170,14 +170,14 @@ func (p *DNSControlAdapterNSProvider) GetZoneCorrections(domain string, rrs []ha
170170
var records models.Records
171171
records, err = p.DNSServiceProvider.GetZoneRecords(strings.TrimSuffix(domain, "."), nil)
172172
if err != nil {
173-
return nil, err
173+
return nil, nbCorrections, err
174174
}
175175

176176
// Compute needed corrections
177177
var corrections []*models.Correction
178-
corrections, err = p.DNSServiceProvider.GetZoneRecordsCorrections(dc, records)
178+
corrections, nbCorrections, err = p.DNSServiceProvider.GetZoneRecordsCorrections(dc, records)
179179
if err != nil {
180-
return nil, err
180+
return nil, nbCorrections, err
181181
}
182182

183183
ret = make([]*happydns.Correction, len(corrections))
@@ -192,7 +192,7 @@ func (p *DNSControlAdapterNSProvider) GetZoneCorrections(domain string, rrs []ha
192192
}
193193
}
194194

195-
return ret, nil
195+
return ret, nbCorrections, nil
196196
}
197197

198198
func (p *DNSControlAdapterNSProvider) CreateDomain(fqdn string) error {
@@ -201,7 +201,7 @@ func (p *DNSControlAdapterNSProvider) CreateDomain(fqdn string) error {
201201
return fmt.Errorf("Provider doesn't support domain creation.")
202202
}
203203

204-
return zc.EnsureZoneExists(strings.TrimSuffix(fqdn, "."))
204+
return zc.EnsureZoneExists(strings.TrimSuffix(fqdn, "."), nil)
205205
}
206206

207207
func (p *DNSControlAdapterNSProvider) ListZones() ([]string, error) {

internal/api/controller/zone.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ func (zc *ZoneController) DiffZones(c *gin.Context) {
104104
var corrections []*happydns.Correction
105105
if c.Param("oldzoneid") == "@" {
106106
var err error
107-
corrections, err = zc.zoneCorrectionService.List(user, domain, newzone)
107+
corrections, _, err = zc.zoneCorrectionService.List(user, domain, newzone)
108108
if err != nil {
109109
middleware.ErrorResponse(c, http.StatusInternalServerError, err)
110110
return

internal/usecase/orchestrator/factory.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ type ZoneRetriever interface {
4444

4545
// ZoneCorrector is an interface for getting zone corrections.
4646
type ZoneCorrector interface {
47-
ListZoneCorrections(provider *happydns.Provider, domain *happydns.Domain, records []happydns.Record) ([]*happydns.Correction, error)
47+
ListZoneCorrections(provider *happydns.Provider, domain *happydns.Domain, records []happydns.Record) ([]*happydns.Correction, int, error)
4848
}
4949

5050
type Orchestrator struct {

internal/usecase/orchestrator/zone_correction_applier.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ func (uc *ZoneCorrectionApplierUsecase) Apply(user *happydns.User, domain *happy
7676
}
7777

7878
nbcorrections := len(form.WantedCorrections)
79-
corrections, err := uc.zoneCorrector.ListZoneCorrections(provider, domain, records)
79+
corrections, _, err := uc.zoneCorrector.ListZoneCorrections(provider, domain, records)
8080
if err != nil {
8181
return nil, happydns.InternalError{
8282
Err: fmt.Errorf("unable to compute domain corrections: %w", err),
@@ -158,15 +158,15 @@ corrections:
158158
return newZone, nil
159159
}
160160

161-
func (uc *ZoneCorrectionApplierUsecase) List(user *happydns.User, domain *happydns.Domain, zone *happydns.Zone) ([]*happydns.Correction, error) {
161+
func (uc *ZoneCorrectionApplierUsecase) List(user *happydns.User, domain *happydns.Domain, zone *happydns.Zone) ([]*happydns.Correction, int, error) {
162162
provider, err := uc.providerService.GetUserProvider(user, domain.ProviderId)
163163
if err != nil {
164-
return nil, err
164+
return nil, 0, err
165165
}
166166

167167
records, err := uc.listRecords.List(domain, zone)
168168
if err != nil {
169-
return nil, err
169+
return nil, 0, err
170170
}
171171

172172
return uc.zoneCorrector.ListZoneCorrections(provider, domain, records)

internal/usecase/provider/zone_operations.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ func (s *Service) RetrieveZone(provider *happydns.Provider, name string) ([]happ
3838
}
3939

4040
// ListZoneCorrections lists the corrections needed to synchronize the zone with the given records.
41-
func (s *Service) ListZoneCorrections(provider *happydns.Provider, domain *happydns.Domain, records []happydns.Record) ([]*happydns.Correction, error) {
41+
func (s *Service) ListZoneCorrections(provider *happydns.Provider, domain *happydns.Domain, records []happydns.Record) ([]*happydns.Correction, int, error) {
4242
instance, err := provider.InstantiateProvider()
4343
if err != nil {
44-
return nil, fmt.Errorf("unable to instantiate provider: %w", err)
44+
return nil, 0, fmt.Errorf("unable to instantiate provider: %w", err)
4545
}
4646

4747
return instance.GetZoneCorrections(domain.DomainName, records)

internal/usecase/zone/zone_differ.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ func (uc *ZoneDifferUsecase) Diff(domain *happydns.Domain, newzone *happydns.Zon
5858
return nil, err
5959
}
6060

61-
corrections, err := adapter.DNSControlDiffByRecord(oldrecords, newrecords, domain.DomainName)
61+
corrections, _, err := adapter.DNSControlDiffByRecord(oldrecords, newrecords, domain.DomainName)
6262
if err != nil {
6363
return nil, err
6464
}

model/orchestrator.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ type RemoteZoneImporterUsecase interface {
2929

3030
type ZoneCorrectionApplierUsecase interface {
3131
Apply(*User, *Domain, *Zone, *ApplyZoneForm) (*Zone, error)
32-
List(*User, *Domain, *Zone) ([]*Correction, error)
32+
List(*User, *Domain, *Zone) ([]*Correction, int, error)
3333
}
3434

3535
type ZoneImporterUsecase interface {

0 commit comments

Comments
 (0)