Hi Alex,
First off, thanks for the lightweight script! It made the whole setup really easy to handle.
1- I’ve been running this on my home network for about 10 friends and family members via port forwarding. I've noticed the traffic usage is unexpectedly high for just 10 people. I also added a few features myself, like a Web GUI and a "one unique IP per secret" limit.
Here’s the weird part: when I sum up everyone's upload/download data, it’s only around 300-400 MB per day. But when I check the Python script’s actual usage in NetWorx, it’s hitting 1 to 1.5 GB!
I'm using USER_MAX_TCP_CONNS to keep connections between 1 and 6. Do you think this limit is causing the extra data overhead? The connection counts in the stats look pretty crazy:
Stats for 12.04.2026 21:08:38
user1: 7171 connects (0 current), 9.91 MB, 2390 msgs
user2: 794 connects (3 current), 5.73 MB, 2737 msgs
user3: 0 connects (0 current), 0.00 MB, 0 msgs
user4: 594 connects (0 current), 3.42 MB, 1717 msgs
user5: 1707 connects (0 current), 16.91 MB, 3199 msgs
user6: 0 connects (0 current), 7.53 MB, 0 msgs
user7: 0 connects (0 current), 0.00 MB, 0 msgs
user8: 1420 connects (0 current), 149.45 MB, 8636 msgs
user9: 12 connects (0 current), 0.10 MB, 38 msgs
user10: 921 connects (0 current), 6.04 MB, 1776 msgs
user11: 3582 connects (0 current), 11.02 MB, 3419 msgs
user12: 392 connects (0 current), 9.67 MB, 3299 msgs
user13: 125 connects (0 current), 5.83 MB, 881 msgs
Also, when the connection limit is on, I get a flood of errors in the console whenever someone opens a chat or downloads a small file. The server still works fine, but the logs just keep piling up.
error logs:
Exception in callback _ProactorBasePipeTransport._call_connection_lost()
handle: <Handle _ProactorBasePipeTransport._call_connection_lost()>
Traceback (most recent call last):
File "D:\Program Files\Python314\Lib\asyncio\events.py", line 94, in _run
self._context.run(self._callback, *self._args)
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Program Files\Python314\Lib\asyncio\proactor_events.py", line 165, in _call_connection_lost
self._sock.shutdown(socket.SHUT_RDWR)
~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine
Exception in callback _ProactorBasePipeTransport._call_connection_lost()
handle: <Handle _ProactorBasePipeTransport._call_connection_lost()>
Traceback (most recent call last):
File "D:\Program Files\Python314\Lib\asyncio\events.py", line 94, in _run
self._context.run(self._callback, *self._args)
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Program Files\Python314\Lib\asyncio\proactor_events.py", line 165, in _call_connection_lost
self._sock.shutdown(socket.SHUT_RDWR)
~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine
Exception in callback _ProactorBasePipeTransport._call_connection_lost()
handle: <Handle _ProactorBasePipeTransport._call_connection_lost()>
Traceback (most recent call last):
File "D:\Program Files\Python314\Lib\asyncio\events.py", line 94, in _run
self._context.run(self._callback, *self._args)
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Program Files\Python314\Lib\asyncio\proactor_events.py", line 165, in _call_connection_lost
self._sock.shutdown(socket.SHUT_RDWR)
~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine
Exception in callback _ProactorBasePipeTransport._call_connection_lost()
handle: <Handle _ProactorBasePipeTransport._call_connection_lost()>
Traceback (most recent call last):
File "D:\Program Files\Python314\Lib\asyncio\events.py", line 94, in _run
self._context.run(self._callback, *self._args)
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Program Files\Python314\Lib\asyncio\proactor_events.py", line 165, in _call_connection_lost
self._sock.shutdown(socket.SHUT_RDWR)
~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine
Exception in callback _ProactorBasePipeTransport._call_connection_lost()
handle: <Handle _ProactorBasePipeTransport._call_connection_lost()>
Traceback (most recent call last):
File "D:\Program Files\Python314\Lib\asyncio\events.py", line 94, in _run
self._context.run(self._callback, *self._args)
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Program Files\Python314\Lib\asyncio\proactor_events.py", line 165, in _call_connection_lost
self._sock.shutdown(socket.SHUT_RDWR)
~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine
Exception in callback _ProactorBasePipeTransport._call_connection_lost()
handle: <Handle _ProactorBasePipeTransport._call_connection_lost()>
Traceback (most recent call last):
File "D:\Program Files\Python314\Lib\asyncio\events.py", line 94, in _run
self._context.run(self._callback, *self._args)
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Program Files\Python314\Lib\asyncio\proactor_events.py", line 165, in _call_connection_lost
self._sock.shutdown(socket.SHUT_RDWR)
~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine
Exception in callback _ProactorBasePipeTransport._call_connection_lost()
handle: <Handle _ProactorBasePipeTransport._call_connection_lost()>
Traceback (most recent call last):
File "D:\Program Files\Python314\Lib\asyncio\events.py", line 94, in _run
self._context.run(self._callback, *self._args)
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Program Files\Python314\Lib\asyncio\proactor_events.py", line 165, in _call_connection_lost
self._sock.shutdown(socket.SHUT_RDWR) ...
I just want to restrict users from downloading media or large videos.
If the MAX_TCP_CONN limit is causing these issues, I should probably modify the code to limit user speeds instead, or explore other ways to achieve this.
any suggestion?
or do you think this data usage behavior is normal for Mtproto protocol and its handshake ?
2- Let me know if you think my changes for web gui and ip restriction are useful—I’d be happy to send over a pull request!
Hi Alex,
First off, thanks for the lightweight script! It made the whole setup really easy to handle.
1- I’ve been running this on my home network for about 10 friends and family members via port forwarding. I've noticed the traffic usage is unexpectedly high for just 10 people. I also added a few features myself, like a Web GUI and a "one unique IP per secret" limit.
Here’s the weird part: when I sum up everyone's upload/download data, it’s only around 300-400 MB per day. But when I check the Python script’s actual usage in NetWorx, it’s hitting 1 to 1.5 GB!
I'm using USER_MAX_TCP_CONNS to keep connections between 1 and 6. Do you think this limit is causing the extra data overhead? The connection counts in the stats look pretty crazy:
Also, when the connection limit is on, I get a flood of errors in the console whenever someone opens a chat or downloads a small file. The server still works fine, but the logs just keep piling up.
error logs:
I just want to restrict users from downloading media or large videos.
If the MAX_TCP_CONN limit is causing these issues, I should probably modify the code to limit user speeds instead, or explore other ways to achieve this.
any suggestion?
or do you think this data usage behavior is normal for Mtproto protocol and its handshake ?
2- Let me know if you think my changes for web gui and ip restriction are useful—I’d be happy to send over a pull request!