aboutsummaryrefslogtreecommitdiffstats
path: root/mitmproxy/connections.py
diff options
context:
space:
mode:
authorThomas Kriechbaumer <thomas@kriechbaumer.name>2017-02-21 00:20:44 +0100
committerThomas Kriechbaumer <thomas@kriechbaumer.name>2017-02-24 13:39:02 +0100
commit3e9125a3c13084f4abb0e5b74554909f24df9454 (patch)
tree924b6d81e14c24535aef662e3696c291d7370bc5 /mitmproxy/connections.py
parentd0d11cec7b479932668eb4e7c99d7824018d0460 (diff)
downloadmitmproxy-3e9125a3c13084f4abb0e5b74554909f24df9454.tar.gz
mitmproxy-3e9125a3c13084f4abb0e5b74554909f24df9454.tar.bz2
mitmproxy-3e9125a3c13084f4abb0e5b74554909f24df9454.zip
nuke tcp.Address and add proper IPv6 support
Diffstat (limited to 'mitmproxy/connections.py')
-rw-r--r--mitmproxy/connections.py20
1 files changed, 11 insertions, 9 deletions
diff --git a/mitmproxy/connections.py b/mitmproxy/connections.py
index f914c7d2..6d7c3c76 100644
--- a/mitmproxy/connections.py
+++ b/mitmproxy/connections.py
@@ -60,10 +60,11 @@ class ClientConnection(tcp.BaseHandler, stateobject.StateObject):
)
else:
alpn = ""
- return "<ClientConnection: {ssl}{alpn}{address}>".format(
+ return "<ClientConnection: {ssl}{alpn}{host}:{port}>".format(
ssl="[ssl] " if self.ssl_established else "",
alpn=alpn,
- address=repr(self.address)
+ host=self.address[0],
+ port=self.address[1],
)
@property
@@ -71,7 +72,7 @@ class ClientConnection(tcp.BaseHandler, stateobject.StateObject):
return self.ssl_established
_stateobject_attributes = dict(
- address=tcp.Address,
+ address=tuple,
ssl_established=bool,
clientcert=certs.SSLCert,
mitmcert=certs.SSLCert,
@@ -176,10 +177,11 @@ class ServerConnection(tcp.TCPClient, stateobject.StateObject):
)
else:
alpn = ""
- return "<ServerConnection: {ssl}{alpn}{address}>".format(
+ return "<ServerConnection: {ssl}{alpn}{host}:{port}>".format(
ssl=ssl,
alpn=alpn,
- address=repr(self.address)
+ host=self.address[0],
+ port=self.address[1],
)
@property
@@ -187,9 +189,9 @@ class ServerConnection(tcp.TCPClient, stateobject.StateObject):
return self.ssl_established
_stateobject_attributes = dict(
- address=tcp.Address,
- ip_address=tcp.Address,
- source_address=tcp.Address,
+ address=tuple,
+ ip_address=tuple,
+ source_address=tuple,
ssl_established=bool,
cert=certs.SSLCert,
sni=str,
@@ -244,7 +246,7 @@ class ServerConnection(tcp.TCPClient, stateobject.StateObject):
else:
path = os.path.join(
clientcerts,
- self.address.host.encode("idna").decode()) + ".pem"
+ self.address[0].encode("idna").decode()) + ".pem"
if os.path.exists(path):
clientcert = path