icinga

Icinga2 API client in Go
git clone https://git.olowe.co/icinga
Log | Files | Refs | README | LICENSE

commit 9ab732cda40be5693e3f1ddba1a5ebf7de9e1bd5
parent b74ab3b391ccb35e2941c6d15039804dfbcd55f4
Author: Oliver Lowe <o@olowe.co>
Date:   Thu, 30 Dec 2021 18:52:51 +1100

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.

Diffstat:
MREADME.md | 11++++-------
1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/README.md b/README.md @@ -2,13 +2,10 @@ Icinga2 servers in the wild often serve self-signed certificates which 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