Documentation ¶
Index ¶
- type APIError
- type APIResponse
- type Server
- func (srv *Server) CaptureRequest(w http.ResponseWriter, r *http.Request)
- func (srv *Server) CreateHosts(w http.ResponseWriter, r *http.Request)
- func (srv *Server) GetHostByID(w http.ResponseWriter, r *http.Request)
- func (srv *Server) Handler() http.Handler
- func (srv *Server) ListHTTPLogEntries(w http.ResponseWriter, r *http.Request)
- func (srv *Server) RecoveryMiddleware(h http.Handler) http.Handler
- func (srv *Server) Run(ctx context.Context) error
- func (srv *Server) Shutdown(ctx context.Context) error
- type ServerOption
- func WithACMEManager(am *certmagic.ACMEManager) ServerOption
- func WithHTTPAddr(addr string) ServerOption
- func WithHostname(hostname string) ServerOption
- func WithHostsService(svc hosts.Service) ServerOption
- func WithLogger(logger *zap.Logger) ServerOption
- func WithTLSAddr(addr string) ServerOption
- func WithTLSConfig(tlsConfig *tls.Config) ServerOption
- func WithoutTLS() ServerOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIError ¶
type APIResponse ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server represents a server for HTTP and TLS.
func NewServer ¶
func NewServer(opts ...ServerOption) *Server
func (*Server) CaptureRequest ¶
func (srv *Server) CaptureRequest(w http.ResponseWriter, r *http.Request)
func (*Server) CreateHosts ¶
func (srv *Server) CreateHosts(w http.ResponseWriter, r *http.Request)
func (*Server) GetHostByID ¶
func (srv *Server) GetHostByID(w http.ResponseWriter, r *http.Request)
func (*Server) ListHTTPLogEntries ¶
func (srv *Server) ListHTTPLogEntries(w http.ResponseWriter, r *http.Request)
func (*Server) RecoveryMiddleware ¶
type ServerOption ¶
type ServerOption func(*Server)
func WithACMEManager ¶
func WithACMEManager(am *certmagic.ACMEManager) ServerOption
WithACMEManager overrides the ACME manager used. If you call this function with `nil`, it will disable ACME support.
func WithHTTPAddr ¶
func WithHTTPAddr(addr string) ServerOption
WithHTTPAddr overrides the default TCP address for the HTTP server to listen on.
func WithHostname ¶
func WithHostname(hostname string) ServerOption
WithHostname sets the hostname used to serve the API.
func WithHostsService ¶
func WithHostsService(svc hosts.Service) ServerOption
WithHostsService sets the hosts.Service used for managing hosts, e.g. creating new hosts and capturing network traffic received on them.
func WithLogger ¶
func WithLogger(logger *zap.Logger) ServerOption
WithLogger provides a logger, which is used for HTTP related logs.
func WithTLSAddr ¶
func WithTLSAddr(addr string) ServerOption
WithTLSAddr overrides the default TCP address for the HTTPS server to listen on.
func WithTLSConfig ¶
func WithTLSConfig(tlsConfig *tls.Config) ServerOption
WithTLSConfig overrides the TLS config used.
func WithoutTLS ¶
func WithoutTLS() ServerOption
WithoutTLS disables binding on a port for serving TLS. This will implicitly disable the TLS-ALPN challenge of the ACME protocol.