proxy

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RequestScheme

func RequestScheme(r *http.Request) string

func WriteError

func WriteError(
	w http.ResponseWriter,
	status int,
)

Types

type ForwardConfig

type ForwardConfig struct {
	HTTPClient             *http.Client
	Cache                  cache.Cache
	CacheTTL               time.Duration
	CacheKeyFn             func(p *RequestPayload) string
	CacheKeyExcludeHeaders map[string]struct{}
}

type RequestPayload

type RequestPayload struct {
	Method   string              `json:"method"`
	URL      string              `json:"url"`
	Headers  map[string][]string `json:"headers,omitempty"`
	Body     []byte              `json:"body,omitempty"`
	ClientIP string              `json:"clientIp,omitempty"`
	Proto    string              `json:"proto,omitempty"`
}

func (*RequestPayload) Hash added in v1.1.1

func (p *RequestPayload) Hash() string

func (*RequestPayload) HashExcluding added in v1.2.1

func (p *RequestPayload) HashExcluding(
	excludeHeaders map[string]struct{},
) string

type ResponseResult

type ResponseResult struct {
	StatusCode int                 `json:"statusCode"`
	Headers    map[string][]string `json:"headers,omitempty"`
	Body       []byte              `json:"body,omitempty"`
}

func ForwardRequest

func ForwardRequest(
	ctx context.Context,
	cfg ForwardConfig,
	payload *RequestPayload,
) (*ResponseResult, error)

Jump to

Keyboard shortcuts

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