proxy

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrRewriteFailed = errors.New("rewrite request failed")

Functions

func BearerAuth

func BearerAuth(req *http.Request, upstream Upstream)

func DecodeResponseBody

func DecodeResponseBody(rawBody []byte, contentEncoding string) ([]byte, error)

func NoopAuth

func NoopAuth(req *http.Request, upstream Upstream)

func ParseBaseURL

func ParseBaseURL(baseURL string) (*url.URL, error)

Types

type AuthInjector

type AuthInjector func(req *http.Request, upstream Upstream)

type ErrorHandler

type ErrorHandler func(w http.ResponseWriter, r *http.Request, err error)

type ModifyResponseFunc

type ModifyResponseFunc func(resp *http.Response) error

func DefaultModifyResponse

func DefaultModifyResponse(onComplete OnCompleteFunc) ModifyResponseFunc

type OnCompleteFunc

type OnCompleteFunc func(resp *http.Response, decodedBody []byte)

type Options

type Options struct {
	Rewrite        RewriteFunc
	ModifyResponse ModifyResponseFunc
	OnComplete     OnCompleteFunc
	AuthInjector   AuthInjector
	ErrorHandler   ErrorHandler
}

type Proxy

type Proxy struct {
	// contains filtered or unexported fields
}

func New

func New(opts Options) *Proxy

func (*Proxy) ServeHTTP

func (p *Proxy) ServeHTTP(w http.ResponseWriter, r *http.Request, upstream Upstream)

type RewriteFunc

type RewriteFunc func(pr *httputil.ProxyRequest) error

type Upstream

type Upstream struct {
	BaseURL string
	APIKey  string
}

Jump to

Keyboard shortcuts

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