3 Commits

Author SHA1 Message Date
Alexander Bersenev
87f4370927 update ubuntu version in docker 2023-02-20 14:45:21 +05:00
Alexander Bersenev
a978eae922 ignore all new rpc calls instead of closing connection 2023-02-20 14:37:16 +05:00
Alexander Bersenev
88c8c57a44 add handling of some unknown new rpc 2023-02-17 20:16:52 +05:00
2 changed files with 9 additions and 2 deletions

View File

@@ -1,4 +1,4 @@
FROM ubuntu:22.04
FROM ubuntu:22.10
RUN apt-get update && apt-get install --no-install-recommends -y python3 python3-uvloop python3-cryptography python3-socks libcap2-bin ca-certificates && rm -rf /var/lib/apt/lists/*
RUN setcap cap_net_bind_service=+ep /usr/bin/python3.10

View File

@@ -868,6 +868,7 @@ class ProxyReqStreamReader(LayeredStreamReaderBase):
RPC_PROXY_ANS = b"\x0d\xda\x03\x44"
RPC_CLOSE_EXT = b"\xa2\x34\xb6\x5e"
RPC_SIMPLE_ACK = b"\x9b\x40\xac\x3b"
RPC_UNKNOWN = b'\xdf\xa2\x30\x57'
data = await self.upstream.read(1)
@@ -886,8 +887,11 @@ class ProxyReqStreamReader(LayeredStreamReaderBase):
conn_id, confirm = data[4:12], data[12:16]
return confirm, {"SIMPLE_ACK": True}
if ans_type == RPC_UNKNOWN:
return b"", {"SKIP_SEND": True}
print_err("unknown rpc ans type:", ans_type)
return b""
return b"", {"SKIP_SEND": True}
class ProxyReqStreamWriter(LayeredStreamWriterBase):
@@ -1570,6 +1574,9 @@ async def tg_connect_reader_to_writer(rd, wr, user, rd_buf_size, is_upstream):
else:
extra = {}
if extra.get("SKIP_SEND"):
continue
if not data:
wr.write_eof()
await wr.drain()