Skip to content
This repository has been archived by the owner on Sep 9, 2023. It is now read-only.
/ xtlsapi Public archive
forked from hiddify/xtlsapi

Python library to communicate with xray core

License

Notifications You must be signed in to change notification settings

aazp/xtlsapi

 
 

Repository files navigation

xtlsapi

codecov CI

Python library to communicate with xray core

Install it from PyPI

pip install xtlsapi

Usage

from xtlsapi import XrayClient, utils, exceptions

xray_client = XrayClient('1.2.3.4', 1234)
user_id = utils.generate_random_user_id()
user_email = utils.generate_random_email()
inbound_tag = 'inbound-tag'

# Get stats
print(utils.human_readable_bytes(xray_client.get_client_download_traffic('[email protected]')))
print(utils.human_readable_bytes(xray_client.get_client_upload_traffic('[email protected]')))
print(utils.human_readable_bytes(xray_client.get_inbound_download_traffic(inbound_tag)))
print(utils.human_readable_bytes(xray_client.get_inbound_upload_traffic(inbound_tag)))

# Add & Remove client
user = xray_client.add_client(inbound_tag, user_id, user_email)
if user:
    print(user)
    xray_client.remove_client(inbound_tag, user_email)

# restart logger
xray_client.restart_logger()

Development

Read the CONTRIBUTING.md file.

About

Python library to communicate with xray core

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 93.1%
  • Makefile 6.6%
  • Other 0.3%