tls.go
tls.go - Overview
-
Overview This file defines the
TLSSetting
andTLSServerSetting
structs used for configuring TLS settings for OTLP receivers. -
Detailed Documentation
TLSSetting
- Purpose: Defines the TLS settings such as certificate paths, TLS versions, and reload intervals.
- Parameters: None
- Returns: None
type TLSSetting struct {
// Path to the CA cert. For a client this verifies the server certificate.
// For a server this verifies client certificates. If empty uses system root CA.
// (optional)
CAFile string `mapstructure:"ca_file"`
// Path to the TLS cert to use for TLS required connections. (optional)
CertFile string `mapstructure:"cert_file"`
// Path to the TLS key to use for TLS required connections. (optional)
KeyFile string `mapstructure:"key_file"`
// MinVersion sets the minimum TLS version that is acceptable.
// If not set, TLS 1.2 will be used. (optional)
MinVersion string `mapstructure:"min_version"`
// MaxVersion sets the maximum TLS version that is acceptable.
// If not set, refer to crypto/tls for defaults. (optional)
MaxVersion string `mapstructure:"max_version"`
// ReloadInterval specifies the duration after which the certificate will be reloaded
// If not set, it will never be reloaded (optional)
ReloadInterval time.Duration `mapstructure:"reload_interval"`
}
- Fields:
CAFile
:- Type:
string
- Description: Path to the CA certificate file.
- Type:
CertFile
:- Type:
string
- Description: Path to the TLS certificate file.
- Type:
KeyFile
:- Type:
string
- Description: Path to the TLS key file.
- Type:
MinVersion
:- Type:
string
- Description: Minimum acceptable TLS version.
- Type:
MaxVersion
:- Type:
string
- Description: Maximum acceptable TLS version.
- Type:
ReloadInterval
:- Type:
time.Duration
- Description: Interval for reloading the certificate.
- Type:
TLSServerSetting
- Purpose: Defines the TLS settings specifically for a server, extending
TLSSetting
with client CA file configuration. - Parameters: None
- Returns: None
type TLSServerSetting struct {
// squash ensures fields are correctly decoded in embedded struct.
TLSSetting `mapstructure:",squash"`
// Path to the TLS cert to use by the server to verify a client certificate. (optional)
// This sets the ClientCAs and ClientAuth to RequireAndVerifyClientCert in the TLSConfig. Please refer to
// https://godoc.org/crypto/tls#Config for more information. (optional)
ClientCAFile string `mapstructure:"client_ca_file"`
}
- Fields:
TLSSetting
:- Type:
TLSSetting
- Description: Embedded
TLSSetting
struct.
- Type:
ClientCAFile
:- Type:
string
- Description: Path to the client CA certificate file.
- Type:
-
Code Examples N/A
-
Clarity and Accuracy The documentation is derived directly from the code.
-
Markdown & MDX Perfection The markdown is formatted correctly.
-
Edge Cases To Avoid Breaking MDX All potential MDX issues have been addressed.
-
Getting Started Relevance Include in Getting Started: NO