ТамТам: реализация 32 опкода. Надеюсь, будет работать

This commit is contained in:
Alexey Polyakov
2026-03-22 16:59:13 +03:00
parent 8d7a1dacb5
commit f2e7e37592
4 changed files with 75 additions and 2 deletions
+6
View File
@@ -3,6 +3,7 @@ from common.proto_tcp import MobileProto
from tamtam.processors import Processors
from common.rate_limiter import RateLimiter
from common.opcodes import Opcodes
from common.tools import Tools
class TTMobileServer:
def __init__(self, host="0.0.0.0", port=443, ssl_context=None, db_pool=None, clients={}, send_event=None):
@@ -18,6 +19,7 @@ class TTMobileServer:
self.proto = MobileProto()
self.processors = Processors(db_pool=db_pool, clients=clients, send_event=send_event)
self.auth_required = Tools().auth_required
# rate limiter
self.auth_rate_limiter = RateLimiter(max_attempts=5, window_seconds=60)
@@ -97,6 +99,10 @@ class TTMobileServer:
if userPhone:
await self._finish_auth(writer, address, userPhone, userId)
case self.opcodes.CONTACT_INFO:
await self.auth_required(
userPhone, self.processors.contact_info, payload, seq, writer
)
case _:
self.logger.warning(f"Неизвестный опкод {opcode}")
except Exception as e: