https

package
v4.2.2 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HTTP01    challenge = "http-01"
	TLSAlpn01 challenge = "tlsalpn-01"
)

Variables

This section is empty.

Functions

func IssueCertificates

func IssueCertificates(cacheDir, email, challengeType string, domains []string, useProduction bool, altHTTPPort, altTLSAlpnPort int, log *zap.Logger) (*tls.Config, error)

Types

type AcmeConfig

type AcmeConfig struct {
	// directory to save the certificates, le_certs default
	CacheDir string `mapstructure:"cache_dir"`

	// User email, mandatory
	Email string `mapstructure:"email"`

	// supported values: http-01, tlsalpn-01
	ChallengeType string `mapstructure:"challenge_type"`

	// The alternate port to use for the ACME HTTP challenge
	AltHTTPPort int `mapstructure:"alt_http_port"`

	// The alternate port to use for the ACME TLS-ALPN
	AltTLSALPNPort int `mapstructure:"alt_tlsalpn_port"`

	// Use LE production endpoint or staging
	UseProductionEndpoint bool `mapstructure:"use_production_endpoint"`

	// Domains to obtain certificates
	Domains []string `mapstructure:"domains"`
}

func (*AcmeConfig) InitDefaults

func (ac *AcmeConfig) InitDefaults() error

type ClientAuthType

type ClientAuthType string
const (
	NoClientCert               ClientAuthType = "no_client_cert"
	RequestClientCert          ClientAuthType = "request_client_cert"
	RequireAnyClientCert       ClientAuthType = "require_any_client_cert"
	VerifyClientCertIfGiven    ClientAuthType = "verify_client_cert_if_given"
	RequireAndVerifyClientCert ClientAuthType = "require_and_verify_client_cert"
)

type HTTP2

type HTTP2 struct {

	// H2C enables HTTP/2 over TCP
	H2C bool

	// MaxConcurrentStreams defaults to 128.
	MaxConcurrentStreams uint32 `mapstructure:"max_concurrent_streams"`
}

HTTP2 HTTP/2 server customizations.

func (*HTTP2) EnableHTTP2

func (h2 *HTTP2) EnableHTTP2() bool

func (*HTTP2) InitDefaults

func (h2 *HTTP2) InitDefaults() error

InitDefaults sets default values for HTTP/2 configuration.

type SSL

type SSL struct {
	// Address to listen as HTTPS server, defaults to 0.0.0.0:443.
	Address string

	// ACME configuration
	Acme *AcmeConfig `mapstructure:"acme"`

	// Redirect when enabled forces all http connections to switch to https.
	Redirect bool

	// Key defined private server key.
	Key string

	// Cert is https certificate.
	Cert string

	// Root CA file
	RootCA string `mapstructure:"root_ca"`

	// mTLS auth
	AuthType ClientAuthType `mapstructure:"client_auth_type"`

	// internal
	Port int
	// contains filtered or unexported fields
}

SSL defines https server configuration.

func (*SSL) EnableACME

func (s *SSL) EnableACME() bool

func (*SSL) InitDefaults

func (s *SSL) InitDefaults() error

func (*SSL) Valid

func (s *SSL) Valid() error

type Server

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

func NewHTTPSServer

func NewHTTPSServer(handler http.Handler, cfg *SSL, cfgHTTP2 *HTTP2, errLog *log.Logger, logger *zap.Logger) (*Server, error)

func (*Server) GetServer

func (s *Server) GetServer() *http.Server

func (*Server) Start

func (s *Server) Start(mdwr map[string]common.Middleware, order []string) error

func (*Server) Stop

func (s *Server) Stop()

Jump to

Keyboard shortcuts

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