Documentation ¶
Index ¶
- func IncomingRequestFromContext(ctx context.Context) *http.Request
- func IpFromContext(ctx context.Context) string
- type AfterReceive
- type BeforeSend
- type HostForward
- type ReverseProxy
- func (rp *ReverseProxy) ComputeForwardUrl(incomingRequestURL string, hostForward *HostForward) (string, error)
- func (rp *ReverseProxy) RewriteHostQueryRequest(request *http.Request) error
- func (rp *ReverseProxy) RewriteHostResponseBody(response *http.Response) error
- func (rp *ReverseProxy) RewriteLocation(location string) string
- func (rp *ReverseProxy) ServeHTTP(writer http.ResponseWriter, incomingRequest *http.Request)
- func (rp *ReverseProxy) Start() error
- func (rp *ReverseProxy) Stop(timeout time.Duration) error
- func (rp *ReverseProxy) UseAutocert(autocertdomain string)
- func (rp *ReverseProxy) UseCertificate(crtfile string, keyfile string)
- type StatusError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IncomingRequestFromContext ¶
IncomingRequestFromContext retrives incoming request from context
func IpFromContext ¶
IpFromContext retrives incoming request from context
Types ¶
type AfterReceive ¶
type AfterReceive func(http.ResponseWriter, *http.Response, *HostForward) error
AfterReceive defines after receive callback function
type BeforeSend ¶
type BeforeSend func(http.ResponseWriter, *http.Request, *HostForward) error
BeforeSend defines before send callback function
type HostForward ¶
type HostForward struct { Host string // Host Forward string // Url to forward on ForwardHost string // Optional host rewrite header BeforeSendFunc BeforeSend // Before send callback function AfterReceiveFunc AfterReceive // After receive callback function }
HostForward struct
func (*HostForward) String ¶
func (hf *HostForward) String() string
String implements string formatting
type ReverseProxy ¶
type ReverseProxy struct { HostForwards []*HostForward Prefix string AllowCrossOrigin bool // contains filtered or unexported fields }
ReverseProxy structure
func NewReverseProxy ¶
func NewReverseProxy(hostForwards []*HostForward, listen string, prefix string, allowCrossOrigin bool) *ReverseProxy
NewReverseProxy constructs ReverseProxy
func ReverseProxyFromContext ¶
func ReverseProxyFromContext(ctx context.Context) *ReverseProxy
ReverseProxyFromContext retrives GisProxy from context
func (*ReverseProxy) ComputeForwardUrl ¶
func (rp *ReverseProxy) ComputeForwardUrl(incomingRequestURL string, hostForward *HostForward) (string, error)
ComputeForwardUrl computes rewrite url
func (*ReverseProxy) RewriteHostQueryRequest ¶
func (rp *ReverseProxy) RewriteHostQueryRequest(request *http.Request) error
RewriteHostQueryRequest computes rewrite query
func (*ReverseProxy) RewriteHostResponseBody ¶
func (rp *ReverseProxy) RewriteHostResponseBody(response *http.Response) error
RewriteHostResponseBody computes rewrite body
func (*ReverseProxy) RewriteLocation ¶
func (rp *ReverseProxy) RewriteLocation(location string) string
RewriteLocation rewrites location
func (*ReverseProxy) ServeHTTP ¶
func (rp *ReverseProxy) ServeHTTP(writer http.ResponseWriter, incomingRequest *http.Request)
ServeHTTP serves rest request
func (*ReverseProxy) Start ¶
func (rp *ReverseProxy) Start() error
func (*ReverseProxy) UseAutocert ¶
func (rp *ReverseProxy) UseAutocert(autocertdomain string)
UseHttps uses Https with autocert
func (*ReverseProxy) UseCertificate ¶
func (rp *ReverseProxy) UseCertificate(crtfile string, keyfile string)
UseCertificate uses Https with certificate
type StatusError ¶
StatusError struct
func NewStatusError ¶
func NewStatusError(message string, code int) *StatusError
NewStatusError constructs StatusError
func NewStatusErrorWithContentType ¶
func NewStatusErrorWithContentType(message string, code int, contentType string) *StatusError
NewStatusErrorWithContentType constructs StatusError
func (*StatusError) Error ¶
func (e *StatusError) Error() string
Error implements the error interface