Update tcp.py

This commit is contained in:
rvck 2025-08-06 22:57:42 +07:00 committed by GitHub
parent f7e64c6cb4
commit f724347ddd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -213,9 +213,7 @@ class SOCKS4Handler:
writer: asyncio.StreamWriter,
reader: asyncio.StreamReader,
destination: Tuple[str, int],
*,
username: Optional[str] = None,
timeout: int = 10,
username: Optional[str] = None
) -> None:
"""Perform SOCKS4 handshake."""
host, port = destination
@ -224,7 +222,7 @@ class SOCKS4Handler:
writer.write(request)
await writer.drain()
response = await asyncio.wait_for(reader.read(8), timeout)
response = await asyncio.wait_for(reader.read(8), 10)
if len(response) != 8 or response[0] != 0x00 or response[1] != 0x5A:
raise ConnectionError("SOCKS4 connection failed")