2014-03-10 21:36:47 +00:00
|
|
|
from __future__ import absolute_import
|
2014-03-10 20:57:50 +00:00
|
|
|
from . import http, tcp
|
|
|
|
|
|
|
|
protocols = {
|
|
|
|
'http': dict(handler=http.HTTPHandler, flow=http.HTTPFlow),
|
|
|
|
'tcp': dict(handler=tcp.TCPHandler)
|
2014-05-15 16:16:42 +00:00
|
|
|
}
|
2014-03-10 20:57:50 +00:00
|
|
|
|
2015-05-30 00:03:28 +00:00
|
|
|
|
2014-08-30 18:15:19 +00:00
|
|
|
def protocol_handler(protocol):
|
|
|
|
"""
|
|
|
|
@type protocol: str
|
|
|
|
@returns: libmproxy.protocol.primitives.ProtocolHandler
|
|
|
|
"""
|
|
|
|
if protocol in protocols:
|
|
|
|
return protocols[protocol]["handler"]
|
|
|
|
|
2015-05-30 00:03:28 +00:00
|
|
|
raise NotImplementedError(
|
|
|
|
"Unknown Protocol: %s" %
|
|
|
|
protocol) # pragma: nocover
|