async def start_client(self, target_node: PeerInfo, on_connect: Callable=None, auth: bool=False, is_feeler: bool=False) -> bool:
    '\n        Tries to connect to the target node, adding one connection into the pipeline, if successful.\n        An on connect method can also be specified, and this will be saved into the instance variables.\n        '
    if self.is_duplicate_or_self_connection(target_node):
        return False
    if ((target_node.host in self.banned_peers) and (time.time() < self.banned_peers[target_node.host])):
        self.log.warning(f'Peer {target_node.host} is still banned, not connecting to it')
        return False
    if auth:
        ssl_context = ssl_context_for_client(self.ca_private_crt_path, self.ca_private_key_path, self._private_cert_path, self._private_key_path)
    else:
        ssl_context = ssl_context_for_client(self.greenberry_ca_crt_path, self.greenberry_ca_key_path, self.p2p_crt_path, self.p2p_key_path)
    session = None
    connection: Optional[WSGreenBerryConnection] = None
    try:
        timeout = ClientTimeout(total=30)
        session = ClientSession(timeout=timeout)
        try:
            if (type(ip_address(target_node.host)) is IPv6Address):
                target_node = PeerInfo(f'[{target_node.host}]', target_node.port)
        except ValueError:
            pass
        url = f'wss://{target_node.host}:{target_node.port}/ws'
        self.log.debug(f'Connecting: {url}, Peer info: {target_node}')
        try:
            ws = (await session.ws_connect(url, autoclose=True, autoping=True, heartbeat=60, ssl=ssl_context, max_msg_size=((50 * 1024) * 1024)))
        except ServerDisconnectedError:
            self.log.debug(f'Server disconnected error connecting to {url}. Perhaps we are banned by the peer.')
            (await session.close())
            return False
        except asyncio.TimeoutError:
            self.log.debug(f'Timeout error connecting to {url}')
            (await session.close())
            return False
        if (ws is not None):
            assert ((ws._response.connection is not None) and (ws._response.connection.transport is not None))
            transport = ws._response.connection.transport
            cert_bytes = transport._ssl_protocol._extra['ssl_object'].getpeercert(True)
            der_cert = x509.load_der_x509_certificate(cert_bytes, default_backend())
            peer_id = bytes32(der_cert.fingerprint(hashes.SHA256()))
            if (peer_id == self.node_id):
                raise RuntimeError(f'Trying to connect to a peer ({target_node}) with the same peer_id: {peer_id}')
            connection = WSGreenBerryConnection(self._local_type, ws, self._port, self.log, True, False, target_node.host, self.incoming_messages, self.connection_closed, peer_id, self._inbound_rate_limit_percent, self._outbound_rate_limit_percent, session=session)
            handshake = (await connection.perform_handshake(self._network_id, protocol_version, self._port, self._local_type))
            assert (handshake is True)
            (await self.connection_added(connection, on_connect))
            connection_type_str = ''
            if (connection.connection_type is not None):
                connection_type_str = connection.connection_type.name.lower()
            self.log.info(f'Connected with {connection_type_str} {target_node}')
            if is_feeler:
                asyncio.create_task(connection.close())
            return True
        else:
            (await session.close())
            return False
    except client_exceptions.ClientConnectorError as e:
        self.log.info(f'{e}')
    except ProtocolError as e:
        if (connection is not None):
            (await connection.close(self.invalid_protocol_ban_seconds, WSCloseCode.PROTOCOL_ERROR, e.code))
        if (e.code == Err.INVALID_HANDSHAKE):
            self.log.warning(f'Invalid handshake with peer {target_node}. Maybe the peer is running old software.')
        elif (e.code == Err.INCOMPATIBLE_NETWORK_ID):
            self.log.warning('Incompatible network ID. Maybe the peer is on another network')
        elif (e.code == Err.SELF_CONNECTION):
            pass
        else:
            error_stack = traceback.format_exc()
            self.log.error(f'Exception {e}, exception Stack: {error_stack}')
    except Exception as e:
        if (connection is not None):
            (await connection.close(self.invalid_protocol_ban_seconds, WSCloseCode.PROTOCOL_ERROR, Err.UNKNOWN))
        error_stack = traceback.format_exc()
        self.log.error(f'Exception {e}, exception Stack: {error_stack}')
    if (session is not None):
        (await session.close())
    return False
