mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2026-01-03 05:54:51 +00:00
Update tcp.py
This commit is contained in:
parent
f7e64c6cb4
commit
f724347ddd
1 changed files with 2 additions and 4 deletions
|
|
@ -213,9 +213,7 @@ class SOCKS4Handler:
|
||||||
writer: asyncio.StreamWriter,
|
writer: asyncio.StreamWriter,
|
||||||
reader: asyncio.StreamReader,
|
reader: asyncio.StreamReader,
|
||||||
destination: Tuple[str, int],
|
destination: Tuple[str, int],
|
||||||
*,
|
username: Optional[str] = None
|
||||||
username: Optional[str] = None,
|
|
||||||
timeout: int = 10,
|
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Perform SOCKS4 handshake."""
|
"""Perform SOCKS4 handshake."""
|
||||||
host, port = destination
|
host, port = destination
|
||||||
|
|
@ -224,7 +222,7 @@ class SOCKS4Handler:
|
||||||
writer.write(request)
|
writer.write(request)
|
||||||
await writer.drain()
|
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:
|
if len(response) != 8 or response[0] != 0x00 or response[1] != 0x5A:
|
||||||
raise ConnectionError("SOCKS4 connection failed")
|
raise ConnectionError("SOCKS4 connection failed")
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue