http

package
v1.45.2 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckFileExists

func CheckFileExists(filename string) error

func GetTLSConfig

func GetTLSConfig(s *ClientTLSSettings) (*tls.Config, error)

func GetX509KeyPair

func GetX509KeyPair(certFile, keyFile, keyPassword string) (tls.Certificate, error)

Types

type BackstopError

type BackstopError struct {
	ErrorID string `json:"error_id"`
	Errors  Errors `json:"errors"`
}

type ClientAuthType

type ClientAuthType string
const (
	ClientAuthNone    ClientAuthType = "none"
	ClientAuthWant    ClientAuthType = "want"
	ClientAuthNeed    ClientAuthType = "need"
	ClientAuthAny     ClientAuthType = "any"
	ClientAuthRequest ClientAuthType = "request"
)

type ClientTLSSettings

type ClientTLSSettings struct {
	// Override server name to check on certificate
	ServerName string `yaml:"serverName,omitempty" json:"serverName,omitempty"`
	// Don't check server name
	InsecureSkipVerify bool `yaml:"insecureSkipVerify" json:"insecureSkipVerify"`
	// Key file if the cert file doesn't provide it
	ClientKeyFile string `yaml:"clientKeyFile,omitempty" json:"clientKeyFile,omitempty"`
	// Key password if the key is encrypted
	ClientKeyPassword string `yaml:"clientKeyFilePassword,omitempty" json:"clientKeyFilePassword,omitempty"`
	// If not provided, it will default to the system cacerts
	CAcertFile string `yaml:"cacertFile,omitempty" json:"cacertFile,omitempty"`
	// Client certificate file - useful for mTLS
	ClientCertFile string `yaml:"clientCertFile,omitempty" json:"clientCertFile,omitempty"`
}

type Configuration added in v1.7.1

type Configuration struct {
	HTTP HTTP
}

func (Configuration) GetAddr added in v1.7.1

func (s Configuration) GetAddr() string

type Errors

type Errors []struct {
	Message string `json:"message"`
	Code    int    `json:"code"`
}

type HTTP

type HTTP struct {
	Prefix string
	Host   string
	Port   uint32
	SSL    SSL
}

type SSL

type SSL struct {
	// Enable SSL
	Enabled bool
	// Certificate file, can be just a PEM of cert + key or just the cert in which case you'll also need
	// to provide the key file
	CertFile string
	// Key file if the cert file doesn't provide it
	KeyFile string
	// Key password if the key is encrypted
	KeyPassword string
	// when using mTLS, CA PEM. If not provided, it will default to the certificate of the server as a CA
	CAcertFile string
	// Client auth requested (none, want, need, any, request)
	ClientAuth ClientAuthType
}

type Server

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

func NewServer

func NewServer(config Configuration) *Server

func (*Server) Shutdown

func (s *Server) Shutdown(ctx context.Context) error

func (*Server) Start

func (s *Server) Start(router http.Handler) error

Start starts the server on the configured port

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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