Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Filter ¶
type Filter interface { // Decorate decorates one http.HandlerFunc with another. Decorate(http.HandlerFunc) http.HandlerFunc }
Filter is an interface to be implemented by components that can decorate a http.HandlerFunc.
func NewIPFilter ¶
func NewIPFilter(config IPFilterConfig) Filter
NewIPFilter returns a component that implements the Filter interface and can conditionally allow or disallow a request on the basis of the client's IP address.
type IPFilterConfig ¶
type IPFilterConfig struct { // AllowedRanges are the IP ranges that are permitted to send requests. AllowedRanges []net.IPNet }
IPFilterConfig encapsulates IPFilterConfig configuration.
type Server ¶
type Server interface { // ListenAndServe runs the HTTP/S server until the provided context is // canceled. This function always returns a non-nil error. ListenAndServe(ctx context.Context) error }
Server is an interface for an HTTP/S server. This is an improvement over the HTTP/S server built into Go's http package, as it exposes simple configuration options and a context-sensitive ListenAndServe function.
type ServerConfig ¶
type ServerConfig struct { // Port specifies the port the server should bind to / listen on. Port int // TLSEnabled specifies whether the server should serve HTTP (false) or HTTPS // (true). TLSEnabled bool // TLSCertPath is the path to a PEM-encoded x509 certificate that can be used // for serving HTTPS. TLSCertPath string // TLSKeyPath is the path to a PEM-encoded x509 private key that can be used // for serving HTTPS. TLSKeyPath string }
ServerConfig represents optional configuration for an HTTP/S server.
Click to show internal directories.
Click to hide internal directories.