commit 9ab732cda40be5693e3f1ddba1a5ebf7de9e1bd5 from: Oliver Lowe date: Thu Dec 30 07:52:51 2021 UTC README: use http.DefaultClient in example The Go devs set useful things for us that we shouldn't lose just because we're something insecure. commit - b74ab3b391ccb35e2941c6d15039804dfbcd55f4 commit + 9ab732cda40be5693e3f1ddba1a5ebf7de9e1bd5 blob - 74e15e763ea7ca51a6c62e3d0d4b49f9d7ede835 blob + 38eb8ee27d388ef042f6b81cc611f709bbcb0cd2 --- README.md +++ README.md @@ -2,13 +2,10 @@ Icinga2 servers in the wild often serve self-signed ce fail verification by Go's tls client. To ignore the errors, Dial the server with a modified http.Client: - c := &http.Client{ - Transport: &http.Transport{ - TLSClientConfig: &tls.Config{ - InsecureSkipVerify: true, - }, - }, - } + t := http.DefaultTransport.(*http.Transport) + t.TLSClientConfig = &tls.Config{InsecureSkipVerify: true} + c := http.DefaultClient + c.Transport = t client, err := icinga.Dial(host, user, pass, c) if err != nil { // handle error