blob: 100c736866e430db1bca56595213eea3c61a3231 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
from __future__ import absolute_import
from . import http, tcp
protocols = {
'http': dict(handler=http.HTTPHandler, flow=http.HTTPFlow),
'tcp': dict(handler=tcp.TCPHandler)
}
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
|