aboutsummaryrefslogtreecommitdiffstats
path: root/libmproxy/protocol2/rawtcp.py
blob: 608a53e3af5cffca18c7c96176a55116ede7b341 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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 TcpLayer(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.