diff options
author | Maximilian Hils <git@maximilianhils.com> | 2015-07-24 13:31:55 +0200 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2015-08-11 20:32:08 +0200 |
commit | 863113f989ee2a089c86b06a88a22e92d840348b (patch) | |
tree | 2d8e05cccb38a95881e2cf74b24c00f134be85b2 /libmproxy/proxy/message.py | |
parent | a9fcef868b369568163e19c73651c55ccea4604d (diff) | |
download | mitmproxy-863113f989ee2a089c86b06a88a22e92d840348b.tar.gz mitmproxy-863113f989ee2a089c86b06a88a22e92d840348b.tar.bz2 mitmproxy-863113f989ee2a089c86b06a88a22e92d840348b.zip |
first initial proof-of-concept
Diffstat (limited to 'libmproxy/proxy/message.py')
-rw-r--r-- | libmproxy/proxy/message.py | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/libmproxy/proxy/message.py b/libmproxy/proxy/message.py new file mode 100644 index 00000000..a667123c --- /dev/null +++ b/libmproxy/proxy/message.py @@ -0,0 +1,40 @@ +""" +This module contains all valid messages layers can send to the underlying layers. +""" + + +class _Message(object): + def __eq__(self, other): + # Allow message == Connect checks. + # FIXME: make Connect == message work. + if isinstance(self, other): + return True + return self is 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 |