IP-based device limit enforcement for Marzneshin panels.
Fork of V2IpLimit by Houshmand, adapted for the Marzneshin panel with multi-node support and a REST API for real-time device counting.
| V2IpLimit (original) | V3IpLimit (this fork) | |
|---|---|---|
| Panel | Marzban | Marzneshin |
| Auth | POST /api/admin/token |
POST /api/admins/token (OAuth2) |
| User API | Marzban REST endpoints | Marzneshin gRPC-compatible REST |
| Log source | Remote node WebSocket | Local marznode Xray/sing-box access log |
| Device counter | Per-node IP count | Multi-node aggregated + REST API (/api/devices) |
| Set limit | Local config.json | HTTP POST /api/set_limit |
| HY2 support | No | Yes (sing-box log parsing) |
┌─────────────┐ REST API ┌──────────────┐
│ VPN client │ ──GET /devices──→│ │
└─────────────┘ │ V3IpLimit │
┌─────────────┐ set_limit │ :7070 │
│ Purchase │ ──POST /api/────→│ │
│ bot │ │ │
└─────────────┘ │ Monitors: │
│ • Xray log │
┌─────────────┐ │ • Sing-box │
│ Marzneshin │ ←──disable/──→ │ • Enforces │
│ panel │ enable users │ IP limit │
└─────────────┘ └──────────────┘
V3IpLimit tails the local marznode access logs (Xray + sing-box), counts unique IPs per user, and disables users who exceed their configured IP limit. A companion REST API serves real-time connection data to VPN client apps and accepts per-user limit overrides from purchase bots.
git clone https://github.com/arsenii-cmd/V3IpLimit.git
cd V3IpLimit
pip install -r requirements.txtCreate a config.json:
{
"PANEL_USERNAME": "your_admin_user",
"PANEL_PASSWORD": "your_admin_password",
"PANEL_DOMAIN": "panel.example.com:443",
"BOT_TOKEN": "123:abc",
"ADMINS": [123456789],
"GENERAL_LIMIT_NUMBER": 5,
"TIME_TO_ACTIVE_USERS": 300,
"CHECK_INTERVAL": 30
}Run:
python v2iplimit.pyThe REST API will be available on http://127.0.0.1:7070. Serve it via a reverse proxy
(Caddy, nginx) at /devices/*.
All endpoints require ?key=<API_KEY> (set via DEVICE_API_KEY env var).
| Method | Path | Description |
|---|---|---|
GET |
/api/devices |
All active users with IP counts |
GET |
/api/devices/{username_or_token} |
By username OR subscription token |
GET |
/api/devices/sub/{token} |
Explicit subscription token lookup |
GET |
/health |
Service health check |
POST |
/api/set_limit |
Override IP limit for a specific user |
V3IpLimit can run an optional Telegram bot for monitoring and administration.
Set BOT_TOKEN and ADMINS in config.json to enable it.
Commands: /start, /create_config, /set_special_limit, /show_special_limit,
/set_general_limit_number, /backup, and more.
MIT — same as the original V2IpLimit.
Copyright (c) 2023 Houshmand
Copyright (c) 2025–2026 V3IpLimit contributors
Original project: github.com/houshmand-2005/V2IpLimit