tls

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package tls provides helper functions for building client and server TLS configurations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadCertPoolFromFS

func LoadCertPoolFromFS(fsys fs.FS, certPoolPath string) (*x509.CertPool, error)

LoadCertPoolFromFS loads a certificate pool from a PEM file in the provided filesystem.

func LoadCertPoolFromFile

func LoadCertPoolFromFile(certPoolPath string) (*x509.CertPool, error)

LoadCertPoolFromFile loads a certificate pool from a PEM file.

func NewClientTLSConfig

func NewClientTLSConfig(c ClientConfig) (*tls.Config, error)

NewClientTLSConfig creates a TLS configuration for a client from the given config.

func NewServerTLSConfig

func NewServerTLSConfig(c ServerConfig) (*tls.Config, error)

NewServerTLSConfig creates a TLS configuration for a server from the given config.

Types

type ClientConfig

type ClientConfig struct {
	RootCAFile         string `mapstructure:"root-ca-file" json:",omitempty"`
	Certificate        string `mapstructure:"cert" json:",omitempty"`
	Key                string `mapstructure:"key" json:",omitempty"`
	InsecureSkipVerify bool   `mapstructure:"insecure-skip-verify"`
}

ClientConfig specifies TLS client configuration.

type ServerConfig

type ServerConfig struct {
	Certificate string `mapstructure:"cert" json:",omitempty"`
	Key         string `mapstructure:"key" json:",omitempty"`
	ClientCA    string `mapstructure:"client-ca" json:",omitempty"`
}

ServerConfig specifies TLS server configuration.

Jump to

Keyboard shortcuts

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