mirror of
https://github.com/qdm12/gluetun.git
synced 2026-05-09 20:29:23 +02:00
fix(all): increase global http client timeout to 35s and precise lower timeouts where needed
- Fix DNS blocklists slow downloads, fix #3102 - Leave 35s timeout for updaters - Set timeouts to 1s for local calls - Set timeouts to 5s for LAN VPN calls and small external calls - Set timeouts to 10s external VPN API calls
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"net/http"
|
||||
"net/netip"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/qdm12/gluetun/internal/models"
|
||||
)
|
||||
@@ -44,6 +45,12 @@ func (e *echoip) Token() string {
|
||||
func (e *echoip) FetchInfo(ctx context.Context, ip netip.Addr) (
|
||||
result models.PublicIP, err error,
|
||||
) {
|
||||
// Define a timeout since the default client has a large timeout and we don't
|
||||
// want to wait too long.
|
||||
const timeout = 5 * time.Second
|
||||
ctx, cancel := context.WithTimeout(ctx, timeout)
|
||||
defer cancel()
|
||||
|
||||
url := e.url + "/json"
|
||||
if ip.IsValid() {
|
||||
url += "?ip=" + ip.String()
|
||||
|
||||
Reference in New Issue
Block a user