Skip to content

Releases: Amogrotex/NSplusthon

v1.8.1 — audit fixes

Choose a tag to compare

@Amogrotex Amogrotex released this 24 Aug 13:32
5017b47

1.8.1

FSM, moderation, license, and shipping fixes on top of 1.8.0.

Fixes

  • FSM SQLiteStorage.update_data is a single BEGIN IMMEDIATE transaction
  • AntiFlood / WarnManager / RateLimiter evict idle keys
  • LinkGuard matches parsed hostnames (not substrings)
  • Night lock is opt-in; exempt_user_ids / is_admin skip inspection
  • OpenSSL AES-IGE reuses the key schedule
  • Plain GPL-3.0 LICENSE plus NOTICE / THIRD_PARTY.md (Telethon + SPlusthon)
  • Examples no longer prompt for Telegram API credentials

Install

pip install -U nsplusthon
pip install -U "nsplusthon[fast]"

What's Changed

Full Changelog: v1.7.0...v1.8.1

v1.7.0 - High-Performance MTProto Engine, Middleware Pipeline & Soroush Detection

Choose a tag to compare

@Amogrotex Amogrotex released this 23 Aug 22:48

🚀 NSplusthon v1.7.0

A major performance, reliability, and feature release for NSplusthon — the modern asynchronous Soroush Plus client library in Python.


⚡ Key Highlights & Upgrades:

  1. 🚀 1,700x Faster Cryptography & Hardware AES:

    • Hardware-accelerated AES-CTR stream cipher with for WebSocket obfuscation (boosted from 0.36 MB/s to 637 MB/s).
    • 16x faster AES-IGE MTProto payload encryption/decryption.
  2. 🏎️ Zero-Copy Binary & TL Serialization:

    • Pre-compiled struct parsers (, , , , , ).
    • Direct O(1) byte index lookups in .
    • Zero-copy tuple padding in .
  3. 🛡️ Active MTProto CircuitBreaker:

    • State-managed fault isolation (, , ) preventing socket hangs during DC latency spikes and auto-recovering stalled connections.
  4. 🧅 Middleware Pipeline Architecture:

    • Onion-style middleware pipeline (, ) for global event logging, rate limiting, and auth guards.
  5. 🔍 Full Soroush Plus Detection Suite:

    • Comprehensive parser in supporting all Soroush Plus domains (, , , ) and URIs (, ).
    • auto-classifies users, groups, channels, invite links, and marked IDs.
  6. 💬 Interactive Conversation API:

    • Linear Q&A flows in DMs () with , , and auto-timeout.
  7. 👥 Multi-Account ClientPool:

    • for managing multiple Soroush accounts in a single process with round-robin load-balancing and multi-client event broadcasting.
  8. ⌨️ Fluent Keyboard Builder:

    • for clean inline and reply markups.
  9. 🗑️ Bulk Message Deletion Engine:

    • for high-throughput, flood-safe message purging.
  10. 💾 Zero-Lag SQLite Sessions:

    • Configured with SQLite WAL mode, 64 MB memory-mapped I/O, and 8 MB cache.
  11. 🌐 512 KB WebSocket Buffers:

    • Upgraded socket buffers from 64 KB to 512 KB with TCP_NODELAY and QuickACK.

🧪 Quality Assurance:

  • 93/93 Unit & Integration Tests Passing (100% test suite success).

💻 Installation:

