From c1d016823c67fc834a2fdb6c77181d14b5fd8008 Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Fri, 24 Jul 2015 18:29:13 +0200 Subject: move files around --- libmproxy/protocol2/messages.py | 43 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 libmproxy/protocol2/messages.py (limited to 'libmproxy/protocol2/messages.py') diff --git a/libmproxy/protocol2/messages.py b/libmproxy/protocol2/messages.py new file mode 100644 index 00000000..52bb5a44 --- /dev/null +++ b/libmproxy/protocol2/messages.py @@ -0,0 +1,43 @@ +""" +This module contains all valid messages layers can send to the underlying layers. +""" +from __future__ import (absolute_import, print_function, division, unicode_literals) + + +class _Message(object): + def __eq__(self, other): + # Allow message == Connect checks. + if isinstance(self, other): + return True + return self is other + + def __ne__(self, other): + return not self.__eq__(other) + + +class Connect(_Message): + """ + Connect to the server + """ + + +class Reconnect(_Message): + """ + Re-establish the server connection + """ + + +class ChangeServer(_Message): + """ + Change the upstream server. + """ + + def __init__(self, address, server_ssl, sni, depth=1): + self.address = address + self.server_ssl = server_ssl + self.sni = sni + + # upstream proxy scenario: you may want to change either the final target or the upstream proxy. + # We can express this neatly as the "nth-server-providing-layer" + # ServerConnection could get a `via` attribute. + self.depth = depth -- cgit v1.2.3