proxy

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 4, 2024 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HttpHeaderContentType            = "Content-Type"
	HttpHeaderConnection             = "Connection"
	HttpHeaderKeepAlive              = "Keep-Alive"
	HttpHeaderProxyAuthenticate      = "Proxy-Authenticate"
	HttpHeaderProxyAuthorization     = "Proxy-Authorization"
	HttpHeaderProxyConnection        = "Proxy-Connection"
	HttpHeaderProxyAgent             = "Proxy-Agent"
	HttpHeaderTe                     = "Te"
	HttpHeaderTrailers               = "Trailers"
	HttpHeaderTransferEncoding       = "Transfer-Encoding"
	HttpHeaderUpgrade                = "Upgrade"
	HttpHeaderSecWebsocketKey        = "Sec-Websocket-Key"
	HttpHeaderSecWebsocketVersion    = "Sec-Websocket-Version"
	HttpHeaderSecWebsocketExtensions = "Sec-Websocket-Extensions"
)

Variables

View Source
var (
	ReqCtxKey   = ReqContextKey{}
	EmptyReqCtx = ReqContext{}
)

Functions

func RemoveHopByHopRequestHeaders

func RemoveHopByHopRequestHeaders(header http.Header)

func RemoveWebsocketRequestHeaders

func RemoveWebsocketRequestHeaders(header http.Header)

Types

type HTTPDelegatedInvoker

type HTTPDelegatedInvoker interface {
	Invoke(*http.Request) (*http.Response, error)
}

type HTTPDelegatedInvokerFunc

type HTTPDelegatedInvokerFunc func(*http.Request) (*http.Response, error)

func (HTTPDelegatedInvokerFunc) Invoke

type ImmutableHTTPInterceptor

type ImmutableHTTPInterceptor func(*http.Request, *http.Response)

type ImmutableWebsocketInterceptor

type ImmutableWebsocketInterceptor func(WSDirection, *http.Request, int, []byte)

type MimtOption

type MimtOption struct {
	Enable       bool
	CaPath       string
	KeyPath      string
	FakeCertPool struct {
		Capacity     int
		Interval     int
		ExpireSecond int
	}
	// contains filtered or unexported fields
}

type MitmHandler

type MitmHandler interface {
	SetMutableHTTPInterceptor(MutableHTTPInterceptor)
	SetImmutableHTTPInterceptor(ImmutableHTTPInterceptor)
	SetMutableWebsocketInterceptor(MutableWebsocketInterceptor)
	SetImmutableWebsocketInterceptor(ImmutableWebsocketInterceptor)
	HandleMIMT(context.Context, net.Conn) error
	CAPath() string
}

func NewMitmHandler

func NewMitmHandler(opt MimtOption) (MitmHandler, error)

type MutableHTTPInterceptor

type MutableHTTPInterceptor func(*http.Request, HTTPDelegatedInvoker) (*http.Response, error)

type MutableWebsocketInterceptor

type MutableWebsocketInterceptor func(WSDirection, *http.Request, int, []byte, WebsocketDelegatedInvoker) error

type ReqContext

type ReqContext struct {
	// Used for http proxy and sock5 (connect) proxy
	ConnMethod bool
	Host       string
	Port       string
	Addr       string
	Request    *http.Request
}

type ReqContextKey

type ReqContextKey struct{}

type WSDirection

type WSDirection byte
const (
	Send WSDirection = iota
	Receive
)

type WebsocketDelegatedInvoker

type WebsocketDelegatedInvoker interface {
	Invoke(int, []byte) error
}

type WebsocketDelegatedInvokerFunc

type WebsocketDelegatedInvokerFunc func(int, []byte) error

func (WebsocketDelegatedInvokerFunc) Invoke

func (f WebsocketDelegatedInvokerFunc) Invoke(t int, data []byte) error

Jump to

Keyboard shortcuts

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