Documentation ¶
Overview ¶
Package https wraps package http and ensures connections are secure and using up-to-date transports.
Index ¶
- func NewHSTS(h http.Handler) http.Handler
- func NewSecureServer(m *autocert.Manager) *http.Server
- func StartSecureServer(h http.Handler, m *autocert.Manager)
- type Client
- func (c *Client) Do(req *http.Request) (*http.Response, error)
- func (c *Client) Get(url string) (resp *http.Response, err error)
- func (c *Client) Head(url string) (resp *http.Response, err error)
- func (c *Client) Post(url string, bodyType string, body io.Reader) (resp *http.Response, err error)
- func (c *Client) PostForm(url string, data url.Values) (resp *http.Response, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewSecureServer ¶
NewSecureServer returns a new HTTP server with strict security settings.
func StartSecureServer ¶
StartSecureServer starts an HTTPS server with a Handler and an autocert manager. The HTTPS server started enables HTST by default to ensure maximum protection (see https://www.owasp.org/index.php/HTTP_Strict_Transport_Security_Cheat_Sheet). StartSecureServer also starts an HTTP server that redirects all requests to their HTTPS counterpart and immediately terminates all connections.
Types ¶
type Client ¶
Client wraps an http.Client and ensures all connections are HTTPS and on the most recent TLS version with strong ciphers.