secure

package
v0.0.0-...-a2144ad Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package secure provides utilities to configure secure transport.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCA

func GetCA(path string) (*x509.CertPool, error)

GetCA retrieves the pool of CA certificates from the system and the specified file.

func ParseTLSOptions

func ParseTLSOptions(url *url.URL) ([]*tls.Config, error)

ParseTLSOptions returns a slice of TLS configuration to try, based on the sslmode specified in the connection URL The returned slice must contain at least one element. A nil element indicates a no-SSL configuration. It allows a uniform way to specify connections to various backends following the Postgres connection specifications.

func TLSConfig

func TLSConfig(certFile string, privateKey string, generateSelfSigned bool) (*tls.Config, error)

TLSConfig loads the certificate and key from disk, to generate a self-signed localhost certificate, or to return nil if TLS has been disabled.

Types

type Config

type Config struct {
	CaCert     string
	ClientCert string
	ClientKey  string
	SkipVerify bool
	// contains filtered or unexported fields
}

Config stores the TLS parameters passed via command line options.

func (*Config) AsTLSConfig

func (c *Config) AsTLSConfig() *tls.Config

AsTLSConfig returns the tls.Config object built from

func (*Config) Bind

func (c *Config) Bind(f *pflag.FlagSet)

Bind adds flags to the set.

func (*Config) Preflight

func (c *Config) Preflight() error

Preflight builds a tls.Config using the command line options provided at start up.

Jump to

Keyboard shortcuts

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