multi_3x_ui
A tool for managing multiple 3x-ui panels at once.
Overview
This module is based on py3xui.
Used dependencies:
py3xui
for connecting and managing 3xui panels
-
-
requests
for synchronous API
-
httpx
for asynchronous API
-
six
(I just cannot make py3xui work without a last version of six. This will be fixed in next versions)
diskcache
for storing 3xui cookies
Supported Python Versions:
3x-ui is under development. py3xui also. I am not related with 3x-ui or py3xui. But the module supports py3xui>=0.3.4(and all version of 3x-ui that are being supported by py3xui)
Quick Start
Installation
pip install py_multi_3xui
Operating with servers
Adding server to database
from py_multi_3xui import Server
from py_multi_3xui import ServerDataManager
username = "Ben"
password = "BenLoveApples123"
host = "https://benserver.com:PORT/PATH/"
secret_token = "very_secret_token"
internet_speed = 5
location = "usa"
server = Server(username=username, password=password, host=host, location=location, secret_token=secret_token,
internet_speed=internet_speed)
data_manager = ServerDataManager()
data_manager.add_server(server)
some notes:
- Learn your server's traffic speed by using Ookla or ask your VPS seller. This is used to calculate a comfortable amount of users per server
- note, that there is no filtration by valid country code. You can add whatever location that you want(maybe will be improved)
Deleting server from database
from py_multi_3xui import ServerDataManager
host = "some_server.com:PORT/PATH/"
manager = ServerDataManager()
manager.delete_server(host)
Get best server by country
from py_multi_3xui import ServerDataManager
manager = ServerDataManager()
location = "usa"
best_server = await manager.choose_best_server_by_location(location)
print(best_server.__str__())
Working with clients/configs
Generate client (not add)
server = ...
from py3xui import Client
client = Client()
from py_multi_3xui import RandomStuffGenerator as rsg
total_gb = 30
inbound_id = 4
limit_ip = 0
client_email = rsg.generate_email(10)
expiry_time = 30
up = 0
down = 0
client = server.generate_client(total_gb=total_gb,
inbound_id=inbound_id,
limit_ip=limit_ip,
client_email=client_email,
expiry_time=expiry_time,
up=up,
down=down)
note: For more complete info about py3xui.Client visit py3xui documentation
Add client to server
from py_multi_3xui import Server
from py3xui import Client
server = ...
client = ...
server.add_client(client)
Edit/Update client
from py3xui import Client
server = ...
client = await server.get_client_by_email("some_email")
client.up = 50
client.down = 30
server.update_client(client)
Get connection string
from py_multi_3xui import Server
from py3xui import Client
server = ...
client = ...
config = server.get_config(client)
Delete client by uuid
server = ...
uuid = "some uuid"
inbound_id = 4
server.delete_client_by_uuid(client_uuid=uuid,inbound_id=inbound_id)
Bugs and Features
Please report any bugs or feature requests by opening an issue on GitHub issues
Donate and support
If this project was helpful for you, you may wish star it or donate ^^
- via CryptoBot
- via Ton:
UQCOKDO9dRYNe3Us8FDK2Ctz6B4fhsonaoKpK93bqneFAyJL
##Plans:
Update README.md(or add manual)
Also planned to do code-review and remove six