Collecting nsplusthon
Downloading nsplusthon-1.3.5-py3-none-any.whl.metadata (10 kB)
Requirement already satisfied: pyaes in /usr/local/lib/python3.13/site-packages (from nsplusthon) (1.6.1)
Requirement already satisfied: rsa in /usr/local/lib/python3.13/site-packages (from nsplusthon) (4.9.1)
Requirement already satisfied: aiohttp in /usr/local/lib/python3.13/site-packages (from nsplusthon) (3.14.1)
Requirement already satisfied: aiohappyeyeballs>=2.5.0 in /usr/local/lib/python3.13/site-packages (from aiohttp->nsplusthon) (2.7.1)
Requirement already satisfied: aiosignal>=1.4.0 in /usr/local/lib/python3.13/site-packages (from aiohttp->nsplusthon) (1.4.0)
Requirement already satisfied: attrs>=17.3.0 in /usr/local/lib/python3.13/site-packages (from aiohttp->nsplusthon) (26.1.0)
Requirement already satisfied: frozenlist>=1.1.1 in /usr/local/lib/python3.13/site-packages (from aiohttp->nsplusthon) (1.8.0)
Requirement already satisfied: multidict<7.0,>=4.5 in /usr/local/lib/python3.13/site-packages (from aiohttp->nsplusthon) (6.7.1)
Requirement already satisfied: propcache>=0.2.0 in /usr/local/lib/python3.13/site-packages (from aiohttp->nsplusthon) (0.5.2)
Requirement already satisfied: yarl<2.0,>=1.17.0 in /usr/local/lib/python3.13/site-packages (from aiohttp->nsplusthon) (1.24.5)
Requirement already satisfied: idna>=2.0 in /usr/local/lib/python3.13/site-packages (from yarl<2.0,>=1.17.0->aiohttp->nsplusthon) (3.18)
Requirement already satisfied: pyasn1>=0.1.3 in /usr/local/lib/python3.13/site-packages (from rsa->nsplusthon) (0.6.4)
Downloading nsplusthon-1.3.5-py3-none-any.whl (675 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 675.8/675.8 kB 22.2 MB/s 0:00:00
Installing collected packages: nsplusthon
Successfully installed nsplusthon-1.3.5

v1.3.0

Choose a tag to compare

@Amogrotex Amogrotex released this 22 Aug 08:27

What's new in 1.3.0

🎛️ Command Router (nsplusthon.router)

The first command framework for Soroush Plus bots:

  • @router.command('start', description=..., usage=...) decorators
  • auto-generated /help
  • onion middleware (log, guard, short-circuit)
  • per-user / per-chat state dicts
  • --key value / --key=value args, / and ! prefixes, @BotName filtering
  • client.use_router(router) one-liner wiring

🚦 Rate Limiter (nsplusthon.ratelimit)

Asyncio sliding-window limiter, per-key — router.use_rate_limit(40, 60)
shapes outgoing traffic so long-running bots stop eating FloodWaits.

🔐 Encrypted Sessions

StringSession.encrypt_session(...) / decrypt_session / from_encrypted —
passphrase-protected session strings (AES-IGE + PBKDF2-SHA256).

⚡ Performance: 25× faster import

PEP 562 lazy package init: import nsplusthon went from ~340 ms → ~15 ms
(client stack loads only when requested). New benchmarks/microbench.py
keeps the numbers honest:

Operation Time
import nsplusthon ~15 ms
TL pack (SendMessageRequest) 2.4 µs
StringSession restore 5.6 µs
Router parse + resolve 2.3 µs
AES-IGE 64 KB 99.6 MiB/s

📚 Docs

New Persian doc page: Command Router

Tests: 24 new (router / ratelimit / session encryption), all passing.


pip install -U "nsplusthon[fast]"

v1.2.1

Choose a tag to compare

@Amogrotex Amogrotex released this 22 Aug 07:11

What's new in 1.2.1

📞 Phone number normalization on login

Login now accepts all common phone formats — every one is normalized to the
digit-only international format Soroush Plus expects:

You type Sent to the server
+98935… 98935…
+980935… 98935… (leading 0 after the country code is dropped)
0935… 98935… (local number — 98 is added)
0098935… 98935…

Formatting characters (spaces, dashes, dots, parentheses) are ignored, and
non-Iranian international numbers pass through unchanged.

All login paths are covered — send_code_request, sign_in and code resend —
since they all go through utils.parse_phone.


pip install -U "nsplusthon[fast]"

v1.2.0

Choose a tag to compare

@Amogrotex Amogrotex released this 22 Aug 07:02

What's new in 1.2.0

📦 Packaging & typing

  • Modernized packaging: PEP 621 pyproject.toml with extras (cryptg, socks, fast, dev)
  • Requires Python 3.9+ (dropped 3.5–3.8)
  • Ships py.typed — full type support for Pyright / Pylance / mypy

⚡ Performance

  • ~18× faster AES-IGE on the libssl path: from_buffer_copy instead of per-byte ctypes marshalling (100.1 MiB/s vs 5.6 MiB/s)
  • Optimized pure-Python AES-IGE fallback (single big-int XOR per block)
  • TCP_NODELAY + enlarged socket buffers to cut per-message latency

📚 Docs & tooling

  • Polished documentation site (MkDocs Material, RTL / Persian)
  • Refreshed examples, PR template and license files

pip install "nsplusthon[fast]"