mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-23 16:17:49 +00:00
Merge pull request #110 from snemes/master
Added getter/setter for TCPClient source_address
This commit is contained in:
commit
0ca0469d6e
@ -548,8 +548,7 @@ class TCPClient(_Connection):
|
|||||||
def __init__(self, address, source_address=None):
|
def __init__(self, address, source_address=None):
|
||||||
super(TCPClient, self).__init__(None)
|
super(TCPClient, self).__init__(None)
|
||||||
self.address = address
|
self.address = address
|
||||||
self.source_address = Address.wrap(
|
self.source_address = source_address
|
||||||
source_address) if source_address else None
|
|
||||||
self.cert = None
|
self.cert = None
|
||||||
self.ssl_verification_error = None
|
self.ssl_verification_error = None
|
||||||
self.sni = None
|
self.sni = None
|
||||||
@ -565,6 +564,17 @@ class TCPClient(_Connection):
|
|||||||
else:
|
else:
|
||||||
self.__address = None
|
self.__address = None
|
||||||
|
|
||||||
|
@property
|
||||||
|
def source_address(self):
|
||||||
|
return self.__source_address
|
||||||
|
|
||||||
|
@source_address.setter
|
||||||
|
def source_address(self, source_address):
|
||||||
|
if source_address:
|
||||||
|
self.__source_address = Address.wrap(source_address)
|
||||||
|
else:
|
||||||
|
self.__source_address = None
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
# Make sure to close the real socket, not the SSL proxy.
|
# Make sure to close the real socket, not the SSL proxy.
|
||||||
# OpenSSL is really good at screwing up, i.e. when trying to recv from a failed connection,
|
# OpenSSL is really good at screwing up, i.e. when trying to recv from a failed connection,
|
||||||
|
Loading…
Reference in New Issue
Block a user