From 927bf13ce44552115a25a565a2f8094c4127f8aa Mon Sep 17 00:00:00 2001 From: Mmx <36563672+Mmx233@users.noreply.github.com> Date: Wed, 6 Dec 2023 09:35:38 +0800 Subject: [PATCH] fix: field name "VerifySSL" to "SkipVerifySSL" in Transport config (#305) --- model/notification.go | 8 +------- pkg/utils/http.go | 8 ++++---- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/model/notification.go b/model/notification.go index 51608f2..18ef495 100644 --- a/model/notification.go +++ b/model/notification.go @@ -110,15 +110,9 @@ func (n *Notification) setRequestHeader(req *http.Request) error { } func (ns *NotificationServerBundle) Send(message string) error { - var verifySSL bool + var client *http.Client n := ns.Notification if n.VerifySSL != nil && *n.VerifySSL { - verifySSL = true - } - - var client *http.Client - - if verifySSL { client = utils.HttpClient } else { client = utils.HttpClientSkipTlsVerify diff --git a/pkg/utils/http.go b/pkg/utils/http.go index 42c1091..6d9cc22 100644 --- a/pkg/utils/http.go +++ b/pkg/utils/http.go @@ -14,23 +14,23 @@ var ( func init() { HttpClientSkipTlsVerify = httpClient(_httpClient{ Transport: httpTransport(_httpTransport{ - VerifySSL: true, + SkipVerifySSL: true, }), }) HttpClient = httpClient(_httpClient{ Transport: httpTransport(_httpTransport{ - VerifySSL: false, + SkipVerifySSL: false, }), }) } type _httpTransport struct { - VerifySSL bool + SkipVerifySSL bool } func httpTransport(conf _httpTransport) *http.Transport { return &http.Transport{ - TLSClientConfig: &tls.Config{InsecureSkipVerify: conf.VerifySSL}, + TLSClientConfig: &tls.Config{InsecureSkipVerify: conf.SkipVerifySSL}, Proxy: http.ProxyFromEnvironment, } }