Made it possible to modify the server_conn.connection attribute,
using the serverconnect stub.
This commit is contained in:
parent
e278ce6455
commit
2ecd89fc51
|
@ -112,7 +112,7 @@ class ServerConnection(tcp.TCPClient, stateobject.StateObject):
|
|||
Attributes:
|
||||
address: Remote address. Can be both a domain or an IP address.
|
||||
ip_address: Resolved remote IP address.
|
||||
source_address: Local IP address
|
||||
source_address: Local IP address or client's source IP address.
|
||||
ssl_established: True if TLS is established, False otherwise
|
||||
cert: The certificate presented by the remote during the TLS handshake
|
||||
sni: Server Name Indication sent by the proxy during the TLS handshake
|
||||
|
|
|
@ -729,10 +729,15 @@ class TCPClient(_Connection):
|
|||
|
||||
def connect(self):
|
||||
try:
|
||||
connection = socket.socket(self.address.family, socket.SOCK_STREAM)
|
||||
if not self.connection:
|
||||
connection = socket.socket(self.address.family, socket.SOCK_STREAM)
|
||||
else:
|
||||
connection = self.connection
|
||||
|
||||
if self.spoof_source_address:
|
||||
try:
|
||||
connection.setsockopt(socket.SOL_IP, 19, 1)
|
||||
if not connection.getsockopt(socket.SOL_IP, 19):
|
||||
connection.setsockopt(socket.SOL_IP, 19, 1)
|
||||
except socket.error as e:
|
||||
raise exceptions.ProtocolException(
|
||||
"Failed to spoof the source address: " + e.strerror)
|
||||
|
|
Loading…
Reference in New Issue