mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-22 15:37:45 +00:00
Factor out an io module
Include tnetstring - we've made enough changes that this no longer belongs in contrib.
This commit is contained in:
parent
3a8da31835
commit
4ca78604af
7
mitmproxy/io/__init__.py
Normal file
7
mitmproxy/io/__init__.py
Normal file
@ -0,0 +1,7 @@
|
||||
|
||||
from .io import FlowWriter, FlowReader, FilteredFlowWriter, read_flows_from_paths
|
||||
|
||||
|
||||
__all__ = [
|
||||
"FlowWriter", "FlowReader", "FilteredFlowWriter", "read_flows_from_paths"
|
||||
]
|
@ -7,9 +7,9 @@ from mitmproxy import flowfilter
|
||||
from mitmproxy import http
|
||||
from mitmproxy import tcp
|
||||
from mitmproxy import websocket
|
||||
from mitmproxy.contrib import tnetstring
|
||||
from mitmproxy import io_compat
|
||||
|
||||
from mitmproxy.io import compat
|
||||
from mitmproxy.io import tnetstring
|
||||
|
||||
FLOW_TYPES = dict(
|
||||
http=http.HTTPFlow,
|
||||
@ -43,7 +43,7 @@ class FlowReader:
|
||||
tnetstring.load(self.fo),
|
||||
)
|
||||
try:
|
||||
mdata = io_compat.migrate_flow(loaded)
|
||||
mdata = compat.migrate_flow(loaded)
|
||||
except ValueError as e:
|
||||
raise exceptions.FlowReadException(str(e))
|
||||
if mdata["type"] not in FLOW_TYPES:
|
@ -4,7 +4,7 @@ import math
|
||||
import io
|
||||
import struct
|
||||
|
||||
from mitmproxy.contrib import tnetstring
|
||||
from mitmproxy.io import tnetstring
|
||||
|
||||
MAXINT = 2 ** (struct.Struct('i').size * 8 - 1) - 1
|
||||
|
@ -6,7 +6,7 @@ import mitmproxy.io
|
||||
from mitmproxy import flowfilter
|
||||
from mitmproxy import options
|
||||
from mitmproxy.proxy import config
|
||||
from mitmproxy.contrib import tnetstring
|
||||
from mitmproxy.io import tnetstring
|
||||
from mitmproxy.exceptions import FlowReadException
|
||||
from mitmproxy import flow
|
||||
from mitmproxy import http
|
||||
|
@ -1,7 +1,7 @@
|
||||
import io
|
||||
import pytest
|
||||
|
||||
from mitmproxy.contrib import tnetstring
|
||||
from mitmproxy.io import tnetstring
|
||||
from mitmproxy import flowfilter
|
||||
from mitmproxy.test import tflow
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user