From f983091e2be9095eae078d2dc284c881451285f7 Mon Sep 17 00:00:00 2001 From: dilap54 Date: Thu, 28 Dec 2023 19:03:38 +0300 Subject: [PATCH] add timeout --- proxies/proxies.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/proxies/proxies.go b/proxies/proxies.go index 371cb94..b20cdcd 100644 --- a/proxies/proxies.go +++ b/proxies/proxies.go @@ -8,6 +8,7 @@ import ( "net/http" "net/url" "os" + "time" ) //https://www.reddit.com/r/golang/comments/ezg1ka/how_can_i_specify_a_proxy_server_when_using/ @@ -45,7 +46,10 @@ func ParseProxies(r io.Reader) ([]*http.Client, error) { Proxy: http.ProxyURL(proxyURL), } - client := &http.Client{Transport: transport} + client := &http.Client{ + Transport: transport, + Timeout: 1 * time.Minute, + } clients = append(clients, client)