aboutsummaryrefslogtreecommitdiffstats
path: root/libmproxy/protocol2/rawtcp.py
blob: 167c8c79bfff23bb41e9af3e10bc823208ff0b59 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from __future__ import (absolute_import, print_function, division)

import OpenSSL
from ..exceptions import ProtocolException
from ..protocol.tcp import TCPHandler
from .layer import Layer
from .messages import Connect


class RawTcpLayer(Layer):
    def __call__(self):
        yield Connect()
        tcp_handler = TCPHandler(self)
        try:
            tcp_handler.handle_messages()
        except OpenSSL.SSL.Error as e:
            raise ProtocolException("SSL error: %s" % repr(e), e)


    def establish_server_connection(self):
        pass
        # FIXME: Remove method, currently just here to mock TCPHandler's call to it.