tls

package
v1.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 25, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ServerModeStrings

func ServerModeStrings() []string

ServerModeStrings returns a slice of all String values of the enum

Types

type ConfigManager

type ConfigManager interface {
	TLSConfig() (*tls.Config, error)
	ServerMode() ServerMode
	ClientEnabled() bool
	TLSHandshakeOnConnect() bool
}

ConfigManager is a tls config manager capable of certificate rotation

func NewConfigManager

func NewConfigManager(opts Options, instrumentOpts instrument.Options) ConfigManager

NewConfigManager creates a new config manager

type Options

type Options interface {
	// SetClientEnabled sets the TLS enabled option
	SetClientEnabled(value bool) Options
	// ClientEnabled returns the TLS enabled option
	ClientEnabled() bool

	// SetInsecureSkipVerify sets the insecure skip verify option
	SetInsecureSkipVerify(value bool) Options
	// InsecureSkipVerify returns the insecure skip verify option
	InsecureSkipVerify() bool

	// SetServerName sets the server name option
	SetServerName(value string) Options
	// ServerName returns the server name option
	ServerName() string

	// SetServerMode sets the tls mode
	SetServerMode(value ServerMode) Options
	// Mode returns the tls mode
	ServerMode() ServerMode

	// SetMutualTLSEnabled sets the mutual tls enabled option
	SetMutualTLSEnabled(value bool) Options
	// MutualTLSEnabled returns the mutual tls enabled option
	MutualTLSEnabled() bool

	// SetCertFile sets the certificate file path
	SetCertFile(value string) Options
	// CertFile returns the certificate file path
	CertFile() string

	// SetKeyFile sets the private key file path
	SetKeyFile(value string) Options
	// KeyFile returns the private key file path
	KeyFile() string

	// SetCAFile sets the CA file path
	SetCAFile(value string) Options
	// CAFile returns the CA file path
	CAFile() string

	// SetCertificatesTTL sets the certificates TTL
	SetCertificatesTTL(value time.Duration) Options
	// CertificatesTTL returns the certificates TTL
	CertificatesTTL() time.Duration

	// SetTLSHandshakeOnConnect sets the TLS handshake on connect option
	SetTLSHandshakeOnConnect(value bool) Options
	// TLSHandshakeOnConnect returns the TLS handshake on connect option
	TLSHandshakeOnConnect() bool
}

Options provide a set of TLS options

func NewOptions

func NewOptions() Options

NewOptions creates a new set of tls options

type ServerMode

type ServerMode uint16

ServerMode represents the TLS mode

const (
	// Disabled allows plaintext connections only
	Disabled ServerMode = iota
	// Permissive allows both TLS and plaintext connections
	Permissive
	// Enforced allows TLS connections only
	Enforced
)

func ServerModeString

func ServerModeString(s string) (ServerMode, error)

ServerModeString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.

func ServerModeValues

func ServerModeValues() []ServerMode

ServerModeValues returns all values of the enum

func (ServerMode) IsAServerMode

func (i ServerMode) IsAServerMode() bool

IsAServerMode returns "true" if the value is listed in the enum definition. "false" otherwise

func (ServerMode) MarshalText

func (i ServerMode) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface for ServerMode

func (ServerMode) String

func (i ServerMode) String() string

func (*ServerMode) UnmarshalText

func (i *ServerMode) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface for ServerMode

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL