1
1
package main
2
2
3
3
import (
4
- "crypto/tls"
5
4
"flag"
6
5
"fmt"
7
6
"log"
@@ -75,15 +74,11 @@ func main() {
75
74
}
76
75
77
76
matches := urlRE .FindAllString (string (file ), - 1 )
78
- retryClient := retryablehttp .NewClient ()
79
- retryClient .RetryMax = 10
80
-
81
- r := retryablehttp .NewClient ()
82
- client := r .StandardClient ()
83
- client .Timeout = * timeout
84
- client .Transport = & http.Transport {
85
- TLSClientConfig : & tls.Config {InsecureSkipVerify : true },
86
- }
77
+ client := retryablehttp .NewClient ()
78
+ client .RetryMax = 10
79
+ client .RetryWaitMax = 10 * time .Second
80
+ client .HTTPClient .Timeout = * timeout
81
+ client .Logger = nil
87
82
88
83
results := make (chan * response )
89
84
@@ -142,7 +137,7 @@ func main() {
142
137
}
143
138
}
144
139
145
- func newRequest (url string ) (* http .Request , error ) {
140
+ func newRequest (url string ) (* retryablehttp .Request , error ) {
146
141
userAgents := []string {
147
142
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.1 Safari/605.1.15" ,
148
143
"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:77.0) Gecko/20100101 Firefox/77.0" ,
@@ -151,7 +146,7 @@ func newRequest(url string) (*http.Request, error) {
151
146
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36" ,
152
147
}
153
148
154
- req , err := http .NewRequest ("GET" , url , nil )
149
+ req , err := retryablehttp .NewRequest ("GET" , url , nil )
155
150
if err != nil {
156
151
return nil , err
157
152
}
@@ -163,7 +158,7 @@ func newRequest(url string) (*http.Request, error) {
163
158
return req , err
164
159
}
165
160
166
- func worker (url string , results chan <- * response , client * http .Client ) {
161
+ func worker (url string , results chan <- * response , client * retryablehttp .Client ) {
167
162
var err error
168
163
169
164
response := & response {
0 commit comments