Code Monkey home page Code Monkey logo

v2iplimit's Introduction

V2IpLimit

Limiting the number of active users with IP (with xray logs)
Supports both IPv4 and IPv6 And Marzban-node


Table of Contents

Installation

You can install V2IpLimit by running the following command in your terminal:

bash <(curl -sSL https://houshmand-2005.github.io/v2iplimit.sh)

After running the command, you will see a menu with the following options:

-----------------------------
1. Start the script
2. Stop the script
3. Attach to the script
4. Update the script
5. Create or Update telegram BOT_TOKEN
6. Create or Update ADMINS
7. Exit
-----------------------------
Enter your choice:

Loading Gif

And after that you need input your panel information and other settings:

Loading Gif

After that script runs automatically and you can see the logs.

Telegram Bot Commands

V2IpLimit can be controlled via a Telegram bot. Here are the available commands:

  • /start: Start the bot.
  • /create_config: Configure panel information (username, password, etc.).
  • /set_special_limit: Set a specific IP limit for each user (e.g., test_user limit: 5 ips).
  • /show_special_limit: Show the list of special IP limits.
  • /add_admin: Give access to another chat ID and create a new admin for the bot.
  • /admins_list: Show the list of active bot admins.
  • /remove_admin: Remove an admin's access to the bot.
  • /country_code: Set your country. Only IPs related to that country are counted (to increase accuracy).
  • /set_except_user: Add a user to the exception list.
  • /remove_except_user: Remove a user from the exception list.
  • /show_except_users: Show the list of users in the exception list.
  • /set_general_limit_number: Set the general limit number. If a user is not in the special limit list, this is their limit number.
  • /set_check_interval: Set the check interval time.
  • /set_time_to_active_users: Set the time to active users.
  • /backup: Send the 'config.json' file.

Common Issues and Solutions

  1. Incorrect Count of Connected IPs

    • Why does the number of detected IPs decrease after a while?
    • This problem arises when the WebSocket connection becomes corrupted during log transmission. So you can use CronJob(for now it isn't available) method
  2. Uninstalling V2IpLimit Script

    • How can I uninstall the V2IpLimit script?
    • Simply Stop the script and then delete the script folder.
  3. Connections Persisting After Disabling

    • Users remain connected even after disabling. Why?
    • 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
  4. Restarting After Changing JSON Config File

    • Is a restart needed after modifying the JSON config file?
    • No, a restart isn't necessary. The program adapts to changes in the JSON file in short time.
  5. Running Script on Different VPS

    • Can I run the script on a different VPS?
    • Absolutely, the script is flexible and works seamlessly on any VPS or even on your local machine.
  6. Tunneling and User IP Detection

    • Tunneling returns the tunnel server IP for users. Any solutions?
    • Tunneling poses challenges. For better IP detection, consider alternative methods Read More Here
  7. I'm using haproxy why I don't have logs

    • You need to add this to your haproxy config file: option forwardfor And then restart your haproxy service.
  8. I'm not using tunnel or haproxy or anything else but still I don't have logs

    • you need add this to your xray config file(If it doesn't exist) :
      "log": {
          "loglevel": "info"
      },

    And also See this issue : Read More Here

If you still have a problem you can open an issue on the issues page
And also you can still use the old version of this script here

Build

V2IpLimit provides pre-built versions for Windows and Linux (both amd64 and arm64) which can be found on the releases page.

The Windows_amd64 and Linux_amd64 builds are created using GitHub Actions. You can check the build details on the actions page.

The 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.
If 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:

sudo apt install build-essential

Next, install the necessary dependencies:
pip install -r build_requirements.txt
And at the end you build it with nuitka

python3 -m nuitka --standalone --onefile --follow-imports --include-plugin-directory=utils --include-package=websockets,logging --python-flag="-OO" v2iplimit.py

Running Without Building

You can also use this program without building it. Just install the dependencies and run it normally:

git clone https://github.com/houshmand-2005/V2IpLimit.git
cd V2IpLimit
pip install -r requirements.txt
python3 v2iplimit.py

then like older version you can use screen and cornjob to run it in background.(And also don't forget to add your panel information and bot token and telegram user id to config.json file)
run with screen
run with cornjob

And 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)

Donations

If you found V2IpLimit useful and would like to support its development, you can donate on the following crypto network:

  • TRON network (TRX): TLARb1Ns5vA7pH6wqSyZGreDbGooS85Mi5

Thank you for your support!

If this program was useful for you, please give it a star โญ

v2iplimit's People

Contributors

houshmand-2005 avatar erfjab avatar dependabot[bot] avatar nikita-safonov avatar

Stargazers

aliazad avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.