MCPcopy Create free account
hub / github.com/masterking32/MasterHttpRelayVPN / _on_socks_client

Method _on_socks_client

src/proxy/proxy_server.py:515–540  ·  view source on GitHub ↗
(self, reader: asyncio.StreamReader,
                               writer: asyncio.StreamWriter)

Source from the content-addressed store, hash-verified

513 pass
514
515 async def _on_socks_client(self, reader: asyncio.StreamReader,
516 writer: asyncio.StreamWriter):
517 addr = writer.get_extra_info("peername")
518 task = self._track_current_task()
519 try:
520 result = await negotiate_socks5(reader, writer)
521 if result is None:
522 return
523 host, port = result
524 log.info("SOCKS5 CONNECT → %s:%d", host, port)
525 await self._handle_target_tunnel(host, port, reader, writer)
526 except asyncio.IncompleteReadError:
527 pass
528 except asyncio.CancelledError:
529 pass
530 except asyncio.TimeoutError:
531 log.debug("SOCKS5 timeout: %s", addr)
532 except Exception as e:
533 log.error("SOCKS5 error (%s): %s", addr, e)
534 finally:
535 self._untrack_task(task)
536 try:
537 writer.close()
538 await writer.wait_closed()
539 except Exception:
540 pass
541
542 # ── CONNECT (HTTPS tunnelling) ────────────────────────────────
543

Callers

nothing calls this directly

Calls 5

_track_current_taskMethod · 0.95
_handle_target_tunnelMethod · 0.95
_untrack_taskMethod · 0.95
negotiate_socks5Function · 0.85
closeMethod · 0.45

Tested by

no test coverage detected