http

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2023 License: Apache-2.0 Imports: 7 Imported by: 2

Documentation

Overview

Package http implements a http-01 ACME protocol responder.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateRedirectServer

func CreateRedirectServer(portNum uint16, logger log.DebugLogger) error

CreateRedirectServer is a convenience function that creates a redirecting HTTP server on port portNum. Do not use this if NewServer is also used.

Types

type RedirectHandler

type RedirectHandler struct{}

func (*RedirectHandler) ServeHTTP

func (h *RedirectHandler) ServeHTTP(w http.ResponseWriter, req *http.Request)

ServeHTTP serves HTTP requests. All GET and HEAD requests will be redirected to the default TLS port 443 with 302 Found status code, preserving the original request path and query. It responds with 400 Bad Request to all other HTTP methods.

type Responder

type Responder struct {
	// contains filtered or unexported fields
}

func NewHandler

func NewHandler(fallback http.Handler,
	logger log.DebugLogger) (*Responder, error)

NewHandler creates a HTTP handler. The handler will respond to ACME "http-01" challenges. A *RedirectHandler may be passed in through fallback. If this is nil, all non-ACME challenge responses will be rejected. The logger is used for logging messages.

func NewServer

func NewServer(portNum uint16, fallback http.Handler,
	logger log.DebugLogger) (*Responder, error)

NewServer creates a HTTP server on port number portNum. This should normally be 80, unless your firewall is configured to DNAT from port 80 on a public IP to portNum. The server will respond to ACME "http-01" challenges. A *RedirectHandler may be passed in through fallback. If this is nil, a call to the Cleanup method will cause new connections to be accepted and immediately closed until the next Respond method is called, minimising the attack surface. The logger is used for logging messages.

func (*Responder) Cleanup

func (r *Responder) Cleanup()

func (*Responder) Respond

func (r *Responder) Respond(key, value string) error

func (*Responder) ServeHTTP

func (r *Responder) ServeHTTP(w http.ResponseWriter, req *http.Request)

Jump to

Keyboard shortcuts

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