Documentation
¶
Overview ¶
Copyright © 2017 VMware, Inc. All Rights Reserved. SPDX-License-Identifier: BSD-2-Clause
Copyright © 2017 VMware, Inc. All Rights Reserved. SPDX-License-Identifier: BSD-2-Clause
Copyright © 2017 VMware, Inc. All Rights Reserved. SPDX-License-Identifier: BSD-2-Clause
Index ¶
- Variables
- func CheckPort(port int) error
- func HttpStatus(err error) int
- func JSONPrettyPrint(v interface{}) (string, error)
- func Memzero(buf []byte)
- func NewUUID() string
- func ReadCertificate(filename string) (*x509.Certificate, error)
- func ReadRSAPrivateKey(filename string) (*rsa.PrivateKey, error)
- func ReadRSAPublicKey(filename string) (*rsa.PublicKey, error)
- func WriteErrorResponse(w http.ResponseWriter, e error) error
- func WriteErrorStatus(w http.ResponseWriter, e error)
- func WriteResponse(w http.ResponseWriter, v interface{}, statusCode int) error
- func WriteStatus(w http.ResponseWriter, statusCode int)
- type HttpFilterManager
- type PostHttpFilter
- type PreHttpFilter
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func HttpStatus ¶
func JSONPrettyPrint ¶
func ReadCertificate ¶
func ReadCertificate(filename string) (*x509.Certificate, error)
func ReadRSAPrivateKey ¶
func ReadRSAPrivateKey(filename string) (*rsa.PrivateKey, error)
func WriteErrorResponse ¶
func WriteErrorResponse(w http.ResponseWriter, e error) error
func WriteErrorStatus ¶
func WriteErrorStatus(w http.ResponseWriter, e error)
func WriteResponse ¶
func WriteResponse(w http.ResponseWriter, v interface{}, statusCode int) error
func WriteStatus ¶
func WriteStatus(w http.ResponseWriter, statusCode int)
Types ¶
type HttpFilterManager ¶
type HttpFilterManager struct {
// contains filtered or unexported fields
}
HttpFilterManager holds a chain of pre-filters and a chain of post-filters, and can be used to build a request/response pipeline from the filters and a main handler (see BuildPipeline).
func NewHttpFilterManager ¶
func NewHttpFilterManager() *HttpFilterManager
func (*HttpFilterManager) AddPostFilter ¶
func (fm *HttpFilterManager) AddPostFilter(f PostHttpFilter) *HttpFilterManager
func (*HttpFilterManager) AddPreFilter ¶
func (fm *HttpFilterManager) AddPreFilter(f PreHttpFilter) *HttpFilterManager
func (*HttpFilterManager) BuildPipeline ¶
func (fm *HttpFilterManager) BuildPipeline(handler http.Handler) http.Handler
BuildPipeline builds an returns http.Handler that first invoked the chain of pre-handlers, then invokes the provided handler and finally invoked the chain of post-handlers in reverse order.
type PostHttpFilter ¶
type PostHttpFilter interface {
HandlePost(w http.ResponseWriter, r *http.Request) bool
}
PostHttpFilter processes a response after its request has been processed by the main request router and returns true if the next filter in the chain should be invoked.
type PreHttpFilter ¶
PreHttpHandler processses a request before it gets handed of to the main request router and returns the original request or a modified request if the next filter in the chain should be invoked; nil otherwise