mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-26 18:18:25 +00:00
minor fixes
This commit is contained in:
parent
35475f6719
commit
f28e7e5f0f
@ -3,6 +3,7 @@ from mitmproxy.proxy.protocol2.context import ClientServerContext, Context, Serv
|
||||
from mitmproxy.proxy.protocol2.events import Event
|
||||
from mitmproxy.proxy.protocol2.http import HTTPLayer
|
||||
from mitmproxy.proxy.protocol2.layer import Layer
|
||||
from mitmproxy.proxy.protocol2.tcp import TCPLayer
|
||||
|
||||
|
||||
class ReverseProxy(Layer):
|
||||
@ -11,8 +12,8 @@ class ReverseProxy(Layer):
|
||||
server = Server(server_addr)
|
||||
self.child_context = ClientServerContext(context.client, server)
|
||||
# self.child_layer = TLSLayer(self.child_context, True, True)
|
||||
# self.child_layer = TCPLayer(self.child_context, True, True)
|
||||
self.child_layer = HTTPLayer(self.child_context)
|
||||
self.child_layer = TCPLayer(self.child_context, False)
|
||||
# self.child_layer = HTTPLayer(self.child_context)
|
||||
|
||||
def _handle_event(self, event: Event) -> TCommandGenerator:
|
||||
yield from self.child_layer.handle_event(event)
|
||||
|
@ -12,10 +12,6 @@ class TCPLayer(Layer):
|
||||
Simple TCP layer that just relays messages right now.
|
||||
"""
|
||||
context: ClientServerContext = None
|
||||
|
||||
# this is like a mini state machine.
|
||||
state: typing.Callable[[events.Event], commands.TCommandGenerator]
|
||||
|
||||
ignore: bool
|
||||
flow: tcp.TCPFlow
|
||||
|
||||
@ -67,4 +63,4 @@ class TCPLayer(Layer):
|
||||
|
||||
@expect(events.DataReceived, events.ConnectionClosed)
|
||||
def done(self, _):
|
||||
pass
|
||||
yield from ()
|
||||
|
Loading…
Reference in New Issue
Block a user