From fe00994522adaea3e5953bb38c38bc450f0010ae Mon Sep 17 00:00:00 2001 From: "Quentin McGaw (desktop)" Date: Tue, 29 Jun 2021 20:37:56 +0000 Subject: [PATCH] Feat: PUBLICIP_DNS_TIMEOUT variable --- Dockerfile | 1 + README.md | 1 + docker-compose.yml | 1 + internal/config/pubip.go | 7 +++++++ 4 files changed, 10 insertions(+) diff --git a/Dockerfile b/Dockerfile index af91988af..b2ccf68e7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -76,6 +76,7 @@ ENV \ PUBLICIPV4_HTTP_PROVIDERS=all \ PUBLICIPV6_HTTP_PROVIDERS=all \ PUBLICIP_DNS_PROVIDERS=all \ + PUBLICIP_DNS_TIMEOUT=3s \ HTTP_TIMEOUT=10s \ DATADIR=/updater/data \ diff --git a/README.md b/README.md index c4d478b84..8309851ee 100644 --- a/README.md +++ b/README.md @@ -177,6 +177,7 @@ Note that: | `PUBLICIPV4_HTTP_PROVIDERS` | `all` | Comma separated providers to obtain the public IPv4 address only. See the [Public IP section](#Public-IP) | | `PUBLICIPV6_HTTP_PROVIDERS` | `all` | Comma separated providers to obtain the public IPv6 address only. See the [Public IP section](#Public-IP) | | `PUBLICIP_DNS_PROVIDERS` | `all` | Comma separated providers to obtain the public IP address (IPv4 and/or IPv6). See the [Public IP section](#Public-IP) | +| `PUBLICIP_DNS_TIMEOUT` | `3s` | Public IP DNS query timeout | | `UPDATE_COOLDOWN_PERIOD` | `5m` | Duration to cooldown between updates for each record. This is useful to avoid being rate limited or banned. | | `HTTP_TIMEOUT` | `10s` | Timeout for all HTTP requests | | `LISTENING_PORT` | `8000` | Internal TCP listening port for the web UI | diff --git a/docker-compose.yml b/docker-compose.yml index dad0ad1de..d641ebbb0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -17,6 +17,7 @@ services: - PUBLICIPV4_HTTP_PROVIDERS=all - PUBLICIPV6_HTTP_PROVIDERS=all - PUBLICIP_DNS_PROVIDERS=all + - PUBLICIP_DNS_TIMEOUT=3s - HTTP_TIMEOUT=10s # Web UI diff --git a/internal/config/pubip.go b/internal/config/pubip.go index 380ade085..5f6c2c6e6 100644 --- a/internal/config/pubip.go +++ b/internal/config/pubip.go @@ -50,7 +50,14 @@ func (p *PubIP) get(env params.Env) (warnings []string, err error) { if err != nil { return warnings, err } + + dnsTimeout, err := env.Duration("PUBLICIP_DNS_TIMEOUT", params.Default("3s")) + if err != nil { + return warnings, err + } + p.DNSSettings.Options = []dns.Option{ + dns.SetTimeout(dnsTimeout), dns.SetProviders(dnsIPProviders[0], dnsIPProviders[1:]...), }