Bump mitmproxy and protobuf version

This commit is contained in:
Jerry Yan 2022-06-12 00:46:07 +08:00
parent 705cf09741
commit 0edb398e20
2 changed files with 16 additions and 15 deletions

View File

@ -18,17 +18,20 @@ _manager: "Optional[ProxyManager]" = None
class ProxyManager: class ProxyManager:
def __init__(self): def __init__(self):
self._mitm_instance = None self._mitm_instance = None
self._loop: "Optional[asyncio.AbstractEventLoop]" = None self._loop: "asyncio.AbstractEventLoop" = asyncio.new_event_loop()
opts = Options( opts = Options(
listen_host=config()['mitm']['host'], listen_host=config()['mitm']['host'],
listen_port=config()['mitm']['port'], listen_port=config()['mitm']['port'],
) )
self._mitm_instance = DumpMaster(options=opts) async def _init_mitm_instance():
self._load_addon() self._mitm_instance = DumpMaster(options=opts)
opts.update_defer( self._load_addon()
flow_detail=0, opts.update_defer(
termlog_verbosity="error", flow_detail=0,
) termlog_verbosity="error",
)
_loop = asyncio.get_event_loop()
_loop.run_until_complete(_init_mitm_instance())
self._thread = None self._thread = None
def __del__(self): def __del__(self):
@ -45,13 +48,12 @@ class ProxyManager:
self._mitm_instance.addons.add(DanmakuWebsocketAddon(MESSAGE_QUEUE)) self._mitm_instance.addons.add(DanmakuWebsocketAddon(MESSAGE_QUEUE))
def _start(self): def _start(self):
loop = asyncio.new_event_loop() asyncio.set_event_loop(self._loop)
self._loop = loop if self._mitm_instance:
asyncio.set_event_loop(loop) self._loop.run_until_complete(self._mitm_instance.run())
self._mitm_instance.run()
def start_loop(self): def start_loop(self):
self._thread = threading.Thread(target=self._start) self._thread = threading.Thread(target=self._start, args=())
self._thread.start() self._thread.start()
def join(self): def join(self):

View File

@ -1,6 +1,5 @@
colorama==0.4.4 colorama==0.4.4
selenium==4.1.0 selenium==4.1.0
requests==2.27.1
mitmproxy~=7.0.4 mitmproxy~=8.1.0
protobuf<3.19 protobuf~=3.20.1