mitm

package
v2.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const UnknownAddr = "unknown"

Variables

This section is empty.

Functions

func ToProxyResponse

func ToProxyResponse(pRes proxyAdapters.ResponseReaderAdapter, acceptEncodingHeader string) (*px.Response, error)

ToProxyResponse converts a ProxyResponse into a MITM proxy response object with body encoding matching the new request's acceptEncodingHeader. Since all responses are stored as uncompressed strings, the cached response might need to be encoded before being sent. This function encodes the response body based on the requested acceptEncodingHeader argument.

Types

type ConnectionStatsAdapter

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

func NewProxyConnectionStatsAdapter

func NewProxyConnectionStatsAdapter(f *px.Flow) *ConnectionStatsAdapter

func (*ConnectionStatsAdapter) GetClientIP

func (cs *ConnectionStatsAdapter) GetClientIP() string

func (*ConnectionStatsAdapter) GetProxyID

func (cs *ConnectionStatsAdapter) GetProxyID() string

func (*ConnectionStatsAdapter) GetRequestURL

func (cs *ConnectionStatsAdapter) GetRequestURL() string

type FlowAdapter

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

FlowAdapter implements the proxyAdapters.ProxyFlowReaderAdapter interface

func NewFlowAdapter

func NewFlowAdapter(flow *px.Flow) *FlowAdapter

func (*FlowAdapter) GetConnectionStats

func (fa *FlowAdapter) GetConnectionStats() proxyAdapters.ConnectionStatsReaderAdapter

func (*FlowAdapter) GetRequest

func (*FlowAdapter) GetResponse

func (*FlowAdapter) SetFlow added in v2.3.0

func (fa *FlowAdapter) SetFlow(flow *px.Flow)

func (*FlowAdapter) SetRequest added in v2.3.0

func (fa *FlowAdapter) SetRequest(req *px.Request)

SetRequest copies the request, to keep the original flow

func (*FlowAdapter) SetResponse added in v2.3.0

func (fa *FlowAdapter) SetResponse(res *px.Response)

type ProxyRequestAdapter

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

ProxyRequestAdapter is a RequestAdapter implementation for mitmproxy requests

func NewProxyRequestAdapter

func NewProxyRequestAdapter(pxReq *px.Request) *ProxyRequestAdapter

func (*ProxyRequestAdapter) GetBodyBytes

func (r *ProxyRequestAdapter) GetBodyBytes() []byte

func (*ProxyRequestAdapter) GetHeaders

func (r *ProxyRequestAdapter) GetHeaders() http.Header

func (*ProxyRequestAdapter) GetMethod

func (r *ProxyRequestAdapter) GetMethod() string

func (*ProxyRequestAdapter) GetProto

func (r *ProxyRequestAdapter) GetProto() string

func (*ProxyRequestAdapter) GetURL

func (r *ProxyRequestAdapter) GetURL() *url.URL

type ProxyResponseAdapter

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

func NewProxyResponseAdapter

func NewProxyResponseAdapter(pxResp *px.Response) *ProxyResponseAdapter

func (*ProxyResponseAdapter) GetBodyBytes

func (r *ProxyResponseAdapter) GetBodyBytes() []byte

func (*ProxyResponseAdapter) GetHeaders

func (r *ProxyResponseAdapter) GetHeaders() http.Header

func (*ProxyResponseAdapter) GetStatusCode

func (r *ProxyResponseAdapter) GetStatusCode() int

Jump to

Keyboard shortcuts

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