codekingpro/portable-devtools
115k
1from dataclasses import dataclass2 3from . import commands4from mitmproxy import connection5 6 7@dataclass8class ClientConnectedHook(commands.StartHook):9 """10 A client has connected to mitmproxy. Note that a connection can11 correspond to multiple HTTP requests.12 13 Setting client.error kills the connection.14 """15 16 client: connection.Client17 18 19@dataclass20class ClientDisconnectedHook(commands.StartHook):21 """22 A client connection has been closed (either by us or the client).23 """24 25 client: connection.Client26 27 28@dataclass29class ServerConnectionHookData:30 """Event data for server connection event hooks."""31 32 server: connection.Server33 """The server connection this hook is about."""34 client: connection.Client35 """The client on the other end."""36 37 38@dataclass39class ServerConnectHook(commands.StartHook):40 """41 Mitmproxy is about to connect to a server.42 Note that a connection can correspond to multiple requests.43 44 Setting data.server.error kills the connection.45 """46 47 data: ServerConnectionHookData48 49 50@dataclass51class ServerConnectedHook(commands.StartHook):52 """53 Mitmproxy has connected to a server.54 """55 56 data: ServerConnectionHookData57 58 59@dataclass60class ServerDisconnectedHook(commands.StartHook):61 """62 A server connection has been closed (either by us or the server).63 """64 65 data: ServerConnectionHookData66 67 68@dataclass69class ServerConnectErrorHook(commands.StartHook):70 """71 Mitmproxy failed to connect to a server.72 73 Every server connection will receive either a server_connected or a server_connect_error event, but not both.74 """75 76 data: ServerConnectionHookData77 