infra

package module
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: BSD-3-Clause Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCertificateFunc added in v0.0.6

func GetCertificateFunc(m *autocert.Manager, devCertFile, devKeyFile string) func(*tls.ClientHelloInfo) (*tls.Certificate, error)

func GetCertificateFuncFromFiles added in v0.0.6

func GetCertificateFuncFromFiles(certFile, keyFile string) func(*tls.ClientHelloInfo) (*tls.Certificate, error)

func GetCertificateFuncFromLetsEncrypt added in v0.0.6

func GetCertificateFuncFromLetsEncrypt(m *autocert.Manager) func(*tls.ClientHelloInfo) (*tls.Certificate, error)

func GetDevelopmentCert added in v0.0.8

func GetDevelopmentCert(certFile, keyFile string) func(*tls.ClientHelloInfo) (*tls.Certificate, error)

func GetenvDefault added in v0.0.3

func GetenvDefault(key, defaultValue string) string

GetenvDefault returns the value of environment variable called by key. If the value is undefined or in other words empty, then value of given defaultValue is returned.

func GoodTLSConfig added in v0.0.8

func GoodTLSConfig(src *tls.Config) *tls.Config

func IsCI added in v0.0.5

func IsCI() bool

IsCI returns true if environment variable CI has value true and false otherwise.

func IsDevelopment added in v0.0.4

func IsDevelopment() bool

IsDevelopment checks environment variable ENV and returns true only if ENV value is `development`.

func IsProduction added in v0.0.4

func IsProduction() bool

IsProduction checks the value of environment variable ENV and returns true if value is `production`.

func Must

func Must[T any](value T, err error) T

Must checks for given err. If err is not nil panic is called, otherwise returns value T.

func RandInt64

func RandInt64() (int64, error)

RandInt64 returns cryptographically secure random number suitable for seeding the pseudo-random number generator math/rand.Seed.

func TLSConfig

func TLSConfig(getCertificate func(*tls.ClientHelloInfo) (*tls.Certificate, error)) *tls.Config

TLSConfig returns secure TLS configuration for Internet server.

Types

type Logger

type Logger interface {
	Printf(format string, v ...any)
}

Logger implements a common logger interaface compatible with standard log.Logger.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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