mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-27 02:24:18 +00:00
21 lines
497 B
Python
21 lines
497 B
Python
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
|