refactor: Rename HasTlsConfig to HasTLSConfig

This commit is contained in:
TwiN 2024-12-06 21:35:26 -05:00
parent a1bbc41b62
commit d56a8487eb

View File

@ -126,7 +126,7 @@ func (c *Config) ValidateAndSetDefaults() error {
if c.HasIAPConfig() && !c.IAPConfig.isValid() { if c.HasIAPConfig() && !c.IAPConfig.isValid() {
return ErrInvalidClientIAPConfig return ErrInvalidClientIAPConfig
} }
if c.HasTlsConfig() { if c.HasTLSConfig() {
if err := c.TLS.isValid(); err != nil { if err := c.TLS.isValid(); err != nil {
return err return err
} }
@ -176,8 +176,8 @@ func (c *Config) HasIAPConfig() bool {
return c.IAPConfig != nil return c.IAPConfig != nil
} }
// HasTlsConfig returns true if the client has client certificate parameters // HasTLSConfig returns true if the client has client certificate parameters
func (c *Config) HasTlsConfig() bool { func (c *Config) HasTLSConfig() bool {
return c.TLS != nil && len(c.TLS.CertificateFile) > 0 && len(c.TLS.PrivateKeyFile) > 0 return c.TLS != nil && len(c.TLS.CertificateFile) > 0 && len(c.TLS.PrivateKeyFile) > 0
} }
@ -203,12 +203,12 @@ func (t *TLSConfig) isValid() error {
return ErrInvalidClientTLSConfig return ErrInvalidClientTLSConfig
} }
// GetHTTPClient return an HTTP client matching the Config's parameters. // getHTTPClient return an HTTP client matching the Config's parameters.
func (c *Config) getHTTPClient() *http.Client { func (c *Config) getHTTPClient() *http.Client {
tlsConfig := &tls.Config{ tlsConfig := &tls.Config{
InsecureSkipVerify: c.Insecure, InsecureSkipVerify: c.Insecure,
} }
if c.HasTlsConfig() && c.TLS.isValid() == nil { if c.HasTLSConfig() && c.TLS.isValid() == nil {
tlsConfig = configureTLS(tlsConfig, *c.TLS) tlsConfig = configureTLS(tlsConfig, *c.TLS)
} }
if c.httpClient == nil { if c.httpClient == nil {