mtls

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2024 License: MIT Imports: 6 Imported by: 2

README

go-mtls

a library to manage generating tls credentials to be used for mutual tls in grpc services

Made With Go Made With gRPC

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MTLSConfig

type MTLSConfig int

MTLSConfig is a type to support the Client/Server mode iota

const (
	Client MTLSConfig = iota // Client-mode Mutual TLS
	Server                   // Server-mode Mutual TLS
)

type X509Files

type X509Files struct {
	CertificateFile          string
	KeyFile                  string
	CertificateAuthorityFile string

	Fs afero.Fs
}

X509Files is a struct to hold the paths to the certificate, key, and certificate authority files

func NewX509Files

func NewX509Files(certificateFile string, keyFile string, certificateAuthorityFile string, options ...X509FilesOption) *X509Files

NewX509Files creates a new X509Files struct, with file-paths for the certificate, key, and certificate authority

func (*X509Files) GenerateTransportCredentials

func (x509Files *X509Files) GenerateTransportCredentials(mtlsConfig MTLSConfig) (credentials.TransportCredentials, error)

GenerateTransportCredentials generates the TransportCredentials for the given MTLSConfig

type X509FilesOption

type X509FilesOption func(*X509Files)

X509FilesOption is a type to support the functional options pattern

func WithFilesystem

func WithFilesystem(fs afero.Fs) X509FilesOption

WithFilesystem is an option to set the underlying filesystem for loading the x509 files

Jump to

Keyboard shortcuts

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