diff --git a/main.go b/main.go index 1dc0962..ee98f2f 100644 --- a/main.go +++ b/main.go @@ -118,20 +118,19 @@ func scrubX509Value(s string) string { return strings.ReplaceAll(s, "\x00", "") } +var client = &http.Client{Transport: &http.Transport{ + TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, +}} + func downloadJSON(url string) ([]byte, *http.Response, error) { req, err := http.NewRequest("GET", url, nil) if err != nil { return []byte{}, nil, err } + req.Header.Set("User-Agent", "ctail (+https://github.com/hdm/ctail)") req.Header.Set("Accept", "application/json") - tr := &http.Transport{ - TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, - } - - client := &http.Client{Transport: tr} - resp, err := client.Do(req) if err != nil { return []byte{}, resp, err