camlistore.org: camlistore.org/pkg/webserver Index | Files | Directories

package webserver

import "camlistore.org/pkg/webserver"

Package webserver implements a superset wrapper of http.Server.

Among other things, it can throttle its connections, inherit its listening socket from a file descriptor in the environment, and log all activity.

Index

Package Files

envpipe_unix.go webserver.go

type Server Uses

type Server struct {
    Logger *log.Logger // or nil.

    // H2Server is the HTTP/2 server config.
    H2Server http2.Server
    // contains filtered or unexported fields
}

func New Uses

func New() *Server

func (*Server) Handle Uses

func (s *Server) Handle(pattern string, handler http.Handler)

func (*Server) HandleFunc Uses

func (s *Server) HandleFunc(pattern string, fn func(http.ResponseWriter, *http.Request))

func (*Server) Listen Uses

func (s *Server) Listen(addr string) error

Listen starts listening on the given host:port addr.

func (*Server) ListenURL Uses

func (s *Server) ListenURL() string

func (*Server) Serve Uses

func (s *Server) Serve()

func (*Server) ServeHTTP Uses

func (s *Server) ServeHTTP(rw http.ResponseWriter, req *http.Request)

func (*Server) SetTLS Uses

func (s *Server) SetTLS(setup TLSSetup)

type TLSSetup Uses

type TLSSetup struct {
    // Certfile is the path to the TLS certificate file. It takes precedence over CertManager.
    CertFile string
    // KeyFile is the path to the TLS key file.
    KeyFile string
    // CertManager is the tls.GetCertificate of the tls Config. But CertFile takes precedence.
    CertManager func(clientHello *tls.ClientHelloInfo) (*tls.Certificate, error)
}

TLSSetup specifies how the server gets its TLS certificate.

Directories

PathSynopsis
listen

Package webserver imports 17 packages (graph) and is imported by 31 packages. Updated 2018-01-31. Refresh now. Tools for package owners.