Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Craig Peterson committed Jul 24, 2018
1 parent 4d4b2b1 commit 66e5a75
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
2 changes: 1 addition & 1 deletion providers/dns/dns_providers.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func NewDNSChallengeProviderByName(name string) (acme.ChallengeProvider, error)
case "manual":
return acme.NewDNSProviderManual()
case "multi":
return multi.New()
return multi.NewDNSProvider()
case "namecheap":
return namecheap.NewDNSProvider()
case "namedotcom":
Expand Down
27 changes: 16 additions & 11 deletions providers/dns/multi/multi.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,22 @@ type DNSProvider struct {
providers map[string]acme.ChallengeProvider
}

// NewDNSProvider creates a new multiple-provider meta-provider. It will look for a json configuration in "MULTI_CONFIG", or on disk from "MULTI_CONFIG_FILE"
func NewDNSProvider() (*DNSProvider, error) {
config, err := getConfig()
if err != nil {
return nil, err
}
return &DNSProvider{
providers: map[string]acme.ChallengeProvider{},
config: config,
}, nil
}

// AggregateProvider is simply a list of dns providers. All Challenges are filled by all members of the aggregate.
type AggregateProvider []acme.ChallengeProvider

// Present creates the txt record in all child dns providers
func (a AggregateProvider) Present(domain, token, keyAuth string) error {
for _, p := range a {
if err := p.Present(domain, token, keyAuth); err != nil {
Expand All @@ -67,6 +80,8 @@ func (a AggregateProvider) Present(domain, token, keyAuth string) error {
}
return nil
}

// CleanUp removes the txt record from all dns providers
func (a AggregateProvider) CleanUp(domain, token, keyAuth string) error {
for _, p := range a {
if err := p.CleanUp(domain, token, keyAuth); err != nil {
Expand All @@ -83,6 +98,7 @@ type AggregateProviderTimeout struct {
AggregateProvider
}

// Timeout gives the largest timeout values from any child provider that supports timeouts.
func (a AggregateProviderTimeout) Timeout() (timeout, interval time.Duration) {
for _, p := range a.AggregateProvider {
if to, ok := p.(acme.ChallengeProviderTimeout); ok {
Expand Down Expand Up @@ -171,17 +187,6 @@ func (d *DNSProvider) buildProvider(name string, params map[string]string) (acme
return prv, nil
}

func New() (*DNSProvider, error) {
config, err := getConfig()
if err != nil {
return nil, err
}
return &DNSProvider{
providers: map[string]acme.ChallengeProvider{},
config: config,
}, nil
}

func (d *DNSProvider) Present(domain, token, keyAuth string) error {
provider, err := d.getProviderForDomain(domain)
if err != nil {
Expand Down

0 comments on commit 66e5a75

Please sign in to comment.