Documentation ¶
Index ¶
Constants ¶
const ( // TLSKey is the key in the TLS secret for the private key of TLS servers TLSKey = "tls.key" // TLSCrt is the key in the TLS secret for the public key of TLS servers TLSCrt = "tls.crt" // DefaultMinTLSVersion is the default minimum TLS version for servers and clients. DefaultMinTLSVersion = tls.VersionTLS12 )
Variables ¶
This section is empty.
Functions ¶
func GetTLSClientConfig ¶
func GetTLSClientConfig(config ClientConfig) (*tls.Config, error)
GetTLSClientConfig returns tls.Config based on the given ClientConfig.
func GetTLSServerConfig ¶
func GetTLSServerConfig(config ServerConfig) (*tls.Config, error)
func IsHttpsSink ¶
IsHttpsSink returns true if the sink has scheme equal to https.
Types ¶
type ClientConfig ¶
type ClientConfig struct { // CACerts are Certification Authority (CA) certificates in PEM format // according to https://www.rfc-editor.org/rfc/rfc7468. CACerts *string }
func NewDefaultClientConfig ¶
func NewDefaultClientConfig() ClientConfig
NewDefaultClientConfig returns a default ClientConfig.
type GetCertificate ¶
type GetCertificate func(*tls.ClientHelloInfo) (*tls.Certificate, error)
GetCertificate returns a Certificate based on the given ClientHelloInfo. It will only be called if the client supplies SNI information or if Certificates is empty.
If GetCertificate is nil or returns nil, then the certificate is retrieved from NameToCertificate. If NameToCertificate is nil, the best element of Certificates will be used.
func GetCertificateFromSecret ¶
func GetCertificateFromSecret(ctx context.Context, informer coreinformersv1.SecretInformer, kube kubernetes.Interface, secret types.NamespacedName) GetCertificate
GetCertificateFromSecret returns a GetCertificate function that will automatically return the latest certificate that is present in the provided secret.
The secret is expected to have at least 2 keys in data: see TLSKey and TLSCrt constants for knowing the key names.
type ServerConfig ¶
type ServerConfig struct { // GetCertificate returns a Certificate based on the given // ClientHelloInfo. It will only be called if the client supplies SNI // information or if Certificates is empty. // // If GetCertificate is nil or returns nil, then the certificate is // retrieved from NameToCertificate. If NameToCertificate is nil, the // best element of Certificates will be used. GetCertificate func(*tls.ClientHelloInfo) (*tls.Certificate, error) }
func NewDefaultServerConfig ¶
func NewDefaultServerConfig() ServerConfig