From c2fd4498e5051bd5adfd3e4f20e5f1733138ee90 Mon Sep 17 00:00:00 2001 From: volayvaz Date: Thu, 21 Sep 2023 14:04:52 +0000 Subject: [PATCH] otc: sequential challenge (#2023) --- cmd/zz_gen_cmd_dnshelp.go | 1 + docs/content/dns/zz_gen_otc.md | 1 + providers/dns/otc/otc.go | 9 +++++++++ providers/dns/otc/otc.toml | 1 + 4 files changed, 12 insertions(+) diff --git a/cmd/zz_gen_cmd_dnshelp.go b/cmd/zz_gen_cmd_dnshelp.go index b724a8fccb..47e3496f7b 100644 --- a/cmd/zz_gen_cmd_dnshelp.go +++ b/cmd/zz_gen_cmd_dnshelp.go @@ -2030,6 +2030,7 @@ func displayDNSHelp(w io.Writer, name string) error { ew.writeln(` - "OTC_HTTP_TIMEOUT": API request timeout`) ew.writeln(` - "OTC_POLLING_INTERVAL": Time between DNS propagation check`) ew.writeln(` - "OTC_PROPAGATION_TIMEOUT": Maximum waiting time for DNS propagation`) + ew.writeln(` - "OTC_SEQUENCE_INTERVAL": Time between sequential requests`) ew.writeln(` - "OTC_TTL": The TTL of the TXT record used for the DNS challenge`) ew.writeln() diff --git a/docs/content/dns/zz_gen_otc.md b/docs/content/dns/zz_gen_otc.md index 0a7136cb19..7d603a8797 100644 --- a/docs/content/dns/zz_gen_otc.md +++ b/docs/content/dns/zz_gen_otc.md @@ -51,6 +51,7 @@ More information [here]({{< ref "dns#configuration-and-credentials" >}}). | `OTC_HTTP_TIMEOUT` | API request timeout | | `OTC_POLLING_INTERVAL` | Time between DNS propagation check | | `OTC_PROPAGATION_TIMEOUT` | Maximum waiting time for DNS propagation | +| `OTC_SEQUENCE_INTERVAL` | Time between sequential requests | | `OTC_TTL` | The TTL of the TXT record used for the DNS challenge | The environment variable names can be suffixed by `_FILE` to reference a file instead of a value. diff --git a/providers/dns/otc/otc.go b/providers/dns/otc/otc.go index e3e0b9259a..f61f74e5ad 100644 --- a/providers/dns/otc/otc.go +++ b/providers/dns/otc/otc.go @@ -33,6 +33,7 @@ const ( EnvPropagationTimeout = envNamespace + "PROPAGATION_TIMEOUT" EnvPollingInterval = envNamespace + "POLLING_INTERVAL" EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" + EnvSequenceInterval = envNamespace + "SEQUENCE_INTERVAL" ) // Config is used to configure the creation of the DNSProvider. @@ -44,6 +45,7 @@ type Config struct { Password string PropagationTimeout time.Duration PollingInterval time.Duration + SequenceInterval time.Duration TTL int HTTPClient *http.Client } @@ -55,6 +57,7 @@ func NewDefaultConfig() *Config { PropagationTimeout: env.GetOrDefaultSecond(EnvPropagationTimeout, dns01.DefaultPropagationTimeout), PollingInterval: env.GetOrDefaultSecond(EnvPollingInterval, dns01.DefaultPollingInterval), IdentityEndpoint: env.GetOrDefaultString(EnvIdentityEndpoint, defaultIdentityEndpoint), + SequenceInterval: env.GetOrDefaultSecond(EnvSequenceInterval, dns01.DefaultPropagationTimeout), HTTPClient: &http.Client{ Timeout: env.GetOrDefaultSecond(EnvHTTPTimeout, 10*time.Second), Transport: &http.Transport{ @@ -202,3 +205,9 @@ func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error { func (d *DNSProvider) Timeout() (timeout, interval time.Duration) { return d.config.PropagationTimeout, d.config.PollingInterval } + +// Sequential All DNS challenges for this provider will be resolved sequentially. +// Returns the interval between each iteration. +func (d *DNSProvider) Sequential() time.Duration { + return d.config.SequenceInterval +} diff --git a/providers/dns/otc/otc.toml b/providers/dns/otc/otc.toml index 7f9703bd47..e3c60158c1 100644 --- a/providers/dns/otc/otc.toml +++ b/providers/dns/otc/otc.toml @@ -16,6 +16,7 @@ Example = '''''' [Configuration.Additional] OTC_POLLING_INTERVAL = "Time between DNS propagation check" OTC_PROPAGATION_TIMEOUT = "Maximum waiting time for DNS propagation" + OTC_SEQUENCE_INTERVAL = "Time between sequential requests" OTC_TTL = "The TTL of the TXT record used for the DNS challenge" OTC_HTTP_TIMEOUT = "API request timeout"