Removed comments of old code

This commit is contained in:
Adolfo Gómez García 2022-02-05 17:31:31 +01:00
parent fee413aa23
commit f58cc159a7

View File

@ -61,7 +61,7 @@ class Proxy:
# Handshake correct in this point, upgrade the connection to TSL and let
# the protocol controller do the rest
# Upgrade connection to SSL, and use asyncio to handle the rest
transport: 'asyncio.transports.Transport'
protocol: tunnel.TunnelProtocol
@ -71,89 +71,3 @@ class Proxy:
await protocol.finished
return
# try:
# command: bytes = await loop.sock_recv(source, consts.COMMAND_LENGTH)
# if command == consts.COMMAND_TEST:
# logger.info('COMMAND: TEST')
# await loop.sock_sendall(source, b'OK')
# logger.info('TERMINATED %s', prettySource)
# return
# if command in (consts.COMMAND_STAT, consts.COMMAND_INFO):
# logger.info('COMMAND: %s', command.decode())
# # This is an stats requests
# await self.stats(
# full=command == consts.COMMAND_STAT, source=source, address=address
# )
# logger.info('TERMINATED %s', prettySource)
# return
# if command != consts.COMMAND_OPEN:
# # Invalid command
# raise Exception()
# # Now, read a TICKET_LENGTH (64) bytes string, that must be [a-zA-Z0-9]{64}
# ticket: bytes = await source.recv(consts.TICKET_LENGTH)
# # Ticket received, now process it with UDS
# try:
# result = await curio.run_in_thread(
# Proxy.getFromUds, self.cfg, ticket, address
# )
# except Exception as e:
# logger.error('ERROR %s', e.args[0] if e.args else e)
# await source.sendall(b'ERROR_TICKET')
# return
# prettyDest = f"{result['host']}:{result['port']}"
# logger.info('OPEN TUNNEL FROM %s to %s', prettySource, prettyDest)
# except Exception:
# if consts.DEBUG:
# logger.exception('COMMAND')
# logger.error('ERROR from %s', prettySource)
# await source.sendall(b'ERROR_COMMAND')
# return
# # Communicate source OPEN is ok
# await source.sendall(b'OK')
# # Initialize own stats counter
# counter = stats.Stats(self.ns)
# # Open remote server connection
# try:
# destination = await curio.open_connection(
# result['host'], int(result['port'])
# )
# async with curio.TaskGroup(wait=any) as grp:
# await grp.spawn(
# Proxy.doProxy, source, destination, counter.as_sent_counter()
# )
# await grp.spawn(
# Proxy.doProxy, destination, source, counter.as_recv_counter()
# )
# logger.debug('PROXIES READY')
# logger.debug('Proxies finalized: %s', grp.exceptions)
# await curio.run_in_thread(
# Proxy.notifyEndToUds, self.cfg, result['notify'].encode(), counter
# )
# except Exception as e:
# if consts.DEBUG:
# logger.exception('OPEN REMOTE')
# logger.error('REMOTE from %s: %s', address, e)
# finally:
# counter.close() # So we ensure stats are correctly updated on ns
# logger.info(
# 'TERMINATED %s to %s, s:%s, r:%s, t:%s',
# prettySource,
# prettyDest,
# counter.sent,
# counter.recv,
# int(counter.end - counter.start),
# )