Documentation ¶
Index ¶
- Variables
- func IdAdd() int
- func NewStructFromFile[T any](filename string) (*T, error)
- type Addon
- type BaseAddon
- func (addon *BaseAddon) ClientConnected(*ClientConn)
- func (addon *BaseAddon) ClientDisconnected(*ClientConn)
- func (addon *BaseAddon) Request(*Flow)
- func (addon *BaseAddon) Requestheaders(*Flow)
- func (addon *BaseAddon) Response(*Flow)
- func (addon *BaseAddon) Responseheaders(*Flow)
- func (addon *BaseAddon) ServerConnected(*ConnContext)
- func (addon *BaseAddon) ServerDisconnected(*ConnContext)
- func (addon *BaseAddon) StreamRequestModifier(f *Flow, in io.Reader) io.Reader
- func (addon *BaseAddon) StreamResponseModifier(f *Flow, in io.Reader) io.Reader
- func (addon *BaseAddon) TlsEstablishedServer(*ConnContext)
- type ClientConn
- type ConnContext
- type Flow
- type LogAddon
- type Options
- type Proxy
- func (proxy *Proxy) AddAddon(addon Addon)
- func (proxy *Proxy) Close() error
- func (proxy *Proxy) GetCertificate() x509.Certificate
- func (proxy *Proxy) ServeHTTP(res http.ResponseWriter, req *http.Request)
- func (proxy *Proxy) SetShouldInterceptRule(rule func(address string) bool)
- func (proxy *Proxy) Shutdown(ctx context.Context) error
- func (proxy *Proxy) Start() error
- type Request
- type Response
- type ServerConn
Constants ¶
This section is empty.
Variables ¶
View Source
var Id int
todo yhy
Functions ¶
func NewStructFromFile ¶
Types ¶
type Addon ¶
type Addon interface { // A client has connected to mitmproxy. Note that a connection can correspond to multiple HTTP requests. ClientConnected(*ClientConn) // A client connection has been closed (either by us or the client). ClientDisconnected(*ClientConn) // Mitmproxy has connected to a server. ServerConnected(*ConnContext) // A server connection has been closed (either by us or the server). ServerDisconnected(*ConnContext) // The TLS handshake with the server has been completed successfully. TlsEstablishedServer(*ConnContext) // HTTP request headers were successfully read. At this point, the body is empty. Requestheaders(*Flow) // The full HTTP request has been read. Request(*Flow) // HTTP response headers were successfully read. At this point, the body is empty. Responseheaders(*Flow) // The full HTTP response has been read. Response(*Flow) // Stream request body modifier StreamRequestModifier(*Flow, io.Reader) io.Reader // Stream response body modifier StreamResponseModifier(*Flow, io.Reader) io.Reader }
type BaseAddon ¶
type BaseAddon struct{}
BaseAddon do nothing
func (*BaseAddon) ClientConnected ¶
func (addon *BaseAddon) ClientConnected(*ClientConn)
func (*BaseAddon) ClientDisconnected ¶
func (addon *BaseAddon) ClientDisconnected(*ClientConn)
func (*BaseAddon) Requestheaders ¶
func (*BaseAddon) Responseheaders ¶
func (*BaseAddon) ServerConnected ¶
func (addon *BaseAddon) ServerConnected(*ConnContext)
func (*BaseAddon) ServerDisconnected ¶
func (addon *BaseAddon) ServerDisconnected(*ConnContext)
func (*BaseAddon) StreamRequestModifier ¶
func (*BaseAddon) StreamResponseModifier ¶
func (*BaseAddon) TlsEstablishedServer ¶
func (addon *BaseAddon) TlsEstablishedServer(*ConnContext)
type ClientConn ¶
client connection
func (*ClientConn) MarshalJSON ¶
func (c *ClientConn) MarshalJSON() ([]byte, error)
type ConnContext ¶
type ConnContext struct { ClientConn *ClientConn `json:"clientConn"` ServerConn *ServerConn `json:"serverConn"` Intercept bool `json:"intercept"` // Indicates whether to parse HTTPS FlowCount uint32 `json:"-"` // Number of HTTP requests made on the same connection // contains filtered or unexported fields }
connection context
func (*ConnContext) Id ¶
func (connCtx *ConnContext) Id() uuid.UUID
type Flow ¶
type Flow struct { UUID uuid.UUID Id int ConnContext *ConnContext Request *Request Response *Response // https://docs.mitmproxy.org/stable/overview-features/#streaming // 如果为 true,则不缓冲 Request.Body 和 Response.Body,且不进入之后的 Addon.Request 和 Addon.Response Stream bool UseSeparateClient bool // use separate http client to send http request // contains filtered or unexported fields }
flow
func (*Flow) MarshalJSON ¶
type LogAddon ¶
type LogAddon struct {
BaseAddon
}
LogAddon log connection and flow
func (*LogAddon) ClientConnected ¶
func (addon *LogAddon) ClientConnected(client *ClientConn)
func (*LogAddon) ClientDisconnected ¶
func (addon *LogAddon) ClientDisconnected(client *ClientConn)
func (*LogAddon) Requestheaders ¶
func (*LogAddon) ServerConnected ¶
func (addon *LogAddon) ServerConnected(connCtx *ConnContext)
func (*LogAddon) ServerDisconnected ¶
func (addon *LogAddon) ServerDisconnected(connCtx *ConnContext)
type Proxy ¶
type Proxy struct { Opts *Options Version string Addons []Addon // contains filtered or unexported fields }
func (*Proxy) GetCertificate ¶
func (proxy *Proxy) GetCertificate() x509.Certificate
func (*Proxy) SetShouldInterceptRule ¶
type Request ¶
type Request struct { Method string URL *url.URL Proto string Header http.Header Body []byte HttpRaw *http.Request RawStr string }
flow http request
func (*Request) MarshalJSON ¶
func (*Request) UnmarshalJSON ¶
type Response ¶
type Response struct { StatusCode int `json:"statusCode"` Header http.Header `json:"header"` Body []byte `json:"-"` BodyReader io.Reader Raw *http.Response Close bool // connection close DecodedBodyStr []byte // contains filtered or unexported fields }
flow http response
func (*Response) DecodedBody ¶
func (*Response) IsTextContentType ¶
func (*Response) ReplaceToDecodedBody ¶
func (r *Response) ReplaceToDecodedBody()
type ServerConn ¶
type ServerConn struct { Id uuid.UUID Address string Conn net.Conn // contains filtered or unexported fields }
server connection
func (*ServerConn) MarshalJSON ¶
func (c *ServerConn) MarshalJSON() ([]byte, error)
func (*ServerConn) TlsState ¶
func (c *ServerConn) TlsState() *tls.ConnectionState
Click to show internal directories.
Click to hide internal directories.