tlsutil: remove unnecessary getter functions

These functions did nothing but hide the fields they were returning.
This commit is contained in:
Daniel Nephin 2021-06-24 14:32:30 -04:00
parent 66ba2e2463
commit 13e5448c17
1 changed files with 3 additions and 11 deletions

View File

@ -394,19 +394,11 @@ func validateConfig(config Config, pool *x509.CertPool, cert *tls.Certificate) e
} }
func (c Config) anyVerifyIncoming() bool { func (c Config) anyVerifyIncoming() bool {
return c.baseVerifyIncoming() || c.VerifyIncomingRPC || c.VerifyIncomingHTTPS return c.VerifyIncoming || c.VerifyIncomingRPC || c.VerifyIncomingHTTPS
} }
func (c Config) verifyIncomingRPC() bool { func (c Config) verifyIncomingRPC() bool {
return c.baseVerifyIncoming() || c.VerifyIncomingRPC return c.VerifyIncoming || c.VerifyIncomingRPC
}
func (c Config) verifyIncomingHTTPS() bool {
return c.baseVerifyIncoming() || c.VerifyIncomingHTTPS
}
func (c *Config) baseVerifyIncoming() bool {
return c.VerifyIncoming
} }
func loadKeyPair(certFile, keyFile string) (*tls.Certificate, error) { func loadKeyPair(certFile, keyFile string) (*tls.Certificate, error) {
@ -616,7 +608,7 @@ func (c *Configurator) verifyIncomingRPC() bool {
func (c *Configurator) verifyIncomingHTTPS() bool { func (c *Configurator) verifyIncomingHTTPS() bool {
c.lock.RLock() c.lock.RLock()
defer c.lock.RUnlock() defer c.lock.RUnlock()
return c.base.verifyIncomingHTTPS() return c.base.VerifyIncoming || c.base.VerifyIncomingHTTPS
} }
// This function acquires a read lock because it reads from the config. // This function acquires a read lock because it reads from the config.