mitmproxy.protocol -> mitmproxy.proxy.protocol

The protocols here are compltely proxy-specific, are only used from within the
proxy module, and are not exposed to users.
This commit is contained in:
Aldo Cortesi 2016-10-19 23:11:56 +13:00
parent e9f7cf68e9
commit e73c7fe77e
19 changed files with 25 additions and 25 deletions

View File

@ -56,7 +56,7 @@ Connection
connection can correspond to multiple HTTP requests.
*root_layer*
The root layer (see `mitmproxy.protocol` for an explanation what
The root layer (see `mitmproxy.proxy.protocol` for an explanation what
the root layer is), provides transparent access to all attributes
of the :py:class:`~mitmproxy.proxy.RootContext`. For example,
``root_layer.client_conn.address`` gives the remote address of the

View File

@ -28,7 +28,7 @@ from enum import Enum
import mitmproxy
from mitmproxy.exceptions import TlsProtocolException
from mitmproxy.protocol import TlsLayer, RawTCPLayer
from mitmproxy.proxy.protocol import TlsLayer, RawTCPLayer
class InterceptionResult(Enum):

View File

@ -13,7 +13,7 @@ from mitmproxy import connections
from mitmproxy import http
from mitmproxy import log
from mitmproxy import io
from mitmproxy.protocol import http_replay
from mitmproxy.proxy.protocol import http_replay
from netlib import basethread
import netlib.http

View File

@ -1,4 +1,4 @@
from mitmproxy import protocol
from mitmproxy.proxy import protocol
class HttpProxy(protocol.Layer, protocol.ServerConnectionMixin):

View File

@ -1,4 +1,4 @@
from mitmproxy import protocol
from mitmproxy.proxy import protocol
class ReverseProxy(protocol.Layer, protocol.ServerConnectionMixin):

View File

@ -1,6 +1,6 @@
import netlib.exceptions
from mitmproxy import exceptions
from mitmproxy import protocol
from mitmproxy.proxy import protocol
from netlib import socks

View File

@ -1,6 +1,6 @@
from mitmproxy import exceptions
from mitmproxy import platform
from mitmproxy import protocol
from mitmproxy.proxy import protocol
class TransparentProxy(protocol.Layer, protocol.ServerConnectionMixin):

View File

@ -22,7 +22,7 @@ class _LayerCodeCompletion:
self.channel = None
"""@type: mitmproxy.controller.Channel"""
self.ctx = None
"""@type: mitmproxy.protocol.Layer"""
"""@type: mitmproxy.proxy.protocol.Layer"""
class Layer(_LayerCodeCompletion):

View File

@ -5,8 +5,8 @@ import traceback
from mitmproxy import exceptions
from mitmproxy import http
from mitmproxy import flow
from mitmproxy.protocol import base
from mitmproxy.protocol import websockets as pwebsockets
from mitmproxy.proxy.protocol import base
from mitmproxy.proxy.protocol import websockets as pwebsockets
import netlib.http
from netlib import tcp
from netlib import websockets

View File

@ -1,5 +1,5 @@
from mitmproxy import http
from mitmproxy.protocol import http as httpbase
from mitmproxy.proxy.protocol import http as httpbase
from netlib.http import http1

View File

@ -11,8 +11,8 @@ import queue
import netlib.exceptions
from mitmproxy import exceptions
from mitmproxy import http
from mitmproxy.protocol import base
from mitmproxy.protocol import http as httpbase
from mitmproxy.proxy.protocol import base
from mitmproxy.proxy.protocol import http as httpbase
import netlib.http
from netlib import tcp
from netlib import basethread

View File

@ -11,7 +11,7 @@ from netlib.http import http1
from netlib import basethread
# TODO: Doesn't really belong into mitmproxy.protocol...
# TODO: Doesn't really belong into mitmproxy.proxy.protocol...
class RequestReplayThread(basethread.BaseThread):

View File

@ -6,7 +6,7 @@ import netlib.exceptions
import netlib.tcp
from mitmproxy import tcp
from mitmproxy import flow
from mitmproxy.protocol import base
from mitmproxy.proxy.protocol import base
class RawTCPLayer(base.Layer):

View File

@ -6,7 +6,7 @@ import construct
import netlib.exceptions
from mitmproxy import exceptions
from mitmproxy.contrib.tls import _constructs
from mitmproxy.protocol import base
from mitmproxy.proxy.protocol import base
from netlib import utils
@ -283,7 +283,7 @@ class TlsClientHello:
client_conn:
The :py:class:`client connection <mitmproxy.connections.ClientConnection>`.
Returns:
:py:class:`client hello <mitmproxy.protocol.tls.TlsClientHello>`.
:py:class:`client hello <mitmproxy.proxy.protocol.tls.TlsClientHello>`.
"""
try:
raw_client_hello = get_client_hello(client_conn)[4:] # exclude handshake header.

View File

@ -3,7 +3,7 @@ import socket
import struct
from OpenSSL import SSL
from mitmproxy import exceptions
from mitmproxy.protocol import base
from mitmproxy.proxy.protocol import base
from netlib import strutils
from netlib import tcp
from netlib import websockets

View File

@ -1,7 +1,7 @@
import netlib.exceptions
from mitmproxy import log
from mitmproxy import exceptions
from mitmproxy import protocol
from mitmproxy.proxy import protocol
from mitmproxy.proxy import modes

View File

@ -14,7 +14,7 @@ class TestClientPlayback:
f = tutils.tflow(resp=True)
cp.load([f])
assert cp.count() == 1
RP = "mitmproxy.protocol.http_replay.RequestReplayThread"
RP = "mitmproxy.proxy.protocol.http_replay.RequestReplayThread"
with mock.patch(RP) as rp:
assert not cp.current
with mastertest.mockctx():

View File

@ -92,10 +92,10 @@ def tflow(client_conn=True, server_conn=True, req=True, resp=None, err=None):
"""
@type client_conn: bool | None | mitmproxy.proxy.connection.ClientConnection
@type server_conn: bool | None | mitmproxy.proxy.connection.ServerConnection
@type req: bool | None | mitmproxy.protocol.http.HTTPRequest
@type resp: bool | None | mitmproxy.protocol.http.HTTPResponse
@type err: bool | None | mitmproxy.protocol.primitives.Error
@return: mitmproxy.protocol.http.HTTPFlow
@type req: bool | None | mitmproxy.proxy.protocol.http.HTTPRequest
@type resp: bool | None | mitmproxy.proxy.protocol.http.HTTPResponse
@type err: bool | None | mitmproxy.proxy.protocol.primitives.Error
@return: mitmproxy.proxy.protocol.http.HTTPFlow
"""
if client_conn is True:
client_conn = tclient_conn()
@ -160,7 +160,7 @@ def tserver_conn():
def terr(content="error"):
"""
@return: mitmproxy.protocol.primitives.Error
@return: mitmproxy.proxy.protocol.primitives.Error
"""
err = flow.Error(content)
return err