proxycompat

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MetricDialUpstream = "dialupstream"

	DialTimeoutHeader = "X-Lantern-Dial-Timeout"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BufferSource

type BufferSource interface {
	Get() *[]byte
	Put(buf *[]byte)
}

type DialFunc

type DialFunc func(ctx context.Context, isCONNECT bool, network, addr string) (conn net.Conn, err error)

type MITMInterceptor

type MITMInterceptor interface {
	MITM(downstream net.Conn, upstream net.Conn) (newDown net.Conn, newUp net.Conn, success bool, err error)
}

type Opts

type Opts struct {
	IdleTimeout time.Duration

	BufferSource BufferSource
	Filter       filters.Filter
	OnError      func(cs *filters.ConnectionState, req *http.Request, read bool, err error) *http.Response

	OKWaitsForUpstream  bool
	OKSendsServerTiming bool

	Dial       DialFunc
	ShouldMITM func(req *http.Request, upstreamAddr string) bool
	MITMOpts   *mitm.Opts
	InitMITM   func() (MITMInterceptor, error)
}

type Proxy

type Proxy interface {
	Handle(dialCtx context.Context, in io.Reader, conn net.Conn) error
	Connect(dialCtx context.Context, in io.Reader, conn net.Conn, origin string) error
	Serve(l net.Listener) error
}

func New

func New(opts *Opts) Proxy

type RequestAware

type RequestAware interface {
	OnRequest(req *http.Request)
}

type ResponseAware

type ResponseAware interface {
	OnResponse(req *http.Request, resp *http.Response, err error)
}

Jump to

Keyboard shortcuts

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