http

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2023 License: MIT Imports: 41 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, 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 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