Tries to connect to the target node, adding one connection into the pipeline, if successful.
An on connect method can also be specified, and this will be saved into the instance variables.
async def start_client(self, target_node: PeerInfo, on_connect: Callable=None, auth: bool=False, is_feeler: bool=False) -> bool:
    '\n        Tries to connect to the target node, adding one connection into the pipeline, if successful.\n        An on connect method can also be specified, and this will be saved into the instance variables.\n        '
    if self.is_duplicate_or_self_connection(target_node):
        return False
    if ((target_node.host in self.banned_peers) and (time.time() < self.banned_peers[target_node.host])):
        self.log.warning(f'Peer {target_node.host} is still banned, not connecting to it')
        return False
    if auth:
        ssl_context = ssl_context_for_client(self.ca_private_crt_path, self.ca_private_key_path, self._private_cert_path, self._private_key_path)
    else:
        ssl_context = ssl_context_for_client(self.greenberry_ca_crt_path, self.greenberry_ca_key_path, self.p2p_crt_path, self.p2p_key_path)
    session = None
    connection: Optional[WSGreenBerryConnection] = None
    try:
        timeout = ClientTimeout(total=30)
        session = ClientSession(timeout=timeout)
        try:
            if (type(ip_address(target_node.host)) is IPv6Address):
                target_node = PeerInfo(f'[{target_node.host}]', target_node.port)
        except ValueError:
            pass
        url = f'wss://{target_node.host}:{target_node.port}/ws'
        self.log.debug(f'Connecting: {url}, Peer info: {target_node}')
        try:
            ws = (await session.ws_connect(url, autoclose=True, autoping=True, heartbeat=60, ssl=ssl_context, max_msg_size=((50 * 1024) * 1024)))
        except ServerDisconnectedError:
            self.log.debug(f'Server disconnected error connecting to {url}. Perhaps we are banned by the peer.')
            (await session.close())
            return False
        except asyncio.TimeoutError:
            self.log.debug(f'Timeout error connecting to {url}')
            (await session.close())
            return False
        if (ws is not None):
            assert ((ws._response.connection is not None) and (ws._response.connection.transport is not None))
            transport = ws._response.connection.transport
            cert_bytes = transport._ssl_protocol._extra['ssl_object'].getpeercert(True)
            der_cert = x509.load_der_x509_certificate(cert_bytes, default_backend())
            peer_id = bytes32(der_cert.fingerprint(hashes.SHA256()))
            if (peer_id == self.node_id):
                raise RuntimeError(f'Trying to connect to a peer ({target_node}) with the same peer_id: {peer_id}')
            connection = WSGreenBerryConnection(self._local_type, ws, self._port, self.log, True, False, target_node.host, self.incoming_messages, self.connection_closed, peer_id, self._inbound_rate_limit_percent, self._outbound_rate_limit_percent, session=session)
            handshake = (await connection.perform_handshake(self._network_id, protocol_version, self._port, self._local_type))
            assert (handshake is True)
            (await self.connection_added(connection, on_connect))
            connection_type_str = 
            if (connection.connection_type is not None):
                connection_type_str = connection.connection_type.name.lower()
            self.log.info(f'Connected with {connection_type_str} {target_node}')
            if is_feeler:
                asyncio.create_task(connection.close())
            return True
        else:
            (await session.close())
            return False
    except client_exceptions.ClientConnectorError as e:
        self.log.info(f'{e}')
    except ProtocolError as e:
        if (connection is not None):
            (await connection.close(self.invalid_protocol_ban_seconds, WSCloseCode.PROTOCOL_ERROR, e.code))
        if (e.code == Err.INVALID_HANDSHAKE):
            self.log.warning(f'Invalid handshake with peer {target_node}. Maybe the peer is running old software.')
        elif (e.code == Err.INCOMPATIBLE_NETWORK_ID):
            self.log.warning('Incompatible network ID. Maybe the peer is on another network')
        elif (e.code == Err.SELF_CONNECTION):
            pass
        else:
            error_stack = traceback.format_exc()
            self.log.error(f'Exception {e}, exception Stack: {error_stack}')
    except Exception as e:
        if (connection is not None):
            (await connection.close(self.invalid_protocol_ban_seconds, WSCloseCode.PROTOCOL_ERROR, Err.UNKNOWN))
        error_stack = traceback.format_exc()
        self.log.error(f'Exception {e}, exception Stack: {error_stack}')
    if (session is not None):
        (await session.close())
    return False