Skip to content

Commit fe00994

Browse files
committed
Feat: PUBLICIP_DNS_TIMEOUT variable
1 parent d22dc41 commit fe00994

File tree

4 files changed

+10
-0
lines changed

4 files changed

+10
-0
lines changed

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ ENV \
7676
PUBLICIPV4_HTTP_PROVIDERS=all \
7777
PUBLICIPV6_HTTP_PROVIDERS=all \
7878
PUBLICIP_DNS_PROVIDERS=all \
79+
PUBLICIP_DNS_TIMEOUT=3s \
7980
HTTP_TIMEOUT=10s \
8081
DATADIR=/updater/data \
8182

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ Note that:
177177
| `PUBLICIPV4_HTTP_PROVIDERS` | `all` | Comma separated providers to obtain the public IPv4 address only. See the [Public IP section](#Public-IP) |
178178
| `PUBLICIPV6_HTTP_PROVIDERS` | `all` | Comma separated providers to obtain the public IPv6 address only. See the [Public IP section](#Public-IP) |
179179
| `PUBLICIP_DNS_PROVIDERS` | `all` | Comma separated providers to obtain the public IP address (IPv4 and/or IPv6). See the [Public IP section](#Public-IP) |
180+
| `PUBLICIP_DNS_TIMEOUT` | `3s` | Public IP DNS query timeout |
180181
| `UPDATE_COOLDOWN_PERIOD` | `5m` | Duration to cooldown between updates for each record. This is useful to avoid being rate limited or banned. |
181182
| `HTTP_TIMEOUT` | `10s` | Timeout for all HTTP requests |
182183
| `LISTENING_PORT` | `8000` | Internal TCP listening port for the web UI |

docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ services:
1717
- PUBLICIPV4_HTTP_PROVIDERS=all
1818
- PUBLICIPV6_HTTP_PROVIDERS=all
1919
- PUBLICIP_DNS_PROVIDERS=all
20+
- PUBLICIP_DNS_TIMEOUT=3s
2021
- HTTP_TIMEOUT=10s
2122

2223
# Web UI

internal/config/pubip.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,14 @@ func (p *PubIP) get(env params.Env) (warnings []string, err error) {
5050
if err != nil {
5151
return warnings, err
5252
}
53+
54+
dnsTimeout, err := env.Duration("PUBLICIP_DNS_TIMEOUT", params.Default("3s"))
55+
if err != nil {
56+
return warnings, err
57+
}
58+
5359
p.DNSSettings.Options = []dns.Option{
60+
dns.SetTimeout(dnsTimeout),
5461
dns.SetProviders(dnsIPProviders[0], dnsIPProviders[1:]...),
5562
}
5663

0 commit comments

Comments
 (0)