{"id":26178471,"url":"https://github.com/houshmand-2005/v2iplimit","last_synced_at":"2025-04-05T02:04:29.522Z","repository":{"id":161972835,"uuid":"615935016","full_name":"houshmand-2005/V2IpLimit","owner":"houshmand-2005","description":"Limiting the number of active users with IP","archived":false,"fork":false,"pushed_at":"2025-03-17T09:58:56.000Z","size":2749,"stargazers_count":155,"open_issues_count":14,"forks_count":40,"subscribers_count":3,"default_branch":"houshmand","last_synced_at":"2025-03-29T01:05:35.717Z","etag":null,"topics":["ip-limit","python","v2ray","xray-core"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/houshmand-2005.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-03-19T05:27:57.000Z","updated_at":"2025-03-19T20:59:19.000Z","dependencies_parsed_at":"2023-11-18T20:25:59.399Z","dependency_job_id":"70e718a2-ec5d-4540-8df2-e35acf419885","html_url":"https://github.com/houshmand-2005/V2IpLimit","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/houshmand-2005%2FV2IpLimit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/houshmand-2005%2FV2IpLimit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/houshmand-2005%2FV2IpLimit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/houshmand-2005%2FV2IpLimit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/houshmand-2005","download_url":"https://codeload.github.com/houshmand-2005/V2IpLimit/tar.gz/refs/heads/houshmand","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247276163,"owners_count":20912288,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ip-limit","python","v2ray","xray-core"],"created_at":"2025-03-11T21:28:46.127Z","updated_at":"2025-04-05T02:04:29.481Z","avatar_url":"https://github.com/houshmand-2005.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ccenter\u003e\n\n# V2IpLimit\n\n\u003cb\u003eLimiting the number of active users with IP for [Marzban](https://github.com/Gozargah/Marzban)\u003c/b\u003e\u003csub\u003e (with xray logs)\u003c/sub\u003e\u003cbr\u003e\nSupports both IPv4 and IPv6 And Marzban-node\n\u003csub\u003e(Tested on Ubuntu 22.04 \u0026 24.04, Fedora 39 \u0026 40)\u003c/sub\u003e\n\n\u003c/center\u003e\n\n\u003chr\u003e\n\n## Table of Contents\n\n- [Installation](#installation)\n- [Telegram Bot Commands](#telegram-bot-commands)\n- [Common Issues and Solutions](#common-issues-and-solutions)\n- [Using Cron Jobs](#using-cron-jobs)\n- [Build](#build)\n- [Donations](#donations)\n\n## Installation\n\nYou can install V2IpLimit by running the following command in your terminal:\n\n```bash\nbash \u003c(curl -sSL https://houshmand-2005.github.io/v2iplimit.sh)\n```\n\nAfter running the command, you will see a menu with the following options:\n\n```\n-----------------------------\n1. Start the script\n2. Stop the script\n3. Attach to the script\n4. Update the script\n5. Create or Update telegram BOT_TOKEN\n6. Create or Update ADMINS\n7. Exit\n-----------------------------\nEnter your choice:\n```\n\n![Loading Gif](readme_files/1.gif)\n\nAnd after that you need input your panel information and other settings:\n\n![Loading Gif](readme_files/1.png)\n\nAfter that script runs automatically and you can see the logs.\n\n## Telegram Bot Commands\n\nV2IpLimit can be controlled via a Telegram bot. Here are the available commands:\n\n- `/start`: Start the bot.\n- `/create_config`: Configure panel information (username, password, etc.).\n- `/set_special_limit`: Set a specific IP limit for each user (e.g., test_user limit: 5 ips).\n- `/show_special_limit`: Show the list of special IP limits.\n- `/add_admin`: Give access to another chat ID and create a new admin for the bot.\n- `/admins_list`: Show the list of active bot admins.\n- `/remove_admin`: Remove an admin's access to the bot.\n- `/country_code`: Set your country. Only IPs related to that country are counted (to increase accuracy).\n- `/set_except_user`: Add a user to the exception list.\n- `/remove_except_user`: Remove a user from the exception list.\n- `/show_except_users`: Show the list of users in the exception list.\n- `/set_general_limit_number`: Set the general limit number. If a user is not in the special limit list, this is their limit number.\n- `/set_check_interval`: Set the check interval time.\n- `/set_time_to_active_users`: Set the time to active users.\n- `/backup`: Send the 'config.json' file.\n\n## Common Issues and Solutions\n\n1.  **Incorrect Count of Connected IPs**\n\n    - Why does the number of detected IPs decrease after a while?\n    - This problem arises when the WebSocket connection becomes corrupted during log transmission. How ever in the new version of this script this problem mostly solved. But if you still have this problem you can use [CronJob](#using-cron-jobs) method\n\n2.  **Uninstalling V2IpLimit Script**\n\n    - How can I uninstall the V2IpLimit script?\n    - Simply Stop the script and then delete the script folder.\n\n3.  **Connections Persisting After Disabling**\n\n    - Users remain connected even after disabling. Why?\n    - This issue is related to the xray core. Connections persist until the user manually closes them. So you have to wait a little until all the connections are closed\n\n4.  **Restarting After Changing JSON Config File**\n\n    - Is a restart needed after modifying the JSON config file?\n    - No, a restart isn't necessary. The program adapts to changes in the JSON file in short time.\n\n5.  **Running Script on Different VPS**\n\n    - Can I run the script on a different VPS?\n    - Absolutely, the script is flexible and works seamlessly on any VPS or even on your local machine.\n\n6.  **Tunneling and User IP Detection**\n\n    - Tunneling returns the tunnel server IP for users. Any solutions?\n    - Tunneling poses challenges. For better IP detection, consider alternative methods [Read More Here](https://github.com/houshmand-2005/V2IpLimit/issues/3)\n\n7.  **I'm using haproxy why I don't have logs**\n\n    - You need to add this to your haproxy config file:\n      `option forwardfor`\n      And then restart your haproxy service.\n\n8.  **I'm not using tunnel or haproxy or anything else but still I don't have logs**\n\n    - you need add this to your xray config file(If it doesn't exist) :\n      ```json\n      \"log\": {\n          \"loglevel\": \"info\"\n      },\n      ```\n\n    And also See this issue : [Read More Here](https://github.com/houshmand-2005/V2IpLimit/issues/32)\n\nIf you still have a problem you can open an issue on the [issues page](https://github.com/houshmand-2005/V2IpLimit/issues)\u003cbr\u003e\n**And also you can still use the old version of this script** [here](https://github.com/houshmand-2005/V2IpLimit/tree/old_version)\n\n## Using Cron Jobs\n\nTo ensure that _V2IpLimit_ runs regularly or automatically after a reboot, you can set up a cron job.  \n_Note:_ cronjob is **not recommended** for normal work, but if you need just make sure you put Telegram `BOT_TOKEN` and `ADMINS` in the `config.json` file. And also you can still check logs with\n\n```bash\nbash \u003c(curl -sSL https://houshmand-2005.github.io/v2iplimit.sh)\n```\n\nand then choose `3. Attach to the script`\u003cbr\u003e\n\nHere's how you can do it. Open your crontab file for editing:\n\n```bash\ncrontab -e\n```\n\nAdd a new line to schedule script. For example:\n\n```bash\n0 */6 * * * bash \u003c(curl -sSL https://houshmand-2005.github.io/v2iplimit.sh) stop \u0026\u0026 bash \u003c(curl -sSL https://houshmand-2005.github.io/v2iplimit.sh) start\n```\n\nOr run at system reboot:\n\n```bash\n@reboot bash \u003c(curl -sSL https://houshmand-2005.github.io/v2iplimit.sh) start\n```\n\nYou can learn more about cron job scheduling by checking the [Cron Howto](https://help.ubuntu.com/community/CronHowto) guide.\n\n## Build\n\nV2IpLimit provides pre-built versions for Windows and Linux (both amd64 and arm64) which can be found on the [releases page](https://github.com/houshmand-2005/V2IpLimit/releases).\n\nThe Windows_amd64 and Linux_amd64 builds are created using GitHub Actions. You can check the build details on the [actions page](https://github.com/houshmand-2005/V2IpLimit/actions/).\n\nThe Linux_arm64 build is created on a local machine due to GitHub's lack of ARM machines and the build method's lack of support for Cross Compiling. However, you can build it on your own machine, or use GitHub Actions to build it on your own.\u003cbr\u003e\nIf you want to build V2IpLimit yourself, you'll first need to install the build essentials, which includes gcc, g++, and more. You can do this with the following command:\n\n```bash\nsudo apt install build-essential\n```\n\nNext, install the necessary dependencies:\u003cbr\u003e\n`pip install -r build_requirements.txt`\u003cbr\u003e\nAnd at the end you build it with [nuitka](https://nuitka.net/)\u003cbr\u003e\n\n```bash\npython3 -m nuitka --standalone --onefile --follow-imports --include-plugin-directory=utils --include-package=websockets,logging --python-flag=\"-OO\" v2iplimit.py\n```\n\n### Running Without Building\n\nYou can also use this program without building it. Just install the dependencies and run it normally:\n\n```bash\ngit clone https://github.com/houshmand-2005/V2IpLimit.git\ncd V2IpLimit\npip install -r requirements.txt\npython3 v2iplimit.py\n```\n\nthen like older version you can use `screen` and `cornjob` to run it in background.\u003csub\u003e(And also don't forget to add your panel information and bot token and telegram user id to config.json file)\u003c/sub\u003e\u003cbr\u003e\n[run with screen](https://github.com/houshmand-2005/V2IpLimit/blob/old_version/Marzban/README.md#screen)\u003cbr\u003e\n[run with cornjob](https://github.com/houshmand-2005/V2IpLimit/blob/old_version/Marzban/README.md#screen)\u003cbr\u003e\n\n\u003csub\u003e\nAnd a small side note if you want to make any changes to the code and then test it, you can use the `core_test.py` file to test the core functions of the program.(Please note that running this make your panel unstable so make sure you run it on a test panel)\n\u003c/sub\u003e\n\n\u003chr\u003e\n\n## Donations\n\nIf you found V2IpLimit useful and would like to support its development, you can donate on the following crypto network:\n\n- TRON network (TRX): `TLARb1Ns5vA7pH6wqSyZGreDbGooS85Mi5`\n\nThank you for your support!\n\nIf this program was useful for you, please give it a star ⭐\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhoushmand-2005%2Fv2iplimit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhoushmand-2005%2Fv2iplimit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhoushmand-2005%2Fv2iplimit/lists"}