lib

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 10, 2022 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IncomingRequestFromContext

func IncomingRequestFromContext(ctx context.Context) *http.Request

IncomingRequestFromContext retrives incoming request from context

func IpFromContext

func IpFromContext(ctx context.Context) string

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) Stop

func (rp *ReverseProxy) Stop(timeout time.Duration) 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

type StatusError struct {
	Message     string
	Code        int
	ContentType string
}

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL