| skipped 10 lines |
11 | 11 | | "github.com/edoardottt/golazy" |
12 | 12 | | ) |
13 | 13 | | |
| 14 | + | var ( |
| 15 | + | UserAgent = golazy.GenerateRandomUserAgent() |
| 16 | + | ) |
| 17 | + | |
14 | 18 | | const ( |
15 | 19 | | TLSHandshakeTimeout = 10 |
16 | 20 | | KeepAlive = 30 |
| skipped 10 lines |
27 | 31 | | if err != nil { |
28 | 32 | | return result, err |
29 | 33 | | } |
| 34 | + | |
| 35 | + | req.Header.Add("User-Agent", UserAgent) |
30 | 36 | | |
31 | 37 | | resp, err := client.Do(req) |
32 | 38 | | if err != nil { |
| skipped 36 lines |
69 | 75 | | func customClient(timeout int) *http.Client { |
70 | 76 | | transport := http.Transport{ |
71 | 77 | | TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, |
| 78 | + | Proxy: http.ProxyFromEnvironment, |
72 | 79 | | Dial: (&net.Dialer{ |
73 | 80 | | Timeout: time.Duration(timeout) * time.Second, |
74 | 81 | | KeepAlive: KeepAlive * time.Second, |
| skipped 28 lines |