http

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2024 License: MIT Imports: 50 Imported by: 1

Documentation

Overview

Package http provides HTTP listeners/servers, for autoconfiguration/autodiscovery, the account and admin web interface and MTA-STS policies.

Index

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 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

func MobileConfig(addresses []string, fullName string) ([]byte, error)

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 Serve added in v0.0.2

func Serve()

Serve starts serving on the initialized listeners.

func WebHandle added in v0.0.2

func WebHandle(w *loggingWriter, r *http.Request, host dns.Domain) (handled bool)

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.

Jump to

Keyboard shortcuts

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