Documentation
¶
Index ¶
- func CreateCertPool(rootCa string) (*x509.CertPool, error)
- func DefaultTLSConfig() *tls.Config
- func IssueCertificates(cacheDir, email string, challengeType ChallengeType, domains []string, ...) (*tls.Config, error)
- func Port(address string) int
- type AcmeConfig
- type ChallengeType
- type ClientAuthType
- type Config
- type H2CConfig
- type HTTP
- type HTTPS
- type SSLConfig
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultTLSConfig ¶
func IssueCertificates ¶
Types ¶
type AcmeConfig ¶
type AcmeConfig struct {
// directory to save the certificates, le_certs default
CacheDir string `json:"cache_dir" yaml:"cache_dir"`
// User email, mandatory
Email string `json:"email" yaml:"email"`
// supported values: http-01, tlsalpn-01
ChallengeType ChallengeType `json:"challenge_type" yaml:"challenge_type"`
// The alternate port to use for the ACME HTTP challenge
AltHTTPPort int `json:"alt_http_port" yaml:"alt_http_port"`
// The alternate port to use for the ACME TLS-ALPN
AltTLSALPNPort int `json:"alt_tlsalpn_port" yaml:"alt_tlsalpn_port"`
// Use LE production endpoint or staging
UseProductionEndpoint bool `json:"use_production_endpoint" yaml:"use_production_endpoint"`
// Domains to obtain certificates
Domains []string `json:"domains" yaml:"domains"`
}
func (*AcmeConfig) InitDefaults ¶
func (cfg *AcmeConfig) InitDefaults() error
type ChallengeType ¶
type ChallengeType string
const ( HTTP01 ChallengeType = "http-01" TLSAlpn01 ChallengeType = "tlsalpn-01" )
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 Config ¶
type Config struct {
// Host and port to handle as http server.
Address string `json:"address,omitempty" yaml:"address,omitempty"`
// Redirect when enabled forces all http connections to switch to https.
Redirect bool `json:"redirect,omitempty" yaml:"redirect,omitempty"`
// ReadTimeout is the maximum duration for reading the entire
// request, including the body. A zero or negative value means
// there will be no timeout.
//
// Because ReadTimeout does not let Handlers make per-request
// decisions on each request body's acceptable deadline or
// upload rate, most users will prefer to use
// ReadHeaderTimeout. It is valid to use them both.
ReadTimeout time.Duration `json:"read_timeout,omitempty" yaml:"read_timeout,omitempty"`
// ReadHeaderTimeout is the amount of time allowed to read
// request headers. The connection's read deadline is reset
// after reading the headers and the Handler can decide what
// is considered too slow for the body. If zero, the value of
// ReadTimeout is used. If negative, or if zero and ReadTimeout
// is zero or negative, there is no timeout.
ReadHeaderTimeout time.Duration `json:"read_header_timeout,omitempty" yaml:"read_header_timeout,omitempty"`
// WriteTimeout is the maximum duration before timing out
// writes of the response. It is reset whenever a new
// request's header is read. Like ReadTimeout, it does not
// let Handlers make decisions on a per-request basis.
// A zero or negative value means there will be no timeout.
WriteTimeout time.Duration `json:"write_timeout,omitempty" yaml:"write_timeout,omitempty"`
// IdleTimeout is the maximum amount of time to wait for the
// next request when keep-alives are enabled. If zero, the value
// of ReadTimeout is used. If negative, or if zero and ReadTimeout
// is zero or negative, there is no timeout.
IdleTimeout time.Duration `json:"idle_timeout,omitempty" yaml:"idle_timeout,omitempty"`
// MaxHeaderBytes controls the maximum number of bytes the
// server will read parsing the request header's keys and
// values, including the request line. It does not limit the
// size of the request body.
// If zero, DefaultMaxHeaderBytes is used.
MaxHeaderBytes int `json:"max_header_bytes,omitempty" yaml:"max_header_bytes,omitempty"`
// H2C defines http/2 server options.
H2C H2CConfig `json:"h2c,omitempty" yaml:"h2c,omitempty"`
// SSL defines https server options.
SSL *SSLConfig `json:"ssl,omitempty" yaml:"ssl,omitempty"`
}
func (*Config) InitDefaults ¶
type H2CConfig ¶
type H2CConfig struct {
// MaxConcurrentStreams defaults to 128.
MaxConcurrentStreams uint `json:"max_concurrent_streams,omitempty" yaml:"max_concurrent_streams,omitempty"`
}
func (*H2CConfig) InitDefaults ¶
func (cfg *H2CConfig) InitDefaults()
type SSLConfig ¶
type SSLConfig struct {
// Address to listen as HTTPS server, defaults to 0.0.0.0:443.
Address string `json:"address,omitempty" yaml:"address,omitempty"`
// Acme configuration
Acme *AcmeConfig `json:"acme,omitempty" yaml:"acme,omitempty"`
// Key defined private server key.
Key string `json:"key,omitempty" yaml:"key,omitempty"`
// Cert is https certificate.
Cert string `json:"cert,omitempty" yaml:"cert,omitempty"`
// RootCA file
RootCA string `json:"root_ca,omitempty" yaml:"root_ca,omitempty"`
// AuthType mTLS auth
AuthType ClientAuthType `json:"auth_type,omitempty" yaml:"auth_type,omitempty"`
// H3 enable HTTP3
H3 bool `json:"h3,omitempty" yaml:"h3,omitempty"`
}
func (*SSLConfig) EnableACME ¶
func (*SSLConfig) InitDefaults ¶
Click to show internal directories.
Click to hide internal directories.