(self)
sends CONNECT request
sends CONNECT request
sends CONNECT request
def _send_connect_request(self):
        "sends CONNECT request"
        # XXX needs to support v6 ... or something else does
        host = self._addr.host
        port = self._addr.port

        if isinstance(self._addr, (IPv4Address, IPv6Address)):
            is_v6 = isinstance(self._addr, IPv6Address)
            self._data_to_send(
                struct.pack(
                    '!BBBB4sH',
                    5,                   # version
                    0x01,                # command
                    0x00,                # reserved
                    0x04 if is_v6 else 0x01,
                    inet_pton(AF_INET6 if is_v6 else AF_INET, host),
                    port,
                )
            )
        else:
            host = host.encode('ascii')
            self._data_to_send(
                struct.pack(
                    '!BBBBB{}sH'.format(len(host)),
                    5,                   # version
                    0x01,                # command
                    0x00,                # reserved
                    0x03,
                    len(host),
                    host,
                    port,
                )
            )
def _send_connect_request ( self ) : # XXX needs to support v6 ... or something else does host = self . _addr . host port = self . _addr . port if isinstance ( self . _addr , ( IPv4Address , IPv6Address ) ) : is_v6 = isinstance ( self . _addr , IPv6Address ) self . _data_to_send ( struct . pack ( '!BBBB4sH' , 5 , # version 0x01 , # command 0x00 , # reserved 0x04 if is_v6 else 0x01 , inet_pton ( AF_INET6 if is_v6 else AF_INET , host ) , port , ) ) else : host = host . encode ( 'ascii' ) self . _data_to_send ( struct . pack ( '!BBBBB{}sH' . format ( len ( host ) ) , 5 , # version 0x01 , # command 0x00 , # reserved 0x03 , len ( host ) , host , port , ) )