Skip to main content

tls.go

tls.go - Overview

  1. Overview This file defines the TLSSetting and TLSServerSetting structs used for configuring TLS settings for OTLP receivers.

  2. 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.
    • CertFile:
      • Type: string
      • Description: Path to the TLS certificate file.
    • KeyFile:
      • Type: string
      • Description: Path to the TLS key file.
    • MinVersion:
      • Type: string
      • Description: Minimum acceptable TLS version.
    • MaxVersion:
      • Type: string
      • Description: Maximum acceptable TLS version.
    • ReloadInterval:
      • Type: time.Duration
      • Description: Interval for reloading the certificate.

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.
    • ClientCAFile:
      • Type: string
      • Description: Path to the client CA certificate file.
  1. Code Examples N/A

  2. Clarity and Accuracy The documentation is derived directly from the code.

  3. Markdown & MDX Perfection The markdown is formatted correctly.

  4. Edge Cases To Avoid Breaking MDX All potential MDX issues have been addressed.

  5. Getting Started Relevance Include in Getting Started: NO