Documentation
¶
Overview ¶
Package http provides HTTP listeners/servers, for autoconfiguration/autodiscovery, the account and admin web interface and MTA-STS policies.
Index ¶
- func HandleForward(h *config.WebForward, w http.ResponseWriter, r *http.Request, path string) (handled bool)
- func HandleInternal(h *config.WebInternal, w http.ResponseWriter, r *http.Request) (handled bool)
- func HandleRedirect(h *config.WebRedirect, w http.ResponseWriter, r *http.Request) (handled bool)
- func HandleStatic(h *config.WebStatic, compress bool, w http.ResponseWriter, r *http.Request) (handled bool)
- func Listen()
- func MobileConfig(addresses []string, fullName string) ([]byte, error)
- func Serve()
- func WebHandle(w *loggingWriter, r *http.Request, host dns.IPDomain) (handled bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HandleForward ¶ added in v0.0.2
func HandleForward(h *config.WebForward, w http.ResponseWriter, r *http.Request, path string) (handled bool)
HandleForward handles a request by forwarding it to another webserver and passing the response on. I.e. a reverse proxy. It handles websocket connections by monitoring the websocket handshake and then just passing along the websocket frames.
func HandleInternal ¶ added in v0.0.12
func HandleInternal(h *config.WebInternal, w http.ResponseWriter, r *http.Request) (handled bool)
HandleInternal passes the request to an internal service.
func HandleRedirect ¶ added in v0.0.2
func HandleRedirect(h *config.WebRedirect, w http.ResponseWriter, r *http.Request) (handled bool)
HandleRedirect writes a response with an HTTP redirect.
func HandleStatic ¶ added in v0.0.2
func HandleStatic(h *config.WebStatic, compress bool, w http.ResponseWriter, r *http.Request) (handled bool)
HandleStatic serves static files. If a directory is requested and the URL path doesn't end with a slash, a response with a redirect to the URL path with trailing slash is written. If a directory is requested and an index.html exists, that file is returned. Otherwise, for directories with ListFiles configured, a directory listing is returned.
func Listen ¶ added in v0.0.2
func Listen()
Listen binds to sockets for HTTP listeners, including those required for ACME to generate TLS certificates. It stores the listeners so Serve can start serving them.
func MobileConfig ¶ added in v0.0.7
MobileConfig returns a device profile for a macOS Mail email account. The file should have a .mobileconfig extension. Opening the file adds it to Profiles in System Preferences, where it can be installed. This profile does not contain a password because sending opaque files containing passwords around to users seems like bad security practice.
Multiple addresses can be passed, the first is used for IMAP/submission login, and likely seen as primary account by Apple software.
The config is not signed, so users must ignore warnings about unsigned profiles.
func WebHandle ¶ added in v0.0.2
WebHandle serves an HTTP request by going through the list of WebHandlers, check if there is a domain+path match, and running the handler if so. WebHandle runs after the built-in handlers for mta-sts, autoconfig, etc. If no handler matched, false is returned. WebHandle sets w.Name to that of the matching handler.
Types ¶
This section is empty.