Feat: PUBLICIP_DNS_TIMEOUT variable

This commit is contained in:
Quentin McGaw (desktop)
2021-06-29 20:37:56 +00:00
parent d22dc41903
commit fe00994522
4 changed files with 10 additions and 0 deletions

View File

@@ -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 \

View File

@@ -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 |

View File

@@ -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

View File

@@ -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:]...),
}