relay

package
v0.1.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyHeaderRules added in v0.1.3

func ApplyHeaderRules(req *http.Request, rules []HeaderRule)

Types

type DumpScope

type DumpScope uint8
const (
	DumpScopeNone DumpScope = 0
	DumpScopeReq  DumpScope = 1 << iota
	DumpScopeResp
)

func ParseDumpScope

func ParseDumpScope(raw string) (DumpScope, bool)

func (DumpScope) HasReq

func (s DumpScope) HasReq() bool

func (DumpScope) HasResp

func (s DumpScope) HasResp() bool

func (DumpScope) String

func (s DumpScope) String() string

type Handler

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

func NewHandler

func NewHandler(client *http.Client, logger *log.Logger, dumpRequest bool, dumpScope DumpScope, maskAuth bool) *Handler

func NewHandlerWithOptions added in v0.1.3

func NewHandlerWithOptions(client *http.Client, logger *log.Logger, opts HandlerOptions) *Handler

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type HandlerOptions added in v0.1.3

type HandlerOptions struct {
	TargetMode  TargetMode
	HeaderRules []HeaderRule
	DumpRequest bool
	DumpScope   DumpScope
	MaskAuth    bool
}

type HeaderRule added in v0.1.3

type HeaderRule struct {
	Action HeaderRuleAction
	Name   string
	Value  string
}

func ParseHeaderRule added in v0.1.3

func ParseHeaderRule(raw string, action HeaderRuleAction) (HeaderRule, error)

func ParseHeaderRules added in v0.1.3

func ParseHeaderRules(addHeaders, modifyHeaders []string) ([]HeaderRule, error)

func (HeaderRule) Apply added in v0.1.3

func (r HeaderRule) Apply(req *http.Request)

func (HeaderRule) Summary added in v0.1.3

func (r HeaderRule) Summary() string

type HeaderRuleAction added in v0.1.3

type HeaderRuleAction string
const (
	HeaderRuleAdd    HeaderRuleAction = "add"
	HeaderRuleModify HeaderRuleAction = "modify"
)

type RelayTransport

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

func NewTransportFromEnv

func NewTransportFromEnv() (*RelayTransport, string, error)

func (*RelayTransport) RoundTrip

func (t *RelayTransport) RoundTrip(req *http.Request) (*http.Response, error)

type TargetMode added in v0.1.3

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

func DefaultTargetMode added in v0.1.3

func DefaultTargetMode() TargetMode

func ParseMode added in v0.1.3

func ParseMode(raw string) (TargetMode, error)

func (TargetMode) String added in v0.1.3

func (m TargetMode) String() string

func (TargetMode) TargetURL added in v0.1.3

func (m TargetMode) TargetURL(r *http.Request) (*url.URL, error)

type TargetModeKind added in v0.1.3

type TargetModeKind uint8
const (
	TargetModeAbsoluteURL TargetModeKind = iota
	TargetModeReverse
)

Jump to

Keyboard shortcuts

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