tls

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodePEM

func DecodePEM(certPEM []byte) tls.Certificate

DecodePEM builds a PEM certificate object

func GetSMValue

func GetSMValue(ctx context.Context, secretsManager SecretsManagerAPI, key string) ([]byte, error)

func GetTLS

func GetTLS(cfg TLSConfig) (*tls.Config, error)

GetTLS produces a TLS object to be used by kafka consumer/producer

func MakeTLS

func MakeTLS(clientCert, key []byte) (*tls.Config, error)

MakeTLS generates a tls.Config, kindly stolen from https://github.com/discovery-digital/entitlements-collection/blob/master/kafkaclient/client.go#L230

Types

type SecretManagerConfig

type SecretManagerConfig struct {
	CertificateString string
	KeyString         string
	SMClient          SecretsManagerAPI
}

SecretManagerConfig holds the key values to fetch from SM for the client cert and key

type SecretsManagerAPI

type SecretsManagerAPI interface {
	GetSecretValue(ctx context.Context,
		params *secretsmanager.GetSecretValueInput,
		optFns ...func(*secretsmanager.Options)) (*secretsmanager.GetSecretValueOutput, error)
}

SecretsManagerAPI interface for AWS Secrets Manager Client.

func SMClient

func SMClient(region, endpoint string) (SecretsManagerAPI, error)

SMClient returns SecretsManagerAPI interface that implements secretsmanager.Client. `endpoint` arg can be used when developing locally.

type TLSConfig

type TLSConfig struct {
	UseTLS                  bool
	SMConfig                *SecretManagerConfig
	ClientSignedCertificate []byte
	ClientKey               []byte
}

TLSConfig holds core configuration to setup TLS for kafka

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