aboutsummaryrefslogtreecommitdiffstats
path: root/libmproxy/protocol/handle.py
diff options
context:
space:
mode:
Diffstat (limited to 'libmproxy/protocol/handle.py')
-rw-r--r--libmproxy/protocol/handle.py27
1 files changed, 9 insertions, 18 deletions
diff --git a/libmproxy/protocol/handle.py b/libmproxy/protocol/handle.py
index a238b349..100c7368 100644
--- a/libmproxy/protocol/handle.py
+++ b/libmproxy/protocol/handle.py
@@ -6,21 +6,12 @@ protocols = {
'tcp': dict(handler=tcp.TCPHandler)
}
-
-def _handler(conntype, connection_handler):
- if conntype in protocols:
- return protocols[conntype]["handler"](connection_handler)
-
- raise NotImplementedError # pragma: nocover
-
-
-def handle_messages(conntype, connection_handler):
- return _handler(conntype, connection_handler).handle_messages()
-
-
-def handle_error(conntype, connection_handler, error):
- return _handler(conntype, connection_handler).handle_error(error)
-
-
-def handle_server_reconnect(conntype, connection_handler, state):
- return _handler(conntype, connection_handler).handle_server_reconnect(state) \ No newline at end of file
+def protocol_handler(protocol):
+ """
+ @type protocol: str
+ @returns: libmproxy.protocol.primitives.ProtocolHandler
+ """
+ if protocol in protocols:
+ return protocols[protocol]["handler"]
+
+ raise NotImplementedError("Unknown Protocol: %s" % protocol) # pragma: nocover \ No newline at end of file