sslflag

package module
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2020 License: CC0-1.0 Imports: 8 Imported by: 24

Documentation

Index

Constants

View Source
const (
	FlagName    = "ssl-cert-file" // The flag name
	CertEnvName = "PCAS_SSL_CERT" // The env var name for the certificate
)

SSL certificates

View Source
const (
	SetName        = "SSL private key"
	KeyCertEnvName = "PCAS_SSL_KEY_CERT" // The env var name for the key's certificate
	KeyEnvName     = "PCAS_SSL_KEY"      // The env var name for the key
)

SSL key and certificate pairs

Variables

This section is empty.

Functions

func ParseSSLCert

func ParseSSLCert(path string, certEnv string) ([]byte, error)

ParseSSLCert loads the SSL certificates from the file with given path. If the environment variable certEnv is set, the SSL certificates in certEnv will also be loaded.

func ParseSSLCertAndKey

func ParseSSLCertAndKey(certEnv string, keyEnv string) (cert []byte, key []byte, err error)

ParseSSLCertAndKey loads the SSL certificate and key pair, with the certificate read from the environment variable certEnv, and the key read from the environment variable keyEnv. On return, the environment variable keyEnv will be unset.

func SSLCertAndKeyEnvUsage

func SSLCertAndKeyEnvUsage(certEnv string, keyEnv string) string

SSLCertAndKeyEnvUsage returns a standard usage message for the SSL certificate and key pair. The SSL certificate will be read from the environment variable certEnv (if set), and the SSL key will be read from the environment variable keyEnv (if set).

func SSLCertEnvUsage

func SSLCertEnvUsage(f string, certEnv string) string

SSLCertEnvUsage returns a standard usage message for the SSL certificate flag -f. SSL certificates will be read from the contents of the file at path specified by -f (if set), along with the environment variable certEnv (if set).

Types

type Flag

type Flag struct {
	// contains filtered or unexported fields
}

Flag is the standard command-line flag for obtaining an SSL certificate.

func (*Flag) Certificate

func (f *Flag) Certificate() ([]byte, error)

Certificate returns the SSL certificate. This should only be called after the flags have been parsed.

func (*Flag) Description

func (*Flag) Description() string

Description returns a one-line description of this variable.

func (*Flag) Name

func (*Flag) Name() string

Name returns the flag name (without leading hyphen).

func (*Flag) Parse

func (f *Flag) Parse(in string) error

Parse parses the string.

func (*Flag) Usage

func (*Flag) Usage() string

Usage returns long-form usage text.

type Set

type Set struct {
	// contains filtered or unexported fields
}

Set is the standard command-line set for obtaining an SSL key and corresponding certificate.

func (*Set) Certificate

func (s *Set) Certificate() []byte

Certificate returns the SSL certificate. This should only be called after a successful call to Validate.

func (*Set) Flags

func (*Set) Flags() []flag.Flag

Flags returns the members of the set.

func (*Set) Key

func (s *Set) Key() []byte

Key returns the SSL key. This should only be called after a successful call to Validate.

func (*Set) Name

func (*Set) Name() string

Name returns the name of this collection of flags.

func (*Set) RequireCertAndKey

func (s *Set) RequireCertAndKey() (cert []byte, key []byte, err error)

RequireCertAndKey returns the SSL certificate and key pair, or an error if either is not set. This should only be called after a successful call to Validate.

func (*Set) UsageFooter

func (*Set) UsageFooter() string

UsageFooter returns the footer for the usage message for this flag set.

func (*Set) UsageHeader

func (*Set) UsageHeader() string

UsageHeader returns the header for the usage message for this flag set.

func (*Set) Validate

func (s *Set) Validate() error

Validate validates the flag set.

Jump to

Keyboard shortcuts

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