httpsd

package module
v0.0.0-...-b483922 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

README

HTTPD

A small httpd server written in go, designed to serve HTTPS traffic with certs managed by an ACME-based Certificate Authority (by default it uses letsencrypt.org). Certificates are created if needed and automatically managed and rotated while the server is running.

Non-encrypted traffic on port 80 is used the ACME "http-01" challenge, all other traffic is redirected to the SSL equivalent URL.

Multiple hostnames are supported, certs for each one are created/managed independently.

The config file is YAML, with the following keys recognized:

hostnames:  # (default is ["localhost"])
- your.domain1
- your.domain2
certs: "/absolute/path/to/SSL/certs" # (default "certs") - directory managed by acme autocert. Protect this!
log: "/path/to/error/logfile" #(default "httpsd.log")
access_log: "/path/to/access/logfile" # (default "access_log")

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HttpsdResponseWriter

type HttpsdResponseWriter struct {
	http.ResponseWriter
	Size    int64
	Started time.Time
	Status  int
	Elapsed int64
}

func NewHttpsdResponseWriter

func NewHttpsdResponseWriter(rw http.ResponseWriter) *HttpsdResponseWriter

func (*HttpsdResponseWriter) Write

func (w *HttpsdResponseWriter) Write(buf []byte) (int, error)

func (*HttpsdResponseWriter) WriteHeader

func (w *HttpsdResponseWriter) WriteHeader(status int)

type Server

type Server struct {
	http.Server
	Conf        *conf.Data
	Hostnames   []string
	Certs       string
	Mux         *http.ServeMux
	HandlerFunc func(http.ResponseWriter, *http.Request)

	RedirectServer *http.Server
	// contains filtered or unexported fields
}

func (*Server) Configure

func (server *Server) Configure(conf *conf.Data, handler func(http.ResponseWriter, *http.Request)) error

func (*Server) ConfigureFromFile

func (server *Server) ConfigureFromFile(confPath string, handler func(http.ResponseWriter, *http.Request)) error

func (*Server) Log

func (server *Server) Log(format string, args ...interface{})

func (*Server) LogAccess

func (server *Server) LogAccess(rhost, user, method, path, proto, agent, referer string, status int, size int64, started time.Time, elapsed int64)

func (*Server) Serve

func (server *Server) Serve() error

func (*Server) ServeHTTP

func (server *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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