commit 7f3684faabe1e8ec804778416054520b23f7308c Author: SaintShit Date: Fri Nov 25 03:38:42 2022 +0330 Initial commit diff --git a/.env.example b/.env.example new file mode 100644 index 00000000..8738a56d --- /dev/null +++ b/.env.example @@ -0,0 +1,14 @@ +SQLALCHEMY_DATABASE_URL = "sqlite:///db.sqlite3" + +UVICORN_HOST = "0.0.0.0" +UVICORN_PORT = 8000 + +XRAY_EXECUTABLE_PATH = "/usr/local/bin/xray" +XRAY_ASSETS_PATH = "/usr/local/share/xray" +XRAY_HOSTS = " +Local@127.0.0.1 +LAN@192.168.1.10 +" + +ADMIN_USERNAME = "admin" +ADMIN_PASSWORD = "admin" diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..e6d49859 --- /dev/null +++ b/.gitignore @@ -0,0 +1,153 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +.pybuilder/ +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# poetry +# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. +# This is especially recommended for binary packages to ensure reproducibility, and is more +# commonly ignored for libraries. +# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control +#poetry.lock + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.venv +venv/ +venv.bak/ +.vscode/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ + +# PyCharm +# JetBrains specific template is maintained in a separate JetBrains.gitignore that can +# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore +# and can be added to the global gitignore or merged into this file. For a more nuclear +# option (not recommended) you can uncomment the following to ignore the entire idea folder. +#.idea/ + +.env +v2ray-core +xray-core \ No newline at end of file diff --git a/README.md b/README.md new file mode 100755 index 00000000..0a66f9cc --- /dev/null +++ b/README.md @@ -0,0 +1,13 @@ +## How to run + +Install Xray-core using [Xray-install](https://github.com/XTLS/Xray-install) + + bash -c "$(curl -L https://github.com/XTLS/Xray-install/raw/main/install-release.sh)" @ install + +Run the server + + pip install -r requirements.txt + alembic upgrade head + python main.py + +Swagger documentation will be available on `http://SERVER_IP:8000/docs` \ No newline at end of file diff --git a/TODO.md b/TODO.md new file mode 100644 index 00000000..010f360f --- /dev/null +++ b/TODO.md @@ -0,0 +1,8 @@ +## TODO's +- [ ] Multi-workers support for XRay +- [ ] Multi-workers support for APScheduler +- [ ] Change proxy type feature +- [ ] reset users traffic option +- [ ] disable user option +- [ ] filters on get users +- [ ] dockerise the project \ No newline at end of file diff --git a/alembic.ini b/alembic.ini new file mode 100644 index 00000000..402281a0 --- /dev/null +++ b/alembic.ini @@ -0,0 +1,99 @@ +# A generic, single database configuration. + +[alembic] +# path to migration scripts +script_location = app/db/migrations + +# template used to generate migration file names; The default value is %%(rev)s_%%(slug)s +# Uncomment the line below if you want the files to be prepended with date and time +# see https://alembic.sqlalchemy.org/en/latest/tutorial.html#editing-the-ini-file +# for all available tokens +# file_template = %%(year)d_%%(month).2d_%%(day).2d_%%(hour).2d%%(minute).2d-%%(rev)s_%%(slug)s + +# sys.path path, will be prepended to sys.path if present. +# defaults to the current working directory. +prepend_sys_path = . + +# timezone to use when rendering the date within the migration file +# as well as the filename. +# If specified, requires the python-dateutil library that can be +# installed by adding `alembic[tz]` to the pip requirements +# string value is passed to dateutil.tz.gettz() +# leave blank for localtime +# timezone = + +# max length of characters to apply to the +# "slug" field +# truncate_slug_length = 40 + +# set to 'true' to run the environment during +# the 'revision' command, regardless of autogenerate +# revision_environment = false + +# set to 'true' to allow .pyc and .pyo files without +# a source .py file to be detected as revisions in the +# versions/ directory +# sourceless = false + +# version location specification; This defaults +# to app/db/migrations/versions. When using multiple version +# directories, initial revisions must be specified with --version-path. +# The path separator used here should be the separator specified by "version_path_separator" below. +# version_locations = %(here)s/bar:%(here)s/bat:app/db/migrations/versions + +# version path separator; As mentioned above, this is the character used to split +# version_locations. The default within new alembic.ini files is "os", which uses os.pathsep. +# If this key is omitted entirely, it falls back to the legacy behavior of splitting on spaces and/or commas. +# Valid values for version_path_separator are: +# +# version_path_separator = : +# version_path_separator = ; +# version_path_separator = space +version_path_separator = os # Use os.pathsep. Default configuration used for new projects. + + +[post_write_hooks] +# post_write_hooks defines scripts or Python functions that are run +# on newly generated revision scripts. See the documentation for further +# detail and examples + +# format using "black" - use the console_scripts runner, against the "black" entrypoint +# hooks = black +# black.type = console_scripts +# black.entrypoint = black +# black.options = -l 79 REVISION_SCRIPT_FILENAME + +# Logging configuration +[loggers] +keys = root,sqlalchemy,alembic + +[handlers] +keys = console + +[formatters] +keys = generic + +[logger_root] +level = WARN +handlers = console +qualname = + +[logger_sqlalchemy] +level = WARN +handlers = +qualname = sqlalchemy.engine + +[logger_alembic] +level = INFO +handlers = +qualname = alembic + +[handler_console] +class = StreamHandler +args = (sys.stderr,) +level = NOTSET +formatter = generic + +[formatter_generic] +format = %(levelname)-5.5s [%(name)s] %(message)s +datefmt = %H:%M:%S diff --git a/app/__init__.py b/app/__init__.py new file mode 100755 index 00000000..73261355 --- /dev/null +++ b/app/__init__.py @@ -0,0 +1,23 @@ +import logging +from fastapi import FastAPI +from fastapi.middleware.cors import CORSMiddleware +from fastapi_responses import custom_openapi +from apscheduler.schedulers.background import BackgroundScheduler + + +app = FastAPI() +app.openapi = custom_openapi(app) +scheduler = BackgroundScheduler() +logger = logging.getLogger('uvicorn.error') +app.add_middleware( + CORSMiddleware, + allow_origins=["*"], + allow_credentials=True, + allow_methods=["*"], + allow_headers=["*"], +) + + +from app import views, jobs # noqa + +scheduler.start() diff --git a/app/db/__init__.py b/app/db/__init__.py new file mode 100644 index 00000000..2d449c55 --- /dev/null +++ b/app/db/__init__.py @@ -0,0 +1,47 @@ +from sqlalchemy.orm import Session + +from .models import User, System, JWT +from .crud import ( + get_user, + get_user_by_id, + get_users, + create_user, + remove_user, + update_user, + update_user_status, + get_system_usage, + get_jwt_secret_key +) + +from .base import Base, SessionLocal, engine # noqa + + +# Dependency +def get_db(): + db = SessionLocal() + try: + yield db + finally: + db.close() + + +__all__ = [ + "get_user", + "get_user_by_id", + "get_users", + "create_user", + "remove_user", + "update_user", + "update_user_status", + "get_system_usage", + "get_jwt_secret_key", + + "get_db", + + "User", + "System", + "JWT", + + "Base", + "Session", +] diff --git a/app/db/base.py b/app/db/base.py new file mode 100644 index 00000000..504b332c --- /dev/null +++ b/app/db/base.py @@ -0,0 +1,8 @@ +from config import SQLALCHEMY_DATABASE_URL +from sqlalchemy import create_engine +from sqlalchemy.ext.declarative import declarative_base +from sqlalchemy.orm import sessionmaker + +engine = create_engine(SQLALCHEMY_DATABASE_URL, connect_args={"check_same_thread": False}) +SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine) +Base = declarative_base() diff --git a/app/db/crud.py b/app/db/crud.py new file mode 100644 index 00000000..87c756bc --- /dev/null +++ b/app/db/crud.py @@ -0,0 +1,82 @@ +import json + +from sqlalchemy.orm import Session + +from app.db.models import JWT, User, System +from app.models.user import UserCreate, UserModify, UserStatus + + +def get_user(db: Session, username: str): + return db.query(User).filter(User.username == username).first() + + +def get_user_by_id(db: Session, user_id: int): + return db.query(User).filter(User.id == user_id).first() + + +def get_users(db: Session, offset: int = None, limit: int = None, status: UserStatus = None): + query = db.query(User) + if offset: + query = query.offset(offset) + if limit: + query = query.limit(limit) + if status: + query = query.filter(User.status == status) + return query.all() + + +def get_users_count(db: Session, status: UserStatus = None): + query = db.query(User.id) + if status: + query = query.filter(User.status == status) + return query.count() + + +def create_user(db: Session, user: UserCreate): + dbuser = User( + username=user.username, + proxy_type=user.proxy_type, + settings=json.loads(user.settings.json()), + data_limit=(user.data_limit or None), + expire=(user.expire or None) + ) + db.add(dbuser) + db.commit() + db.refresh(dbuser) + return dbuser + + +def remove_user(db: Session, dbuser: User): + db.delete(dbuser) + db.commit() + return dbuser + + +def update_user(db: Session, dbuser: User, modify: UserModify): + if modify.settings is not None: + dbuser.settings = json.loads(modify.settings.json()) + + if modify.data_limit is not None: + dbuser.data_limit = (modify.data_limit or None) + + if modify.expire is not None: + dbuser.expire = (modify.expire or None) + + db.commit() + db.refresh(dbuser) + return dbuser + + +def update_user_status(db: Session, dbuser: User, status: UserStatus): + dbuser.status = status + db.commit() + db.refresh(dbuser) + return dbuser + + +def get_system_usage(db: Session): + return db.query(System).first() + + +def get_jwt_secret_key(db: Session): + return db.query(JWT).first().secret_key diff --git a/app/db/migrations/README b/app/db/migrations/README new file mode 100644 index 00000000..98e4f9c4 --- /dev/null +++ b/app/db/migrations/README @@ -0,0 +1 @@ +Generic single-database configuration. \ No newline at end of file diff --git a/app/db/migrations/env.py b/app/db/migrations/env.py new file mode 100644 index 00000000..70e30f11 --- /dev/null +++ b/app/db/migrations/env.py @@ -0,0 +1,82 @@ +from logging.config import fileConfig + +from sqlalchemy import engine_from_config +from sqlalchemy import pool + +from alembic import context + +from app.db.base import Base +from config import SQLALCHEMY_DATABASE_URL + +# this is the Alembic Config object, which provides +# access to the values within the .ini file in use. +config = context.config +config.set_main_option('sqlalchemy.url', SQLALCHEMY_DATABASE_URL) + +# Interpret the config file for Python logging. +# This line sets up loggers basically. +if config.config_file_name is not None: + fileConfig(config.config_file_name) + +# add your model's MetaData object here +# for 'autogenerate' support +# from myapp import mymodel +# target_metadata = mymodel.Base.metadata +target_metadata = Base.metadata + +# other values from the config, defined by the needs of env.py, +# can be acquired: +# my_important_option = config.get_main_option("my_important_option") +# ... etc. + + +def run_migrations_offline() -> None: + """Run migrations in 'offline' mode. + + This configures the context with just a URL + and not an Engine, though an Engine is acceptable + here as well. By skipping the Engine creation + we don't even need a DBAPI to be available. + + Calls to context.execute() here emit the given string to the + script output. + + """ + url = config.get_main_option("sqlalchemy.url") + context.configure( + url=url, + target_metadata=target_metadata, + literal_binds=True, + dialect_opts={"paramstyle": "named"}, + ) + + with context.begin_transaction(): + context.run_migrations() + + +def run_migrations_online() -> None: + """Run migrations in 'online' mode. + + In this scenario we need to create an Engine + and associate a connection with the context. + + """ + connectable = engine_from_config( + config.get_section(config.config_ini_section), + prefix="sqlalchemy.", + poolclass=pool.NullPool, + ) + + with connectable.connect() as connection: + context.configure( + connection=connection, target_metadata=target_metadata + ) + + with context.begin_transaction(): + context.run_migrations() + + +if context.is_offline_mode(): + run_migrations_offline() +else: + run_migrations_online() diff --git a/app/db/migrations/script.py.mako b/app/db/migrations/script.py.mako new file mode 100644 index 00000000..55df2863 --- /dev/null +++ b/app/db/migrations/script.py.mako @@ -0,0 +1,24 @@ +"""${message} + +Revision ID: ${up_revision} +Revises: ${down_revision | comma,n} +Create Date: ${create_date} + +""" +from alembic import op +import sqlalchemy as sa +${imports if imports else ""} + +# revision identifiers, used by Alembic. +revision = ${repr(up_revision)} +down_revision = ${repr(down_revision)} +branch_labels = ${repr(branch_labels)} +depends_on = ${repr(depends_on)} + + +def upgrade() -> None: + ${upgrades if upgrades else "pass"} + + +def downgrade() -> None: + ${downgrades if downgrades else "pass"} diff --git a/app/db/migrations/versions/3cf36a5fde73_init_system_table.py b/app/db/migrations/versions/3cf36a5fde73_init_system_table.py new file mode 100644 index 00000000..a0252329 --- /dev/null +++ b/app/db/migrations/versions/3cf36a5fde73_init_system_table.py @@ -0,0 +1,39 @@ +"""init system table + +Revision ID: 3cf36a5fde73 +Revises: 94a5cc12c0d6 +Create Date: 2022-11-22 04:48:55.227490 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = '3cf36a5fde73' +down_revision = '94a5cc12c0d6' +branch_labels = None +depends_on = None + + +def upgrade() -> None: + # ### commands auto generated by Alembic - please adjust! ### + table = op.create_table('system', + sa.Column('id', sa.Integer(), nullable=False), + sa.Column('uplink', sa.BigInteger(), nullable=True), + sa.Column('downlink', sa.BigInteger(), nullable=True), + sa.PrimaryKeyConstraint('id') + ) + op.create_index(op.f('ix_system_id'), 'system', ['id'], unique=False) + + # INSERT DEFAULT ROW + op.bulk_insert(table, [{"id": 1, "uplink": 0, "downlink": 0}]) + + # ### end Alembic commands ### + + +def downgrade() -> None: + # ### commands auto generated by Alembic - please adjust! ### + op.drop_index(op.f('ix_system_id'), table_name='system') + op.drop_table('system') + # ### end Alembic commands ### diff --git a/app/db/migrations/versions/94a5cc12c0d6_init_user_table.py b/app/db/migrations/versions/94a5cc12c0d6_init_user_table.py new file mode 100644 index 00000000..a44492d1 --- /dev/null +++ b/app/db/migrations/versions/94a5cc12c0d6_init_user_table.py @@ -0,0 +1,42 @@ +"""init user table + +Revision ID: 94a5cc12c0d6 +Revises: +Create Date: 2022-11-18 20:54:05.616546 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = '94a5cc12c0d6' +down_revision = None +branch_labels = None +depends_on = None + + +def upgrade() -> None: + # ### commands auto generated by Alembic - please adjust! ### + op.create_table('users', + sa.Column('id', sa.Integer(), nullable=False), + sa.Column('username', sa.String(), nullable=True), + sa.Column('proxy_type', sa.Enum('VMess', 'VLESS', 'Trojan', 'Shadowsocks', name='proxytypes'), nullable=False), + sa.Column('settings', sa.JSON(), nullable=False), + sa.Column('status', sa.Enum('active', 'limited', 'expired', name='userstatus'), nullable=True), + sa.Column('used_traffic', sa.BigInteger(), nullable=True), + sa.Column('data_limit', sa.BigInteger(), nullable=True), + sa.Column('expire', sa.Integer(), nullable=True), + sa.PrimaryKeyConstraint('id') + ) + op.create_index(op.f('ix_users_id'), 'users', ['id'], unique=False) + op.create_index(op.f('ix_users_username'), 'users', ['username'], unique=True) + # ### end Alembic commands ### + + +def downgrade() -> None: + # ### commands auto generated by Alembic - please adjust! ### + op.drop_index(op.f('ix_users_username'), table_name='users') + op.drop_index(op.f('ix_users_id'), table_name='users') + op.drop_table('users') + # ### end Alembic commands ### diff --git a/app/db/migrations/versions/9d5a518ae432_init_jwt_table.py b/app/db/migrations/versions/9d5a518ae432_init_jwt_table.py new file mode 100644 index 00000000..51c44340 --- /dev/null +++ b/app/db/migrations/versions/9d5a518ae432_init_jwt_table.py @@ -0,0 +1,37 @@ +"""init jwt table + +Revision ID: 9d5a518ae432 +Revises: 3cf36a5fde73 +Create Date: 2022-11-24 21:02:44.278773 + +""" +import os +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = '9d5a518ae432' +down_revision = '3cf36a5fde73' +branch_labels = None +depends_on = None + + +def upgrade() -> None: + # ### commands auto generated by Alembic - please adjust! ### + table = op.create_table('jwt', + sa.Column('id', sa.Integer(), nullable=False), + sa.Column('secret_key', sa.String(length=64), nullable=False), + sa.PrimaryKeyConstraint('id') + ) + + # INSERT DEFAULT ROW + op.bulk_insert(table, [{"id": 1, "secret_key": os.urandom(32).hex()}]) + + # ### end Alembic commands ### + + +def downgrade() -> None: + # ### commands auto generated by Alembic - please adjust! ### + op.drop_table('jwt') + # ### end Alembic commands ### diff --git a/app/db/models.py b/app/db/models.py new file mode 100644 index 00000000..ed207663 --- /dev/null +++ b/app/db/models.py @@ -0,0 +1,35 @@ +from email.policy import default +import os +from sqlalchemy import Column, Integer, BigInteger, String, Enum, JSON + +from app.db.base import Base +from app.models.proxy import ProxyTypes +from app.models.user import UserStatus + + +class User(Base): + __tablename__ = "users" + + id = Column(Integer, primary_key=True, index=True) + username = Column(String, unique=True, index=True) + proxy_type = Column(Enum(ProxyTypes), nullable=False) + settings = Column(JSON, nullable=False) + status = Column(Enum(UserStatus), default=UserStatus.active) + used_traffic = Column(BigInteger, default=0) + data_limit = Column(BigInteger, nullable=True) + expire = Column(Integer, nullable=True) + + +class System(Base): + __tablename__ = "system" + + id = Column(Integer, primary_key=True, index=True) + uplink = Column(BigInteger, default=0) + downlink = Column(BigInteger, default=0) + + +class JWT(Base): + __tablename__ = "jwt" + + id = Column(Integer, primary_key=True) + secret_key = Column(String(64), nullable=False, default=lambda: os.urandom(32).hex()) diff --git a/app/jobs/__init__.py b/app/jobs/__init__.py new file mode 100644 index 00000000..627a8bd8 --- /dev/null +++ b/app/jobs/__init__.py @@ -0,0 +1,13 @@ +import glob +import importlib.util +from os.path import basename, dirname, join + +modules = glob.glob(join(dirname(__file__), "*.py")) + +for file in modules: + name = basename(file).replace('.py', '') + if name.startswith('_'): + continue + + spec = importlib.util.spec_from_file_location(name, file) + spec.loader.exec_module(importlib.util.module_from_spec(spec)) diff --git a/app/jobs/add_db_users.py b/app/jobs/add_db_users.py new file mode 100644 index 00000000..4a7ee896 --- /dev/null +++ b/app/jobs/add_db_users.py @@ -0,0 +1,15 @@ +import sqlalchemy +from app import xray +from app.db import get_users, get_db, engine, User +from app.models.user import UserResponse, UserStatus +from app.xray import INBOUND_TAGS + +if sqlalchemy.inspect(engine).has_table(User.__tablename__): + for db in get_db(): + for user in get_users(db, status=UserStatus.active): + account = UserResponse.from_orm(user).get_account() + inbound = INBOUND_TAGS[user.proxy_type] + try: + xray.api.add_inbound_user(inbound, account) + except xray.exc.EmailExistsError: + pass diff --git a/app/jobs/record_usages.py b/app/jobs/record_usages.py new file mode 100644 index 00000000..d31b93f4 --- /dev/null +++ b/app/jobs/record_usages.py @@ -0,0 +1,36 @@ +from app import scheduler, xray +from app.db import engine +from app.db.models import System, User + +from sqlalchemy import update + +# TODO https://stackoverflow.com/questions/25694234/bulk-update-in-sqlalchemy-core-using-where + + +def record_users_usage(): + with engine.connect() as conn: + for stat in xray.api.get_users_stats(reset=True): + if stat.value == 0: + continue + conn.execute( + update(User) + .where(User.username == stat.name) + .values(used_traffic=User.used_traffic+stat.value) + ) + + +scheduler.add_job(record_users_usage, 'interval', seconds=10) + + +def record_outbounds_usage(): + with engine.connect() as conn: + for stat in xray.api.get_outbounds_stats(reset=True): + if stat.value == 0: + continue + conn.execute( + update(System) + .values({stat.link: getattr(System, stat.link)+stat.value}) + ) + + +scheduler.add_job(record_outbounds_usage, 'interval', seconds=5) diff --git a/app/jobs/review_users.py b/app/jobs/review_users.py new file mode 100644 index 00000000..5d80831e --- /dev/null +++ b/app/jobs/review_users.py @@ -0,0 +1,31 @@ +from datetime import datetime + +from app import logger, scheduler, xray +from app.db import get_users, get_db, update_user_status +from app.models.user import UserStatus +from app.xray import INBOUND_TAGS + + +def review(): + now = datetime.utcnow().timestamp() + for db in get_db(): + for user in get_users(db, status=UserStatus.active): + limited = user.data_limit and user.used_traffic >= user.data_limit + expired = user.expire and user.expire <= now + if limited: + status = UserStatus.limited + elif expired: + status = UserStatus.expired + else: + continue + + update_user_status(db, user, status) + inbound = INBOUND_TAGS[user.proxy_type] + try: + xray.api.remove_inbound_user(tag=inbound, email=user.username) + except xray.exc.EmailNotFoundError: + pass + logger.info(f"User \"{user.username}\" status changed to {status}") + + +scheduler.add_job(review, 'interval', seconds=10) diff --git a/app/jwt.py b/app/jwt.py new file mode 100644 index 00000000..3f9b370f --- /dev/null +++ b/app/jwt.py @@ -0,0 +1,38 @@ +from datetime import datetime, timedelta + +import sqlalchemy +from config import JWT_ACCESS_TOKEN_EXPIRE_MINUTES +from fastapi import Depends, HTTPException, status +from fastapi.security import OAuth2PasswordBearer +from jose import JWTError, jwt + +from app.db import get_db, get_jwt_secret_key, engine, JWT + +oauth2_scheme = OAuth2PasswordBearer(tokenUrl="/admin/token") # Admin view url + +if sqlalchemy.inspect(engine).has_table(JWT.__tablename__): + for db in get_db(): + JWT_SECRET_KEY = get_jwt_secret_key(db) + + +def create_access_token(username: str) -> str: + expire = datetime.utcnow() + timedelta(minutes=JWT_ACCESS_TOKEN_EXPIRE_MINUTES) + data = {"sub": username, "exp": expire} + encoded_jwt = jwt.encode(data, JWT_SECRET_KEY, algorithm="HS256") + return encoded_jwt + + +async def current_user(token: str = Depends(oauth2_scheme)) -> str: + credentials_exception = HTTPException( + status_code=status.HTTP_401_UNAUTHORIZED, + detail="Could not validate credentials", + headers={"WWW-Authenticate": "Bearer"}, + ) + try: + payload = jwt.decode(token, JWT_SECRET_KEY, algorithms=["HS256"]) + username: str = payload.get("sub") + if username is None: + raise credentials_exception + except JWTError: + raise credentials_exception + return username diff --git a/app/models/__init__.py b/app/models/__init__.py new file mode 100644 index 00000000..30de9031 --- /dev/null +++ b/app/models/__init__.py @@ -0,0 +1,4 @@ +from .admin import * +from .proxy import * +from .system import * +from .user import * diff --git a/app/models/admin.py b/app/models/admin.py new file mode 100644 index 00000000..0b20c373 --- /dev/null +++ b/app/models/admin.py @@ -0,0 +1,10 @@ +from pydantic import BaseModel + + +class Token(BaseModel): + access_token: str + token_type: str + + +class Admin(BaseModel): + username: str diff --git a/app/models/proxy.py b/app/models/proxy.py new file mode 100644 index 00000000..9e6c3d24 --- /dev/null +++ b/app/models/proxy.py @@ -0,0 +1,71 @@ +from enum import Enum +from multiprocessing.sharedctypes import Value +from uuid import UUID, uuid4 + +from app.utils import random_password +from pydantic import BaseModel, Field +from xray_api.types.account import ( + ShadowsocksAccount, + TrojanAccount, + VLESSAccount, + VMessAccount +) + + +class ProxyTypes(str, Enum): + # proxy_type = protocol + + VMess = "vmess" + VLESS = "vless" + Trojan = "trojan" + Shadowsocks = "shadowsocks" + + @property + def account_model(self): + if self == self.VMess: + return VMessAccount + if self == self.VLESS: + return VLESSAccount + if self == self.Trojan: + return TrojanAccount + if self == self.Shadowsocks: + return ShadowsocksAccount + + @property + def settings_model(self): + if self == self.VMess: + return VMessSettings + if self == self.VLESS: + return VLESSSettings + if self == self.Trojan: + return TrojanSettings + if self == self.Shadowsocks: + return ShadowsocksSettings + + +class ProxySettings(BaseModel): + pass + + @classmethod + def from_dict(cls, proxy_type: ProxyTypes, _dict: dict): + try: + return ProxyTypes(proxy_type).settings_model.parse_obj(_dict) + except ValueError: + raise NotImplementedError(f'Proxy type "{proxy_type}" not supported') + + +class VMessSettings(ProxySettings): + id: UUID = Field(default_factory=uuid4) + + +class VLESSSettings(ProxySettings): + id: UUID = Field(default_factory=uuid4) + flow: str = "" + + +class TrojanSettings(ProxySettings): + password: str = Field(default_factory=random_password) + + +class ShadowsocksSettings(ProxySettings): + password: str = Field(default_factory=random_password) diff --git a/app/models/system.py b/app/models/system.py new file mode 100644 index 00000000..e99ac82c --- /dev/null +++ b/app/models/system.py @@ -0,0 +1,10 @@ +from pydantic import BaseModel + + +class SystemStats(BaseModel): + mem_total: int + mem_used: int + total_user: int + users_active: int + incoming_bandwidth: int + outgoing_bandwith: int diff --git a/app/models/user.py b/app/models/user.py new file mode 100644 index 00000000..6b566fbb --- /dev/null +++ b/app/models/user.py @@ -0,0 +1,72 @@ +from enum import Enum +from pydantic import BaseModel, validator + +from app.models.proxy import ProxyTypes, ProxySettings +from app.utils import get_share_links +from app import xray +from xray_api.types.account import Account + + +class UserStatus(str, Enum): + active = "active" + disabled = "disabled" + limited = "limited" + expired = "expired" + + +class User(BaseModel): + proxy_type: ProxyTypes + settings: ProxySettings = {} + expire: int = None + data_limit: int = None + + @validator('settings', pre=True, always=True) + def validate_settings(cls, v, values, **kwargs): + if isinstance(v, dict): + return ProxySettings.from_dict(values['proxy_type'], v) + return v + + def get_account(self) -> Account: + if not getattr(self, 'username'): + return + + if isinstance(self.settings, ProxySettings): + return self.proxy_type.account_model(email=self.username, **self.settings.dict()) + + return self.proxy_type.account_model(email=self.username, **self.settings) + + +class UserCreate(User): + username: str + + +class UserModify(User): + proxy_type: ProxyTypes = None + expire: int = None + data_limit: int = None + settings: ProxySettings = None + + @validator('settings', pre=True, always=True) + def validate_settings(cls, v, values, **kwargs): + if v is not None and values.get('proxy_type') is None: + raise ValueError("proxy_type field must be specified when settings field is set") + return super().validate_settings(v, values, **kwargs) + + +class UserResponse(User): + username: str + status: UserStatus + used_traffic: int + settings: dict | ProxyTypes + links: list[str] = [] + + class Config: + orm_mode = True + + @validator('links', pre=False, always=True) + def validate_links(cls, v, values, **kwargs): + if not v: + if isinstance(values['settings'], ProxySettings): + return get_share_links(values['proxy_type'], values['settings'].dict()) + return get_share_links(values['proxy_type'], values['settings']) + return v diff --git a/app/utils.py b/app/utils.py new file mode 100644 index 00000000..1802d383 --- /dev/null +++ b/app/utils.py @@ -0,0 +1,158 @@ +import base64 +import json +import os +import secrets +import socket +import urllib.parse as urlparse +from dataclasses import dataclass +from uuid import UUID + +from config import XRAY_HOSTS + + +@dataclass +class MemoryStat(): + total: int + used: int + free: int + + +def mem_usage() -> MemoryStat: + total, used, free = map(int, os.popen('free -t -b').readlines()[-1].split()[1:]) + return MemoryStat(total=total, used=used, free=free) + + +def random_password() -> str: + return secrets.token_urlsafe(16) + + +def check_port(port: int) -> bool: + s = socket.socket() + try: + s.connect(('127.0.0.1', port)) + return True + except socket.error: + return False + finally: + s.close() + + +def vmess_link(remark: str, + address: str, + id: str | UUID, + host='', + net='tcp', + path='', + sni='', + tls=False, + type=''): + return "vmess://" + base64.b64encode(json.dumps({ + 'add': address, + 'aid': '0', + 'host': host, + 'id': str(id), + 'net': net, + 'path': urlparse.quote(path), + 'port': INBOUND_PORTS['vmess'], + 'ps': remark, + 'scy': 'auto', + 'sni': sni, + 'tls': 'tls' if tls else '', + 'type': type, + 'v': '2' + }, sort_keys=True).encode('utf-8')).decode() + + +def vless_link(remark: str, + address: str, + id: str | UUID, + net='ws', + path='', + tls=False, + host='', + sni=''): + return "vless://" + \ + f"{id}@{address}:{INBOUND_PORTS['vless']}?" + \ + urlparse.urlencode({ + "security": "tls" if tls else "none", + "type": net, + "path": urlparse.quote(path), + "host": host, + "encryption": "none", + "sni": sni + }) + f"#{( urlparse.quote(remark))}" + + +def trojan_link(remark: str, + address: str, + password: str, + net='tcp', + path='', + tls=False, + host='', + sni=''): + return "trojan://" + \ + f"{urlparse.quote(password, safe=':')}@{address}:{INBOUND_PORTS['trojan']}?" + \ + urlparse.urlencode({ + "security": "tls" if tls else "none", + "type": net, + "path": urlparse.quote(path), + "host": host, + "sni": sni + }) + f"#{urlparse.quote(remark)}" + + +def shadowsocks_link(remark: str, + address: str, + password: str, + security='chacha20-ietf-poly1305'): + return "ss://" + \ + base64.b64encode(f'{security}:{password}'.encode()).decode() + \ + f"@{address}:{INBOUND_PORTS['shadowsocks']}#{urlparse.quote(remark)}" + + +def get_share_link(remark: str, host: str, protocol: str, settings: dict): + if protocol == 'vmess': + return vmess_link(remark=remark, + address=host, + id=settings['id'], + net=INBOUND_STREAMS[protocol]['net'], + tls=INBOUND_STREAMS[protocol]['tls'], + sni=INBOUND_STREAMS[protocol]['sni'], + host=INBOUND_STREAMS[protocol]['sni'], + path=INBOUND_STREAMS[protocol]['path']) + + if protocol == 'vless': + return vless_link(remark=remark, + address=host, + id=settings['id'], + net=INBOUND_STREAMS[protocol]['net'], + tls=INBOUND_STREAMS[protocol]['tls'], + sni=INBOUND_STREAMS[protocol]['sni'], + host=INBOUND_STREAMS[protocol]['sni'], + path=INBOUND_STREAMS[protocol]['path']) + + if protocol == 'trojan': + return trojan_link(remark=remark, + address=host, + password=settings['password'], + net=INBOUND_STREAMS[protocol]['net'], + tls=INBOUND_STREAMS[protocol]['tls'], + sni=INBOUND_STREAMS[protocol]['sni'], + host=INBOUND_STREAMS[protocol]['sni'], + path=INBOUND_STREAMS[protocol]['path']) + + if protocol == 'shadowsocks': + return shadowsocks_link(remark=remark, + address=host, + password=settings['password']) + + +def get_share_links(protocol: str, settings: str): + links = [] + for host in XRAY_HOSTS: + links.append(get_share_link(host['remark'], host['hostname'], protocol, settings)) + return links + + +from app.xray import INBOUND_PORTS, INBOUND_STREAMS # noqa diff --git a/app/views/__init__.py b/app/views/__init__.py new file mode 100644 index 00000000..dc0f6d59 --- /dev/null +++ b/app/views/__init__.py @@ -0,0 +1,3 @@ +from .admin import * +from .system import * +from .user import * diff --git a/app/views/admin.py b/app/views/admin.py new file mode 100644 index 00000000..65a23607 --- /dev/null +++ b/app/views/admin.py @@ -0,0 +1,34 @@ +from datetime import timedelta + +from app import app, jwt +from app.models.admin import Admin, Token +from config import ADMINS +from fastapi import Depends, HTTPException, status +from fastapi.security import OAuth2PasswordRequestForm + + +def is_admin(username: str, password: str): + try: + return password == ADMINS[username] + except KeyError: + return False + + +@app.post("/admin/token", tags=['Admin'], response_model=Token) +async def login_for_access_token(form_data: OAuth2PasswordRequestForm = Depends()): + if not is_admin(form_data.username, form_data.password): + raise HTTPException( + status_code=status.HTTP_401_UNAUTHORIZED, + detail="Incorrect username or password", + headers={"WWW-Authenticate": "Bearer"}, + ) + access_token = jwt.create_access_token(username=form_data.username) + return { + "access_token": access_token, + "token_type": "bearer" + } + + +@app.get("/admin", tags=['Admin'], response_model=Admin) +async def current_admin(admin: Admin = Depends(jwt.current_user)): + return {"username": admin} diff --git a/app/views/system.py b/app/views/system.py new file mode 100644 index 00000000..3ca67c7a --- /dev/null +++ b/app/views/system.py @@ -0,0 +1,24 @@ +from app import app, jwt, utils +from app.db import crud, Session, get_db +from app.models.admin import Admin +from app.models.system import SystemStats +from fastapi import Depends + +from app.models.user import UserStatus + + +@app.get("/system", tags=["System"], response_model=SystemStats) +def system_stats(db: Session = Depends(get_db), admin: Admin = Depends(jwt.current_user)): + mem = utils.mem_usage() + system = crud.get_system_usage(db) + total_user = crud.get_users_count(db) + users_active = crud.get_users_count(db, UserStatus.active) + + return SystemStats( + mem_total=mem.total, + mem_used=mem.used, + total_user=total_user, + users_active=users_active, + incoming_bandwidth=system.uplink, + outgoing_bandwith=system.downlink, + ) diff --git a/app/views/user.py b/app/views/user.py new file mode 100644 index 00000000..db956d87 --- /dev/null +++ b/app/views/user.py @@ -0,0 +1,157 @@ +from datetime import datetime +import re +import sqlalchemy + +from app import app, jwt, logger, xray +from app.db import get_db, Session, crud +from app.models.admin import Admin +from app.models.proxy import ProxyTypes +from app.models.user import UserCreate, UserModify, UserResponse, UserStatus +from app.xray import INBOUND_TAGS +from fastapi import Depends, HTTPException + +USERNAME_REGEXP = re.compile(r'^(?=\w{3,32}\b)[a-zA-Z0-9]+(?:_[a-zA-Z0-9]+)*$') + + +def get_inbound(proxy_type: ProxyTypes): + if isinstance(proxy_type, ProxyTypes): + proxy_type = proxy_type.value + + try: + return INBOUND_TAGS[proxy_type] + except KeyError: + raise ValueError(proxy_type) + + +@app.post("/user", tags=['User'], response_model=UserResponse) +def add_user(new_user: UserCreate, + db: Session = Depends(get_db), + admin: Admin = Depends(jwt.current_user)): + """ + Add a new user + + - **username** must have 3 to 32 characters and is allowed to contain a-z, 0-9, and underscores in between + - **expire** must be an UTC timestamp + - **data_limit** must be in Bytes, e.g. 1073741824B = 1GB + - **proxy_type** vmess, vless, trojan or shadowsocks + """ + + if not USERNAME_REGEXP.match(new_user.username): + raise HTTPException( + status_code=400, + detail="Username only can be 3 to 32 characters and contain a-z, 0-9, and underscores in between.") + + try: + inbound = get_inbound(new_user.proxy_type) + except ValueError: + raise HTTPException(status_code=400, detail=f"Proxy type {new_user.proxy_type} not supported") + + try: + dbuser = crud.create_user(db, new_user) + except sqlalchemy.exc.IntegrityError: + raise HTTPException(status_code=409, detail="User already exists.") + + account = new_user.get_account() + + try: + xray.api.add_inbound_user(tag=inbound, user=account) + except xray.exc.EmailExistsError: + pass + + logger.info(f"New user \"{dbuser.username}\" added") + return dbuser + + +@app.get("/user/{username}", tags=['User'], response_model=UserResponse) +def get_user(username: str, + db: Session = Depends(get_db), + admin: Admin = Depends(jwt.current_user)): + """ + Get users information + """ + if dbuser := crud.get_user(db, username): + return dbuser + + raise HTTPException(status_code=404, detail="User not found") + + +@app.put("/user/{username}", tags=['User'], response_model=UserResponse) +def modify_user(username: str, + modified_user: UserModify, + db: Session = Depends(get_db), + admin: Admin = Depends(jwt.current_user)): + """ + Modify a user + + - set **expire** to 0 to make the user unlimited in time + - set **data_limit** to 0 to make the user unlimited in data + - **settings** depends on what type of proxy user have + - **proxy_type** must be specified when settings field is set + """ + + if not (dbuser := crud.get_user(db, username)): + raise HTTPException(status_code=404, detail="User not found") + + dbuser = crud.update_user(db, dbuser, modified_user) + + if modified_user.expire is not None and dbuser.status != UserStatus.limited: + if not dbuser.expire or dbuser.expire > datetime.utcnow().timestamp(): + dbuser = crud.update_user_status(db, dbuser, UserStatus.active) + else: + dbuser = crud.update_user_status(db, dbuser, UserStatus.expired) + + if modified_user.data_limit is not None and dbuser.status != UserStatus.expired: + if not dbuser.data_limit or dbuser.used_traffic < dbuser.data_limit: + dbuser = crud.update_user_status(db, dbuser, UserStatus.active) + else: + dbuser = crud.update_user_status(db, dbuser, UserStatus.limited) + + user = UserResponse.from_orm(dbuser) + inbound = get_inbound(user.proxy_type) + account = user.get_account() + + try: + xray.api.remove_inbound_user(tag=inbound, email=username) + except xray.exc.EmailNotFoundError: + pass + + if user.status == UserStatus.active: + xray.api.add_inbound_user(tag=inbound, user=account) + + logger.info(f"User \"{user.username}\" modified") + return user + + +@app.delete("/user/{username}", tags=['User']) +def remove_user(username: str, + db: Session = Depends(get_db), + admin: Admin = Depends(jwt.current_user)): + """ + Remove a user + """ + + if not (dbuser := crud.get_user(db, username)): + raise HTTPException(status_code=404, detail="User not found") + + inbound = get_inbound(dbuser.proxy_type) + crud.remove_user(db, dbuser) + + try: + xray.api.remove_inbound_user(tag=inbound, email=username) + except xray.exc.EmailNotFoundError: + pass + + logger.info(f"User \"{username}\" deleted") + return {} + + +@app.get("/users", tags=['User'], response_model=list[UserResponse]) +def get_users(offset: int = None, + limit: int = None, + db: Session = Depends(get_db), + admin: Admin = Depends(jwt.current_user)): + """ + Get all users + """ + + return crud.get_users(db, offset, limit) diff --git a/app/xray/__init__.py b/app/xray/__init__.py new file mode 100644 index 00000000..ecbc6b1e --- /dev/null +++ b/app/xray/__init__.py @@ -0,0 +1,71 @@ +import atexit + +from app.utils import check_port +from app.xray.config import XRayConfig +from app.xray.core import XRayCore +from xray_api import XRay +from xray_api import exceptions +from xray_api import exceptions as exc +from xray_api import types + +from config import XRAY_ASSETS_PATH, XRAY_EXECUTABLE_PATH, XRAY_JSON + +# Search for a free API port from 8080 +try: + for api_port in range(8080, 65536): + if not check_port(api_port): + break +finally: + config = XRayConfig(XRAY_JSON, api_port=api_port) + del api_port + + +core = XRayCore(XRAY_EXECUTABLE_PATH, XRAY_ASSETS_PATH) +core.start(config) + + +@atexit.register +def stop_core(): + if core.started: + core.stop() + + +api = XRay(config.api_host, config.api_port) + + +INBOUND_PORTS = {inbound['protocol']: inbound['port'] for inbound in config['inbounds']} +INBOUND_TAGS = {inbound['protocol']: inbound['tag'] for inbound in config['inbounds']} +INBOUND_STREAMS = {inbound['protocol']: ( + { + "net": inbound['streamSettings'].get('network', 'tcp'), + "tls": inbound['streamSettings'].get('security') in ('tls', 'xtls'), + "sni": ( + inbound['streamSettings'].get('tlsSettings') or + inbound['streamSettings'].get('xtlsSettings') or + {} + ).get('serverName', ''), + "path": inbound['streamSettings'].get( + f"{inbound['streamSettings'].get('network', 'tcp')}Settings", {} + ).get('path', '') + } + if inbound.get('streamSettings') else + { + "net": "tcp", + "tls": False, + "sni": "", + "path": "" + } + ) for inbound in config['inbounds']} + + +__all__ = [ + "config", + "core", + "api", + "exceptions", + "exc", + "types", + "INBOUND_PORTS", + "INBOUND_TAGS", + "INBOUND_STREAMS" +] diff --git a/app/xray/config.py b/app/xray/config.py new file mode 100644 index 00000000..9e3c01b3 --- /dev/null +++ b/app/xray/config.py @@ -0,0 +1,95 @@ +import json +from pathlib import PosixPath + + +class XRayConfig(dict): + def __init__(self, + config: dict | str | PosixPath = {}, + api_host: str = "127.0.0.1", + api_port: int = 8080): + if isinstance(config, str): + try: + # considering string as json + config = json.loads(config) + except json.JSONDecodeError: + # considering string as file path + with open(config, 'r') as file: + config = json.loads(file.read()) + + if isinstance(config, PosixPath): + with open(config, 'r') as file: + config = json.loads(file.read()) + + self.api_host = api_host + self.api_port = api_port + + super().__init__(config) + self._apply_api() + + def _apply_api(self): + if self.get_inbound("API_INBOUND"): + return + + self["api"] = { + "services": [ + "HandlerService", + "StatsService", + "LoggerService" + ], + "tag": "API" + } + self["stats"] = {} + self["policy"] = { + "levels": { + "0": { + "statsUserUplink": True, + "statsUserDownlink": True + } + }, + "system": { + "statsInboundDownlink": False, + "statsInboundUplink": False, + "statsOutboundDownlink": True, + "statsOutboundUplink": True + } + } + inbound = { + "listen": self.api_host, + "port": self.api_port, + "protocol": "dokodemo-door", + "settings": { + "address": self.api_host + }, + "tag": "API_INBOUND" + } + try: + self["inbounds"].insert(0, inbound) + except KeyError: + self["inbounds"] = [] + self["inbounds"].insert(0, inbound) + + rule = { + "inboundTag": [ + "API_INBOUND" + ], + "outboundTag": "API", + "type": "field" + } + try: + self["routing"]["rules"].insert(0, rule) + except KeyError: + self["routing"] = {"rules": []} + self["routing"]["rules"].insert(0, rule) + + def get_inbound(self, tag) -> dict: + for inbound in self['inbounds']: + if inbound['tag'] == tag: + return inbound + + def get_outbound(self, tag) -> dict: + for outbound in self['outbounds']: + if outbound['tag'] == tag: + outbound + + def to_json(self, **json_kwargs): + return json.dumps(self, **json_kwargs) diff --git a/app/xray/core.py b/app/xray/core.py new file mode 100644 index 00000000..2b6631ca --- /dev/null +++ b/app/xray/core.py @@ -0,0 +1,66 @@ +import subprocess + +from app.xray.config import XRayConfig +from app import logger + + +class XRayCore: + def __init__(self, + executable_path: str = "/usr/bin/xray", + assets_path: str = "/usr/share/xray"): + self.executable_path = executable_path + self.assets_path = assets_path + self.started = False + + self._process = None + self._env = { + "XRAY_LOCATION_ASSET": assets_path + } + + @property + def process(self): + if self._process is None: + raise ProcessLookupError("Xray has not been started") + return self._process + + def start(self, config: XRayConfig): + if self.started is True: + raise RuntimeError("Xray is started already") + + if config.get('log', {}).get('logLevel') in ('none', 'error'): + config['log']['logLevel'] = 'warning' + + cmd = [ + self.executable_path, + "run", + '-config', + 'stdin:' + ] + self._process = subprocess.Popen( + cmd, + env=self._env, + stdin=subprocess.PIPE, + stdout=subprocess.PIPE + ) + self._process.stdin.write( + config.to_json().encode() + ) + self._process.stdin.flush() + self._process.stdin.close() + + # Wait for XRay to get started + while _log := self._process.stdout.readline().decode(): + log = _log.strip('\n') + logger.debug(log) + if 'core: Xray' in log and 'started' in log: + logger.info(log) + self.started = True + break + + if not self.started: + raise RuntimeError("Failed to run XRay", log) + + def stop(self): + self.process.terminate() + self.started = False + self._process = None diff --git a/config.py b/config.py new file mode 100755 index 00000000..75e62506 --- /dev/null +++ b/config.py @@ -0,0 +1,40 @@ +import requests +from decouple import config +from dotenv import load_dotenv + +load_dotenv() + + +# Disable IPv6 +requests.packages.urllib3.util.connection.HAS_IPV6 = False + + +SQLALCHEMY_DATABASE_URL = config("SQLALCHEMY_DATABASE_URL", default="sqlite:///db.sqlite3") + + +UVICORN_HOST = config("UVICORN_HOST", default="127.0.0.1") +UVICORN_PORT = config("UVICORN_PORT", cast=int, default=8000) + + +XRAY_JSON = config("XRAY_JSON", default="./xray.json") +XRAY_EXECUTABLE_PATH = config("XRAY_EXECUTABLE_PATH", default="/usr/local/bin/xray") +XRAY_ASSETS_PATH = config("XRAY_ASSETS_PATH", default="/usr/local/share/xray") +XRAY_HOSTS = [ + { + "remark": h.rsplit('@', 1)[0], + "hostname": h.rsplit('@', 1)[1] + } + for h in filter(bool, config( + "XRAY_HOSTS", + default=f'Marz@{requests.get("https://ifconfig.io/ip").text}' + ).split("\n")) +] + + +JWT_ACCESS_TOKEN_EXPIRE_MINUTES = config("JWT_ACCESS_TOKEN_EXPIRE_MINUTES", cast=int, default=1440) + + +# USERNAME: PASSWORD +ADMINS = { + config("ADMIN_USERNAME", default="admin"): config("ADMIN_PASSWORD", default="admin") +} diff --git a/main.py b/main.py new file mode 100644 index 00000000..0489bbd9 --- /dev/null +++ b/main.py @@ -0,0 +1,9 @@ +import uvicorn +from app import app +from config import UVICORN_HOST, UVICORN_PORT + + +if __name__ == "__main__": + # Do NOT change workers count for now + # multi-workers support isn't implemented yet for APScheduler and XRay module + uvicorn.run("main:app", host=UVICORN_HOST, port=UVICORN_PORT, workers=1) diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000..01c7b3c9 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,52 @@ +alembic==1.8.1 +anyio==3.6.2 +APScheduler==3.9.1.post1 +async-timeout==4.0.2 +bcrypt==4.0.1 +certifi==2022.9.24 +cffi==1.15.1 +charset-normalizer==2.1.1 +click==8.1.3 +cryptography==38.0.3 +Deprecated==1.2.13 +ecdsa==0.18.0 +fastapi==0.86.0 +fastapi-responses==0.2.1 +greenlet==2.0.1 +grpcio==1.44.0 +grpcio-tools==1.44.0 +h11==0.14.0 +httptools==0.5.0 +idna==3.4 +Mako==1.2.4 +MarkupSafe==2.1.1 +packaging==21.3 +passlib==1.7.4 +protobuf==3.20.3 +pyasn1==0.4.8 +pycparser==2.21 +pydantic==1.10.2 +pyparsing==3.0.9 +python-decouple==3.6 +python-dotenv==0.21.0 +python-jose==3.3.0 +python-multipart==0.0.5 +pytz==2022.6 +pytz-deprecation-shim==0.1.0.post0 +PyYAML==6.0 +redis==4.3.5 +requests==2.28.1 +rsa==4.9 +six==1.16.0 +sniffio==1.3.0 +SQLAlchemy==1.4.44 +starlette==0.20.4 +typing_extensions==4.4.0 +tzdata==2022.6 +tzlocal==4.2 +urllib3==1.26.12 +uvicorn==0.19.0 +uvloop==0.17.0 +watchfiles==0.18.1 +websockets==10.4 +wrapt==1.14.1 diff --git a/xray.json b/xray.json new file mode 100644 index 00000000..7f44ee66 --- /dev/null +++ b/xray.json @@ -0,0 +1,85 @@ +{ + "inbounds": [ + { + "listen": "0.0.0.0", + "port": 8443, + "protocol": "vmess", + "settings": { + "clients": [] + }, + "streamSettings": { + "network": "ws", + "wsSettings": { + "path": "/" + } + }, + "tag": "VMESS_INBOUND" + }, + { + "listen": "0.0.0.0", + "port": 8880, + "protocol": "vless", + "settings": { + "clients": [], + "decryption": "none" + }, + "streamSettings": { + "network": "ws", + "wsSettings": { + "path": "/" + } + }, + "tag": "VLESS_INBOUND" + }, + { + "listen": "0.0.0.0", + "port": 2053, + "protocol": "shadowsocks", + "settings": { + "clients": [] + }, + "network": "tcp,udp", + "tag": "SHADOWSOCKS_INBOUND" + }, + { + "listen": "0.0.0.0", + "port": 8080, + "protocol": "trojan", + "settings": { + "clients": [] + }, + "network": "tcp,udp", + "tag": "TROJAN_INBOUND" + } + ], + "outbounds": [ + { + "protocol": "freedom", + "settings": {}, + "tag": "DIRECT" + }, + { + "protocol": "blackhole", + "settings": {}, + "tag": "BLOCK" + } + ], + "routing": { + "rules": [ + { + "ip": [ + "geoip:private" + ], + "outboundTag": "BLOCK", + "type": "field" + }, + { + "domain": [ + "localhost" + ], + "outboundTag": "BLOCK", + "type": "field" + } + ] + } +} \ No newline at end of file diff --git a/xray_api/__init__.py b/xray_api/__init__.py new file mode 100644 index 00000000..16ef9c1f --- /dev/null +++ b/xray_api/__init__.py @@ -0,0 +1,17 @@ +from . import exceptions +from . import exceptions as exc +from . import types +from .proxyman import Proxyman +from .stats import Stats + + +class XRay(Proxyman, Stats): + pass + + +__all__ = [ + "XRay", + "exceptions", + "exc", + "types" +] diff --git a/xray_api/base.py b/xray_api/base.py new file mode 100644 index 00000000..5daa6cbe --- /dev/null +++ b/xray_api/base.py @@ -0,0 +1,8 @@ +import grpc + + +class XRayBase(object): + def __init__(self, address, port): + self.address = address + self.port = port + self._channel = grpc.insecure_channel(f"{address}:{port}") diff --git a/xray_api/exceptions.py b/xray_api/exceptions.py new file mode 100755 index 00000000..815a68ce --- /dev/null +++ b/xray_api/exceptions.py @@ -0,0 +1,51 @@ +import re + +import grpc + + +class XrayError(Exception): + REGEXP = ... + + def __init__(self, details): + self.details = details + + +class EmailExistsError(XrayError): + REGEXP = re.compile(r"User (.*) already exists.") + + def __init__(self, details, email): + self.email = email + super().__init__(details) + + +class EmailNotFoundError(XrayError): + REGEXP = re.compile(r"User (.*) not found.") + + def __init__(self, details, email): + self.email = email + super().__init__(details) + + +class TagNotFoundError(XrayError): + REGEXP = re.compile(r"handler not found: (.*)") + + def __init__(self, details, tag): + self.tag = tag + super().__init__(details) + + +class UnkownError(XrayError): + def __init__(self, details=''): + super().__init__(details) + + +class RelatedError(XrayError): + def __new__(cls, error: grpc.RpcError): + details = error.details() + for e in (EmailExistsError, EmailNotFoundError, TagNotFoundError): + args = e.REGEXP.findall(details) + if not args: + continue + return e(details, *args) + + return UnkownError(details) diff --git a/xray_api/proto/app/commander/config_pb2.py b/xray_api/proto/app/commander/config_pb2.py new file mode 100644 index 00000000..bd9bffa7 --- /dev/null +++ b/xray_api/proto/app/commander/config_pb2.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: app/commander/config.proto +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from xray_api.proto.common.serial import typed_message_pb2 as common_dot_serial_dot_typed__message__pb2 + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1a\x61pp/commander/config.proto\x12\x12xray.app.commander\x1a!common/serial/typed_message.proto\"H\n\x06\x43onfig\x12\x0b\n\x03tag\x18\x01 \x01(\t\x12\x31\n\x07service\x18\x02 \x03(\x0b\x32 .xray.common.serial.TypedMessage\"\x12\n\x10ReflectionConfigBX\n\x16\x63om.xray.app.commanderP\x01Z\'github.com/xtls/xray-core/app/commander\xaa\x02\x12Xray.App.Commanderb\x06proto3') + + + +_CONFIG = DESCRIPTOR.message_types_by_name['Config'] +_REFLECTIONCONFIG = DESCRIPTOR.message_types_by_name['ReflectionConfig'] +Config = _reflection.GeneratedProtocolMessageType('Config', (_message.Message,), { + 'DESCRIPTOR' : _CONFIG, + '__module__' : 'app.commander.config_pb2' + # @@protoc_insertion_point(class_scope:xray.app.commander.Config) + }) +_sym_db.RegisterMessage(Config) + +ReflectionConfig = _reflection.GeneratedProtocolMessageType('ReflectionConfig', (_message.Message,), { + 'DESCRIPTOR' : _REFLECTIONCONFIG, + '__module__' : 'app.commander.config_pb2' + # @@protoc_insertion_point(class_scope:xray.app.commander.ReflectionConfig) + }) +_sym_db.RegisterMessage(ReflectionConfig) + +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n\026com.xray.app.commanderP\001Z\'github.com/xtls/xray-core/app/commander\252\002\022Xray.App.Commander' + _CONFIG._serialized_start=85 + _CONFIG._serialized_end=157 + _REFLECTIONCONFIG._serialized_start=159 + _REFLECTIONCONFIG._serialized_end=177 +# @@protoc_insertion_point(module_scope) diff --git a/xray_api/proto/app/commander/config_pb2_grpc.py b/xray_api/proto/app/commander/config_pb2_grpc.py new file mode 100644 index 00000000..2daafffe --- /dev/null +++ b/xray_api/proto/app/commander/config_pb2_grpc.py @@ -0,0 +1,4 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + diff --git a/xray_api/proto/app/dispatcher/config_pb2.py b/xray_api/proto/app/dispatcher/config_pb2.py new file mode 100644 index 00000000..35b90089 --- /dev/null +++ b/xray_api/proto/app/dispatcher/config_pb2.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: app/dispatcher/config.proto +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1b\x61pp/dispatcher/config.proto\x12\x13xray.app.dispatcher\"\x15\n\rSessionConfigJ\x04\x08\x01\x10\x02\">\n\x06\x43onfig\x12\x34\n\x08settings\x18\x01 \x01(\x0b\x32\".xray.app.dispatcher.SessionConfigB[\n\x17\x63om.xray.app.dispatcherP\x01Z(github.com/xtls/xray-core/app/dispatcher\xaa\x02\x13Xray.App.Dispatcherb\x06proto3') + + + +_SESSIONCONFIG = DESCRIPTOR.message_types_by_name['SessionConfig'] +_CONFIG = DESCRIPTOR.message_types_by_name['Config'] +SessionConfig = _reflection.GeneratedProtocolMessageType('SessionConfig', (_message.Message,), { + 'DESCRIPTOR' : _SESSIONCONFIG, + '__module__' : 'app.dispatcher.config_pb2' + # @@protoc_insertion_point(class_scope:xray.app.dispatcher.SessionConfig) + }) +_sym_db.RegisterMessage(SessionConfig) + +Config = _reflection.GeneratedProtocolMessageType('Config', (_message.Message,), { + 'DESCRIPTOR' : _CONFIG, + '__module__' : 'app.dispatcher.config_pb2' + # @@protoc_insertion_point(class_scope:xray.app.dispatcher.Config) + }) +_sym_db.RegisterMessage(Config) + +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n\027com.xray.app.dispatcherP\001Z(github.com/xtls/xray-core/app/dispatcher\252\002\023Xray.App.Dispatcher' + _SESSIONCONFIG._serialized_start=52 + _SESSIONCONFIG._serialized_end=73 + _CONFIG._serialized_start=75 + _CONFIG._serialized_end=137 +# @@protoc_insertion_point(module_scope) diff --git a/xray_api/proto/app/dispatcher/config_pb2_grpc.py b/xray_api/proto/app/dispatcher/config_pb2_grpc.py new file mode 100644 index 00000000..2daafffe --- /dev/null +++ b/xray_api/proto/app/dispatcher/config_pb2_grpc.py @@ -0,0 +1,4 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + diff --git a/xray_api/proto/app/dns/config_pb2.py b/xray_api/proto/app/dns/config_pb2.py new file mode 100644 index 00000000..9966067c --- /dev/null +++ b/xray_api/proto/app/dns/config_pb2.py @@ -0,0 +1,114 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: app/dns/config.proto +"""Generated protocol buffer code.""" +from google.protobuf.internal import enum_type_wrapper +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from xray_api.proto.common.net import address_pb2 as common_dot_net_dot_address__pb2 +from xray_api.proto.common.net import destination_pb2 as common_dot_net_dot_destination__pb2 +from xray_api.proto.app.router import config_pb2 as app_dot_router_dot_config__pb2 + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x14\x61pp/dns/config.proto\x12\x0cxray.app.dns\x1a\x18\x63ommon/net/address.proto\x1a\x1c\x63ommon/net/destination.proto\x1a\x17\x61pp/router/config.proto\"\x8a\x03\n\nNameServer\x12*\n\x07\x61\x64\x64ress\x18\x01 \x01(\x0b\x32\x19.xray.common.net.Endpoint\x12\x11\n\tclient_ip\x18\x05 \x01(\x0c\x12\x14\n\x0cskipFallback\x18\x06 \x01(\x08\x12\x43\n\x12prioritized_domain\x18\x02 \x03(\x0b\x32\'.xray.app.dns.NameServer.PriorityDomain\x12%\n\x05geoip\x18\x03 \x03(\x0b\x32\x16.xray.app.router.GeoIP\x12=\n\x0eoriginal_rules\x18\x04 \x03(\x0b\x32%.xray.app.dns.NameServer.OriginalRule\x1aP\n\x0ePriorityDomain\x12.\n\x04type\x18\x01 \x01(\x0e\x32 .xray.app.dns.DomainMatchingType\x12\x0e\n\x06\x64omain\x18\x02 \x01(\t\x1a*\n\x0cOriginalRule\x12\x0c\n\x04rule\x18\x01 \x01(\t\x12\x0c\n\x04size\x18\x02 \x01(\r\"\xbf\x04\n\x06\x43onfig\x12\x32\n\x0bNameServers\x18\x01 \x03(\x0b\x32\x19.xray.common.net.EndpointB\x02\x18\x01\x12-\n\x0bname_server\x18\x05 \x03(\x0b\x32\x18.xray.app.dns.NameServer\x12\x32\n\x05Hosts\x18\x02 \x03(\x0b\x32\x1f.xray.app.dns.Config.HostsEntryB\x02\x18\x01\x12\x11\n\tclient_ip\x18\x03 \x01(\x0c\x12\x36\n\x0cstatic_hosts\x18\x04 \x03(\x0b\x32 .xray.app.dns.Config.HostMapping\x12\x0b\n\x03tag\x18\x06 \x01(\t\x12\x14\n\x0c\x64isableCache\x18\x08 \x01(\x08\x12\x33\n\x0equery_strategy\x18\t \x01(\x0e\x32\x1b.xray.app.dns.QueryStrategy\x12\x17\n\x0f\x64isableFallback\x18\n \x01(\x08\x12\x1e\n\x16\x64isableFallbackIfMatch\x18\x0b \x01(\x08\x1aI\n\nHostsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12*\n\x05value\x18\x02 \x01(\x0b\x32\x1b.xray.common.net.IPOrDomain:\x02\x38\x01\x1aq\n\x0bHostMapping\x12.\n\x04type\x18\x01 \x01(\x0e\x32 .xray.app.dns.DomainMatchingType\x12\x0e\n\x06\x64omain\x18\x02 \x01(\t\x12\n\n\x02ip\x18\x03 \x03(\x0c\x12\x16\n\x0eproxied_domain\x18\x04 \x01(\tJ\x04\x08\x07\x10\x08*E\n\x12\x44omainMatchingType\x12\x08\n\x04\x46ull\x10\x00\x12\r\n\tSubdomain\x10\x01\x12\x0b\n\x07Keyword\x10\x02\x12\t\n\x05Regex\x10\x03*5\n\rQueryStrategy\x12\n\n\x06USE_IP\x10\x00\x12\x0b\n\x07USE_IP4\x10\x01\x12\x0b\n\x07USE_IP6\x10\x02\x42\x46\n\x10\x63om.xray.app.dnsP\x01Z!github.com/xtls/xray-core/app/dns\xaa\x02\x0cXray.App.Dnsb\x06proto3') + +_DOMAINMATCHINGTYPE = DESCRIPTOR.enum_types_by_name['DomainMatchingType'] +DomainMatchingType = enum_type_wrapper.EnumTypeWrapper(_DOMAINMATCHINGTYPE) +_QUERYSTRATEGY = DESCRIPTOR.enum_types_by_name['QueryStrategy'] +QueryStrategy = enum_type_wrapper.EnumTypeWrapper(_QUERYSTRATEGY) +Full = 0 +Subdomain = 1 +Keyword = 2 +Regex = 3 +USE_IP = 0 +USE_IP4 = 1 +USE_IP6 = 2 + + +_NAMESERVER = DESCRIPTOR.message_types_by_name['NameServer'] +_NAMESERVER_PRIORITYDOMAIN = _NAMESERVER.nested_types_by_name['PriorityDomain'] +_NAMESERVER_ORIGINALRULE = _NAMESERVER.nested_types_by_name['OriginalRule'] +_CONFIG = DESCRIPTOR.message_types_by_name['Config'] +_CONFIG_HOSTSENTRY = _CONFIG.nested_types_by_name['HostsEntry'] +_CONFIG_HOSTMAPPING = _CONFIG.nested_types_by_name['HostMapping'] +NameServer = _reflection.GeneratedProtocolMessageType('NameServer', (_message.Message,), { + + 'PriorityDomain' : _reflection.GeneratedProtocolMessageType('PriorityDomain', (_message.Message,), { + 'DESCRIPTOR' : _NAMESERVER_PRIORITYDOMAIN, + '__module__' : 'app.dns.config_pb2' + # @@protoc_insertion_point(class_scope:xray.app.dns.NameServer.PriorityDomain) + }) + , + + 'OriginalRule' : _reflection.GeneratedProtocolMessageType('OriginalRule', (_message.Message,), { + 'DESCRIPTOR' : _NAMESERVER_ORIGINALRULE, + '__module__' : 'app.dns.config_pb2' + # @@protoc_insertion_point(class_scope:xray.app.dns.NameServer.OriginalRule) + }) + , + 'DESCRIPTOR' : _NAMESERVER, + '__module__' : 'app.dns.config_pb2' + # @@protoc_insertion_point(class_scope:xray.app.dns.NameServer) + }) +_sym_db.RegisterMessage(NameServer) +_sym_db.RegisterMessage(NameServer.PriorityDomain) +_sym_db.RegisterMessage(NameServer.OriginalRule) + +Config = _reflection.GeneratedProtocolMessageType('Config', (_message.Message,), { + + 'HostsEntry' : _reflection.GeneratedProtocolMessageType('HostsEntry', (_message.Message,), { + 'DESCRIPTOR' : _CONFIG_HOSTSENTRY, + '__module__' : 'app.dns.config_pb2' + # @@protoc_insertion_point(class_scope:xray.app.dns.Config.HostsEntry) + }) + , + + 'HostMapping' : _reflection.GeneratedProtocolMessageType('HostMapping', (_message.Message,), { + 'DESCRIPTOR' : _CONFIG_HOSTMAPPING, + '__module__' : 'app.dns.config_pb2' + # @@protoc_insertion_point(class_scope:xray.app.dns.Config.HostMapping) + }) + , + 'DESCRIPTOR' : _CONFIG, + '__module__' : 'app.dns.config_pb2' + # @@protoc_insertion_point(class_scope:xray.app.dns.Config) + }) +_sym_db.RegisterMessage(Config) +_sym_db.RegisterMessage(Config.HostsEntry) +_sym_db.RegisterMessage(Config.HostMapping) + +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n\020com.xray.app.dnsP\001Z!github.com/xtls/xray-core/app/dns\252\002\014Xray.App.Dns' + _CONFIG_HOSTSENTRY._options = None + _CONFIG_HOSTSENTRY._serialized_options = b'8\001' + _CONFIG.fields_by_name['NameServers']._options = None + _CONFIG.fields_by_name['NameServers']._serialized_options = b'\030\001' + _CONFIG.fields_by_name['Hosts']._options = None + _CONFIG.fields_by_name['Hosts']._serialized_options = b'\030\001' + _DOMAINMATCHINGTYPE._serialized_start=1094 + _DOMAINMATCHINGTYPE._serialized_end=1163 + _QUERYSTRATEGY._serialized_start=1165 + _QUERYSTRATEGY._serialized_end=1218 + _NAMESERVER._serialized_start=120 + _NAMESERVER._serialized_end=514 + _NAMESERVER_PRIORITYDOMAIN._serialized_start=390 + _NAMESERVER_PRIORITYDOMAIN._serialized_end=470 + _NAMESERVER_ORIGINALRULE._serialized_start=472 + _NAMESERVER_ORIGINALRULE._serialized_end=514 + _CONFIG._serialized_start=517 + _CONFIG._serialized_end=1092 + _CONFIG_HOSTSENTRY._serialized_start=898 + _CONFIG_HOSTSENTRY._serialized_end=971 + _CONFIG_HOSTMAPPING._serialized_start=973 + _CONFIG_HOSTMAPPING._serialized_end=1086 +# @@protoc_insertion_point(module_scope) diff --git a/xray_api/proto/app/dns/config_pb2_grpc.py b/xray_api/proto/app/dns/config_pb2_grpc.py new file mode 100644 index 00000000..2daafffe --- /dev/null +++ b/xray_api/proto/app/dns/config_pb2_grpc.py @@ -0,0 +1,4 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + diff --git a/xray_api/proto/app/dns/fakedns/fakedns_pb2.py b/xray_api/proto/app/dns/fakedns/fakedns_pb2.py new file mode 100644 index 00000000..68c8df0f --- /dev/null +++ b/xray_api/proto/app/dns/fakedns/fakedns_pb2.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: app/dns/fakedns/fakedns.proto +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1d\x61pp/dns/fakedns/fakedns.proto\x12\x14xray.app.dns.fakedns\"/\n\x0b\x46\x61keDnsPool\x12\x0f\n\x07ip_pool\x18\x01 \x01(\t\x12\x0f\n\x07lruSize\x18\x02 \x01(\x03\"D\n\x10\x46\x61keDnsPoolMulti\x12\x30\n\x05pools\x18\x01 \x03(\x0b\x32!.xray.app.dns.fakedns.FakeDnsPoolB^\n\x18\x63om.xray.app.dns.fakednsP\x01Z)github.com/xtls/xray-core/app/dns/fakedns\xaa\x02\x14Xray.App.Dns.Fakednsb\x06proto3') + + + +_FAKEDNSPOOL = DESCRIPTOR.message_types_by_name['FakeDnsPool'] +_FAKEDNSPOOLMULTI = DESCRIPTOR.message_types_by_name['FakeDnsPoolMulti'] +FakeDnsPool = _reflection.GeneratedProtocolMessageType('FakeDnsPool', (_message.Message,), { + 'DESCRIPTOR' : _FAKEDNSPOOL, + '__module__' : 'app.dns.fakedns.fakedns_pb2' + # @@protoc_insertion_point(class_scope:xray.app.dns.fakedns.FakeDnsPool) + }) +_sym_db.RegisterMessage(FakeDnsPool) + +FakeDnsPoolMulti = _reflection.GeneratedProtocolMessageType('FakeDnsPoolMulti', (_message.Message,), { + 'DESCRIPTOR' : _FAKEDNSPOOLMULTI, + '__module__' : 'app.dns.fakedns.fakedns_pb2' + # @@protoc_insertion_point(class_scope:xray.app.dns.fakedns.FakeDnsPoolMulti) + }) +_sym_db.RegisterMessage(FakeDnsPoolMulti) + +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n\030com.xray.app.dns.fakednsP\001Z)github.com/xtls/xray-core/app/dns/fakedns\252\002\024Xray.App.Dns.Fakedns' + _FAKEDNSPOOL._serialized_start=55 + _FAKEDNSPOOL._serialized_end=102 + _FAKEDNSPOOLMULTI._serialized_start=104 + _FAKEDNSPOOLMULTI._serialized_end=172 +# @@protoc_insertion_point(module_scope) diff --git a/xray_api/proto/app/dns/fakedns/fakedns_pb2_grpc.py b/xray_api/proto/app/dns/fakedns/fakedns_pb2_grpc.py new file mode 100644 index 00000000..2daafffe --- /dev/null +++ b/xray_api/proto/app/dns/fakedns/fakedns_pb2_grpc.py @@ -0,0 +1,4 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + diff --git a/xray_api/proto/app/log/command/config_pb2.py b/xray_api/proto/app/log/command/config_pb2.py new file mode 100644 index 00000000..03b627c1 --- /dev/null +++ b/xray_api/proto/app/log/command/config_pb2.py @@ -0,0 +1,58 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: app/log/command/config.proto +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1c\x61pp/log/command/config.proto\x12\x14xray.app.log.command\"\x08\n\x06\x43onfig\"\x16\n\x14RestartLoggerRequest\"\x17\n\x15RestartLoggerResponse2{\n\rLoggerService\x12j\n\rRestartLogger\x12*.xray.app.log.command.RestartLoggerRequest\x1a+.xray.app.log.command.RestartLoggerResponse\"\x00\x42^\n\x18\x63om.xray.app.log.commandP\x01Z)github.com/xtls/xray-core/app/log/command\xaa\x02\x14Xray.App.Log.Commandb\x06proto3') + + + +_CONFIG = DESCRIPTOR.message_types_by_name['Config'] +_RESTARTLOGGERREQUEST = DESCRIPTOR.message_types_by_name['RestartLoggerRequest'] +_RESTARTLOGGERRESPONSE = DESCRIPTOR.message_types_by_name['RestartLoggerResponse'] +Config = _reflection.GeneratedProtocolMessageType('Config', (_message.Message,), { + 'DESCRIPTOR' : _CONFIG, + '__module__' : 'app.log.command.config_pb2' + # @@protoc_insertion_point(class_scope:xray.app.log.command.Config) + }) +_sym_db.RegisterMessage(Config) + +RestartLoggerRequest = _reflection.GeneratedProtocolMessageType('RestartLoggerRequest', (_message.Message,), { + 'DESCRIPTOR' : _RESTARTLOGGERREQUEST, + '__module__' : 'app.log.command.config_pb2' + # @@protoc_insertion_point(class_scope:xray.app.log.command.RestartLoggerRequest) + }) +_sym_db.RegisterMessage(RestartLoggerRequest) + +RestartLoggerResponse = _reflection.GeneratedProtocolMessageType('RestartLoggerResponse', (_message.Message,), { + 'DESCRIPTOR' : _RESTARTLOGGERRESPONSE, + '__module__' : 'app.log.command.config_pb2' + # @@protoc_insertion_point(class_scope:xray.app.log.command.RestartLoggerResponse) + }) +_sym_db.RegisterMessage(RestartLoggerResponse) + +_LOGGERSERVICE = DESCRIPTOR.services_by_name['LoggerService'] +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n\030com.xray.app.log.commandP\001Z)github.com/xtls/xray-core/app/log/command\252\002\024Xray.App.Log.Command' + _CONFIG._serialized_start=54 + _CONFIG._serialized_end=62 + _RESTARTLOGGERREQUEST._serialized_start=64 + _RESTARTLOGGERREQUEST._serialized_end=86 + _RESTARTLOGGERRESPONSE._serialized_start=88 + _RESTARTLOGGERRESPONSE._serialized_end=111 + _LOGGERSERVICE._serialized_start=113 + _LOGGERSERVICE._serialized_end=236 +# @@protoc_insertion_point(module_scope) diff --git a/xray_api/proto/app/log/command/config_pb2_grpc.py b/xray_api/proto/app/log/command/config_pb2_grpc.py new file mode 100644 index 00000000..36929366 --- /dev/null +++ b/xray_api/proto/app/log/command/config_pb2_grpc.py @@ -0,0 +1,66 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + +from xray_api.proto.app.log.command import config_pb2 as app_dot_log_dot_command_dot_config__pb2 + + +class LoggerServiceStub(object): + """Missing associated documentation comment in .proto file.""" + + def __init__(self, channel): + """Constructor. + + Args: + channel: A grpc.Channel. + """ + self.RestartLogger = channel.unary_unary( + '/xray.app.log.command.LoggerService/RestartLogger', + request_serializer=app_dot_log_dot_command_dot_config__pb2.RestartLoggerRequest.SerializeToString, + response_deserializer=app_dot_log_dot_command_dot_config__pb2.RestartLoggerResponse.FromString, + ) + + +class LoggerServiceServicer(object): + """Missing associated documentation comment in .proto file.""" + + def RestartLogger(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + +def add_LoggerServiceServicer_to_server(servicer, server): + rpc_method_handlers = { + 'RestartLogger': grpc.unary_unary_rpc_method_handler( + servicer.RestartLogger, + request_deserializer=app_dot_log_dot_command_dot_config__pb2.RestartLoggerRequest.FromString, + response_serializer=app_dot_log_dot_command_dot_config__pb2.RestartLoggerResponse.SerializeToString, + ), + } + generic_handler = grpc.method_handlers_generic_handler( + 'xray.app.log.command.LoggerService', rpc_method_handlers) + server.add_generic_rpc_handlers((generic_handler,)) + + + # This class is part of an EXPERIMENTAL API. +class LoggerService(object): + """Missing associated documentation comment in .proto file.""" + + @staticmethod + def RestartLogger(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/xray.app.log.command.LoggerService/RestartLogger', + app_dot_log_dot_command_dot_config__pb2.RestartLoggerRequest.SerializeToString, + app_dot_log_dot_command_dot_config__pb2.RestartLoggerResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) diff --git a/xray_api/proto/app/log/config_pb2.py b/xray_api/proto/app/log/config_pb2.py new file mode 100644 index 00000000..127eb2d3 --- /dev/null +++ b/xray_api/proto/app/log/config_pb2.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: app/log/config.proto +"""Generated protocol buffer code.""" +from google.protobuf.internal import enum_type_wrapper +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from xray_api.proto.common.log import log_pb2 as common_dot_log_dot_log__pb2 + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x14\x61pp/log/config.proto\x12\x0cxray.app.log\x1a\x14\x63ommon/log/log.proto\"\xe4\x01\n\x06\x43onfig\x12-\n\x0e\x65rror_log_type\x18\x01 \x01(\x0e\x32\x15.xray.app.log.LogType\x12\x32\n\x0f\x65rror_log_level\x18\x02 \x01(\x0e\x32\x19.xray.common.log.Severity\x12\x16\n\x0e\x65rror_log_path\x18\x03 \x01(\t\x12.\n\x0f\x61\x63\x63\x65ss_log_type\x18\x04 \x01(\x0e\x32\x15.xray.app.log.LogType\x12\x17\n\x0f\x61\x63\x63\x65ss_log_path\x18\x05 \x01(\t\x12\x16\n\x0e\x65nable_dns_log\x18\x06 \x01(\x08*5\n\x07LogType\x12\x08\n\x04None\x10\x00\x12\x0b\n\x07\x43onsole\x10\x01\x12\x08\n\x04\x46ile\x10\x02\x12\t\n\x05\x45vent\x10\x03\x42\x46\n\x10\x63om.xray.app.logP\x01Z!github.com/xtls/xray-core/app/log\xaa\x02\x0cXray.App.Logb\x06proto3') + +_LOGTYPE = DESCRIPTOR.enum_types_by_name['LogType'] +LogType = enum_type_wrapper.EnumTypeWrapper(_LOGTYPE) +globals()['None'] = 0 +Console = 1 +File = 2 +Event = 3 + + +_CONFIG = DESCRIPTOR.message_types_by_name['Config'] +Config = _reflection.GeneratedProtocolMessageType('Config', (_message.Message,), { + 'DESCRIPTOR' : _CONFIG, + '__module__' : 'app.log.config_pb2' + # @@protoc_insertion_point(class_scope:xray.app.log.Config) + }) +_sym_db.RegisterMessage(Config) + +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n\020com.xray.app.logP\001Z!github.com/xtls/xray-core/app/log\252\002\014Xray.App.Log' + _LOGTYPE._serialized_start=291 + _LOGTYPE._serialized_end=344 + _CONFIG._serialized_start=61 + _CONFIG._serialized_end=289 +# @@protoc_insertion_point(module_scope) diff --git a/xray_api/proto/app/log/config_pb2_grpc.py b/xray_api/proto/app/log/config_pb2_grpc.py new file mode 100644 index 00000000..2daafffe --- /dev/null +++ b/xray_api/proto/app/log/config_pb2_grpc.py @@ -0,0 +1,4 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + diff --git a/xray_api/proto/app/metrics/config_pb2.py b/xray_api/proto/app/metrics/config_pb2.py new file mode 100644 index 00000000..5c4a7097 --- /dev/null +++ b/xray_api/proto/app/metrics/config_pb2.py @@ -0,0 +1,35 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: app/metrics/config.proto +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x18\x61pp/metrics/config.proto\x12\x10xray.app.metrics\"\x15\n\x06\x43onfig\x12\x0b\n\x03tag\x18\x01 \x01(\tBR\n\x14\x63om.xray.app.metricsP\x01Z%github.com/xtls/xray-core/app/metrics\xaa\x02\x10Xray.App.Metricsb\x06proto3') + + + +_CONFIG = DESCRIPTOR.message_types_by_name['Config'] +Config = _reflection.GeneratedProtocolMessageType('Config', (_message.Message,), { + 'DESCRIPTOR' : _CONFIG, + '__module__' : 'app.metrics.config_pb2' + # @@protoc_insertion_point(class_scope:xray.app.metrics.Config) + }) +_sym_db.RegisterMessage(Config) + +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n\024com.xray.app.metricsP\001Z%github.com/xtls/xray-core/app/metrics\252\002\020Xray.App.Metrics' + _CONFIG._serialized_start=46 + _CONFIG._serialized_end=67 +# @@protoc_insertion_point(module_scope) diff --git a/xray_api/proto/app/metrics/config_pb2_grpc.py b/xray_api/proto/app/metrics/config_pb2_grpc.py new file mode 100644 index 00000000..2daafffe --- /dev/null +++ b/xray_api/proto/app/metrics/config_pb2_grpc.py @@ -0,0 +1,4 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + diff --git a/xray_api/proto/app/observatory/command/command_pb2.py b/xray_api/proto/app/observatory/command/command_pb2.py new file mode 100644 index 00000000..a61cf8cd --- /dev/null +++ b/xray_api/proto/app/observatory/command/command_pb2.py @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: app/observatory/command/command.proto +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from xray_api.proto.app.observatory import config_pb2 as app_dot_observatory_dot_config__pb2 + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n%app/observatory/command/command.proto\x12!xray.core.app.observatory.command\x1a\x1c\x61pp/observatory/config.proto\"\x1a\n\x18GetOutboundStatusRequest\"Y\n\x19GetOutboundStatusResponse\x12<\n\x06status\x18\x01 \x01(\x0b\x32,.xray.core.app.observatory.ObservationResult\"\x08\n\x06\x43onfig2\xa7\x01\n\x12ObservatoryService\x12\x90\x01\n\x11GetOutboundStatus\x12;.xray.core.app.observatory.command.GetOutboundStatusRequest\x1a<.xray.core.app.observatory.command.GetOutboundStatusResponse\"\x00\x42\x80\x01\n%com.xray.core.app.observatory.commandP\x01Z1github.com/xtls/xray-core/app/observatory/command\xaa\x02!Xray.Core.App.Observatory.Commandb\x06proto3') + + + +_GETOUTBOUNDSTATUSREQUEST = DESCRIPTOR.message_types_by_name['GetOutboundStatusRequest'] +_GETOUTBOUNDSTATUSRESPONSE = DESCRIPTOR.message_types_by_name['GetOutboundStatusResponse'] +_CONFIG = DESCRIPTOR.message_types_by_name['Config'] +GetOutboundStatusRequest = _reflection.GeneratedProtocolMessageType('GetOutboundStatusRequest', (_message.Message,), { + 'DESCRIPTOR' : _GETOUTBOUNDSTATUSREQUEST, + '__module__' : 'app.observatory.command.command_pb2' + # @@protoc_insertion_point(class_scope:xray.core.app.observatory.command.GetOutboundStatusRequest) + }) +_sym_db.RegisterMessage(GetOutboundStatusRequest) + +GetOutboundStatusResponse = _reflection.GeneratedProtocolMessageType('GetOutboundStatusResponse', (_message.Message,), { + 'DESCRIPTOR' : _GETOUTBOUNDSTATUSRESPONSE, + '__module__' : 'app.observatory.command.command_pb2' + # @@protoc_insertion_point(class_scope:xray.core.app.observatory.command.GetOutboundStatusResponse) + }) +_sym_db.RegisterMessage(GetOutboundStatusResponse) + +Config = _reflection.GeneratedProtocolMessageType('Config', (_message.Message,), { + 'DESCRIPTOR' : _CONFIG, + '__module__' : 'app.observatory.command.command_pb2' + # @@protoc_insertion_point(class_scope:xray.core.app.observatory.command.Config) + }) +_sym_db.RegisterMessage(Config) + +_OBSERVATORYSERVICE = DESCRIPTOR.services_by_name['ObservatoryService'] +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n%com.xray.core.app.observatory.commandP\001Z1github.com/xtls/xray-core/app/observatory/command\252\002!Xray.Core.App.Observatory.Command' + _GETOUTBOUNDSTATUSREQUEST._serialized_start=106 + _GETOUTBOUNDSTATUSREQUEST._serialized_end=132 + _GETOUTBOUNDSTATUSRESPONSE._serialized_start=134 + _GETOUTBOUNDSTATUSRESPONSE._serialized_end=223 + _CONFIG._serialized_start=225 + _CONFIG._serialized_end=233 + _OBSERVATORYSERVICE._serialized_start=236 + _OBSERVATORYSERVICE._serialized_end=403 +# @@protoc_insertion_point(module_scope) diff --git a/xray_api/proto/app/observatory/command/command_pb2_grpc.py b/xray_api/proto/app/observatory/command/command_pb2_grpc.py new file mode 100644 index 00000000..8d742ba8 --- /dev/null +++ b/xray_api/proto/app/observatory/command/command_pb2_grpc.py @@ -0,0 +1,66 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + +from xray_api.proto.app.observatory.command import command_pb2 as app_dot_observatory_dot_command_dot_command__pb2 + + +class ObservatoryServiceStub(object): + """Missing associated documentation comment in .proto file.""" + + def __init__(self, channel): + """Constructor. + + Args: + channel: A grpc.Channel. + """ + self.GetOutboundStatus = channel.unary_unary( + '/xray.core.app.observatory.command.ObservatoryService/GetOutboundStatus', + request_serializer=app_dot_observatory_dot_command_dot_command__pb2.GetOutboundStatusRequest.SerializeToString, + response_deserializer=app_dot_observatory_dot_command_dot_command__pb2.GetOutboundStatusResponse.FromString, + ) + + +class ObservatoryServiceServicer(object): + """Missing associated documentation comment in .proto file.""" + + def GetOutboundStatus(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + +def add_ObservatoryServiceServicer_to_server(servicer, server): + rpc_method_handlers = { + 'GetOutboundStatus': grpc.unary_unary_rpc_method_handler( + servicer.GetOutboundStatus, + request_deserializer=app_dot_observatory_dot_command_dot_command__pb2.GetOutboundStatusRequest.FromString, + response_serializer=app_dot_observatory_dot_command_dot_command__pb2.GetOutboundStatusResponse.SerializeToString, + ), + } + generic_handler = grpc.method_handlers_generic_handler( + 'xray.core.app.observatory.command.ObservatoryService', rpc_method_handlers) + server.add_generic_rpc_handlers((generic_handler,)) + + + # This class is part of an EXPERIMENTAL API. +class ObservatoryService(object): + """Missing associated documentation comment in .proto file.""" + + @staticmethod + def GetOutboundStatus(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/xray.core.app.observatory.command.ObservatoryService/GetOutboundStatus', + app_dot_observatory_dot_command_dot_command__pb2.GetOutboundStatusRequest.SerializeToString, + app_dot_observatory_dot_command_dot_command__pb2.GetOutboundStatusResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) diff --git a/xray_api/proto/app/observatory/config_pb2.py b/xray_api/proto/app/observatory/config_pb2.py new file mode 100644 index 00000000..65191a6a --- /dev/null +++ b/xray_api/proto/app/observatory/config_pb2.py @@ -0,0 +1,75 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: app/observatory/config.proto +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1c\x61pp/observatory/config.proto\x12\x19xray.core.app.observatory\"N\n\x11ObservationResult\x12\x39\n\x06status\x18\x01 \x03(\x0b\x32).xray.core.app.observatory.OutboundStatus\"\x8e\x01\n\x0eOutboundStatus\x12\r\n\x05\x61live\x18\x01 \x01(\x08\x12\r\n\x05\x64\x65lay\x18\x02 \x01(\x03\x12\x19\n\x11last_error_reason\x18\x03 \x01(\t\x12\x14\n\x0coutbound_tag\x18\x04 \x01(\t\x12\x16\n\x0elast_seen_time\x18\x05 \x01(\x03\x12\x15\n\rlast_try_time\x18\x06 \x01(\x03\"F\n\x0bProbeResult\x12\r\n\x05\x61live\x18\x01 \x01(\x08\x12\r\n\x05\x64\x65lay\x18\x02 \x01(\x03\x12\x19\n\x11last_error_reason\x18\x03 \x01(\t\"#\n\tIntensity\x12\x16\n\x0eprobe_interval\x18\x01 \x01(\r\"i\n\x06\x43onfig\x12\x18\n\x10subject_selector\x18\x02 \x03(\t\x12\x11\n\tprobe_url\x18\x03 \x01(\t\x12\x16\n\x0eprobe_interval\x18\x04 \x01(\x03\x12\x1a\n\x12\x65nable_concurrency\x18\x05 \x01(\x08\x42^\n\x18\x63om.xray.app.observatoryP\x01Z)github.com/xtls/xray-core/app/observatory\xaa\x02\x14Xray.App.Observatoryb\x06proto3') + + + +_OBSERVATIONRESULT = DESCRIPTOR.message_types_by_name['ObservationResult'] +_OUTBOUNDSTATUS = DESCRIPTOR.message_types_by_name['OutboundStatus'] +_PROBERESULT = DESCRIPTOR.message_types_by_name['ProbeResult'] +_INTENSITY = DESCRIPTOR.message_types_by_name['Intensity'] +_CONFIG = DESCRIPTOR.message_types_by_name['Config'] +ObservationResult = _reflection.GeneratedProtocolMessageType('ObservationResult', (_message.Message,), { + 'DESCRIPTOR' : _OBSERVATIONRESULT, + '__module__' : 'app.observatory.config_pb2' + # @@protoc_insertion_point(class_scope:xray.core.app.observatory.ObservationResult) + }) +_sym_db.RegisterMessage(ObservationResult) + +OutboundStatus = _reflection.GeneratedProtocolMessageType('OutboundStatus', (_message.Message,), { + 'DESCRIPTOR' : _OUTBOUNDSTATUS, + '__module__' : 'app.observatory.config_pb2' + # @@protoc_insertion_point(class_scope:xray.core.app.observatory.OutboundStatus) + }) +_sym_db.RegisterMessage(OutboundStatus) + +ProbeResult = _reflection.GeneratedProtocolMessageType('ProbeResult', (_message.Message,), { + 'DESCRIPTOR' : _PROBERESULT, + '__module__' : 'app.observatory.config_pb2' + # @@protoc_insertion_point(class_scope:xray.core.app.observatory.ProbeResult) + }) +_sym_db.RegisterMessage(ProbeResult) + +Intensity = _reflection.GeneratedProtocolMessageType('Intensity', (_message.Message,), { + 'DESCRIPTOR' : _INTENSITY, + '__module__' : 'app.observatory.config_pb2' + # @@protoc_insertion_point(class_scope:xray.core.app.observatory.Intensity) + }) +_sym_db.RegisterMessage(Intensity) + +Config = _reflection.GeneratedProtocolMessageType('Config', (_message.Message,), { + 'DESCRIPTOR' : _CONFIG, + '__module__' : 'app.observatory.config_pb2' + # @@protoc_insertion_point(class_scope:xray.core.app.observatory.Config) + }) +_sym_db.RegisterMessage(Config) + +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n\030com.xray.app.observatoryP\001Z)github.com/xtls/xray-core/app/observatory\252\002\024Xray.App.Observatory' + _OBSERVATIONRESULT._serialized_start=59 + _OBSERVATIONRESULT._serialized_end=137 + _OUTBOUNDSTATUS._serialized_start=140 + _OUTBOUNDSTATUS._serialized_end=282 + _PROBERESULT._serialized_start=284 + _PROBERESULT._serialized_end=354 + _INTENSITY._serialized_start=356 + _INTENSITY._serialized_end=391 + _CONFIG._serialized_start=393 + _CONFIG._serialized_end=498 +# @@protoc_insertion_point(module_scope) diff --git a/xray_api/proto/app/observatory/config_pb2_grpc.py b/xray_api/proto/app/observatory/config_pb2_grpc.py new file mode 100644 index 00000000..2daafffe --- /dev/null +++ b/xray_api/proto/app/observatory/config_pb2_grpc.py @@ -0,0 +1,4 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + diff --git a/xray_api/proto/app/policy/config_pb2.py b/xray_api/proto/app/policy/config_pb2.py new file mode 100644 index 00000000..cdf0910d --- /dev/null +++ b/xray_api/proto/app/policy/config_pb2.py @@ -0,0 +1,122 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: app/policy/config.proto +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x17\x61pp/policy/config.proto\x12\x0fxray.app.policy\"\x17\n\x06Second\x12\r\n\x05value\x18\x01 \x01(\r\"\xb3\x03\n\x06Policy\x12\x30\n\x07timeout\x18\x01 \x01(\x0b\x32\x1f.xray.app.policy.Policy.Timeout\x12,\n\x05stats\x18\x02 \x01(\x0b\x32\x1d.xray.app.policy.Policy.Stats\x12.\n\x06\x62uffer\x18\x03 \x01(\x0b\x32\x1e.xray.app.policy.Policy.Buffer\x1a\xc5\x01\n\x07Timeout\x12*\n\thandshake\x18\x01 \x01(\x0b\x32\x17.xray.app.policy.Second\x12\x30\n\x0f\x63onnection_idle\x18\x02 \x01(\x0b\x32\x17.xray.app.policy.Second\x12,\n\x0buplink_only\x18\x03 \x01(\x0b\x32\x17.xray.app.policy.Second\x12.\n\rdownlink_only\x18\x04 \x01(\x0b\x32\x17.xray.app.policy.Second\x1a\x33\n\x05Stats\x12\x13\n\x0buser_uplink\x18\x01 \x01(\x08\x12\x15\n\ruser_downlink\x18\x02 \x01(\x08\x1a\x1c\n\x06\x42uffer\x12\x12\n\nconnection\x18\x01 \x01(\x05\"\xb1\x01\n\x0cSystemPolicy\x12\x32\n\x05stats\x18\x01 \x01(\x0b\x32#.xray.app.policy.SystemPolicy.Stats\x1am\n\x05Stats\x12\x16\n\x0einbound_uplink\x18\x01 \x01(\x08\x12\x18\n\x10inbound_downlink\x18\x02 \x01(\x08\x12\x17\n\x0foutbound_uplink\x18\x03 \x01(\x08\x12\x19\n\x11outbound_downlink\x18\x04 \x01(\x08\"\xb1\x01\n\x06\x43onfig\x12\x31\n\x05level\x18\x01 \x03(\x0b\x32\".xray.app.policy.Config.LevelEntry\x12-\n\x06system\x18\x02 \x01(\x0b\x32\x1d.xray.app.policy.SystemPolicy\x1a\x45\n\nLevelEntry\x12\x0b\n\x03key\x18\x01 \x01(\r\x12&\n\x05value\x18\x02 \x01(\x0b\x32\x17.xray.app.policy.Policy:\x02\x38\x01\x42O\n\x13\x63om.xray.app.policyP\x01Z$github.com/xtls/xray-core/app/policy\xaa\x02\x0fXray.App.Policyb\x06proto3') + + + +_SECOND = DESCRIPTOR.message_types_by_name['Second'] +_POLICY = DESCRIPTOR.message_types_by_name['Policy'] +_POLICY_TIMEOUT = _POLICY.nested_types_by_name['Timeout'] +_POLICY_STATS = _POLICY.nested_types_by_name['Stats'] +_POLICY_BUFFER = _POLICY.nested_types_by_name['Buffer'] +_SYSTEMPOLICY = DESCRIPTOR.message_types_by_name['SystemPolicy'] +_SYSTEMPOLICY_STATS = _SYSTEMPOLICY.nested_types_by_name['Stats'] +_CONFIG = DESCRIPTOR.message_types_by_name['Config'] +_CONFIG_LEVELENTRY = _CONFIG.nested_types_by_name['LevelEntry'] +Second = _reflection.GeneratedProtocolMessageType('Second', (_message.Message,), { + 'DESCRIPTOR' : _SECOND, + '__module__' : 'app.policy.config_pb2' + # @@protoc_insertion_point(class_scope:xray.app.policy.Second) + }) +_sym_db.RegisterMessage(Second) + +Policy = _reflection.GeneratedProtocolMessageType('Policy', (_message.Message,), { + + 'Timeout' : _reflection.GeneratedProtocolMessageType('Timeout', (_message.Message,), { + 'DESCRIPTOR' : _POLICY_TIMEOUT, + '__module__' : 'app.policy.config_pb2' + # @@protoc_insertion_point(class_scope:xray.app.policy.Policy.Timeout) + }) + , + + 'Stats' : _reflection.GeneratedProtocolMessageType('Stats', (_message.Message,), { + 'DESCRIPTOR' : _POLICY_STATS, + '__module__' : 'app.policy.config_pb2' + # @@protoc_insertion_point(class_scope:xray.app.policy.Policy.Stats) + }) + , + + 'Buffer' : _reflection.GeneratedProtocolMessageType('Buffer', (_message.Message,), { + 'DESCRIPTOR' : _POLICY_BUFFER, + '__module__' : 'app.policy.config_pb2' + # @@protoc_insertion_point(class_scope:xray.app.policy.Policy.Buffer) + }) + , + 'DESCRIPTOR' : _POLICY, + '__module__' : 'app.policy.config_pb2' + # @@protoc_insertion_point(class_scope:xray.app.policy.Policy) + }) +_sym_db.RegisterMessage(Policy) +_sym_db.RegisterMessage(Policy.Timeout) +_sym_db.RegisterMessage(Policy.Stats) +_sym_db.RegisterMessage(Policy.Buffer) + +SystemPolicy = _reflection.GeneratedProtocolMessageType('SystemPolicy', (_message.Message,), { + + 'Stats' : _reflection.GeneratedProtocolMessageType('Stats', (_message.Message,), { + 'DESCRIPTOR' : _SYSTEMPOLICY_STATS, + '__module__' : 'app.policy.config_pb2' + # @@protoc_insertion_point(class_scope:xray.app.policy.SystemPolicy.Stats) + }) + , + 'DESCRIPTOR' : _SYSTEMPOLICY, + '__module__' : 'app.policy.config_pb2' + # @@protoc_insertion_point(class_scope:xray.app.policy.SystemPolicy) + }) +_sym_db.RegisterMessage(SystemPolicy) +_sym_db.RegisterMessage(SystemPolicy.Stats) + +Config = _reflection.GeneratedProtocolMessageType('Config', (_message.Message,), { + + 'LevelEntry' : _reflection.GeneratedProtocolMessageType('LevelEntry', (_message.Message,), { + 'DESCRIPTOR' : _CONFIG_LEVELENTRY, + '__module__' : 'app.policy.config_pb2' + # @@protoc_insertion_point(class_scope:xray.app.policy.Config.LevelEntry) + }) + , + 'DESCRIPTOR' : _CONFIG, + '__module__' : 'app.policy.config_pb2' + # @@protoc_insertion_point(class_scope:xray.app.policy.Config) + }) +_sym_db.RegisterMessage(Config) +_sym_db.RegisterMessage(Config.LevelEntry) + +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n\023com.xray.app.policyP\001Z$github.com/xtls/xray-core/app/policy\252\002\017Xray.App.Policy' + _CONFIG_LEVELENTRY._options = None + _CONFIG_LEVELENTRY._serialized_options = b'8\001' + _SECOND._serialized_start=44 + _SECOND._serialized_end=67 + _POLICY._serialized_start=70 + _POLICY._serialized_end=505 + _POLICY_TIMEOUT._serialized_start=225 + _POLICY_TIMEOUT._serialized_end=422 + _POLICY_STATS._serialized_start=424 + _POLICY_STATS._serialized_end=475 + _POLICY_BUFFER._serialized_start=477 + _POLICY_BUFFER._serialized_end=505 + _SYSTEMPOLICY._serialized_start=508 + _SYSTEMPOLICY._serialized_end=685 + _SYSTEMPOLICY_STATS._serialized_start=576 + _SYSTEMPOLICY_STATS._serialized_end=685 + _CONFIG._serialized_start=688 + _CONFIG._serialized_end=865 + _CONFIG_LEVELENTRY._serialized_start=796 + _CONFIG_LEVELENTRY._serialized_end=865 +# @@protoc_insertion_point(module_scope) diff --git a/xray_api/proto/app/policy/config_pb2_grpc.py b/xray_api/proto/app/policy/config_pb2_grpc.py new file mode 100644 index 00000000..2daafffe --- /dev/null +++ b/xray_api/proto/app/policy/config_pb2_grpc.py @@ -0,0 +1,4 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + diff --git a/xray_api/proto/app/proxyman/command/command_pb2.py b/xray_api/proto/app/proxyman/command/command_pb2.py new file mode 100644 index 00000000..c55c0bef --- /dev/null +++ b/xray_api/proto/app/proxyman/command/command_pb2.py @@ -0,0 +1,181 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: app/proxyman/command/command.proto +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from xray_api.proto.common.protocol import user_pb2 as common_dot_protocol_dot_user__pb2 +from xray_api.proto.common.serial import typed_message_pb2 as common_dot_serial_dot_typed__message__pb2 +from xray_api.proto.core import config_pb2 as core_dot_config__pb2 + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\"app/proxyman/command/command.proto\x12\x19xray.app.proxyman.command\x1a\x1a\x63ommon/protocol/user.proto\x1a!common/serial/typed_message.proto\x1a\x11\x63ore/config.proto\"<\n\x10\x41\x64\x64UserOperation\x12(\n\x04user\x18\x01 \x01(\x0b\x32\x1a.xray.common.protocol.User\"$\n\x13RemoveUserOperation\x12\r\n\x05\x65mail\x18\x01 \x01(\t\"E\n\x11\x41\x64\x64InboundRequest\x12\x30\n\x07inbound\x18\x01 \x01(\x0b\x32\x1f.xray.core.InboundHandlerConfig\"\x14\n\x12\x41\x64\x64InboundResponse\"#\n\x14RemoveInboundRequest\x12\x0b\n\x03tag\x18\x01 \x01(\t\"\x17\n\x15RemoveInboundResponse\"W\n\x13\x41lterInboundRequest\x12\x0b\n\x03tag\x18\x01 \x01(\t\x12\x33\n\toperation\x18\x02 \x01(\x0b\x32 .xray.common.serial.TypedMessage\"\x16\n\x14\x41lterInboundResponse\"H\n\x12\x41\x64\x64OutboundRequest\x12\x32\n\x08outbound\x18\x01 \x01(\x0b\x32 .xray.core.OutboundHandlerConfig\"\x15\n\x13\x41\x64\x64OutboundResponse\"$\n\x15RemoveOutboundRequest\x12\x0b\n\x03tag\x18\x01 \x01(\t\"\x18\n\x16RemoveOutboundResponse\"X\n\x14\x41lterOutboundRequest\x12\x0b\n\x03tag\x18\x01 \x01(\t\x12\x33\n\toperation\x18\x02 \x01(\x0b\x32 .xray.common.serial.TypedMessage\"\x17\n\x15\x41lterOutboundResponse\"\x08\n\x06\x43onfig2\xc5\x05\n\x0eHandlerService\x12k\n\nAddInbound\x12,.xray.app.proxyman.command.AddInboundRequest\x1a-.xray.app.proxyman.command.AddInboundResponse\"\x00\x12t\n\rRemoveInbound\x12/.xray.app.proxyman.command.RemoveInboundRequest\x1a\x30.xray.app.proxyman.command.RemoveInboundResponse\"\x00\x12q\n\x0c\x41lterInbound\x12..xray.app.proxyman.command.AlterInboundRequest\x1a/.xray.app.proxyman.command.AlterInboundResponse\"\x00\x12n\n\x0b\x41\x64\x64Outbound\x12-.xray.app.proxyman.command.AddOutboundRequest\x1a..xray.app.proxyman.command.AddOutboundResponse\"\x00\x12w\n\x0eRemoveOutbound\x12\x30.xray.app.proxyman.command.RemoveOutboundRequest\x1a\x31.xray.app.proxyman.command.RemoveOutboundResponse\"\x00\x12t\n\rAlterOutbound\x12/.xray.app.proxyman.command.AlterOutboundRequest\x1a\x30.xray.app.proxyman.command.AlterOutboundResponse\"\x00\x42m\n\x1d\x63om.xray.app.proxyman.commandP\x01Z.github.com/xtls/xray-core/app/proxyman/command\xaa\x02\x19Xray.App.Proxyman.Commandb\x06proto3') + + + +_ADDUSEROPERATION = DESCRIPTOR.message_types_by_name['AddUserOperation'] +_REMOVEUSEROPERATION = DESCRIPTOR.message_types_by_name['RemoveUserOperation'] +_ADDINBOUNDREQUEST = DESCRIPTOR.message_types_by_name['AddInboundRequest'] +_ADDINBOUNDRESPONSE = DESCRIPTOR.message_types_by_name['AddInboundResponse'] +_REMOVEINBOUNDREQUEST = DESCRIPTOR.message_types_by_name['RemoveInboundRequest'] +_REMOVEINBOUNDRESPONSE = DESCRIPTOR.message_types_by_name['RemoveInboundResponse'] +_ALTERINBOUNDREQUEST = DESCRIPTOR.message_types_by_name['AlterInboundRequest'] +_ALTERINBOUNDRESPONSE = DESCRIPTOR.message_types_by_name['AlterInboundResponse'] +_ADDOUTBOUNDREQUEST = DESCRIPTOR.message_types_by_name['AddOutboundRequest'] +_ADDOUTBOUNDRESPONSE = DESCRIPTOR.message_types_by_name['AddOutboundResponse'] +_REMOVEOUTBOUNDREQUEST = DESCRIPTOR.message_types_by_name['RemoveOutboundRequest'] +_REMOVEOUTBOUNDRESPONSE = DESCRIPTOR.message_types_by_name['RemoveOutboundResponse'] +_ALTEROUTBOUNDREQUEST = DESCRIPTOR.message_types_by_name['AlterOutboundRequest'] +_ALTEROUTBOUNDRESPONSE = DESCRIPTOR.message_types_by_name['AlterOutboundResponse'] +_CONFIG = DESCRIPTOR.message_types_by_name['Config'] +AddUserOperation = _reflection.GeneratedProtocolMessageType('AddUserOperation', (_message.Message,), { + 'DESCRIPTOR' : _ADDUSEROPERATION, + '__module__' : 'app.proxyman.command.command_pb2' + # @@protoc_insertion_point(class_scope:xray.app.proxyman.command.AddUserOperation) + }) +_sym_db.RegisterMessage(AddUserOperation) + +RemoveUserOperation = _reflection.GeneratedProtocolMessageType('RemoveUserOperation', (_message.Message,), { + 'DESCRIPTOR' : _REMOVEUSEROPERATION, + '__module__' : 'app.proxyman.command.command_pb2' + # @@protoc_insertion_point(class_scope:xray.app.proxyman.command.RemoveUserOperation) + }) +_sym_db.RegisterMessage(RemoveUserOperation) + +AddInboundRequest = _reflection.GeneratedProtocolMessageType('AddInboundRequest', (_message.Message,), { + 'DESCRIPTOR' : _ADDINBOUNDREQUEST, + '__module__' : 'app.proxyman.command.command_pb2' + # @@protoc_insertion_point(class_scope:xray.app.proxyman.command.AddInboundRequest) + }) +_sym_db.RegisterMessage(AddInboundRequest) + +AddInboundResponse = _reflection.GeneratedProtocolMessageType('AddInboundResponse', (_message.Message,), { + 'DESCRIPTOR' : _ADDINBOUNDRESPONSE, + '__module__' : 'app.proxyman.command.command_pb2' + # @@protoc_insertion_point(class_scope:xray.app.proxyman.command.AddInboundResponse) + }) +_sym_db.RegisterMessage(AddInboundResponse) + +RemoveInboundRequest = _reflection.GeneratedProtocolMessageType('RemoveInboundRequest', (_message.Message,), { + 'DESCRIPTOR' : _REMOVEINBOUNDREQUEST, + '__module__' : 'app.proxyman.command.command_pb2' + # @@protoc_insertion_point(class_scope:xray.app.proxyman.command.RemoveInboundRequest) + }) +_sym_db.RegisterMessage(RemoveInboundRequest) + +RemoveInboundResponse = _reflection.GeneratedProtocolMessageType('RemoveInboundResponse', (_message.Message,), { + 'DESCRIPTOR' : _REMOVEINBOUNDRESPONSE, + '__module__' : 'app.proxyman.command.command_pb2' + # @@protoc_insertion_point(class_scope:xray.app.proxyman.command.RemoveInboundResponse) + }) +_sym_db.RegisterMessage(RemoveInboundResponse) + +AlterInboundRequest = _reflection.GeneratedProtocolMessageType('AlterInboundRequest', (_message.Message,), { + 'DESCRIPTOR' : _ALTERINBOUNDREQUEST, + '__module__' : 'app.proxyman.command.command_pb2' + # @@protoc_insertion_point(class_scope:xray.app.proxyman.command.AlterInboundRequest) + }) +_sym_db.RegisterMessage(AlterInboundRequest) + +AlterInboundResponse = _reflection.GeneratedProtocolMessageType('AlterInboundResponse', (_message.Message,), { + 'DESCRIPTOR' : _ALTERINBOUNDRESPONSE, + '__module__' : 'app.proxyman.command.command_pb2' + # @@protoc_insertion_point(class_scope:xray.app.proxyman.command.AlterInboundResponse) + }) +_sym_db.RegisterMessage(AlterInboundResponse) + +AddOutboundRequest = _reflection.GeneratedProtocolMessageType('AddOutboundRequest', (_message.Message,), { + 'DESCRIPTOR' : _ADDOUTBOUNDREQUEST, + '__module__' : 'app.proxyman.command.command_pb2' + # @@protoc_insertion_point(class_scope:xray.app.proxyman.command.AddOutboundRequest) + }) +_sym_db.RegisterMessage(AddOutboundRequest) + +AddOutboundResponse = _reflection.GeneratedProtocolMessageType('AddOutboundResponse', (_message.Message,), { + 'DESCRIPTOR' : _ADDOUTBOUNDRESPONSE, + '__module__' : 'app.proxyman.command.command_pb2' + # @@protoc_insertion_point(class_scope:xray.app.proxyman.command.AddOutboundResponse) + }) +_sym_db.RegisterMessage(AddOutboundResponse) + +RemoveOutboundRequest = _reflection.GeneratedProtocolMessageType('RemoveOutboundRequest', (_message.Message,), { + 'DESCRIPTOR' : _REMOVEOUTBOUNDREQUEST, + '__module__' : 'app.proxyman.command.command_pb2' + # @@protoc_insertion_point(class_scope:xray.app.proxyman.command.RemoveOutboundRequest) + }) +_sym_db.RegisterMessage(RemoveOutboundRequest) + +RemoveOutboundResponse = _reflection.GeneratedProtocolMessageType('RemoveOutboundResponse', (_message.Message,), { + 'DESCRIPTOR' : _REMOVEOUTBOUNDRESPONSE, + '__module__' : 'app.proxyman.command.command_pb2' + # @@protoc_insertion_point(class_scope:xray.app.proxyman.command.RemoveOutboundResponse) + }) +_sym_db.RegisterMessage(RemoveOutboundResponse) + +AlterOutboundRequest = _reflection.GeneratedProtocolMessageType('AlterOutboundRequest', (_message.Message,), { + 'DESCRIPTOR' : _ALTEROUTBOUNDREQUEST, + '__module__' : 'app.proxyman.command.command_pb2' + # @@protoc_insertion_point(class_scope:xray.app.proxyman.command.AlterOutboundRequest) + }) +_sym_db.RegisterMessage(AlterOutboundRequest) + +AlterOutboundResponse = _reflection.GeneratedProtocolMessageType('AlterOutboundResponse', (_message.Message,), { + 'DESCRIPTOR' : _ALTEROUTBOUNDRESPONSE, + '__module__' : 'app.proxyman.command.command_pb2' + # @@protoc_insertion_point(class_scope:xray.app.proxyman.command.AlterOutboundResponse) + }) +_sym_db.RegisterMessage(AlterOutboundResponse) + +Config = _reflection.GeneratedProtocolMessageType('Config', (_message.Message,), { + 'DESCRIPTOR' : _CONFIG, + '__module__' : 'app.proxyman.command.command_pb2' + # @@protoc_insertion_point(class_scope:xray.app.proxyman.command.Config) + }) +_sym_db.RegisterMessage(Config) + +_HANDLERSERVICE = DESCRIPTOR.services_by_name['HandlerService'] +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n\035com.xray.app.proxyman.commandP\001Z.github.com/xtls/xray-core/app/proxyman/command\252\002\031Xray.App.Proxyman.Command' + _ADDUSEROPERATION._serialized_start=147 + _ADDUSEROPERATION._serialized_end=207 + _REMOVEUSEROPERATION._serialized_start=209 + _REMOVEUSEROPERATION._serialized_end=245 + _ADDINBOUNDREQUEST._serialized_start=247 + _ADDINBOUNDREQUEST._serialized_end=316 + _ADDINBOUNDRESPONSE._serialized_start=318 + _ADDINBOUNDRESPONSE._serialized_end=338 + _REMOVEINBOUNDREQUEST._serialized_start=340 + _REMOVEINBOUNDREQUEST._serialized_end=375 + _REMOVEINBOUNDRESPONSE._serialized_start=377 + _REMOVEINBOUNDRESPONSE._serialized_end=400 + _ALTERINBOUNDREQUEST._serialized_start=402 + _ALTERINBOUNDREQUEST._serialized_end=489 + _ALTERINBOUNDRESPONSE._serialized_start=491 + _ALTERINBOUNDRESPONSE._serialized_end=513 + _ADDOUTBOUNDREQUEST._serialized_start=515 + _ADDOUTBOUNDREQUEST._serialized_end=587 + _ADDOUTBOUNDRESPONSE._serialized_start=589 + _ADDOUTBOUNDRESPONSE._serialized_end=610 + _REMOVEOUTBOUNDREQUEST._serialized_start=612 + _REMOVEOUTBOUNDREQUEST._serialized_end=648 + _REMOVEOUTBOUNDRESPONSE._serialized_start=650 + _REMOVEOUTBOUNDRESPONSE._serialized_end=674 + _ALTEROUTBOUNDREQUEST._serialized_start=676 + _ALTEROUTBOUNDREQUEST._serialized_end=764 + _ALTEROUTBOUNDRESPONSE._serialized_start=766 + _ALTEROUTBOUNDRESPONSE._serialized_end=789 + _CONFIG._serialized_start=791 + _CONFIG._serialized_end=799 + _HANDLERSERVICE._serialized_start=802 + _HANDLERSERVICE._serialized_end=1511 +# @@protoc_insertion_point(module_scope) diff --git a/xray_api/proto/app/proxyman/command/command_pb2_grpc.py b/xray_api/proto/app/proxyman/command/command_pb2_grpc.py new file mode 100644 index 00000000..fb200164 --- /dev/null +++ b/xray_api/proto/app/proxyman/command/command_pb2_grpc.py @@ -0,0 +1,231 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + +from xray_api.proto.app.proxyman.command import command_pb2 as app_dot_proxyman_dot_command_dot_command__pb2 + + +class HandlerServiceStub(object): + """Missing associated documentation comment in .proto file.""" + + def __init__(self, channel): + """Constructor. + + Args: + channel: A grpc.Channel. + """ + self.AddInbound = channel.unary_unary( + '/xray.app.proxyman.command.HandlerService/AddInbound', + request_serializer=app_dot_proxyman_dot_command_dot_command__pb2.AddInboundRequest.SerializeToString, + response_deserializer=app_dot_proxyman_dot_command_dot_command__pb2.AddInboundResponse.FromString, + ) + self.RemoveInbound = channel.unary_unary( + '/xray.app.proxyman.command.HandlerService/RemoveInbound', + request_serializer=app_dot_proxyman_dot_command_dot_command__pb2.RemoveInboundRequest.SerializeToString, + response_deserializer=app_dot_proxyman_dot_command_dot_command__pb2.RemoveInboundResponse.FromString, + ) + self.AlterInbound = channel.unary_unary( + '/xray.app.proxyman.command.HandlerService/AlterInbound', + request_serializer=app_dot_proxyman_dot_command_dot_command__pb2.AlterInboundRequest.SerializeToString, + response_deserializer=app_dot_proxyman_dot_command_dot_command__pb2.AlterInboundResponse.FromString, + ) + self.AddOutbound = channel.unary_unary( + '/xray.app.proxyman.command.HandlerService/AddOutbound', + request_serializer=app_dot_proxyman_dot_command_dot_command__pb2.AddOutboundRequest.SerializeToString, + response_deserializer=app_dot_proxyman_dot_command_dot_command__pb2.AddOutboundResponse.FromString, + ) + self.RemoveOutbound = channel.unary_unary( + '/xray.app.proxyman.command.HandlerService/RemoveOutbound', + request_serializer=app_dot_proxyman_dot_command_dot_command__pb2.RemoveOutboundRequest.SerializeToString, + response_deserializer=app_dot_proxyman_dot_command_dot_command__pb2.RemoveOutboundResponse.FromString, + ) + self.AlterOutbound = channel.unary_unary( + '/xray.app.proxyman.command.HandlerService/AlterOutbound', + request_serializer=app_dot_proxyman_dot_command_dot_command__pb2.AlterOutboundRequest.SerializeToString, + response_deserializer=app_dot_proxyman_dot_command_dot_command__pb2.AlterOutboundResponse.FromString, + ) + + +class HandlerServiceServicer(object): + """Missing associated documentation comment in .proto file.""" + + def AddInbound(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def RemoveInbound(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def AlterInbound(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def AddOutbound(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def RemoveOutbound(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def AlterOutbound(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + +def add_HandlerServiceServicer_to_server(servicer, server): + rpc_method_handlers = { + 'AddInbound': grpc.unary_unary_rpc_method_handler( + servicer.AddInbound, + request_deserializer=app_dot_proxyman_dot_command_dot_command__pb2.AddInboundRequest.FromString, + response_serializer=app_dot_proxyman_dot_command_dot_command__pb2.AddInboundResponse.SerializeToString, + ), + 'RemoveInbound': grpc.unary_unary_rpc_method_handler( + servicer.RemoveInbound, + request_deserializer=app_dot_proxyman_dot_command_dot_command__pb2.RemoveInboundRequest.FromString, + response_serializer=app_dot_proxyman_dot_command_dot_command__pb2.RemoveInboundResponse.SerializeToString, + ), + 'AlterInbound': grpc.unary_unary_rpc_method_handler( + servicer.AlterInbound, + request_deserializer=app_dot_proxyman_dot_command_dot_command__pb2.AlterInboundRequest.FromString, + response_serializer=app_dot_proxyman_dot_command_dot_command__pb2.AlterInboundResponse.SerializeToString, + ), + 'AddOutbound': grpc.unary_unary_rpc_method_handler( + servicer.AddOutbound, + request_deserializer=app_dot_proxyman_dot_command_dot_command__pb2.AddOutboundRequest.FromString, + response_serializer=app_dot_proxyman_dot_command_dot_command__pb2.AddOutboundResponse.SerializeToString, + ), + 'RemoveOutbound': grpc.unary_unary_rpc_method_handler( + servicer.RemoveOutbound, + request_deserializer=app_dot_proxyman_dot_command_dot_command__pb2.RemoveOutboundRequest.FromString, + response_serializer=app_dot_proxyman_dot_command_dot_command__pb2.RemoveOutboundResponse.SerializeToString, + ), + 'AlterOutbound': grpc.unary_unary_rpc_method_handler( + servicer.AlterOutbound, + request_deserializer=app_dot_proxyman_dot_command_dot_command__pb2.AlterOutboundRequest.FromString, + response_serializer=app_dot_proxyman_dot_command_dot_command__pb2.AlterOutboundResponse.SerializeToString, + ), + } + generic_handler = grpc.method_handlers_generic_handler( + 'xray.app.proxyman.command.HandlerService', rpc_method_handlers) + server.add_generic_rpc_handlers((generic_handler,)) + + + # This class is part of an EXPERIMENTAL API. +class HandlerService(object): + """Missing associated documentation comment in .proto file.""" + + @staticmethod + def AddInbound(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/xray.app.proxyman.command.HandlerService/AddInbound', + app_dot_proxyman_dot_command_dot_command__pb2.AddInboundRequest.SerializeToString, + app_dot_proxyman_dot_command_dot_command__pb2.AddInboundResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def RemoveInbound(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/xray.app.proxyman.command.HandlerService/RemoveInbound', + app_dot_proxyman_dot_command_dot_command__pb2.RemoveInboundRequest.SerializeToString, + app_dot_proxyman_dot_command_dot_command__pb2.RemoveInboundResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def AlterInbound(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/xray.app.proxyman.command.HandlerService/AlterInbound', + app_dot_proxyman_dot_command_dot_command__pb2.AlterInboundRequest.SerializeToString, + app_dot_proxyman_dot_command_dot_command__pb2.AlterInboundResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def AddOutbound(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/xray.app.proxyman.command.HandlerService/AddOutbound', + app_dot_proxyman_dot_command_dot_command__pb2.AddOutboundRequest.SerializeToString, + app_dot_proxyman_dot_command_dot_command__pb2.AddOutboundResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def RemoveOutbound(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/xray.app.proxyman.command.HandlerService/RemoveOutbound', + app_dot_proxyman_dot_command_dot_command__pb2.RemoveOutboundRequest.SerializeToString, + app_dot_proxyman_dot_command_dot_command__pb2.RemoveOutboundResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def AlterOutbound(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/xray.app.proxyman.command.HandlerService/AlterOutbound', + app_dot_proxyman_dot_command_dot_command__pb2.AlterOutboundRequest.SerializeToString, + app_dot_proxyman_dot_command_dot_command__pb2.AlterOutboundResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) diff --git a/xray_api/proto/app/proxyman/config_pb2.py b/xray_api/proto/app/proxyman/config_pb2.py new file mode 100644 index 00000000..eeda6640 --- /dev/null +++ b/xray_api/proto/app/proxyman/config_pb2.py @@ -0,0 +1,143 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: app/proxyman/config.proto +"""Generated protocol buffer code.""" +from google.protobuf.internal import enum_type_wrapper +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from xray_api.proto.common.net import address_pb2 as common_dot_net_dot_address__pb2 +from xray_api.proto.common.net import port_pb2 as common_dot_net_dot_port__pb2 +from xray_api.proto.transport.internet import config_pb2 as transport_dot_internet_dot_config__pb2 +from xray_api.proto.common.serial import typed_message_pb2 as common_dot_serial_dot_typed__message__pb2 + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x19\x61pp/proxyman/config.proto\x12\x11xray.app.proxyman\x1a\x18\x63ommon/net/address.proto\x1a\x15\x63ommon/net/port.proto\x1a\x1ftransport/internet/config.proto\x1a!common/serial/typed_message.proto\"\x0f\n\rInboundConfig\"\x84\x03\n\x12\x41llocationStrategy\x12\x38\n\x04type\x18\x01 \x01(\x0e\x32*.xray.app.proxyman.AllocationStrategy.Type\x12X\n\x0b\x63oncurrency\x18\x02 \x01(\x0b\x32\x43.xray.app.proxyman.AllocationStrategy.AllocationStrategyConcurrency\x12P\n\x07refresh\x18\x03 \x01(\x0b\x32?.xray.app.proxyman.AllocationStrategy.AllocationStrategyRefresh\x1a.\n\x1d\x41llocationStrategyConcurrency\x12\r\n\x05value\x18\x01 \x01(\r\x1a*\n\x19\x41llocationStrategyRefresh\x12\r\n\x05value\x18\x01 \x01(\r\",\n\x04Type\x12\n\n\x06\x41lways\x10\x00\x12\n\n\x06Random\x10\x01\x12\x0c\n\x08\x45xternal\x10\x02\"\x84\x01\n\x0eSniffingConfig\x12\x0f\n\x07\x65nabled\x18\x01 \x01(\x08\x12\x1c\n\x14\x64\x65stination_override\x18\x02 \x03(\t\x12\x18\n\x10\x64omains_excluded\x18\x03 \x03(\t\x12\x15\n\rmetadata_only\x18\x04 \x01(\x08\x12\x12\n\nroute_only\x18\x05 \x01(\x08\"\x99\x03\n\x0eReceiverConfig\x12,\n\tport_list\x18\x01 \x01(\x0b\x32\x19.xray.common.net.PortList\x12+\n\x06listen\x18\x02 \x01(\x0b\x32\x1b.xray.common.net.IPOrDomain\x12\x42\n\x13\x61llocation_strategy\x18\x03 \x01(\x0b\x32%.xray.app.proxyman.AllocationStrategy\x12>\n\x0fstream_settings\x18\x04 \x01(\x0b\x32%.xray.transport.internet.StreamConfig\x12$\n\x1creceive_original_destination\x18\x05 \x01(\x08\x12>\n\x0f\x64omain_override\x18\x07 \x03(\x0e\x32!.xray.app.proxyman.KnownProtocolsB\x02\x18\x01\x12<\n\x11sniffing_settings\x18\x08 \x01(\x0b\x32!.xray.app.proxyman.SniffingConfigJ\x04\x08\x06\x10\x07\"\x9a\x01\n\x14InboundHandlerConfig\x12\x0b\n\x03tag\x18\x01 \x01(\t\x12;\n\x11receiver_settings\x18\x02 \x01(\x0b\x32 .xray.common.serial.TypedMessage\x12\x38\n\x0eproxy_settings\x18\x03 \x01(\x0b\x32 .xray.common.serial.TypedMessage\"\x10\n\x0eOutboundConfig\"\xf9\x01\n\x0cSenderConfig\x12(\n\x03via\x18\x01 \x01(\x0b\x32\x1b.xray.common.net.IPOrDomain\x12>\n\x0fstream_settings\x18\x02 \x01(\x0b\x32%.xray.transport.internet.StreamConfig\x12<\n\x0eproxy_settings\x18\x03 \x01(\x0b\x32$.xray.transport.internet.ProxyConfig\x12\x41\n\x12multiplex_settings\x18\x04 \x01(\x0b\x32%.xray.app.proxyman.MultiplexingConfig\":\n\x12MultiplexingConfig\x12\x0f\n\x07\x65nabled\x18\x01 \x01(\x08\x12\x13\n\x0b\x63oncurrency\x18\x02 \x01(\r*#\n\x0eKnownProtocols\x12\x08\n\x04HTTP\x10\x00\x12\x07\n\x03TLS\x10\x01\x42U\n\x15\x63om.xray.app.proxymanP\x01Z&github.com/xtls/xray-core/app/proxyman\xaa\x02\x11Xray.App.Proxymanb\x06proto3') + +_KNOWNPROTOCOLS = DESCRIPTOR.enum_types_by_name['KnownProtocols'] +KnownProtocols = enum_type_wrapper.EnumTypeWrapper(_KNOWNPROTOCOLS) +HTTP = 0 +TLS = 1 + + +_INBOUNDCONFIG = DESCRIPTOR.message_types_by_name['InboundConfig'] +_ALLOCATIONSTRATEGY = DESCRIPTOR.message_types_by_name['AllocationStrategy'] +_ALLOCATIONSTRATEGY_ALLOCATIONSTRATEGYCONCURRENCY = _ALLOCATIONSTRATEGY.nested_types_by_name['AllocationStrategyConcurrency'] +_ALLOCATIONSTRATEGY_ALLOCATIONSTRATEGYREFRESH = _ALLOCATIONSTRATEGY.nested_types_by_name['AllocationStrategyRefresh'] +_SNIFFINGCONFIG = DESCRIPTOR.message_types_by_name['SniffingConfig'] +_RECEIVERCONFIG = DESCRIPTOR.message_types_by_name['ReceiverConfig'] +_INBOUNDHANDLERCONFIG = DESCRIPTOR.message_types_by_name['InboundHandlerConfig'] +_OUTBOUNDCONFIG = DESCRIPTOR.message_types_by_name['OutboundConfig'] +_SENDERCONFIG = DESCRIPTOR.message_types_by_name['SenderConfig'] +_MULTIPLEXINGCONFIG = DESCRIPTOR.message_types_by_name['MultiplexingConfig'] +_ALLOCATIONSTRATEGY_TYPE = _ALLOCATIONSTRATEGY.enum_types_by_name['Type'] +InboundConfig = _reflection.GeneratedProtocolMessageType('InboundConfig', (_message.Message,), { + 'DESCRIPTOR' : _INBOUNDCONFIG, + '__module__' : 'app.proxyman.config_pb2' + # @@protoc_insertion_point(class_scope:xray.app.proxyman.InboundConfig) + }) +_sym_db.RegisterMessage(InboundConfig) + +AllocationStrategy = _reflection.GeneratedProtocolMessageType('AllocationStrategy', (_message.Message,), { + + 'AllocationStrategyConcurrency' : _reflection.GeneratedProtocolMessageType('AllocationStrategyConcurrency', (_message.Message,), { + 'DESCRIPTOR' : _ALLOCATIONSTRATEGY_ALLOCATIONSTRATEGYCONCURRENCY, + '__module__' : 'app.proxyman.config_pb2' + # @@protoc_insertion_point(class_scope:xray.app.proxyman.AllocationStrategy.AllocationStrategyConcurrency) + }) + , + + 'AllocationStrategyRefresh' : _reflection.GeneratedProtocolMessageType('AllocationStrategyRefresh', (_message.Message,), { + 'DESCRIPTOR' : _ALLOCATIONSTRATEGY_ALLOCATIONSTRATEGYREFRESH, + '__module__' : 'app.proxyman.config_pb2' + # @@protoc_insertion_point(class_scope:xray.app.proxyman.AllocationStrategy.AllocationStrategyRefresh) + }) + , + 'DESCRIPTOR' : _ALLOCATIONSTRATEGY, + '__module__' : 'app.proxyman.config_pb2' + # @@protoc_insertion_point(class_scope:xray.app.proxyman.AllocationStrategy) + }) +_sym_db.RegisterMessage(AllocationStrategy) +_sym_db.RegisterMessage(AllocationStrategy.AllocationStrategyConcurrency) +_sym_db.RegisterMessage(AllocationStrategy.AllocationStrategyRefresh) + +SniffingConfig = _reflection.GeneratedProtocolMessageType('SniffingConfig', (_message.Message,), { + 'DESCRIPTOR' : _SNIFFINGCONFIG, + '__module__' : 'app.proxyman.config_pb2' + # @@protoc_insertion_point(class_scope:xray.app.proxyman.SniffingConfig) + }) +_sym_db.RegisterMessage(SniffingConfig) + +ReceiverConfig = _reflection.GeneratedProtocolMessageType('ReceiverConfig', (_message.Message,), { + 'DESCRIPTOR' : _RECEIVERCONFIG, + '__module__' : 'app.proxyman.config_pb2' + # @@protoc_insertion_point(class_scope:xray.app.proxyman.ReceiverConfig) + }) +_sym_db.RegisterMessage(ReceiverConfig) + +InboundHandlerConfig = _reflection.GeneratedProtocolMessageType('InboundHandlerConfig', (_message.Message,), { + 'DESCRIPTOR' : _INBOUNDHANDLERCONFIG, + '__module__' : 'app.proxyman.config_pb2' + # @@protoc_insertion_point(class_scope:xray.app.proxyman.InboundHandlerConfig) + }) +_sym_db.RegisterMessage(InboundHandlerConfig) + +OutboundConfig = _reflection.GeneratedProtocolMessageType('OutboundConfig', (_message.Message,), { + 'DESCRIPTOR' : _OUTBOUNDCONFIG, + '__module__' : 'app.proxyman.config_pb2' + # @@protoc_insertion_point(class_scope:xray.app.proxyman.OutboundConfig) + }) +_sym_db.RegisterMessage(OutboundConfig) + +SenderConfig = _reflection.GeneratedProtocolMessageType('SenderConfig', (_message.Message,), { + 'DESCRIPTOR' : _SENDERCONFIG, + '__module__' : 'app.proxyman.config_pb2' + # @@protoc_insertion_point(class_scope:xray.app.proxyman.SenderConfig) + }) +_sym_db.RegisterMessage(SenderConfig) + +MultiplexingConfig = _reflection.GeneratedProtocolMessageType('MultiplexingConfig', (_message.Message,), { + 'DESCRIPTOR' : _MULTIPLEXINGCONFIG, + '__module__' : 'app.proxyman.config_pb2' + # @@protoc_insertion_point(class_scope:xray.app.proxyman.MultiplexingConfig) + }) +_sym_db.RegisterMessage(MultiplexingConfig) + +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n\025com.xray.app.proxymanP\001Z&github.com/xtls/xray-core/app/proxyman\252\002\021Xray.App.Proxyman' + _RECEIVERCONFIG.fields_by_name['domain_override']._options = None + _RECEIVERCONFIG.fields_by_name['domain_override']._serialized_options = b'\030\001' + _KNOWNPROTOCOLS._serialized_start=1607 + _KNOWNPROTOCOLS._serialized_end=1642 + _INBOUNDCONFIG._serialized_start=165 + _INBOUNDCONFIG._serialized_end=180 + _ALLOCATIONSTRATEGY._serialized_start=183 + _ALLOCATIONSTRATEGY._serialized_end=571 + _ALLOCATIONSTRATEGY_ALLOCATIONSTRATEGYCONCURRENCY._serialized_start=435 + _ALLOCATIONSTRATEGY_ALLOCATIONSTRATEGYCONCURRENCY._serialized_end=481 + _ALLOCATIONSTRATEGY_ALLOCATIONSTRATEGYREFRESH._serialized_start=483 + _ALLOCATIONSTRATEGY_ALLOCATIONSTRATEGYREFRESH._serialized_end=525 + _ALLOCATIONSTRATEGY_TYPE._serialized_start=527 + _ALLOCATIONSTRATEGY_TYPE._serialized_end=571 + _SNIFFINGCONFIG._serialized_start=574 + _SNIFFINGCONFIG._serialized_end=706 + _RECEIVERCONFIG._serialized_start=709 + _RECEIVERCONFIG._serialized_end=1118 + _INBOUNDHANDLERCONFIG._serialized_start=1121 + _INBOUNDHANDLERCONFIG._serialized_end=1275 + _OUTBOUNDCONFIG._serialized_start=1277 + _OUTBOUNDCONFIG._serialized_end=1293 + _SENDERCONFIG._serialized_start=1296 + _SENDERCONFIG._serialized_end=1545 + _MULTIPLEXINGCONFIG._serialized_start=1547 + _MULTIPLEXINGCONFIG._serialized_end=1605 +# @@protoc_insertion_point(module_scope) diff --git a/xray_api/proto/app/proxyman/config_pb2_grpc.py b/xray_api/proto/app/proxyman/config_pb2_grpc.py new file mode 100644 index 00000000..2daafffe --- /dev/null +++ b/xray_api/proto/app/proxyman/config_pb2_grpc.py @@ -0,0 +1,4 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + diff --git a/xray_api/proto/app/reverse/config_pb2.py b/xray_api/proto/app/reverse/config_pb2.py new file mode 100644 index 00000000..89c272ac --- /dev/null +++ b/xray_api/proto/app/reverse/config_pb2.py @@ -0,0 +1,68 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: app/reverse/config.proto +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x18\x61pp/reverse/config.proto\x12\x10xray.app.reverse\"i\n\x07\x43ontrol\x12.\n\x05state\x18\x01 \x01(\x0e\x32\x1f.xray.app.reverse.Control.State\x12\x0e\n\x06random\x18\x63 \x01(\x0c\"\x1e\n\x05State\x12\n\n\x06\x41\x43TIVE\x10\x00\x12\t\n\x05\x44RAIN\x10\x01\"+\n\x0c\x42ridgeConfig\x12\x0b\n\x03tag\x18\x01 \x01(\t\x12\x0e\n\x06\x64omain\x18\x02 \x01(\t\"+\n\x0cPortalConfig\x12\x0b\n\x03tag\x18\x01 \x01(\t\x12\x0e\n\x06\x64omain\x18\x02 \x01(\t\"v\n\x06\x43onfig\x12\x35\n\rbridge_config\x18\x01 \x03(\x0b\x32\x1e.xray.app.reverse.BridgeConfig\x12\x35\n\rportal_config\x18\x02 \x03(\x0b\x32\x1e.xray.app.reverse.PortalConfigBV\n\x16\x63om.xray.proxy.reverseP\x01Z%github.com/xtls/xray-core/app/reverse\xaa\x02\x12Xray.Proxy.Reverseb\x06proto3') + + + +_CONTROL = DESCRIPTOR.message_types_by_name['Control'] +_BRIDGECONFIG = DESCRIPTOR.message_types_by_name['BridgeConfig'] +_PORTALCONFIG = DESCRIPTOR.message_types_by_name['PortalConfig'] +_CONFIG = DESCRIPTOR.message_types_by_name['Config'] +_CONTROL_STATE = _CONTROL.enum_types_by_name['State'] +Control = _reflection.GeneratedProtocolMessageType('Control', (_message.Message,), { + 'DESCRIPTOR' : _CONTROL, + '__module__' : 'app.reverse.config_pb2' + # @@protoc_insertion_point(class_scope:xray.app.reverse.Control) + }) +_sym_db.RegisterMessage(Control) + +BridgeConfig = _reflection.GeneratedProtocolMessageType('BridgeConfig', (_message.Message,), { + 'DESCRIPTOR' : _BRIDGECONFIG, + '__module__' : 'app.reverse.config_pb2' + # @@protoc_insertion_point(class_scope:xray.app.reverse.BridgeConfig) + }) +_sym_db.RegisterMessage(BridgeConfig) + +PortalConfig = _reflection.GeneratedProtocolMessageType('PortalConfig', (_message.Message,), { + 'DESCRIPTOR' : _PORTALCONFIG, + '__module__' : 'app.reverse.config_pb2' + # @@protoc_insertion_point(class_scope:xray.app.reverse.PortalConfig) + }) +_sym_db.RegisterMessage(PortalConfig) + +Config = _reflection.GeneratedProtocolMessageType('Config', (_message.Message,), { + 'DESCRIPTOR' : _CONFIG, + '__module__' : 'app.reverse.config_pb2' + # @@protoc_insertion_point(class_scope:xray.app.reverse.Config) + }) +_sym_db.RegisterMessage(Config) + +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n\026com.xray.proxy.reverseP\001Z%github.com/xtls/xray-core/app/reverse\252\002\022Xray.Proxy.Reverse' + _CONTROL._serialized_start=46 + _CONTROL._serialized_end=151 + _CONTROL_STATE._serialized_start=121 + _CONTROL_STATE._serialized_end=151 + _BRIDGECONFIG._serialized_start=153 + _BRIDGECONFIG._serialized_end=196 + _PORTALCONFIG._serialized_start=198 + _PORTALCONFIG._serialized_end=241 + _CONFIG._serialized_start=243 + _CONFIG._serialized_end=361 +# @@protoc_insertion_point(module_scope) diff --git a/xray_api/proto/app/reverse/config_pb2_grpc.py b/xray_api/proto/app/reverse/config_pb2_grpc.py new file mode 100644 index 00000000..2daafffe --- /dev/null +++ b/xray_api/proto/app/reverse/config_pb2_grpc.py @@ -0,0 +1,4 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + diff --git a/xray_api/proto/app/router/command/command_pb2.py b/xray_api/proto/app/router/command/command_pb2.py new file mode 100644 index 00000000..4102cc79 --- /dev/null +++ b/xray_api/proto/app/router/command/command_pb2.py @@ -0,0 +1,82 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: app/router/command/command.proto +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from xray_api.proto.common.net import network_pb2 as common_dot_net_dot_network__pb2 + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n app/router/command/command.proto\x12\x17xray.app.router.command\x1a\x18\x63ommon/net/network.proto\"\x83\x03\n\x0eRoutingContext\x12\x12\n\nInboundTag\x18\x01 \x01(\t\x12)\n\x07Network\x18\x02 \x01(\x0e\x32\x18.xray.common.net.Network\x12\x11\n\tSourceIPs\x18\x03 \x03(\x0c\x12\x11\n\tTargetIPs\x18\x04 \x03(\x0c\x12\x12\n\nSourcePort\x18\x05 \x01(\r\x12\x12\n\nTargetPort\x18\x06 \x01(\r\x12\x14\n\x0cTargetDomain\x18\x07 \x01(\t\x12\x10\n\x08Protocol\x18\x08 \x01(\t\x12\x0c\n\x04User\x18\t \x01(\t\x12K\n\nAttributes\x18\n \x03(\x0b\x32\x37.xray.app.router.command.RoutingContext.AttributesEntry\x12\x19\n\x11OutboundGroupTags\x18\x0b \x03(\t\x12\x13\n\x0bOutboundTag\x18\x0c \x01(\t\x1a\x31\n\x0f\x41ttributesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"6\n\x1cSubscribeRoutingStatsRequest\x12\x16\n\x0e\x46ieldSelectors\x18\x01 \x03(\t\"\x82\x01\n\x10TestRouteRequest\x12?\n\x0eRoutingContext\x18\x01 \x01(\x0b\x32\'.xray.app.router.command.RoutingContext\x12\x16\n\x0e\x46ieldSelectors\x18\x02 \x03(\t\x12\x15\n\rPublishResult\x18\x03 \x01(\x08\"\x08\n\x06\x43onfig2\xf0\x01\n\x0eRoutingService\x12{\n\x15SubscribeRoutingStats\x12\x35.xray.app.router.command.SubscribeRoutingStatsRequest\x1a\'.xray.app.router.command.RoutingContext\"\x00\x30\x01\x12\x61\n\tTestRoute\x12).xray.app.router.command.TestRouteRequest\x1a\'.xray.app.router.command.RoutingContext\"\x00\x42g\n\x1b\x63om.xray.app.router.commandP\x01Z,github.com/xtls/xray-core/app/router/command\xaa\x02\x17Xray.App.Router.Commandb\x06proto3') + + + +_ROUTINGCONTEXT = DESCRIPTOR.message_types_by_name['RoutingContext'] +_ROUTINGCONTEXT_ATTRIBUTESENTRY = _ROUTINGCONTEXT.nested_types_by_name['AttributesEntry'] +_SUBSCRIBEROUTINGSTATSREQUEST = DESCRIPTOR.message_types_by_name['SubscribeRoutingStatsRequest'] +_TESTROUTEREQUEST = DESCRIPTOR.message_types_by_name['TestRouteRequest'] +_CONFIG = DESCRIPTOR.message_types_by_name['Config'] +RoutingContext = _reflection.GeneratedProtocolMessageType('RoutingContext', (_message.Message,), { + + 'AttributesEntry' : _reflection.GeneratedProtocolMessageType('AttributesEntry', (_message.Message,), { + 'DESCRIPTOR' : _ROUTINGCONTEXT_ATTRIBUTESENTRY, + '__module__' : 'app.router.command.command_pb2' + # @@protoc_insertion_point(class_scope:xray.app.router.command.RoutingContext.AttributesEntry) + }) + , + 'DESCRIPTOR' : _ROUTINGCONTEXT, + '__module__' : 'app.router.command.command_pb2' + # @@protoc_insertion_point(class_scope:xray.app.router.command.RoutingContext) + }) +_sym_db.RegisterMessage(RoutingContext) +_sym_db.RegisterMessage(RoutingContext.AttributesEntry) + +SubscribeRoutingStatsRequest = _reflection.GeneratedProtocolMessageType('SubscribeRoutingStatsRequest', (_message.Message,), { + 'DESCRIPTOR' : _SUBSCRIBEROUTINGSTATSREQUEST, + '__module__' : 'app.router.command.command_pb2' + # @@protoc_insertion_point(class_scope:xray.app.router.command.SubscribeRoutingStatsRequest) + }) +_sym_db.RegisterMessage(SubscribeRoutingStatsRequest) + +TestRouteRequest = _reflection.GeneratedProtocolMessageType('TestRouteRequest', (_message.Message,), { + 'DESCRIPTOR' : _TESTROUTEREQUEST, + '__module__' : 'app.router.command.command_pb2' + # @@protoc_insertion_point(class_scope:xray.app.router.command.TestRouteRequest) + }) +_sym_db.RegisterMessage(TestRouteRequest) + +Config = _reflection.GeneratedProtocolMessageType('Config', (_message.Message,), { + 'DESCRIPTOR' : _CONFIG, + '__module__' : 'app.router.command.command_pb2' + # @@protoc_insertion_point(class_scope:xray.app.router.command.Config) + }) +_sym_db.RegisterMessage(Config) + +_ROUTINGSERVICE = DESCRIPTOR.services_by_name['RoutingService'] +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n\033com.xray.app.router.commandP\001Z,github.com/xtls/xray-core/app/router/command\252\002\027Xray.App.Router.Command' + _ROUTINGCONTEXT_ATTRIBUTESENTRY._options = None + _ROUTINGCONTEXT_ATTRIBUTESENTRY._serialized_options = b'8\001' + _ROUTINGCONTEXT._serialized_start=88 + _ROUTINGCONTEXT._serialized_end=475 + _ROUTINGCONTEXT_ATTRIBUTESENTRY._serialized_start=426 + _ROUTINGCONTEXT_ATTRIBUTESENTRY._serialized_end=475 + _SUBSCRIBEROUTINGSTATSREQUEST._serialized_start=477 + _SUBSCRIBEROUTINGSTATSREQUEST._serialized_end=531 + _TESTROUTEREQUEST._serialized_start=534 + _TESTROUTEREQUEST._serialized_end=664 + _CONFIG._serialized_start=666 + _CONFIG._serialized_end=674 + _ROUTINGSERVICE._serialized_start=677 + _ROUTINGSERVICE._serialized_end=917 +# @@protoc_insertion_point(module_scope) diff --git a/xray_api/proto/app/router/command/command_pb2_grpc.py b/xray_api/proto/app/router/command/command_pb2_grpc.py new file mode 100644 index 00000000..5a4ebe59 --- /dev/null +++ b/xray_api/proto/app/router/command/command_pb2_grpc.py @@ -0,0 +1,99 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + +from xray_api.proto.app.router.command import command_pb2 as app_dot_router_dot_command_dot_command__pb2 + + +class RoutingServiceStub(object): + """Missing associated documentation comment in .proto file.""" + + def __init__(self, channel): + """Constructor. + + Args: + channel: A grpc.Channel. + """ + self.SubscribeRoutingStats = channel.unary_stream( + '/xray.app.router.command.RoutingService/SubscribeRoutingStats', + request_serializer=app_dot_router_dot_command_dot_command__pb2.SubscribeRoutingStatsRequest.SerializeToString, + response_deserializer=app_dot_router_dot_command_dot_command__pb2.RoutingContext.FromString, + ) + self.TestRoute = channel.unary_unary( + '/xray.app.router.command.RoutingService/TestRoute', + request_serializer=app_dot_router_dot_command_dot_command__pb2.TestRouteRequest.SerializeToString, + response_deserializer=app_dot_router_dot_command_dot_command__pb2.RoutingContext.FromString, + ) + + +class RoutingServiceServicer(object): + """Missing associated documentation comment in .proto file.""" + + def SubscribeRoutingStats(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def TestRoute(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + +def add_RoutingServiceServicer_to_server(servicer, server): + rpc_method_handlers = { + 'SubscribeRoutingStats': grpc.unary_stream_rpc_method_handler( + servicer.SubscribeRoutingStats, + request_deserializer=app_dot_router_dot_command_dot_command__pb2.SubscribeRoutingStatsRequest.FromString, + response_serializer=app_dot_router_dot_command_dot_command__pb2.RoutingContext.SerializeToString, + ), + 'TestRoute': grpc.unary_unary_rpc_method_handler( + servicer.TestRoute, + request_deserializer=app_dot_router_dot_command_dot_command__pb2.TestRouteRequest.FromString, + response_serializer=app_dot_router_dot_command_dot_command__pb2.RoutingContext.SerializeToString, + ), + } + generic_handler = grpc.method_handlers_generic_handler( + 'xray.app.router.command.RoutingService', rpc_method_handlers) + server.add_generic_rpc_handlers((generic_handler,)) + + + # This class is part of an EXPERIMENTAL API. +class RoutingService(object): + """Missing associated documentation comment in .proto file.""" + + @staticmethod + def SubscribeRoutingStats(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_stream(request, target, '/xray.app.router.command.RoutingService/SubscribeRoutingStats', + app_dot_router_dot_command_dot_command__pb2.SubscribeRoutingStatsRequest.SerializeToString, + app_dot_router_dot_command_dot_command__pb2.RoutingContext.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def TestRoute(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/xray.app.router.command.RoutingService/TestRoute', + app_dot_router_dot_command_dot_command__pb2.TestRouteRequest.SerializeToString, + app_dot_router_dot_command_dot_command__pb2.RoutingContext.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) diff --git a/xray_api/proto/app/router/config_pb2.py b/xray_api/proto/app/router/config_pb2.py new file mode 100644 index 00000000..e8e9c0c1 --- /dev/null +++ b/xray_api/proto/app/router/config_pb2.py @@ -0,0 +1,142 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: app/router/config.proto +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from xray_api.proto.common.net import port_pb2 as common_dot_net_dot_port__pb2 +from xray_api.proto.common.net import network_pb2 as common_dot_net_dot_network__pb2 + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x17\x61pp/router/config.proto\x12\x0fxray.app.router\x1a\x15\x63ommon/net/port.proto\x1a\x18\x63ommon/net/network.proto\"\x81\x02\n\x06\x44omain\x12*\n\x04type\x18\x01 \x01(\x0e\x32\x1c.xray.app.router.Domain.Type\x12\r\n\x05value\x18\x02 \x01(\t\x12\x34\n\tattribute\x18\x03 \x03(\x0b\x32!.xray.app.router.Domain.Attribute\x1aR\n\tAttribute\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x14\n\nbool_value\x18\x02 \x01(\x08H\x00\x12\x13\n\tint_value\x18\x03 \x01(\x03H\x00\x42\r\n\x0btyped_value\"2\n\x04Type\x12\t\n\x05Plain\x10\x00\x12\t\n\x05Regex\x10\x01\x12\n\n\x06\x44omain\x10\x02\x12\x08\n\x04\x46ull\x10\x03\"\"\n\x04\x43IDR\x12\n\n\x02ip\x18\x01 \x01(\x0c\x12\x0e\n\x06prefix\x18\x02 \x01(\r\"Y\n\x05GeoIP\x12\x14\n\x0c\x63ountry_code\x18\x01 \x01(\t\x12#\n\x04\x63idr\x18\x02 \x03(\x0b\x32\x15.xray.app.router.CIDR\x12\x15\n\rreverse_match\x18\x03 \x01(\x08\"2\n\tGeoIPList\x12%\n\x05\x65ntry\x18\x01 \x03(\x0b\x32\x16.xray.app.router.GeoIP\"H\n\x07GeoSite\x12\x14\n\x0c\x63ountry_code\x18\x01 \x01(\t\x12\'\n\x06\x64omain\x18\x02 \x03(\x0b\x32\x17.xray.app.router.Domain\"6\n\x0bGeoSiteList\x12\'\n\x05\x65ntry\x18\x01 \x03(\x0b\x32\x18.xray.app.router.GeoSite\"\xfc\x04\n\x0bRoutingRule\x12\r\n\x03tag\x18\x01 \x01(\tH\x00\x12\x17\n\rbalancing_tag\x18\x0c \x01(\tH\x00\x12\'\n\x06\x64omain\x18\x02 \x03(\x0b\x32\x17.xray.app.router.Domain\x12\'\n\x04\x63idr\x18\x03 \x03(\x0b\x32\x15.xray.app.router.CIDRB\x02\x18\x01\x12%\n\x05geoip\x18\n \x03(\x0b\x32\x16.xray.app.router.GeoIP\x12\x32\n\nport_range\x18\x04 \x01(\x0b\x32\x1a.xray.common.net.PortRangeB\x02\x18\x01\x12,\n\tport_list\x18\x0e \x01(\x0b\x32\x19.xray.common.net.PortList\x12\x36\n\x0cnetwork_list\x18\x05 \x01(\x0b\x32\x1c.xray.common.net.NetworkListB\x02\x18\x01\x12*\n\x08networks\x18\r \x03(\x0e\x32\x18.xray.common.net.Network\x12.\n\x0bsource_cidr\x18\x06 \x03(\x0b\x32\x15.xray.app.router.CIDRB\x02\x18\x01\x12,\n\x0csource_geoip\x18\x0b \x03(\x0b\x32\x16.xray.app.router.GeoIP\x12\x33\n\x10source_port_list\x18\x10 \x01(\x0b\x32\x19.xray.common.net.PortList\x12\x12\n\nuser_email\x18\x07 \x03(\t\x12\x13\n\x0binbound_tag\x18\x08 \x03(\t\x12\x10\n\x08protocol\x18\t \x03(\t\x12\x12\n\nattributes\x18\x0f \x01(\t\x12\x16\n\x0e\x64omain_matcher\x18\x11 \x01(\tB\x0c\n\ntarget_tag\"I\n\rBalancingRule\x12\x0b\n\x03tag\x18\x01 \x01(\t\x12\x19\n\x11outbound_selector\x18\x02 \x03(\t\x12\x10\n\x08strategy\x18\x03 \x01(\t\"\xf6\x01\n\x06\x43onfig\x12?\n\x0f\x64omain_strategy\x18\x01 \x01(\x0e\x32&.xray.app.router.Config.DomainStrategy\x12*\n\x04rule\x18\x02 \x03(\x0b\x32\x1c.xray.app.router.RoutingRule\x12\x36\n\x0e\x62\x61lancing_rule\x18\x03 \x03(\x0b\x32\x1e.xray.app.router.BalancingRule\"G\n\x0e\x44omainStrategy\x12\x08\n\x04\x41sIs\x10\x00\x12\t\n\x05UseIp\x10\x01\x12\x10\n\x0cIpIfNonMatch\x10\x02\x12\x0e\n\nIpOnDemand\x10\x03\x42O\n\x13\x63om.xray.app.routerP\x01Z$github.com/xtls/xray-core/app/router\xaa\x02\x0fXray.App.Routerb\x06proto3') + + + +_DOMAIN = DESCRIPTOR.message_types_by_name['Domain'] +_DOMAIN_ATTRIBUTE = _DOMAIN.nested_types_by_name['Attribute'] +_CIDR = DESCRIPTOR.message_types_by_name['CIDR'] +_GEOIP = DESCRIPTOR.message_types_by_name['GeoIP'] +_GEOIPLIST = DESCRIPTOR.message_types_by_name['GeoIPList'] +_GEOSITE = DESCRIPTOR.message_types_by_name['GeoSite'] +_GEOSITELIST = DESCRIPTOR.message_types_by_name['GeoSiteList'] +_ROUTINGRULE = DESCRIPTOR.message_types_by_name['RoutingRule'] +_BALANCINGRULE = DESCRIPTOR.message_types_by_name['BalancingRule'] +_CONFIG = DESCRIPTOR.message_types_by_name['Config'] +_DOMAIN_TYPE = _DOMAIN.enum_types_by_name['Type'] +_CONFIG_DOMAINSTRATEGY = _CONFIG.enum_types_by_name['DomainStrategy'] +Domain = _reflection.GeneratedProtocolMessageType('Domain', (_message.Message,), { + + 'Attribute' : _reflection.GeneratedProtocolMessageType('Attribute', (_message.Message,), { + 'DESCRIPTOR' : _DOMAIN_ATTRIBUTE, + '__module__' : 'app.router.config_pb2' + # @@protoc_insertion_point(class_scope:xray.app.router.Domain.Attribute) + }) + , + 'DESCRIPTOR' : _DOMAIN, + '__module__' : 'app.router.config_pb2' + # @@protoc_insertion_point(class_scope:xray.app.router.Domain) + }) +_sym_db.RegisterMessage(Domain) +_sym_db.RegisterMessage(Domain.Attribute) + +CIDR = _reflection.GeneratedProtocolMessageType('CIDR', (_message.Message,), { + 'DESCRIPTOR' : _CIDR, + '__module__' : 'app.router.config_pb2' + # @@protoc_insertion_point(class_scope:xray.app.router.CIDR) + }) +_sym_db.RegisterMessage(CIDR) + +GeoIP = _reflection.GeneratedProtocolMessageType('GeoIP', (_message.Message,), { + 'DESCRIPTOR' : _GEOIP, + '__module__' : 'app.router.config_pb2' + # @@protoc_insertion_point(class_scope:xray.app.router.GeoIP) + }) +_sym_db.RegisterMessage(GeoIP) + +GeoIPList = _reflection.GeneratedProtocolMessageType('GeoIPList', (_message.Message,), { + 'DESCRIPTOR' : _GEOIPLIST, + '__module__' : 'app.router.config_pb2' + # @@protoc_insertion_point(class_scope:xray.app.router.GeoIPList) + }) +_sym_db.RegisterMessage(GeoIPList) + +GeoSite = _reflection.GeneratedProtocolMessageType('GeoSite', (_message.Message,), { + 'DESCRIPTOR' : _GEOSITE, + '__module__' : 'app.router.config_pb2' + # @@protoc_insertion_point(class_scope:xray.app.router.GeoSite) + }) +_sym_db.RegisterMessage(GeoSite) + +GeoSiteList = _reflection.GeneratedProtocolMessageType('GeoSiteList', (_message.Message,), { + 'DESCRIPTOR' : _GEOSITELIST, + '__module__' : 'app.router.config_pb2' + # @@protoc_insertion_point(class_scope:xray.app.router.GeoSiteList) + }) +_sym_db.RegisterMessage(GeoSiteList) + +RoutingRule = _reflection.GeneratedProtocolMessageType('RoutingRule', (_message.Message,), { + 'DESCRIPTOR' : _ROUTINGRULE, + '__module__' : 'app.router.config_pb2' + # @@protoc_insertion_point(class_scope:xray.app.router.RoutingRule) + }) +_sym_db.RegisterMessage(RoutingRule) + +BalancingRule = _reflection.GeneratedProtocolMessageType('BalancingRule', (_message.Message,), { + 'DESCRIPTOR' : _BALANCINGRULE, + '__module__' : 'app.router.config_pb2' + # @@protoc_insertion_point(class_scope:xray.app.router.BalancingRule) + }) +_sym_db.RegisterMessage(BalancingRule) + +Config = _reflection.GeneratedProtocolMessageType('Config', (_message.Message,), { + 'DESCRIPTOR' : _CONFIG, + '__module__' : 'app.router.config_pb2' + # @@protoc_insertion_point(class_scope:xray.app.router.Config) + }) +_sym_db.RegisterMessage(Config) + +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n\023com.xray.app.routerP\001Z$github.com/xtls/xray-core/app/router\252\002\017Xray.App.Router' + _ROUTINGRULE.fields_by_name['cidr']._options = None + _ROUTINGRULE.fields_by_name['cidr']._serialized_options = b'\030\001' + _ROUTINGRULE.fields_by_name['port_range']._options = None + _ROUTINGRULE.fields_by_name['port_range']._serialized_options = b'\030\001' + _ROUTINGRULE.fields_by_name['network_list']._options = None + _ROUTINGRULE.fields_by_name['network_list']._serialized_options = b'\030\001' + _ROUTINGRULE.fields_by_name['source_cidr']._options = None + _ROUTINGRULE.fields_by_name['source_cidr']._serialized_options = b'\030\001' + _DOMAIN._serialized_start=94 + _DOMAIN._serialized_end=351 + _DOMAIN_ATTRIBUTE._serialized_start=217 + _DOMAIN_ATTRIBUTE._serialized_end=299 + _DOMAIN_TYPE._serialized_start=301 + _DOMAIN_TYPE._serialized_end=351 + _CIDR._serialized_start=353 + _CIDR._serialized_end=387 + _GEOIP._serialized_start=389 + _GEOIP._serialized_end=478 + _GEOIPLIST._serialized_start=480 + _GEOIPLIST._serialized_end=530 + _GEOSITE._serialized_start=532 + _GEOSITE._serialized_end=604 + _GEOSITELIST._serialized_start=606 + _GEOSITELIST._serialized_end=660 + _ROUTINGRULE._serialized_start=663 + _ROUTINGRULE._serialized_end=1299 + _BALANCINGRULE._serialized_start=1301 + _BALANCINGRULE._serialized_end=1374 + _CONFIG._serialized_start=1377 + _CONFIG._serialized_end=1623 + _CONFIG_DOMAINSTRATEGY._serialized_start=1552 + _CONFIG_DOMAINSTRATEGY._serialized_end=1623 +# @@protoc_insertion_point(module_scope) diff --git a/xray_api/proto/app/router/config_pb2_grpc.py b/xray_api/proto/app/router/config_pb2_grpc.py new file mode 100644 index 00000000..2daafffe --- /dev/null +++ b/xray_api/proto/app/router/config_pb2_grpc.py @@ -0,0 +1,4 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + diff --git a/xray_api/proto/app/stats/command/command_pb2.py b/xray_api/proto/app/stats/command/command_pb2.py new file mode 100644 index 00000000..44b5e00d --- /dev/null +++ b/xray_api/proto/app/stats/command/command_pb2.py @@ -0,0 +1,108 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: app/stats/command/command.proto +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1f\x61pp/stats/command/command.proto\x12\x16xray.app.stats.command\".\n\x0fGetStatsRequest\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05reset\x18\x02 \x01(\x08\"#\n\x04Stat\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x03\">\n\x10GetStatsResponse\x12*\n\x04stat\x18\x01 \x01(\x0b\x32\x1c.xray.app.stats.command.Stat\"3\n\x11QueryStatsRequest\x12\x0f\n\x07pattern\x18\x01 \x01(\t\x12\r\n\x05reset\x18\x02 \x01(\x08\"@\n\x12QueryStatsResponse\x12*\n\x04stat\x18\x01 \x03(\x0b\x32\x1c.xray.app.stats.command.Stat\"\x11\n\x0fSysStatsRequest\"\xc2\x01\n\x10SysStatsResponse\x12\x14\n\x0cNumGoroutine\x18\x01 \x01(\r\x12\r\n\x05NumGC\x18\x02 \x01(\r\x12\r\n\x05\x41lloc\x18\x03 \x01(\x04\x12\x12\n\nTotalAlloc\x18\x04 \x01(\x04\x12\x0b\n\x03Sys\x18\x05 \x01(\x04\x12\x0f\n\x07Mallocs\x18\x06 \x01(\x04\x12\r\n\x05\x46rees\x18\x07 \x01(\x04\x12\x13\n\x0bLiveObjects\x18\x08 \x01(\x04\x12\x14\n\x0cPauseTotalNs\x18\t \x01(\x04\x12\x0e\n\x06Uptime\x18\n \x01(\r\"\x08\n\x06\x43onfig2\xba\x02\n\x0cStatsService\x12_\n\x08GetStats\x12\'.xray.app.stats.command.GetStatsRequest\x1a(.xray.app.stats.command.GetStatsResponse\"\x00\x12\x65\n\nQueryStats\x12).xray.app.stats.command.QueryStatsRequest\x1a*.xray.app.stats.command.QueryStatsResponse\"\x00\x12\x62\n\x0bGetSysStats\x12\'.xray.app.stats.command.SysStatsRequest\x1a(.xray.app.stats.command.SysStatsResponse\"\x00\x42\x64\n\x1a\x63om.xray.app.stats.commandP\x01Z+github.com/xtls/xray-core/app/stats/command\xaa\x02\x16Xray.App.Stats.Commandb\x06proto3') + + + +_GETSTATSREQUEST = DESCRIPTOR.message_types_by_name['GetStatsRequest'] +_STAT = DESCRIPTOR.message_types_by_name['Stat'] +_GETSTATSRESPONSE = DESCRIPTOR.message_types_by_name['GetStatsResponse'] +_QUERYSTATSREQUEST = DESCRIPTOR.message_types_by_name['QueryStatsRequest'] +_QUERYSTATSRESPONSE = DESCRIPTOR.message_types_by_name['QueryStatsResponse'] +_SYSSTATSREQUEST = DESCRIPTOR.message_types_by_name['SysStatsRequest'] +_SYSSTATSRESPONSE = DESCRIPTOR.message_types_by_name['SysStatsResponse'] +_CONFIG = DESCRIPTOR.message_types_by_name['Config'] +GetStatsRequest = _reflection.GeneratedProtocolMessageType('GetStatsRequest', (_message.Message,), { + 'DESCRIPTOR' : _GETSTATSREQUEST, + '__module__' : 'app.stats.command.command_pb2' + # @@protoc_insertion_point(class_scope:xray.app.stats.command.GetStatsRequest) + }) +_sym_db.RegisterMessage(GetStatsRequest) + +Stat = _reflection.GeneratedProtocolMessageType('Stat', (_message.Message,), { + 'DESCRIPTOR' : _STAT, + '__module__' : 'app.stats.command.command_pb2' + # @@protoc_insertion_point(class_scope:xray.app.stats.command.Stat) + }) +_sym_db.RegisterMessage(Stat) + +GetStatsResponse = _reflection.GeneratedProtocolMessageType('GetStatsResponse', (_message.Message,), { + 'DESCRIPTOR' : _GETSTATSRESPONSE, + '__module__' : 'app.stats.command.command_pb2' + # @@protoc_insertion_point(class_scope:xray.app.stats.command.GetStatsResponse) + }) +_sym_db.RegisterMessage(GetStatsResponse) + +QueryStatsRequest = _reflection.GeneratedProtocolMessageType('QueryStatsRequest', (_message.Message,), { + 'DESCRIPTOR' : _QUERYSTATSREQUEST, + '__module__' : 'app.stats.command.command_pb2' + # @@protoc_insertion_point(class_scope:xray.app.stats.command.QueryStatsRequest) + }) +_sym_db.RegisterMessage(QueryStatsRequest) + +QueryStatsResponse = _reflection.GeneratedProtocolMessageType('QueryStatsResponse', (_message.Message,), { + 'DESCRIPTOR' : _QUERYSTATSRESPONSE, + '__module__' : 'app.stats.command.command_pb2' + # @@protoc_insertion_point(class_scope:xray.app.stats.command.QueryStatsResponse) + }) +_sym_db.RegisterMessage(QueryStatsResponse) + +SysStatsRequest = _reflection.GeneratedProtocolMessageType('SysStatsRequest', (_message.Message,), { + 'DESCRIPTOR' : _SYSSTATSREQUEST, + '__module__' : 'app.stats.command.command_pb2' + # @@protoc_insertion_point(class_scope:xray.app.stats.command.SysStatsRequest) + }) +_sym_db.RegisterMessage(SysStatsRequest) + +SysStatsResponse = _reflection.GeneratedProtocolMessageType('SysStatsResponse', (_message.Message,), { + 'DESCRIPTOR' : _SYSSTATSRESPONSE, + '__module__' : 'app.stats.command.command_pb2' + # @@protoc_insertion_point(class_scope:xray.app.stats.command.SysStatsResponse) + }) +_sym_db.RegisterMessage(SysStatsResponse) + +Config = _reflection.GeneratedProtocolMessageType('Config', (_message.Message,), { + 'DESCRIPTOR' : _CONFIG, + '__module__' : 'app.stats.command.command_pb2' + # @@protoc_insertion_point(class_scope:xray.app.stats.command.Config) + }) +_sym_db.RegisterMessage(Config) + +_STATSSERVICE = DESCRIPTOR.services_by_name['StatsService'] +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n\032com.xray.app.stats.commandP\001Z+github.com/xtls/xray-core/app/stats/command\252\002\026Xray.App.Stats.Command' + _GETSTATSREQUEST._serialized_start=59 + _GETSTATSREQUEST._serialized_end=105 + _STAT._serialized_start=107 + _STAT._serialized_end=142 + _GETSTATSRESPONSE._serialized_start=144 + _GETSTATSRESPONSE._serialized_end=206 + _QUERYSTATSREQUEST._serialized_start=208 + _QUERYSTATSREQUEST._serialized_end=259 + _QUERYSTATSRESPONSE._serialized_start=261 + _QUERYSTATSRESPONSE._serialized_end=325 + _SYSSTATSREQUEST._serialized_start=327 + _SYSSTATSREQUEST._serialized_end=344 + _SYSSTATSRESPONSE._serialized_start=347 + _SYSSTATSRESPONSE._serialized_end=541 + _CONFIG._serialized_start=543 + _CONFIG._serialized_end=551 + _STATSSERVICE._serialized_start=554 + _STATSSERVICE._serialized_end=868 +# @@protoc_insertion_point(module_scope) diff --git a/xray_api/proto/app/stats/command/command_pb2_grpc.py b/xray_api/proto/app/stats/command/command_pb2_grpc.py new file mode 100644 index 00000000..69ef70de --- /dev/null +++ b/xray_api/proto/app/stats/command/command_pb2_grpc.py @@ -0,0 +1,132 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + +from xray_api.proto.app.stats.command import command_pb2 as app_dot_stats_dot_command_dot_command__pb2 + + +class StatsServiceStub(object): + """Missing associated documentation comment in .proto file.""" + + def __init__(self, channel): + """Constructor. + + Args: + channel: A grpc.Channel. + """ + self.GetStats = channel.unary_unary( + '/xray.app.stats.command.StatsService/GetStats', + request_serializer=app_dot_stats_dot_command_dot_command__pb2.GetStatsRequest.SerializeToString, + response_deserializer=app_dot_stats_dot_command_dot_command__pb2.GetStatsResponse.FromString, + ) + self.QueryStats = channel.unary_unary( + '/xray.app.stats.command.StatsService/QueryStats', + request_serializer=app_dot_stats_dot_command_dot_command__pb2.QueryStatsRequest.SerializeToString, + response_deserializer=app_dot_stats_dot_command_dot_command__pb2.QueryStatsResponse.FromString, + ) + self.GetSysStats = channel.unary_unary( + '/xray.app.stats.command.StatsService/GetSysStats', + request_serializer=app_dot_stats_dot_command_dot_command__pb2.SysStatsRequest.SerializeToString, + response_deserializer=app_dot_stats_dot_command_dot_command__pb2.SysStatsResponse.FromString, + ) + + +class StatsServiceServicer(object): + """Missing associated documentation comment in .proto file.""" + + def GetStats(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def QueryStats(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def GetSysStats(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + +def add_StatsServiceServicer_to_server(servicer, server): + rpc_method_handlers = { + 'GetStats': grpc.unary_unary_rpc_method_handler( + servicer.GetStats, + request_deserializer=app_dot_stats_dot_command_dot_command__pb2.GetStatsRequest.FromString, + response_serializer=app_dot_stats_dot_command_dot_command__pb2.GetStatsResponse.SerializeToString, + ), + 'QueryStats': grpc.unary_unary_rpc_method_handler( + servicer.QueryStats, + request_deserializer=app_dot_stats_dot_command_dot_command__pb2.QueryStatsRequest.FromString, + response_serializer=app_dot_stats_dot_command_dot_command__pb2.QueryStatsResponse.SerializeToString, + ), + 'GetSysStats': grpc.unary_unary_rpc_method_handler( + servicer.GetSysStats, + request_deserializer=app_dot_stats_dot_command_dot_command__pb2.SysStatsRequest.FromString, + response_serializer=app_dot_stats_dot_command_dot_command__pb2.SysStatsResponse.SerializeToString, + ), + } + generic_handler = grpc.method_handlers_generic_handler( + 'xray.app.stats.command.StatsService', rpc_method_handlers) + server.add_generic_rpc_handlers((generic_handler,)) + + + # This class is part of an EXPERIMENTAL API. +class StatsService(object): + """Missing associated documentation comment in .proto file.""" + + @staticmethod + def GetStats(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/xray.app.stats.command.StatsService/GetStats', + app_dot_stats_dot_command_dot_command__pb2.GetStatsRequest.SerializeToString, + app_dot_stats_dot_command_dot_command__pb2.GetStatsResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def QueryStats(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/xray.app.stats.command.StatsService/QueryStats', + app_dot_stats_dot_command_dot_command__pb2.QueryStatsRequest.SerializeToString, + app_dot_stats_dot_command_dot_command__pb2.QueryStatsResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def GetSysStats(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/xray.app.stats.command.StatsService/GetSysStats', + app_dot_stats_dot_command_dot_command__pb2.SysStatsRequest.SerializeToString, + app_dot_stats_dot_command_dot_command__pb2.SysStatsResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) diff --git a/xray_api/proto/app/stats/config_pb2.py b/xray_api/proto/app/stats/config_pb2.py new file mode 100644 index 00000000..fb4af871 --- /dev/null +++ b/xray_api/proto/app/stats/config_pb2.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: app/stats/config.proto +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x16\x61pp/stats/config.proto\x12\x0exray.app.stats\"\x08\n\x06\x43onfig\"N\n\rChannelConfig\x12\x10\n\x08\x42locking\x18\x01 \x01(\x08\x12\x17\n\x0fSubscriberLimit\x18\x02 \x01(\x05\x12\x12\n\nBufferSize\x18\x03 \x01(\x05\x42L\n\x12\x63om.xray.app.statsP\x01Z#github.com/xtls/xray-core/app/stats\xaa\x02\x0eXray.App.Statsb\x06proto3') + + + +_CONFIG = DESCRIPTOR.message_types_by_name['Config'] +_CHANNELCONFIG = DESCRIPTOR.message_types_by_name['ChannelConfig'] +Config = _reflection.GeneratedProtocolMessageType('Config', (_message.Message,), { + 'DESCRIPTOR' : _CONFIG, + '__module__' : 'app.stats.config_pb2' + # @@protoc_insertion_point(class_scope:xray.app.stats.Config) + }) +_sym_db.RegisterMessage(Config) + +ChannelConfig = _reflection.GeneratedProtocolMessageType('ChannelConfig', (_message.Message,), { + 'DESCRIPTOR' : _CHANNELCONFIG, + '__module__' : 'app.stats.config_pb2' + # @@protoc_insertion_point(class_scope:xray.app.stats.ChannelConfig) + }) +_sym_db.RegisterMessage(ChannelConfig) + +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n\022com.xray.app.statsP\001Z#github.com/xtls/xray-core/app/stats\252\002\016Xray.App.Stats' + _CONFIG._serialized_start=42 + _CONFIG._serialized_end=50 + _CHANNELCONFIG._serialized_start=52 + _CHANNELCONFIG._serialized_end=130 +# @@protoc_insertion_point(module_scope) diff --git a/xray_api/proto/app/stats/config_pb2_grpc.py b/xray_api/proto/app/stats/config_pb2_grpc.py new file mode 100644 index 00000000..2daafffe --- /dev/null +++ b/xray_api/proto/app/stats/config_pb2_grpc.py @@ -0,0 +1,4 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + diff --git a/xray_api/proto/common/log/log_pb2.py b/xray_api/proto/common/log/log_pb2.py new file mode 100644 index 00000000..1436a3d7 --- /dev/null +++ b/xray_api/proto/common/log/log_pb2.py @@ -0,0 +1,35 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: common/log/log.proto +"""Generated protocol buffer code.""" +from google.protobuf.internal import enum_type_wrapper +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x14\x63ommon/log/log.proto\x12\x0fxray.common.log*D\n\x08Severity\x12\x0b\n\x07Unknown\x10\x00\x12\t\n\x05\x45rror\x10\x01\x12\x0b\n\x07Warning\x10\x02\x12\x08\n\x04Info\x10\x03\x12\t\n\x05\x44\x65\x62ug\x10\x04\x42O\n\x13\x63om.xray.common.logP\x01Z$github.com/xtls/xray-core/common/log\xaa\x02\x0fXray.Common.Logb\x06proto3') + +_SEVERITY = DESCRIPTOR.enum_types_by_name['Severity'] +Severity = enum_type_wrapper.EnumTypeWrapper(_SEVERITY) +Unknown = 0 +Error = 1 +Warning = 2 +Info = 3 +Debug = 4 + + +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n\023com.xray.common.logP\001Z$github.com/xtls/xray-core/common/log\252\002\017Xray.Common.Log' + _SEVERITY._serialized_start=41 + _SEVERITY._serialized_end=109 +# @@protoc_insertion_point(module_scope) diff --git a/xray_api/proto/common/log/log_pb2_grpc.py b/xray_api/proto/common/log/log_pb2_grpc.py new file mode 100644 index 00000000..2daafffe --- /dev/null +++ b/xray_api/proto/common/log/log_pb2_grpc.py @@ -0,0 +1,4 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + diff --git a/xray_api/proto/common/net/address_pb2.py b/xray_api/proto/common/net/address_pb2.py new file mode 100644 index 00000000..67a90cc7 --- /dev/null +++ b/xray_api/proto/common/net/address_pb2.py @@ -0,0 +1,35 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: common/net/address.proto +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x18\x63ommon/net/address.proto\x12\x0fxray.common.net\"7\n\nIPOrDomain\x12\x0c\n\x02ip\x18\x01 \x01(\x0cH\x00\x12\x10\n\x06\x64omain\x18\x02 \x01(\tH\x00\x42\t\n\x07\x61\x64\x64ressBO\n\x13\x63om.xray.common.netP\x01Z$github.com/xtls/xray-core/common/net\xaa\x02\x0fXray.Common.Netb\x06proto3') + + + +_IPORDOMAIN = DESCRIPTOR.message_types_by_name['IPOrDomain'] +IPOrDomain = _reflection.GeneratedProtocolMessageType('IPOrDomain', (_message.Message,), { + 'DESCRIPTOR' : _IPORDOMAIN, + '__module__' : 'common.net.address_pb2' + # @@protoc_insertion_point(class_scope:xray.common.net.IPOrDomain) + }) +_sym_db.RegisterMessage(IPOrDomain) + +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n\023com.xray.common.netP\001Z$github.com/xtls/xray-core/common/net\252\002\017Xray.Common.Net' + _IPORDOMAIN._serialized_start=45 + _IPORDOMAIN._serialized_end=100 +# @@protoc_insertion_point(module_scope) diff --git a/xray_api/proto/common/net/address_pb2_grpc.py b/xray_api/proto/common/net/address_pb2_grpc.py new file mode 100644 index 00000000..2daafffe --- /dev/null +++ b/xray_api/proto/common/net/address_pb2_grpc.py @@ -0,0 +1,4 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + diff --git a/xray_api/proto/common/net/destination_pb2.py b/xray_api/proto/common/net/destination_pb2.py new file mode 100644 index 00000000..edc919b6 --- /dev/null +++ b/xray_api/proto/common/net/destination_pb2.py @@ -0,0 +1,37 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: common/net/destination.proto +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from xray_api.proto.common.net import network_pb2 as common_dot_net_dot_network__pb2 +from xray_api.proto.common.net import address_pb2 as common_dot_net_dot_address__pb2 + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1c\x63ommon/net/destination.proto\x12\x0fxray.common.net\x1a\x18\x63ommon/net/network.proto\x1a\x18\x63ommon/net/address.proto\"q\n\x08\x45ndpoint\x12)\n\x07network\x18\x01 \x01(\x0e\x32\x18.xray.common.net.Network\x12,\n\x07\x61\x64\x64ress\x18\x02 \x01(\x0b\x32\x1b.xray.common.net.IPOrDomain\x12\x0c\n\x04port\x18\x03 \x01(\rBO\n\x13\x63om.xray.common.netP\x01Z$github.com/xtls/xray-core/common/net\xaa\x02\x0fXray.Common.Netb\x06proto3') + + + +_ENDPOINT = DESCRIPTOR.message_types_by_name['Endpoint'] +Endpoint = _reflection.GeneratedProtocolMessageType('Endpoint', (_message.Message,), { + 'DESCRIPTOR' : _ENDPOINT, + '__module__' : 'common.net.destination_pb2' + # @@protoc_insertion_point(class_scope:xray.common.net.Endpoint) + }) +_sym_db.RegisterMessage(Endpoint) + +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n\023com.xray.common.netP\001Z$github.com/xtls/xray-core/common/net\252\002\017Xray.Common.Net' + _ENDPOINT._serialized_start=101 + _ENDPOINT._serialized_end=214 +# @@protoc_insertion_point(module_scope) diff --git a/xray_api/proto/common/net/destination_pb2_grpc.py b/xray_api/proto/common/net/destination_pb2_grpc.py new file mode 100644 index 00000000..2daafffe --- /dev/null +++ b/xray_api/proto/common/net/destination_pb2_grpc.py @@ -0,0 +1,4 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + diff --git a/xray_api/proto/common/net/network_pb2.py b/xray_api/proto/common/net/network_pb2.py new file mode 100644 index 00000000..e4d9de8d --- /dev/null +++ b/xray_api/proto/common/net/network_pb2.py @@ -0,0 +1,47 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: common/net/network.proto +"""Generated protocol buffer code.""" +from google.protobuf.internal import enum_type_wrapper +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x18\x63ommon/net/network.proto\x12\x0fxray.common.net\"8\n\x0bNetworkList\x12)\n\x07network\x18\x01 \x03(\x0e\x32\x18.xray.common.net.Network*B\n\x07Network\x12\x0b\n\x07Unknown\x10\x00\x12\x0e\n\x06RawTCP\x10\x01\x1a\x02\x08\x01\x12\x07\n\x03TCP\x10\x02\x12\x07\n\x03UDP\x10\x03\x12\x08\n\x04UNIX\x10\x04\x42O\n\x13\x63om.xray.common.netP\x01Z$github.com/xtls/xray-core/common/net\xaa\x02\x0fXray.Common.Netb\x06proto3') + +_NETWORK = DESCRIPTOR.enum_types_by_name['Network'] +Network = enum_type_wrapper.EnumTypeWrapper(_NETWORK) +Unknown = 0 +RawTCP = 1 +TCP = 2 +UDP = 3 +UNIX = 4 + + +_NETWORKLIST = DESCRIPTOR.message_types_by_name['NetworkList'] +NetworkList = _reflection.GeneratedProtocolMessageType('NetworkList', (_message.Message,), { + 'DESCRIPTOR' : _NETWORKLIST, + '__module__' : 'common.net.network_pb2' + # @@protoc_insertion_point(class_scope:xray.common.net.NetworkList) + }) +_sym_db.RegisterMessage(NetworkList) + +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n\023com.xray.common.netP\001Z$github.com/xtls/xray-core/common/net\252\002\017Xray.Common.Net' + _NETWORK.values_by_name["RawTCP"]._options = None + _NETWORK.values_by_name["RawTCP"]._serialized_options = b'\010\001' + _NETWORK._serialized_start=103 + _NETWORK._serialized_end=169 + _NETWORKLIST._serialized_start=45 + _NETWORKLIST._serialized_end=101 +# @@protoc_insertion_point(module_scope) diff --git a/xray_api/proto/common/net/network_pb2_grpc.py b/xray_api/proto/common/net/network_pb2_grpc.py new file mode 100644 index 00000000..2daafffe --- /dev/null +++ b/xray_api/proto/common/net/network_pb2_grpc.py @@ -0,0 +1,4 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + diff --git a/xray_api/proto/common/net/port_pb2.py b/xray_api/proto/common/net/port_pb2.py new file mode 100644 index 00000000..ffdd7acd --- /dev/null +++ b/xray_api/proto/common/net/port_pb2.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: common/net/port.proto +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x15\x63ommon/net/port.proto\x12\x0fxray.common.net\"%\n\tPortRange\x12\x0c\n\x04\x46rom\x18\x01 \x01(\r\x12\n\n\x02To\x18\x02 \x01(\r\"5\n\x08PortList\x12)\n\x05range\x18\x01 \x03(\x0b\x32\x1a.xray.common.net.PortRangeBO\n\x13\x63om.xray.common.netP\x01Z$github.com/xtls/xray-core/common/net\xaa\x02\x0fXray.Common.Netb\x06proto3') + + + +_PORTRANGE = DESCRIPTOR.message_types_by_name['PortRange'] +_PORTLIST = DESCRIPTOR.message_types_by_name['PortList'] +PortRange = _reflection.GeneratedProtocolMessageType('PortRange', (_message.Message,), { + 'DESCRIPTOR' : _PORTRANGE, + '__module__' : 'common.net.port_pb2' + # @@protoc_insertion_point(class_scope:xray.common.net.PortRange) + }) +_sym_db.RegisterMessage(PortRange) + +PortList = _reflection.GeneratedProtocolMessageType('PortList', (_message.Message,), { + 'DESCRIPTOR' : _PORTLIST, + '__module__' : 'common.net.port_pb2' + # @@protoc_insertion_point(class_scope:xray.common.net.PortList) + }) +_sym_db.RegisterMessage(PortList) + +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n\023com.xray.common.netP\001Z$github.com/xtls/xray-core/common/net\252\002\017Xray.Common.Net' + _PORTRANGE._serialized_start=42 + _PORTRANGE._serialized_end=79 + _PORTLIST._serialized_start=81 + _PORTLIST._serialized_end=134 +# @@protoc_insertion_point(module_scope) diff --git a/xray_api/proto/common/net/port_pb2_grpc.py b/xray_api/proto/common/net/port_pb2_grpc.py new file mode 100644 index 00000000..2daafffe --- /dev/null +++ b/xray_api/proto/common/net/port_pb2_grpc.py @@ -0,0 +1,4 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + diff --git a/xray_api/proto/common/protocol/headers_pb2.py b/xray_api/proto/common/protocol/headers_pb2.py new file mode 100644 index 00000000..a204791b --- /dev/null +++ b/xray_api/proto/common/protocol/headers_pb2.py @@ -0,0 +1,47 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: common/protocol/headers.proto +"""Generated protocol buffer code.""" +from google.protobuf.internal import enum_type_wrapper +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1d\x63ommon/protocol/headers.proto\x12\x14xray.common.protocol\"B\n\x0eSecurityConfig\x12\x30\n\x04type\x18\x01 \x01(\x0e\x32\".xray.common.protocol.SecurityType*l\n\x0cSecurityType\x12\x0b\n\x07UNKNOWN\x10\x00\x12\n\n\x06LEGACY\x10\x01\x12\x08\n\x04\x41UTO\x10\x02\x12\x0e\n\nAES128_GCM\x10\x03\x12\x15\n\x11\x43HACHA20_POLY1305\x10\x04\x12\x08\n\x04NONE\x10\x05\x12\x08\n\x04ZERO\x10\x06\x42^\n\x18\x63om.xray.common.protocolP\x01Z)github.com/xtls/xray-core/common/protocol\xaa\x02\x14Xray.Common.Protocolb\x06proto3') + +_SECURITYTYPE = DESCRIPTOR.enum_types_by_name['SecurityType'] +SecurityType = enum_type_wrapper.EnumTypeWrapper(_SECURITYTYPE) +UNKNOWN = 0 +LEGACY = 1 +AUTO = 2 +AES128_GCM = 3 +CHACHA20_POLY1305 = 4 +NONE = 5 +ZERO = 6 + + +_SECURITYCONFIG = DESCRIPTOR.message_types_by_name['SecurityConfig'] +SecurityConfig = _reflection.GeneratedProtocolMessageType('SecurityConfig', (_message.Message,), { + 'DESCRIPTOR' : _SECURITYCONFIG, + '__module__' : 'common.protocol.headers_pb2' + # @@protoc_insertion_point(class_scope:xray.common.protocol.SecurityConfig) + }) +_sym_db.RegisterMessage(SecurityConfig) + +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n\030com.xray.common.protocolP\001Z)github.com/xtls/xray-core/common/protocol\252\002\024Xray.Common.Protocol' + _SECURITYTYPE._serialized_start=123 + _SECURITYTYPE._serialized_end=231 + _SECURITYCONFIG._serialized_start=55 + _SECURITYCONFIG._serialized_end=121 +# @@protoc_insertion_point(module_scope) diff --git a/xray_api/proto/common/protocol/headers_pb2_grpc.py b/xray_api/proto/common/protocol/headers_pb2_grpc.py new file mode 100644 index 00000000..2daafffe --- /dev/null +++ b/xray_api/proto/common/protocol/headers_pb2_grpc.py @@ -0,0 +1,4 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + diff --git a/xray_api/proto/common/protocol/server_spec_pb2.py b/xray_api/proto/common/protocol/server_spec_pb2.py new file mode 100644 index 00000000..8df3cc52 --- /dev/null +++ b/xray_api/proto/common/protocol/server_spec_pb2.py @@ -0,0 +1,37 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: common/protocol/server_spec.proto +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from xray_api.proto.common.net import address_pb2 as common_dot_net_dot_address__pb2 +from xray_api.proto.common.protocol import user_pb2 as common_dot_protocol_dot_user__pb2 + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n!common/protocol/server_spec.proto\x12\x14xray.common.protocol\x1a\x18\x63ommon/net/address.proto\x1a\x1a\x63ommon/protocol/user.proto\"v\n\x0eServerEndpoint\x12,\n\x07\x61\x64\x64ress\x18\x01 \x01(\x0b\x32\x1b.xray.common.net.IPOrDomain\x12\x0c\n\x04port\x18\x02 \x01(\r\x12(\n\x04user\x18\x03 \x03(\x0b\x32\x1a.xray.common.protocol.UserB^\n\x18\x63om.xray.common.protocolP\x01Z)github.com/xtls/xray-core/common/protocol\xaa\x02\x14Xray.Common.Protocolb\x06proto3') + + + +_SERVERENDPOINT = DESCRIPTOR.message_types_by_name['ServerEndpoint'] +ServerEndpoint = _reflection.GeneratedProtocolMessageType('ServerEndpoint', (_message.Message,), { + 'DESCRIPTOR' : _SERVERENDPOINT, + '__module__' : 'common.protocol.server_spec_pb2' + # @@protoc_insertion_point(class_scope:xray.common.protocol.ServerEndpoint) + }) +_sym_db.RegisterMessage(ServerEndpoint) + +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n\030com.xray.common.protocolP\001Z)github.com/xtls/xray-core/common/protocol\252\002\024Xray.Common.Protocol' + _SERVERENDPOINT._serialized_start=113 + _SERVERENDPOINT._serialized_end=231 +# @@protoc_insertion_point(module_scope) diff --git a/xray_api/proto/common/protocol/server_spec_pb2_grpc.py b/xray_api/proto/common/protocol/server_spec_pb2_grpc.py new file mode 100644 index 00000000..2daafffe --- /dev/null +++ b/xray_api/proto/common/protocol/server_spec_pb2_grpc.py @@ -0,0 +1,4 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + diff --git a/xray_api/proto/common/protocol/user_pb2.py b/xray_api/proto/common/protocol/user_pb2.py new file mode 100644 index 00000000..783f2ae7 --- /dev/null +++ b/xray_api/proto/common/protocol/user_pb2.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: common/protocol/user.proto +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from xray_api.proto.common.serial import typed_message_pb2 as common_dot_serial_dot_typed__message__pb2 + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1a\x63ommon/protocol/user.proto\x12\x14xray.common.protocol\x1a!common/serial/typed_message.proto\"W\n\x04User\x12\r\n\x05level\x18\x01 \x01(\r\x12\r\n\x05\x65mail\x18\x02 \x01(\t\x12\x31\n\x07\x61\x63\x63ount\x18\x03 \x01(\x0b\x32 .xray.common.serial.TypedMessageB^\n\x18\x63om.xray.common.protocolP\x01Z)github.com/xtls/xray-core/common/protocol\xaa\x02\x14Xray.Common.Protocolb\x06proto3') + + + +_USER = DESCRIPTOR.message_types_by_name['User'] +User = _reflection.GeneratedProtocolMessageType('User', (_message.Message,), { + 'DESCRIPTOR' : _USER, + '__module__' : 'common.protocol.user_pb2' + # @@protoc_insertion_point(class_scope:xray.common.protocol.User) + }) +_sym_db.RegisterMessage(User) + +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n\030com.xray.common.protocolP\001Z)github.com/xtls/xray-core/common/protocol\252\002\024Xray.Common.Protocol' + _USER._serialized_start=87 + _USER._serialized_end=174 +# @@protoc_insertion_point(module_scope) diff --git a/xray_api/proto/common/protocol/user_pb2_grpc.py b/xray_api/proto/common/protocol/user_pb2_grpc.py new file mode 100644 index 00000000..2daafffe --- /dev/null +++ b/xray_api/proto/common/protocol/user_pb2_grpc.py @@ -0,0 +1,4 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + diff --git a/xray_api/proto/common/serial/typed_message_pb2.py b/xray_api/proto/common/serial/typed_message_pb2.py new file mode 100644 index 00000000..eb8f80f6 --- /dev/null +++ b/xray_api/proto/common/serial/typed_message_pb2.py @@ -0,0 +1,35 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: common/serial/typed_message.proto +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n!common/serial/typed_message.proto\x12\x12xray.common.serial\"+\n\x0cTypedMessage\x12\x0c\n\x04type\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x0c\x42X\n\x16\x63om.xray.common.serialP\x01Z\'github.com/xtls/xray-core/common/serial\xaa\x02\x12Xray.Common.Serialb\x06proto3') + + + +_TYPEDMESSAGE = DESCRIPTOR.message_types_by_name['TypedMessage'] +TypedMessage = _reflection.GeneratedProtocolMessageType('TypedMessage', (_message.Message,), { + 'DESCRIPTOR' : _TYPEDMESSAGE, + '__module__' : 'common.serial.typed_message_pb2' + # @@protoc_insertion_point(class_scope:xray.common.serial.TypedMessage) + }) +_sym_db.RegisterMessage(TypedMessage) + +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n\026com.xray.common.serialP\001Z\'github.com/xtls/xray-core/common/serial\252\002\022Xray.Common.Serial' + _TYPEDMESSAGE._serialized_start=57 + _TYPEDMESSAGE._serialized_end=100 +# @@protoc_insertion_point(module_scope) diff --git a/xray_api/proto/common/serial/typed_message_pb2_grpc.py b/xray_api/proto/common/serial/typed_message_pb2_grpc.py new file mode 100644 index 00000000..2daafffe --- /dev/null +++ b/xray_api/proto/common/serial/typed_message_pb2_grpc.py @@ -0,0 +1,4 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + diff --git a/xray_api/proto/compile.py b/xray_api/proto/compile.py new file mode 100755 index 00000000..ec306bc2 --- /dev/null +++ b/xray_api/proto/compile.py @@ -0,0 +1,103 @@ +# DO NOT RUN THIS SCRIPT +# This supposed to be used for development + + +import io +import os +import re +import sys +import tarfile +import tempfile +from pathlib import Path + +import requests +from genericpath import isdir + +# Compile proto files from github repository + + +def compile_proto_from_source(dist): + tmp = tempfile.TemporaryDirectory() + tmp_dir = tmp.name + + # download and extract source + print("Getting latest version...") + latest = requests.get('https://api.github.com/repos/XTLS/xray-core/releases/latest') \ + .json() \ + .get('tag_name') + print("Latest version is", latest) + + # version = 'v4.45.2' + version = latest + + print("Downloading source", version, "...") + download_url = f'https://github.com/XTLS/xray-core/archive/refs/tags/{version}.tar.gz' + print("Source downloaded. extracting and compiling...") + r = requests.get(download_url, stream=True) + io_bytes = io.BytesIO(r.content) + tar = tarfile.open(fileobj=io_bytes, mode='r') + tar.extractall(tmp_dir) + v2ray_dir = os.path.join(tmp_dir, tar.getnames()[0]) + tar.close() + io_bytes.close() + + # find proto files + proto_files = '' + for root, dirs, files in os.walk(tmp_dir): + for file in files: + if file.endswith(".proto"): + proto_files += ' ' + os.path.join(root, file) + + if not proto_files: + raise FileNotFoundError("there's no proto file.") + + command = f'{sys.executable} -m grpc.tools.protoc ' \ + f'-I={v2ray_dir} ' \ + f'--python_out={dist} ' \ + f'--grpc_python_out={dist} ' + proto_files + + os.system(command) + + tmp.cleanup() + print("Compile ended.") + + +def fix_proto_imports(dist): + curr_dir = Path(__file__).parent + parent_dir = curr_dir.parent + + imports = [] + for f in os.listdir('.'): + if os.path.isdir(f) and not f.startswith('__'): + imports.append(f) + + new_imp = f'{parent_dir.name}.{curr_dir.name}.' + '{}' + + for root, dirs, files in os.walk('.'): + for file in files: + if file == 'compile.py': + continue + + if file.endswith(".py"): + path = Path(root) / file + with open(path, 'r') as pyfile: + content = pyfile.read() + for imp in imports: + for found in re.findall(f'from {imp}', content): + content = content.replace(found, "from " + new_imp.format(imp)) + for found in re.findall(f'import_module\(\'{imp}', content): + content = content.replace(found, "import_module('" + new_imp.format(imp)) + + # Only for v2fly + content = content.replace('\nimport config_pb2', "\nimport " + new_imp.format('config_pb2')) + + with open(path, 'w') as pyfile: + pyfile.write(content) + + +if __name__ == "__main__": + print("Compiling source...") + compile_proto_from_source('.') + print("Fixing imports...") + fix_proto_imports('.') + print("Done.") diff --git a/xray_api/proto/core/config_pb2.py b/xray_api/proto/core/config_pb2.py new file mode 100644 index 00000000..7ee578a9 --- /dev/null +++ b/xray_api/proto/core/config_pb2.py @@ -0,0 +1,60 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: core/config.proto +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from xray_api.proto.common.serial import typed_message_pb2 as common_dot_serial_dot_typed__message__pb2 +import importlib +transport_dot_global_dot_config__pb2 = importlib.import_module('xray_api.proto.transport.global.config_pb2') + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x11\x63ore/config.proto\x12\txray.core\x1a!common/serial/typed_message.proto\x1a\x1dtransport/global/config.proto\"\x87\x02\n\x06\x43onfig\x12\x30\n\x07inbound\x18\x01 \x03(\x0b\x32\x1f.xray.core.InboundHandlerConfig\x12\x32\n\x08outbound\x18\x02 \x03(\x0b\x32 .xray.core.OutboundHandlerConfig\x12-\n\x03\x61pp\x18\x04 \x03(\x0b\x32 .xray.common.serial.TypedMessage\x12-\n\ttransport\x18\x05 \x01(\x0b\x32\x16.xray.transport.ConfigB\x02\x18\x01\x12\x33\n\textension\x18\x06 \x03(\x0b\x32 .xray.common.serial.TypedMessageJ\x04\x08\x03\x10\x04\"\x9a\x01\n\x14InboundHandlerConfig\x12\x0b\n\x03tag\x18\x01 \x01(\t\x12;\n\x11receiver_settings\x18\x02 \x01(\x0b\x32 .xray.common.serial.TypedMessage\x12\x38\n\x0eproxy_settings\x18\x03 \x01(\x0b\x32 .xray.common.serial.TypedMessage\"\xba\x01\n\x15OutboundHandlerConfig\x12\x0b\n\x03tag\x18\x01 \x01(\t\x12\x39\n\x0fsender_settings\x18\x02 \x01(\x0b\x32 .xray.common.serial.TypedMessage\x12\x38\n\x0eproxy_settings\x18\x03 \x01(\x0b\x32 .xray.common.serial.TypedMessage\x12\x0e\n\x06\x65xpire\x18\x04 \x01(\x03\x12\x0f\n\x07\x63omment\x18\x05 \x01(\tB=\n\rcom.xray.coreP\x01Z\x1egithub.com/xtls/xray-core/core\xaa\x02\tXray.Coreb\x06proto3') + + + +_CONFIG = DESCRIPTOR.message_types_by_name['Config'] +_INBOUNDHANDLERCONFIG = DESCRIPTOR.message_types_by_name['InboundHandlerConfig'] +_OUTBOUNDHANDLERCONFIG = DESCRIPTOR.message_types_by_name['OutboundHandlerConfig'] +Config = _reflection.GeneratedProtocolMessageType('Config', (_message.Message,), { + 'DESCRIPTOR' : _CONFIG, + '__module__' : 'core.config_pb2' + # @@protoc_insertion_point(class_scope:xray.core.Config) + }) +_sym_db.RegisterMessage(Config) + +InboundHandlerConfig = _reflection.GeneratedProtocolMessageType('InboundHandlerConfig', (_message.Message,), { + 'DESCRIPTOR' : _INBOUNDHANDLERCONFIG, + '__module__' : 'core.config_pb2' + # @@protoc_insertion_point(class_scope:xray.core.InboundHandlerConfig) + }) +_sym_db.RegisterMessage(InboundHandlerConfig) + +OutboundHandlerConfig = _reflection.GeneratedProtocolMessageType('OutboundHandlerConfig', (_message.Message,), { + 'DESCRIPTOR' : _OUTBOUNDHANDLERCONFIG, + '__module__' : 'core.config_pb2' + # @@protoc_insertion_point(class_scope:xray.core.OutboundHandlerConfig) + }) +_sym_db.RegisterMessage(OutboundHandlerConfig) + +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n\rcom.xray.coreP\001Z\036github.com/xtls/xray-core/core\252\002\tXray.Core' + _CONFIG.fields_by_name['transport']._options = None + _CONFIG.fields_by_name['transport']._serialized_options = b'\030\001' + _CONFIG._serialized_start=99 + _CONFIG._serialized_end=362 + _INBOUNDHANDLERCONFIG._serialized_start=365 + _INBOUNDHANDLERCONFIG._serialized_end=519 + _OUTBOUNDHANDLERCONFIG._serialized_start=522 + _OUTBOUNDHANDLERCONFIG._serialized_end=708 +# @@protoc_insertion_point(module_scope) diff --git a/xray_api/proto/core/config_pb2_grpc.py b/xray_api/proto/core/config_pb2_grpc.py new file mode 100644 index 00000000..2daafffe --- /dev/null +++ b/xray_api/proto/core/config_pb2_grpc.py @@ -0,0 +1,4 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + diff --git a/xray_api/proto/proxy/blackhole/config_pb2.py b/xray_api/proto/proxy/blackhole/config_pb2.py new file mode 100644 index 00000000..5813a683 --- /dev/null +++ b/xray_api/proto/proxy/blackhole/config_pb2.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: proxy/blackhole/config.proto +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from xray_api.proto.common.serial import typed_message_pb2 as common_dot_serial_dot_typed__message__pb2 + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1cproxy/blackhole/config.proto\x12\x14xray.proxy.blackhole\x1a!common/serial/typed_message.proto\"\x0e\n\x0cNoneResponse\"\x0e\n\x0cHTTPResponse\"<\n\x06\x43onfig\x12\x32\n\x08response\x18\x01 \x01(\x0b\x32 .xray.common.serial.TypedMessageB^\n\x18\x63om.xray.proxy.blackholeP\x01Z)github.com/xtls/xray-core/proxy/blackhole\xaa\x02\x14Xray.Proxy.Blackholeb\x06proto3') + + + +_NONERESPONSE = DESCRIPTOR.message_types_by_name['NoneResponse'] +_HTTPRESPONSE = DESCRIPTOR.message_types_by_name['HTTPResponse'] +_CONFIG = DESCRIPTOR.message_types_by_name['Config'] +NoneResponse = _reflection.GeneratedProtocolMessageType('NoneResponse', (_message.Message,), { + 'DESCRIPTOR' : _NONERESPONSE, + '__module__' : 'proxy.blackhole.config_pb2' + # @@protoc_insertion_point(class_scope:xray.proxy.blackhole.NoneResponse) + }) +_sym_db.RegisterMessage(NoneResponse) + +HTTPResponse = _reflection.GeneratedProtocolMessageType('HTTPResponse', (_message.Message,), { + 'DESCRIPTOR' : _HTTPRESPONSE, + '__module__' : 'proxy.blackhole.config_pb2' + # @@protoc_insertion_point(class_scope:xray.proxy.blackhole.HTTPResponse) + }) +_sym_db.RegisterMessage(HTTPResponse) + +Config = _reflection.GeneratedProtocolMessageType('Config', (_message.Message,), { + 'DESCRIPTOR' : _CONFIG, + '__module__' : 'proxy.blackhole.config_pb2' + # @@protoc_insertion_point(class_scope:xray.proxy.blackhole.Config) + }) +_sym_db.RegisterMessage(Config) + +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n\030com.xray.proxy.blackholeP\001Z)github.com/xtls/xray-core/proxy/blackhole\252\002\024Xray.Proxy.Blackhole' + _NONERESPONSE._serialized_start=89 + _NONERESPONSE._serialized_end=103 + _HTTPRESPONSE._serialized_start=105 + _HTTPRESPONSE._serialized_end=119 + _CONFIG._serialized_start=121 + _CONFIG._serialized_end=181 +# @@protoc_insertion_point(module_scope) diff --git a/xray_api/proto/proxy/blackhole/config_pb2_grpc.py b/xray_api/proto/proxy/blackhole/config_pb2_grpc.py new file mode 100644 index 00000000..2daafffe --- /dev/null +++ b/xray_api/proto/proxy/blackhole/config_pb2_grpc.py @@ -0,0 +1,4 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + diff --git a/xray_api/proto/proxy/dns/config_pb2.py b/xray_api/proto/proxy/dns/config_pb2.py new file mode 100644 index 00000000..62f02d19 --- /dev/null +++ b/xray_api/proto/proxy/dns/config_pb2.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: proxy/dns/config.proto +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from xray_api.proto.common.net import destination_pb2 as common_dot_net_dot_destination__pb2 + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x16proxy/dns/config.proto\x12\x0exray.proxy.dns\x1a\x1c\x63ommon/net/destination.proto\"G\n\x06\x43onfig\x12)\n\x06server\x18\x01 \x01(\x0b\x32\x19.xray.common.net.Endpoint\x12\x12\n\nuser_level\x18\x02 \x01(\rBL\n\x12\x63om.xray.proxy.dnsP\x01Z#github.com/xtls/xray-core/proxy/dns\xaa\x02\x0eXray.Proxy.Dnsb\x06proto3') + + + +_CONFIG = DESCRIPTOR.message_types_by_name['Config'] +Config = _reflection.GeneratedProtocolMessageType('Config', (_message.Message,), { + 'DESCRIPTOR' : _CONFIG, + '__module__' : 'proxy.dns.config_pb2' + # @@protoc_insertion_point(class_scope:xray.proxy.dns.Config) + }) +_sym_db.RegisterMessage(Config) + +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n\022com.xray.proxy.dnsP\001Z#github.com/xtls/xray-core/proxy/dns\252\002\016Xray.Proxy.Dns' + _CONFIG._serialized_start=72 + _CONFIG._serialized_end=143 +# @@protoc_insertion_point(module_scope) diff --git a/xray_api/proto/proxy/dns/config_pb2_grpc.py b/xray_api/proto/proxy/dns/config_pb2_grpc.py new file mode 100644 index 00000000..2daafffe --- /dev/null +++ b/xray_api/proto/proxy/dns/config_pb2_grpc.py @@ -0,0 +1,4 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + diff --git a/xray_api/proto/proxy/dokodemo/config_pb2.py b/xray_api/proto/proxy/dokodemo/config_pb2.py new file mode 100644 index 00000000..bda6e5f3 --- /dev/null +++ b/xray_api/proto/proxy/dokodemo/config_pb2.py @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: proxy/dokodemo/config.proto +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from xray_api.proto.common.net import address_pb2 as common_dot_net_dot_address__pb2 +from xray_api.proto.common.net import network_pb2 as common_dot_net_dot_network__pb2 + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1bproxy/dokodemo/config.proto\x12\x13xray.proxy.dokodemo\x1a\x18\x63ommon/net/address.proto\x1a\x18\x63ommon/net/network.proto\"\xea\x01\n\x06\x43onfig\x12,\n\x07\x61\x64\x64ress\x18\x01 \x01(\x0b\x32\x1b.xray.common.net.IPOrDomain\x12\x0c\n\x04port\x18\x02 \x01(\r\x12\x36\n\x0cnetwork_list\x18\x03 \x01(\x0b\x32\x1c.xray.common.net.NetworkListB\x02\x18\x01\x12*\n\x08networks\x18\x07 \x03(\x0e\x32\x18.xray.common.net.Network\x12\x13\n\x07timeout\x18\x04 \x01(\rB\x02\x18\x01\x12\x17\n\x0f\x66ollow_redirect\x18\x05 \x01(\x08\x12\x12\n\nuser_level\x18\x06 \x01(\rB[\n\x17\x63om.xray.proxy.dokodemoP\x01Z(github.com/xtls/xray-core/proxy/dokodemo\xaa\x02\x13Xray.Proxy.Dokodemob\x06proto3') + + + +_CONFIG = DESCRIPTOR.message_types_by_name['Config'] +Config = _reflection.GeneratedProtocolMessageType('Config', (_message.Message,), { + 'DESCRIPTOR' : _CONFIG, + '__module__' : 'proxy.dokodemo.config_pb2' + # @@protoc_insertion_point(class_scope:xray.proxy.dokodemo.Config) + }) +_sym_db.RegisterMessage(Config) + +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n\027com.xray.proxy.dokodemoP\001Z(github.com/xtls/xray-core/proxy/dokodemo\252\002\023Xray.Proxy.Dokodemo' + _CONFIG.fields_by_name['network_list']._options = None + _CONFIG.fields_by_name['network_list']._serialized_options = b'\030\001' + _CONFIG.fields_by_name['timeout']._options = None + _CONFIG.fields_by_name['timeout']._serialized_options = b'\030\001' + _CONFIG._serialized_start=105 + _CONFIG._serialized_end=339 +# @@protoc_insertion_point(module_scope) diff --git a/xray_api/proto/proxy/dokodemo/config_pb2_grpc.py b/xray_api/proto/proxy/dokodemo/config_pb2_grpc.py new file mode 100644 index 00000000..2daafffe --- /dev/null +++ b/xray_api/proto/proxy/dokodemo/config_pb2_grpc.py @@ -0,0 +1,4 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + diff --git a/xray_api/proto/proxy/freedom/config_pb2.py b/xray_api/proto/proxy/freedom/config_pb2.py new file mode 100644 index 00000000..99101292 --- /dev/null +++ b/xray_api/proto/proxy/freedom/config_pb2.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: proxy/freedom/config.proto +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from xray_api.proto.common.protocol import server_spec_pb2 as common_dot_protocol_dot_server__spec__pb2 + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1aproxy/freedom/config.proto\x12\x12xray.proxy.freedom\x1a!common/protocol/server_spec.proto\"K\n\x13\x44\x65stinationOverride\x12\x34\n\x06server\x18\x01 \x01(\x0b\x32$.xray.common.protocol.ServerEndpoint\"\xff\x01\n\x06\x43onfig\x12\x42\n\x0f\x64omain_strategy\x18\x01 \x01(\x0e\x32).xray.proxy.freedom.Config.DomainStrategy\x12\x13\n\x07timeout\x18\x02 \x01(\rB\x02\x18\x01\x12\x45\n\x14\x64\x65stination_override\x18\x03 \x01(\x0b\x32\'.xray.proxy.freedom.DestinationOverride\x12\x12\n\nuser_level\x18\x04 \x01(\r\"A\n\x0e\x44omainStrategy\x12\t\n\x05\x41S_IS\x10\x00\x12\n\n\x06USE_IP\x10\x01\x12\x0b\n\x07USE_IP4\x10\x02\x12\x0b\n\x07USE_IP6\x10\x03\x42X\n\x16\x63om.xray.proxy.freedomP\x01Z\'github.com/xtls/xray-core/proxy/freedom\xaa\x02\x12Xray.Proxy.Freedomb\x06proto3') + + + +_DESTINATIONOVERRIDE = DESCRIPTOR.message_types_by_name['DestinationOverride'] +_CONFIG = DESCRIPTOR.message_types_by_name['Config'] +_CONFIG_DOMAINSTRATEGY = _CONFIG.enum_types_by_name['DomainStrategy'] +DestinationOverride = _reflection.GeneratedProtocolMessageType('DestinationOverride', (_message.Message,), { + 'DESCRIPTOR' : _DESTINATIONOVERRIDE, + '__module__' : 'proxy.freedom.config_pb2' + # @@protoc_insertion_point(class_scope:xray.proxy.freedom.DestinationOverride) + }) +_sym_db.RegisterMessage(DestinationOverride) + +Config = _reflection.GeneratedProtocolMessageType('Config', (_message.Message,), { + 'DESCRIPTOR' : _CONFIG, + '__module__' : 'proxy.freedom.config_pb2' + # @@protoc_insertion_point(class_scope:xray.proxy.freedom.Config) + }) +_sym_db.RegisterMessage(Config) + +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n\026com.xray.proxy.freedomP\001Z\'github.com/xtls/xray-core/proxy/freedom\252\002\022Xray.Proxy.Freedom' + _CONFIG.fields_by_name['timeout']._options = None + _CONFIG.fields_by_name['timeout']._serialized_options = b'\030\001' + _DESTINATIONOVERRIDE._serialized_start=85 + _DESTINATIONOVERRIDE._serialized_end=160 + _CONFIG._serialized_start=163 + _CONFIG._serialized_end=418 + _CONFIG_DOMAINSTRATEGY._serialized_start=353 + _CONFIG_DOMAINSTRATEGY._serialized_end=418 +# @@protoc_insertion_point(module_scope) diff --git a/xray_api/proto/proxy/freedom/config_pb2_grpc.py b/xray_api/proto/proxy/freedom/config_pb2_grpc.py new file mode 100644 index 00000000..2daafffe --- /dev/null +++ b/xray_api/proto/proxy/freedom/config_pb2_grpc.py @@ -0,0 +1,4 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + diff --git a/xray_api/proto/proxy/http/config_pb2.py b/xray_api/proto/proxy/http/config_pb2.py new file mode 100644 index 00000000..6c3bbf25 --- /dev/null +++ b/xray_api/proto/proxy/http/config_pb2.py @@ -0,0 +1,71 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: proxy/http/config.proto +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from xray_api.proto.common.protocol import server_spec_pb2 as common_dot_protocol_dot_server__spec__pb2 + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x17proxy/http/config.proto\x12\x0fxray.proxy.http\x1a!common/protocol/server_spec.proto\"-\n\x07\x41\x63\x63ount\x12\x10\n\x08username\x18\x01 \x01(\t\x12\x10\n\x08password\x18\x02 \x01(\t\"\xc2\x01\n\x0cServerConfig\x12\x13\n\x07timeout\x18\x01 \x01(\rB\x02\x18\x01\x12=\n\x08\x61\x63\x63ounts\x18\x02 \x03(\x0b\x32+.xray.proxy.http.ServerConfig.AccountsEntry\x12\x19\n\x11\x61llow_transparent\x18\x03 \x01(\x08\x12\x12\n\nuser_level\x18\x04 \x01(\r\x1a/\n\rAccountsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"D\n\x0c\x43lientConfig\x12\x34\n\x06server\x18\x01 \x03(\x0b\x32$.xray.common.protocol.ServerEndpointBO\n\x13\x63om.xray.proxy.httpP\x01Z$github.com/xtls/xray-core/proxy/http\xaa\x02\x0fXray.Proxy.Httpb\x06proto3') + + + +_ACCOUNT = DESCRIPTOR.message_types_by_name['Account'] +_SERVERCONFIG = DESCRIPTOR.message_types_by_name['ServerConfig'] +_SERVERCONFIG_ACCOUNTSENTRY = _SERVERCONFIG.nested_types_by_name['AccountsEntry'] +_CLIENTCONFIG = DESCRIPTOR.message_types_by_name['ClientConfig'] +Account = _reflection.GeneratedProtocolMessageType('Account', (_message.Message,), { + 'DESCRIPTOR' : _ACCOUNT, + '__module__' : 'proxy.http.config_pb2' + # @@protoc_insertion_point(class_scope:xray.proxy.http.Account) + }) +_sym_db.RegisterMessage(Account) + +ServerConfig = _reflection.GeneratedProtocolMessageType('ServerConfig', (_message.Message,), { + + 'AccountsEntry' : _reflection.GeneratedProtocolMessageType('AccountsEntry', (_message.Message,), { + 'DESCRIPTOR' : _SERVERCONFIG_ACCOUNTSENTRY, + '__module__' : 'proxy.http.config_pb2' + # @@protoc_insertion_point(class_scope:xray.proxy.http.ServerConfig.AccountsEntry) + }) + , + 'DESCRIPTOR' : _SERVERCONFIG, + '__module__' : 'proxy.http.config_pb2' + # @@protoc_insertion_point(class_scope:xray.proxy.http.ServerConfig) + }) +_sym_db.RegisterMessage(ServerConfig) +_sym_db.RegisterMessage(ServerConfig.AccountsEntry) + +ClientConfig = _reflection.GeneratedProtocolMessageType('ClientConfig', (_message.Message,), { + 'DESCRIPTOR' : _CLIENTCONFIG, + '__module__' : 'proxy.http.config_pb2' + # @@protoc_insertion_point(class_scope:xray.proxy.http.ClientConfig) + }) +_sym_db.RegisterMessage(ClientConfig) + +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n\023com.xray.proxy.httpP\001Z$github.com/xtls/xray-core/proxy/http\252\002\017Xray.Proxy.Http' + _SERVERCONFIG_ACCOUNTSENTRY._options = None + _SERVERCONFIG_ACCOUNTSENTRY._serialized_options = b'8\001' + _SERVERCONFIG.fields_by_name['timeout']._options = None + _SERVERCONFIG.fields_by_name['timeout']._serialized_options = b'\030\001' + _ACCOUNT._serialized_start=79 + _ACCOUNT._serialized_end=124 + _SERVERCONFIG._serialized_start=127 + _SERVERCONFIG._serialized_end=321 + _SERVERCONFIG_ACCOUNTSENTRY._serialized_start=274 + _SERVERCONFIG_ACCOUNTSENTRY._serialized_end=321 + _CLIENTCONFIG._serialized_start=323 + _CLIENTCONFIG._serialized_end=391 +# @@protoc_insertion_point(module_scope) diff --git a/xray_api/proto/proxy/http/config_pb2_grpc.py b/xray_api/proto/proxy/http/config_pb2_grpc.py new file mode 100644 index 00000000..2daafffe --- /dev/null +++ b/xray_api/proto/proxy/http/config_pb2_grpc.py @@ -0,0 +1,4 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + diff --git a/xray_api/proto/proxy/loopback/config_pb2.py b/xray_api/proto/proxy/loopback/config_pb2.py new file mode 100644 index 00000000..2212efc6 --- /dev/null +++ b/xray_api/proto/proxy/loopback/config_pb2.py @@ -0,0 +1,35 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: proxy/loopback/config.proto +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1bproxy/loopback/config.proto\x12\x13xray.proxy.loopback\"\x1d\n\x06\x43onfig\x12\x13\n\x0binbound_tag\x18\x01 \x01(\tB[\n\x17\x63om.xray.proxy.loopbackP\x01Z(github.com/xtls/xray-core/proxy/loopback\xaa\x02\x13Xray.Proxy.Loopbackb\x06proto3') + + + +_CONFIG = DESCRIPTOR.message_types_by_name['Config'] +Config = _reflection.GeneratedProtocolMessageType('Config', (_message.Message,), { + 'DESCRIPTOR' : _CONFIG, + '__module__' : 'proxy.loopback.config_pb2' + # @@protoc_insertion_point(class_scope:xray.proxy.loopback.Config) + }) +_sym_db.RegisterMessage(Config) + +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n\027com.xray.proxy.loopbackP\001Z(github.com/xtls/xray-core/proxy/loopback\252\002\023Xray.Proxy.Loopback' + _CONFIG._serialized_start=52 + _CONFIG._serialized_end=81 +# @@protoc_insertion_point(module_scope) diff --git a/xray_api/proto/proxy/loopback/config_pb2_grpc.py b/xray_api/proto/proxy/loopback/config_pb2_grpc.py new file mode 100644 index 00000000..2daafffe --- /dev/null +++ b/xray_api/proto/proxy/loopback/config_pb2_grpc.py @@ -0,0 +1,4 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + diff --git a/xray_api/proto/proxy/mtproto/config_pb2.py b/xray_api/proto/proxy/mtproto/config_pb2.py new file mode 100644 index 00000000..8e834a1d --- /dev/null +++ b/xray_api/proto/proxy/mtproto/config_pb2.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: proxy/mtproto/config.proto +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from xray_api.proto.common.protocol import user_pb2 as common_dot_protocol_dot_user__pb2 + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1aproxy/mtproto/config.proto\x12\x12xray.proxy.mtproto\x1a\x1a\x63ommon/protocol/user.proto\"\x19\n\x07\x41\x63\x63ount\x12\x0e\n\x06secret\x18\x01 \x01(\x0c\"8\n\x0cServerConfig\x12(\n\x04user\x18\x01 \x03(\x0b\x32\x1a.xray.common.protocol.User\"\x0e\n\x0c\x43lientConfigBX\n\x16\x63om.xray.proxy.mtprotoP\x01Z\'github.com/xtls/xray-core/proxy/mtproto\xaa\x02\x12Xray.Proxy.Mtprotob\x06proto3') + + + +_ACCOUNT = DESCRIPTOR.message_types_by_name['Account'] +_SERVERCONFIG = DESCRIPTOR.message_types_by_name['ServerConfig'] +_CLIENTCONFIG = DESCRIPTOR.message_types_by_name['ClientConfig'] +Account = _reflection.GeneratedProtocolMessageType('Account', (_message.Message,), { + 'DESCRIPTOR' : _ACCOUNT, + '__module__' : 'proxy.mtproto.config_pb2' + # @@protoc_insertion_point(class_scope:xray.proxy.mtproto.Account) + }) +_sym_db.RegisterMessage(Account) + +ServerConfig = _reflection.GeneratedProtocolMessageType('ServerConfig', (_message.Message,), { + 'DESCRIPTOR' : _SERVERCONFIG, + '__module__' : 'proxy.mtproto.config_pb2' + # @@protoc_insertion_point(class_scope:xray.proxy.mtproto.ServerConfig) + }) +_sym_db.RegisterMessage(ServerConfig) + +ClientConfig = _reflection.GeneratedProtocolMessageType('ClientConfig', (_message.Message,), { + 'DESCRIPTOR' : _CLIENTCONFIG, + '__module__' : 'proxy.mtproto.config_pb2' + # @@protoc_insertion_point(class_scope:xray.proxy.mtproto.ClientConfig) + }) +_sym_db.RegisterMessage(ClientConfig) + +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n\026com.xray.proxy.mtprotoP\001Z\'github.com/xtls/xray-core/proxy/mtproto\252\002\022Xray.Proxy.Mtproto' + _ACCOUNT._serialized_start=78 + _ACCOUNT._serialized_end=103 + _SERVERCONFIG._serialized_start=105 + _SERVERCONFIG._serialized_end=161 + _CLIENTCONFIG._serialized_start=163 + _CLIENTCONFIG._serialized_end=177 +# @@protoc_insertion_point(module_scope) diff --git a/xray_api/proto/proxy/mtproto/config_pb2_grpc.py b/xray_api/proto/proxy/mtproto/config_pb2_grpc.py new file mode 100644 index 00000000..2daafffe --- /dev/null +++ b/xray_api/proto/proxy/mtproto/config_pb2_grpc.py @@ -0,0 +1,4 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + diff --git a/xray_api/proto/proxy/shadowsocks/config_pb2.py b/xray_api/proto/proxy/shadowsocks/config_pb2.py new file mode 100644 index 00000000..8dc8d018 --- /dev/null +++ b/xray_api/proto/proxy/shadowsocks/config_pb2.py @@ -0,0 +1,69 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: proxy/shadowsocks/config.proto +"""Generated protocol buffer code.""" +from google.protobuf.internal import enum_type_wrapper +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from xray_api.proto.common.net import network_pb2 as common_dot_net_dot_network__pb2 +from xray_api.proto.common.protocol import user_pb2 as common_dot_protocol_dot_user__pb2 +from xray_api.proto.common.protocol import server_spec_pb2 as common_dot_protocol_dot_server__spec__pb2 + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1eproxy/shadowsocks/config.proto\x12\x16xray.proxy.shadowsocks\x1a\x18\x63ommon/net/network.proto\x1a\x1a\x63ommon/protocol/user.proto\x1a!common/protocol/server_spec.proto\"f\n\x07\x41\x63\x63ount\x12\x10\n\x08password\x18\x01 \x01(\t\x12\x37\n\x0b\x63ipher_type\x18\x02 \x01(\x0e\x32\".xray.proxy.shadowsocks.CipherType\x12\x10\n\x08iv_check\x18\x03 \x01(\x08\"d\n\x0cServerConfig\x12)\n\x05users\x18\x01 \x03(\x0b\x32\x1a.xray.common.protocol.User\x12)\n\x07network\x18\x02 \x03(\x0e\x32\x18.xray.common.net.Network\"D\n\x0c\x43lientConfig\x12\x34\n\x06server\x18\x01 \x03(\x0b\x32$.xray.common.protocol.ServerEndpoint*t\n\nCipherType\x12\x0b\n\x07UNKNOWN\x10\x00\x12\x0f\n\x0b\x41\x45S_128_GCM\x10\x05\x12\x0f\n\x0b\x41\x45S_256_GCM\x10\x06\x12\x15\n\x11\x43HACHA20_POLY1305\x10\x07\x12\x16\n\x12XCHACHA20_POLY1305\x10\x08\x12\x08\n\x04NONE\x10\tBd\n\x1a\x63om.xray.proxy.shadowsocksP\x01Z+github.com/xtls/xray-core/proxy/shadowsocks\xaa\x02\x16Xray.Proxy.Shadowsocksb\x06proto3') + +_CIPHERTYPE = DESCRIPTOR.enum_types_by_name['CipherType'] +CipherType = enum_type_wrapper.EnumTypeWrapper(_CIPHERTYPE) +UNKNOWN = 0 +AES_128_GCM = 5 +AES_256_GCM = 6 +CHACHA20_POLY1305 = 7 +XCHACHA20_POLY1305 = 8 +NONE = 9 + + +_ACCOUNT = DESCRIPTOR.message_types_by_name['Account'] +_SERVERCONFIG = DESCRIPTOR.message_types_by_name['ServerConfig'] +_CLIENTCONFIG = DESCRIPTOR.message_types_by_name['ClientConfig'] +Account = _reflection.GeneratedProtocolMessageType('Account', (_message.Message,), { + 'DESCRIPTOR' : _ACCOUNT, + '__module__' : 'proxy.shadowsocks.config_pb2' + # @@protoc_insertion_point(class_scope:xray.proxy.shadowsocks.Account) + }) +_sym_db.RegisterMessage(Account) + +ServerConfig = _reflection.GeneratedProtocolMessageType('ServerConfig', (_message.Message,), { + 'DESCRIPTOR' : _SERVERCONFIG, + '__module__' : 'proxy.shadowsocks.config_pb2' + # @@protoc_insertion_point(class_scope:xray.proxy.shadowsocks.ServerConfig) + }) +_sym_db.RegisterMessage(ServerConfig) + +ClientConfig = _reflection.GeneratedProtocolMessageType('ClientConfig', (_message.Message,), { + 'DESCRIPTOR' : _CLIENTCONFIG, + '__module__' : 'proxy.shadowsocks.config_pb2' + # @@protoc_insertion_point(class_scope:xray.proxy.shadowsocks.ClientConfig) + }) +_sym_db.RegisterMessage(ClientConfig) + +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n\032com.xray.proxy.shadowsocksP\001Z+github.com/xtls/xray-core/proxy/shadowsocks\252\002\026Xray.Proxy.Shadowsocks' + _CIPHERTYPE._serialized_start=423 + _CIPHERTYPE._serialized_end=539 + _ACCOUNT._serialized_start=147 + _ACCOUNT._serialized_end=249 + _SERVERCONFIG._serialized_start=251 + _SERVERCONFIG._serialized_end=351 + _CLIENTCONFIG._serialized_start=353 + _CLIENTCONFIG._serialized_end=421 +# @@protoc_insertion_point(module_scope) diff --git a/xray_api/proto/proxy/shadowsocks/config_pb2_grpc.py b/xray_api/proto/proxy/shadowsocks/config_pb2_grpc.py new file mode 100644 index 00000000..2daafffe --- /dev/null +++ b/xray_api/proto/proxy/shadowsocks/config_pb2_grpc.py @@ -0,0 +1,4 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + diff --git a/xray_api/proto/proxy/shadowsocks_2022/config_pb2.py b/xray_api/proto/proxy/shadowsocks_2022/config_pb2.py new file mode 100644 index 00000000..5d325048 --- /dev/null +++ b/xray_api/proto/proxy/shadowsocks_2022/config_pb2.py @@ -0,0 +1,87 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: proxy/shadowsocks_2022/config.proto +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from xray_api.proto.common.net import network_pb2 as common_dot_net_dot_network__pb2 +from xray_api.proto.common.net import address_pb2 as common_dot_net_dot_address__pb2 + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n#proxy/shadowsocks_2022/config.proto\x12\x1bxray.proxy.shadowsocks_2022\x1a\x18\x63ommon/net/network.proto\x1a\x18\x63ommon/net/address.proto\"t\n\x0cServerConfig\x12\x0e\n\x06method\x18\x01 \x01(\t\x12\x0b\n\x03key\x18\x02 \x01(\t\x12\r\n\x05\x65mail\x18\x03 \x01(\t\x12\r\n\x05level\x18\x04 \x01(\x05\x12)\n\x07network\x18\x05 \x03(\x0e\x32\x18.xray.common.net.Network\"\x91\x01\n\x15MultiUserServerConfig\x12\x0e\n\x06method\x18\x01 \x01(\t\x12\x0b\n\x03key\x18\x02 \x01(\t\x12\x30\n\x05users\x18\x03 \x03(\x0b\x32!.xray.proxy.shadowsocks_2022.User\x12)\n\x07network\x18\x04 \x03(\x0e\x32\x18.xray.common.net.Network\"y\n\x10RelayDestination\x12\x0b\n\x03key\x18\x01 \x01(\t\x12,\n\x07\x61\x64\x64ress\x18\x02 \x01(\x0b\x32\x1b.xray.common.net.IPOrDomain\x12\x0c\n\x04port\x18\x03 \x01(\r\x12\r\n\x05\x65mail\x18\x04 \x01(\t\x12\r\n\x05level\x18\x05 \x01(\x05\"\xa0\x01\n\x11RelayServerConfig\x12\x0e\n\x06method\x18\x01 \x01(\t\x12\x0b\n\x03key\x18\x02 \x01(\t\x12\x43\n\x0c\x64\x65stinations\x18\x03 \x03(\x0b\x32-.xray.proxy.shadowsocks_2022.RelayDestination\x12)\n\x07network\x18\x04 \x03(\x0e\x32\x18.xray.common.net.Network\"1\n\x04User\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05\x65mail\x18\x02 \x01(\t\x12\r\n\x05level\x18\x03 \x01(\x05\"}\n\x0c\x43lientConfig\x12,\n\x07\x61\x64\x64ress\x18\x01 \x01(\x0b\x32\x1b.xray.common.net.IPOrDomain\x12\x0c\n\x04port\x18\x02 \x01(\r\x12\x0e\n\x06method\x18\x03 \x01(\t\x12\x0b\n\x03key\x18\x04 \x01(\t\x12\x14\n\x0cudp_over_tcp\x18\x05 \x01(\x08\x42r\n\x1f\x63om.xray.proxy.shadowsocks_2022P\x01Z0github.com/xtls/xray-core/proxy/shadowsocks_2022\xaa\x02\x1aXray.Proxy.Shadowsocks2022b\x06proto3') + + + +_SERVERCONFIG = DESCRIPTOR.message_types_by_name['ServerConfig'] +_MULTIUSERSERVERCONFIG = DESCRIPTOR.message_types_by_name['MultiUserServerConfig'] +_RELAYDESTINATION = DESCRIPTOR.message_types_by_name['RelayDestination'] +_RELAYSERVERCONFIG = DESCRIPTOR.message_types_by_name['RelayServerConfig'] +_USER = DESCRIPTOR.message_types_by_name['User'] +_CLIENTCONFIG = DESCRIPTOR.message_types_by_name['ClientConfig'] +ServerConfig = _reflection.GeneratedProtocolMessageType('ServerConfig', (_message.Message,), { + 'DESCRIPTOR' : _SERVERCONFIG, + '__module__' : 'proxy.shadowsocks_2022.config_pb2' + # @@protoc_insertion_point(class_scope:xray.proxy.shadowsocks_2022.ServerConfig) + }) +_sym_db.RegisterMessage(ServerConfig) + +MultiUserServerConfig = _reflection.GeneratedProtocolMessageType('MultiUserServerConfig', (_message.Message,), { + 'DESCRIPTOR' : _MULTIUSERSERVERCONFIG, + '__module__' : 'proxy.shadowsocks_2022.config_pb2' + # @@protoc_insertion_point(class_scope:xray.proxy.shadowsocks_2022.MultiUserServerConfig) + }) +_sym_db.RegisterMessage(MultiUserServerConfig) + +RelayDestination = _reflection.GeneratedProtocolMessageType('RelayDestination', (_message.Message,), { + 'DESCRIPTOR' : _RELAYDESTINATION, + '__module__' : 'proxy.shadowsocks_2022.config_pb2' + # @@protoc_insertion_point(class_scope:xray.proxy.shadowsocks_2022.RelayDestination) + }) +_sym_db.RegisterMessage(RelayDestination) + +RelayServerConfig = _reflection.GeneratedProtocolMessageType('RelayServerConfig', (_message.Message,), { + 'DESCRIPTOR' : _RELAYSERVERCONFIG, + '__module__' : 'proxy.shadowsocks_2022.config_pb2' + # @@protoc_insertion_point(class_scope:xray.proxy.shadowsocks_2022.RelayServerConfig) + }) +_sym_db.RegisterMessage(RelayServerConfig) + +User = _reflection.GeneratedProtocolMessageType('User', (_message.Message,), { + 'DESCRIPTOR' : _USER, + '__module__' : 'proxy.shadowsocks_2022.config_pb2' + # @@protoc_insertion_point(class_scope:xray.proxy.shadowsocks_2022.User) + }) +_sym_db.RegisterMessage(User) + +ClientConfig = _reflection.GeneratedProtocolMessageType('ClientConfig', (_message.Message,), { + 'DESCRIPTOR' : _CLIENTCONFIG, + '__module__' : 'proxy.shadowsocks_2022.config_pb2' + # @@protoc_insertion_point(class_scope:xray.proxy.shadowsocks_2022.ClientConfig) + }) +_sym_db.RegisterMessage(ClientConfig) + +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n\037com.xray.proxy.shadowsocks_2022P\001Z0github.com/xtls/xray-core/proxy/shadowsocks_2022\252\002\032Xray.Proxy.Shadowsocks2022' + _SERVERCONFIG._serialized_start=120 + _SERVERCONFIG._serialized_end=236 + _MULTIUSERSERVERCONFIG._serialized_start=239 + _MULTIUSERSERVERCONFIG._serialized_end=384 + _RELAYDESTINATION._serialized_start=386 + _RELAYDESTINATION._serialized_end=507 + _RELAYSERVERCONFIG._serialized_start=510 + _RELAYSERVERCONFIG._serialized_end=670 + _USER._serialized_start=672 + _USER._serialized_end=721 + _CLIENTCONFIG._serialized_start=723 + _CLIENTCONFIG._serialized_end=848 +# @@protoc_insertion_point(module_scope) diff --git a/xray_api/proto/proxy/shadowsocks_2022/config_pb2_grpc.py b/xray_api/proto/proxy/shadowsocks_2022/config_pb2_grpc.py new file mode 100644 index 00000000..2daafffe --- /dev/null +++ b/xray_api/proto/proxy/shadowsocks_2022/config_pb2_grpc.py @@ -0,0 +1,4 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + diff --git a/xray_api/proto/proxy/socks/config_pb2.py b/xray_api/proto/proxy/socks/config_pb2.py new file mode 100644 index 00000000..10587ae6 --- /dev/null +++ b/xray_api/proto/proxy/socks/config_pb2.py @@ -0,0 +1,86 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: proxy/socks/config.proto +"""Generated protocol buffer code.""" +from google.protobuf.internal import enum_type_wrapper +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from xray_api.proto.common.net import address_pb2 as common_dot_net_dot_address__pb2 +from xray_api.proto.common.protocol import server_spec_pb2 as common_dot_protocol_dot_server__spec__pb2 + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x18proxy/socks/config.proto\x12\x10xray.proxy.socks\x1a\x18\x63ommon/net/address.proto\x1a!common/protocol/server_spec.proto\"-\n\x07\x41\x63\x63ount\x12\x10\n\x08username\x18\x01 \x01(\t\x12\x10\n\x08password\x18\x02 \x01(\t\"\x9a\x02\n\x0cServerConfig\x12-\n\tauth_type\x18\x01 \x01(\x0e\x32\x1a.xray.proxy.socks.AuthType\x12>\n\x08\x61\x63\x63ounts\x18\x02 \x03(\x0b\x32,.xray.proxy.socks.ServerConfig.AccountsEntry\x12,\n\x07\x61\x64\x64ress\x18\x03 \x01(\x0b\x32\x1b.xray.common.net.IPOrDomain\x12\x13\n\x0budp_enabled\x18\x04 \x01(\x08\x12\x13\n\x07timeout\x18\x05 \x01(\rB\x02\x18\x01\x12\x12\n\nuser_level\x18\x06 \x01(\r\x1a/\n\rAccountsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"p\n\x0c\x43lientConfig\x12\x34\n\x06server\x18\x01 \x03(\x0b\x32$.xray.common.protocol.ServerEndpoint\x12*\n\x07version\x18\x02 \x01(\x0e\x32\x19.xray.proxy.socks.Version*%\n\x08\x41uthType\x12\x0b\n\x07NO_AUTH\x10\x00\x12\x0c\n\x08PASSWORD\x10\x01*.\n\x07Version\x12\n\n\x06SOCKS5\x10\x00\x12\n\n\x06SOCKS4\x10\x01\x12\x0b\n\x07SOCKS4A\x10\x02\x42R\n\x14\x63om.xray.proxy.socksP\x01Z%github.com/xtls/xray-core/proxy/socks\xaa\x02\x10Xray.Proxy.Socksb\x06proto3') + +_AUTHTYPE = DESCRIPTOR.enum_types_by_name['AuthType'] +AuthType = enum_type_wrapper.EnumTypeWrapper(_AUTHTYPE) +_VERSION = DESCRIPTOR.enum_types_by_name['Version'] +Version = enum_type_wrapper.EnumTypeWrapper(_VERSION) +NO_AUTH = 0 +PASSWORD = 1 +SOCKS5 = 0 +SOCKS4 = 1 +SOCKS4A = 2 + + +_ACCOUNT = DESCRIPTOR.message_types_by_name['Account'] +_SERVERCONFIG = DESCRIPTOR.message_types_by_name['ServerConfig'] +_SERVERCONFIG_ACCOUNTSENTRY = _SERVERCONFIG.nested_types_by_name['AccountsEntry'] +_CLIENTCONFIG = DESCRIPTOR.message_types_by_name['ClientConfig'] +Account = _reflection.GeneratedProtocolMessageType('Account', (_message.Message,), { + 'DESCRIPTOR' : _ACCOUNT, + '__module__' : 'proxy.socks.config_pb2' + # @@protoc_insertion_point(class_scope:xray.proxy.socks.Account) + }) +_sym_db.RegisterMessage(Account) + +ServerConfig = _reflection.GeneratedProtocolMessageType('ServerConfig', (_message.Message,), { + + 'AccountsEntry' : _reflection.GeneratedProtocolMessageType('AccountsEntry', (_message.Message,), { + 'DESCRIPTOR' : _SERVERCONFIG_ACCOUNTSENTRY, + '__module__' : 'proxy.socks.config_pb2' + # @@protoc_insertion_point(class_scope:xray.proxy.socks.ServerConfig.AccountsEntry) + }) + , + 'DESCRIPTOR' : _SERVERCONFIG, + '__module__' : 'proxy.socks.config_pb2' + # @@protoc_insertion_point(class_scope:xray.proxy.socks.ServerConfig) + }) +_sym_db.RegisterMessage(ServerConfig) +_sym_db.RegisterMessage(ServerConfig.AccountsEntry) + +ClientConfig = _reflection.GeneratedProtocolMessageType('ClientConfig', (_message.Message,), { + 'DESCRIPTOR' : _CLIENTCONFIG, + '__module__' : 'proxy.socks.config_pb2' + # @@protoc_insertion_point(class_scope:xray.proxy.socks.ClientConfig) + }) +_sym_db.RegisterMessage(ClientConfig) + +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n\024com.xray.proxy.socksP\001Z%github.com/xtls/xray-core/proxy/socks\252\002\020Xray.Proxy.Socks' + _SERVERCONFIG_ACCOUNTSENTRY._options = None + _SERVERCONFIG_ACCOUNTSENTRY._serialized_options = b'8\001' + _SERVERCONFIG.fields_by_name['timeout']._options = None + _SERVERCONFIG.fields_by_name['timeout']._serialized_options = b'\030\001' + _AUTHTYPE._serialized_start=553 + _AUTHTYPE._serialized_end=590 + _VERSION._serialized_start=592 + _VERSION._serialized_end=638 + _ACCOUNT._serialized_start=107 + _ACCOUNT._serialized_end=152 + _SERVERCONFIG._serialized_start=155 + _SERVERCONFIG._serialized_end=437 + _SERVERCONFIG_ACCOUNTSENTRY._serialized_start=390 + _SERVERCONFIG_ACCOUNTSENTRY._serialized_end=437 + _CLIENTCONFIG._serialized_start=439 + _CLIENTCONFIG._serialized_end=551 +# @@protoc_insertion_point(module_scope) diff --git a/xray_api/proto/proxy/socks/config_pb2_grpc.py b/xray_api/proto/proxy/socks/config_pb2_grpc.py new file mode 100644 index 00000000..2daafffe --- /dev/null +++ b/xray_api/proto/proxy/socks/config_pb2_grpc.py @@ -0,0 +1,4 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + diff --git a/xray_api/proto/proxy/trojan/config_pb2.py b/xray_api/proto/proxy/trojan/config_pb2.py new file mode 100644 index 00000000..cd38e4b1 --- /dev/null +++ b/xray_api/proto/proxy/trojan/config_pb2.py @@ -0,0 +1,67 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: proxy/trojan/config.proto +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from xray_api.proto.common.protocol import user_pb2 as common_dot_protocol_dot_user__pb2 +from xray_api.proto.common.protocol import server_spec_pb2 as common_dot_protocol_dot_server__spec__pb2 + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x19proxy/trojan/config.proto\x12\x11xray.proxy.trojan\x1a\x1a\x63ommon/protocol/user.proto\x1a!common/protocol/server_spec.proto\")\n\x07\x41\x63\x63ount\x12\x10\n\x08password\x18\x01 \x01(\t\x12\x0c\n\x04\x66low\x18\x02 \x01(\t\"^\n\x08\x46\x61llback\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0c\n\x04\x61lpn\x18\x02 \x01(\t\x12\x0c\n\x04path\x18\x03 \x01(\t\x12\x0c\n\x04type\x18\x04 \x01(\t\x12\x0c\n\x04\x64\x65st\x18\x05 \x01(\t\x12\x0c\n\x04xver\x18\x06 \x01(\x04\"D\n\x0c\x43lientConfig\x12\x34\n\x06server\x18\x01 \x03(\x0b\x32$.xray.common.protocol.ServerEndpoint\"i\n\x0cServerConfig\x12)\n\x05users\x18\x01 \x03(\x0b\x32\x1a.xray.common.protocol.User\x12.\n\tfallbacks\x18\x03 \x03(\x0b\x32\x1b.xray.proxy.trojan.FallbackBU\n\x15\x63om.xray.proxy.trojanP\x01Z&github.com/xtls/xray-core/proxy/trojan\xaa\x02\x11Xray.Proxy.Trojanb\x06proto3') + + + +_ACCOUNT = DESCRIPTOR.message_types_by_name['Account'] +_FALLBACK = DESCRIPTOR.message_types_by_name['Fallback'] +_CLIENTCONFIG = DESCRIPTOR.message_types_by_name['ClientConfig'] +_SERVERCONFIG = DESCRIPTOR.message_types_by_name['ServerConfig'] +Account = _reflection.GeneratedProtocolMessageType('Account', (_message.Message,), { + 'DESCRIPTOR' : _ACCOUNT, + '__module__' : 'proxy.trojan.config_pb2' + # @@protoc_insertion_point(class_scope:xray.proxy.trojan.Account) + }) +_sym_db.RegisterMessage(Account) + +Fallback = _reflection.GeneratedProtocolMessageType('Fallback', (_message.Message,), { + 'DESCRIPTOR' : _FALLBACK, + '__module__' : 'proxy.trojan.config_pb2' + # @@protoc_insertion_point(class_scope:xray.proxy.trojan.Fallback) + }) +_sym_db.RegisterMessage(Fallback) + +ClientConfig = _reflection.GeneratedProtocolMessageType('ClientConfig', (_message.Message,), { + 'DESCRIPTOR' : _CLIENTCONFIG, + '__module__' : 'proxy.trojan.config_pb2' + # @@protoc_insertion_point(class_scope:xray.proxy.trojan.ClientConfig) + }) +_sym_db.RegisterMessage(ClientConfig) + +ServerConfig = _reflection.GeneratedProtocolMessageType('ServerConfig', (_message.Message,), { + 'DESCRIPTOR' : _SERVERCONFIG, + '__module__' : 'proxy.trojan.config_pb2' + # @@protoc_insertion_point(class_scope:xray.proxy.trojan.ServerConfig) + }) +_sym_db.RegisterMessage(ServerConfig) + +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n\025com.xray.proxy.trojanP\001Z&github.com/xtls/xray-core/proxy/trojan\252\002\021Xray.Proxy.Trojan' + _ACCOUNT._serialized_start=111 + _ACCOUNT._serialized_end=152 + _FALLBACK._serialized_start=154 + _FALLBACK._serialized_end=248 + _CLIENTCONFIG._serialized_start=250 + _CLIENTCONFIG._serialized_end=318 + _SERVERCONFIG._serialized_start=320 + _SERVERCONFIG._serialized_end=425 +# @@protoc_insertion_point(module_scope) diff --git a/xray_api/proto/proxy/trojan/config_pb2_grpc.py b/xray_api/proto/proxy/trojan/config_pb2_grpc.py new file mode 100644 index 00000000..2daafffe --- /dev/null +++ b/xray_api/proto/proxy/trojan/config_pb2_grpc.py @@ -0,0 +1,4 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + diff --git a/xray_api/proto/proxy/vless/account_pb2.py b/xray_api/proto/proxy/vless/account_pb2.py new file mode 100644 index 00000000..ec5bb860 --- /dev/null +++ b/xray_api/proto/proxy/vless/account_pb2.py @@ -0,0 +1,35 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: proxy/vless/account.proto +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x19proxy/vless/account.proto\x12\x10xray.proxy.vless\"7\n\x07\x41\x63\x63ount\x12\n\n\x02id\x18\x01 \x01(\t\x12\x0c\n\x04\x66low\x18\x02 \x01(\t\x12\x12\n\nencryption\x18\x03 \x01(\tBR\n\x14\x63om.xray.proxy.vlessP\x01Z%github.com/xtls/xray-core/proxy/vless\xaa\x02\x10Xray.Proxy.Vlessb\x06proto3') + + + +_ACCOUNT = DESCRIPTOR.message_types_by_name['Account'] +Account = _reflection.GeneratedProtocolMessageType('Account', (_message.Message,), { + 'DESCRIPTOR' : _ACCOUNT, + '__module__' : 'proxy.vless.account_pb2' + # @@protoc_insertion_point(class_scope:xray.proxy.vless.Account) + }) +_sym_db.RegisterMessage(Account) + +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n\024com.xray.proxy.vlessP\001Z%github.com/xtls/xray-core/proxy/vless\252\002\020Xray.Proxy.Vless' + _ACCOUNT._serialized_start=47 + _ACCOUNT._serialized_end=102 +# @@protoc_insertion_point(module_scope) diff --git a/xray_api/proto/proxy/vless/account_pb2_grpc.py b/xray_api/proto/proxy/vless/account_pb2_grpc.py new file mode 100644 index 00000000..2daafffe --- /dev/null +++ b/xray_api/proto/proxy/vless/account_pb2_grpc.py @@ -0,0 +1,4 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + diff --git a/xray_api/proto/proxy/vless/encoding/addons_pb2.py b/xray_api/proto/proxy/vless/encoding/addons_pb2.py new file mode 100644 index 00000000..4aa94bed --- /dev/null +++ b/xray_api/proto/proxy/vless/encoding/addons_pb2.py @@ -0,0 +1,35 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: proxy/vless/encoding/addons.proto +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n!proxy/vless/encoding/addons.proto\x12\x19xray.proxy.vless.encoding\"$\n\x06\x41\x64\x64ons\x12\x0c\n\x04\x46low\x18\x01 \x01(\t\x12\x0c\n\x04Seed\x18\x02 \x01(\x0c\x42m\n\x1d\x63om.xray.proxy.vless.encodingP\x01Z.github.com/xtls/xray-core/proxy/vless/encoding\xaa\x02\x19Xray.Proxy.Vless.Encodingb\x06proto3') + + + +_ADDONS = DESCRIPTOR.message_types_by_name['Addons'] +Addons = _reflection.GeneratedProtocolMessageType('Addons', (_message.Message,), { + 'DESCRIPTOR' : _ADDONS, + '__module__' : 'proxy.vless.encoding.addons_pb2' + # @@protoc_insertion_point(class_scope:xray.proxy.vless.encoding.Addons) + }) +_sym_db.RegisterMessage(Addons) + +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n\035com.xray.proxy.vless.encodingP\001Z.github.com/xtls/xray-core/proxy/vless/encoding\252\002\031Xray.Proxy.Vless.Encoding' + _ADDONS._serialized_start=64 + _ADDONS._serialized_end=100 +# @@protoc_insertion_point(module_scope) diff --git a/xray_api/proto/proxy/vless/encoding/addons_pb2_grpc.py b/xray_api/proto/proxy/vless/encoding/addons_pb2_grpc.py new file mode 100644 index 00000000..2daafffe --- /dev/null +++ b/xray_api/proto/proxy/vless/encoding/addons_pb2_grpc.py @@ -0,0 +1,4 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + diff --git a/xray_api/proto/proxy/vless/inbound/config_pb2.py b/xray_api/proto/proxy/vless/inbound/config_pb2.py new file mode 100644 index 00000000..f0274020 --- /dev/null +++ b/xray_api/proto/proxy/vless/inbound/config_pb2.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: proxy/vless/inbound/config.proto +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from xray_api.proto.common.protocol import user_pb2 as common_dot_protocol_dot_user__pb2 + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n proxy/vless/inbound/config.proto\x12\x18xray.proxy.vless.inbound\x1a\x1a\x63ommon/protocol/user.proto\"^\n\x08\x46\x61llback\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0c\n\x04\x61lpn\x18\x02 \x01(\t\x12\x0c\n\x04path\x18\x03 \x01(\t\x12\x0c\n\x04type\x18\x04 \x01(\t\x12\x0c\n\x04\x64\x65st\x18\x05 \x01(\t\x12\x0c\n\x04xver\x18\x06 \x01(\x04\"\x80\x01\n\x06\x43onfig\x12+\n\x07\x63lients\x18\x01 \x03(\x0b\x32\x1a.xray.common.protocol.User\x12\x12\n\ndecryption\x18\x02 \x01(\t\x12\x35\n\tfallbacks\x18\x03 \x03(\x0b\x32\".xray.proxy.vless.inbound.FallbackBj\n\x1c\x63om.xray.proxy.vless.inboundP\x01Z-github.com/xtls/xray-core/proxy/vless/inbound\xaa\x02\x18Xray.Proxy.Vless.Inboundb\x06proto3') + + + +_FALLBACK = DESCRIPTOR.message_types_by_name['Fallback'] +_CONFIG = DESCRIPTOR.message_types_by_name['Config'] +Fallback = _reflection.GeneratedProtocolMessageType('Fallback', (_message.Message,), { + 'DESCRIPTOR' : _FALLBACK, + '__module__' : 'proxy.vless.inbound.config_pb2' + # @@protoc_insertion_point(class_scope:xray.proxy.vless.inbound.Fallback) + }) +_sym_db.RegisterMessage(Fallback) + +Config = _reflection.GeneratedProtocolMessageType('Config', (_message.Message,), { + 'DESCRIPTOR' : _CONFIG, + '__module__' : 'proxy.vless.inbound.config_pb2' + # @@protoc_insertion_point(class_scope:xray.proxy.vless.inbound.Config) + }) +_sym_db.RegisterMessage(Config) + +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n\034com.xray.proxy.vless.inboundP\001Z-github.com/xtls/xray-core/proxy/vless/inbound\252\002\030Xray.Proxy.Vless.Inbound' + _FALLBACK._serialized_start=90 + _FALLBACK._serialized_end=184 + _CONFIG._serialized_start=187 + _CONFIG._serialized_end=315 +# @@protoc_insertion_point(module_scope) diff --git a/xray_api/proto/proxy/vless/inbound/config_pb2_grpc.py b/xray_api/proto/proxy/vless/inbound/config_pb2_grpc.py new file mode 100644 index 00000000..2daafffe --- /dev/null +++ b/xray_api/proto/proxy/vless/inbound/config_pb2_grpc.py @@ -0,0 +1,4 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + diff --git a/xray_api/proto/proxy/vless/outbound/config_pb2.py b/xray_api/proto/proxy/vless/outbound/config_pb2.py new file mode 100644 index 00000000..d0da7f47 --- /dev/null +++ b/xray_api/proto/proxy/vless/outbound/config_pb2.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: proxy/vless/outbound/config.proto +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from xray_api.proto.common.protocol import server_spec_pb2 as common_dot_protocol_dot_server__spec__pb2 + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n!proxy/vless/outbound/config.proto\x12\x19xray.proxy.vless.outbound\x1a!common/protocol/server_spec.proto\"=\n\x06\x43onfig\x12\x33\n\x05vnext\x18\x01 \x03(\x0b\x32$.xray.common.protocol.ServerEndpointBm\n\x1d\x63om.xray.proxy.vless.outboundP\x01Z.github.com/xtls/xray-core/proxy/vless/outbound\xaa\x02\x19Xray.Proxy.Vless.Outboundb\x06proto3') + + + +_CONFIG = DESCRIPTOR.message_types_by_name['Config'] +Config = _reflection.GeneratedProtocolMessageType('Config', (_message.Message,), { + 'DESCRIPTOR' : _CONFIG, + '__module__' : 'proxy.vless.outbound.config_pb2' + # @@protoc_insertion_point(class_scope:xray.proxy.vless.outbound.Config) + }) +_sym_db.RegisterMessage(Config) + +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n\035com.xray.proxy.vless.outboundP\001Z.github.com/xtls/xray-core/proxy/vless/outbound\252\002\031Xray.Proxy.Vless.Outbound' + _CONFIG._serialized_start=99 + _CONFIG._serialized_end=160 +# @@protoc_insertion_point(module_scope) diff --git a/xray_api/proto/proxy/vless/outbound/config_pb2_grpc.py b/xray_api/proto/proxy/vless/outbound/config_pb2_grpc.py new file mode 100644 index 00000000..2daafffe --- /dev/null +++ b/xray_api/proto/proxy/vless/outbound/config_pb2_grpc.py @@ -0,0 +1,4 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + diff --git a/xray_api/proto/proxy/vmess/account_pb2.py b/xray_api/proto/proxy/vmess/account_pb2.py new file mode 100644 index 00000000..9433d00b --- /dev/null +++ b/xray_api/proto/proxy/vmess/account_pb2.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: proxy/vmess/account.proto +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from xray_api.proto.common.protocol import headers_pb2 as common_dot_protocol_dot_headers__pb2 + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x19proxy/vmess/account.proto\x12\x10xray.proxy.vmess\x1a\x1d\x63ommon/protocol/headers.proto\"\x7f\n\x07\x41\x63\x63ount\x12\n\n\x02id\x18\x01 \x01(\t\x12\x10\n\x08\x61lter_id\x18\x02 \x01(\r\x12?\n\x11security_settings\x18\x03 \x01(\x0b\x32$.xray.common.protocol.SecurityConfig\x12\x15\n\rtests_enabled\x18\x04 \x01(\tBR\n\x14\x63om.xray.proxy.vmessP\x01Z%github.com/xtls/xray-core/proxy/vmess\xaa\x02\x10Xray.Proxy.Vmessb\x06proto3') + + + +_ACCOUNT = DESCRIPTOR.message_types_by_name['Account'] +Account = _reflection.GeneratedProtocolMessageType('Account', (_message.Message,), { + 'DESCRIPTOR' : _ACCOUNT, + '__module__' : 'proxy.vmess.account_pb2' + # @@protoc_insertion_point(class_scope:xray.proxy.vmess.Account) + }) +_sym_db.RegisterMessage(Account) + +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n\024com.xray.proxy.vmessP\001Z%github.com/xtls/xray-core/proxy/vmess\252\002\020Xray.Proxy.Vmess' + _ACCOUNT._serialized_start=78 + _ACCOUNT._serialized_end=205 +# @@protoc_insertion_point(module_scope) diff --git a/xray_api/proto/proxy/vmess/account_pb2_grpc.py b/xray_api/proto/proxy/vmess/account_pb2_grpc.py new file mode 100644 index 00000000..2daafffe --- /dev/null +++ b/xray_api/proto/proxy/vmess/account_pb2_grpc.py @@ -0,0 +1,4 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + diff --git a/xray_api/proto/proxy/vmess/inbound/config_pb2.py b/xray_api/proto/proxy/vmess/inbound/config_pb2.py new file mode 100644 index 00000000..7e61d815 --- /dev/null +++ b/xray_api/proto/proxy/vmess/inbound/config_pb2.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: proxy/vmess/inbound/config.proto +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from xray_api.proto.common.protocol import user_pb2 as common_dot_protocol_dot_user__pb2 + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n proxy/vmess/inbound/config.proto\x12\x18xray.proxy.vmess.inbound\x1a\x1a\x63ommon/protocol/user.proto\"\x1a\n\x0c\x44\x65tourConfig\x12\n\n\x02to\x18\x01 \x01(\t\"0\n\rDefaultConfig\x12\x10\n\x08\x61lter_id\x18\x01 \x01(\r\x12\r\n\x05level\x18\x02 \x01(\r\"\xc4\x01\n\x06\x43onfig\x12(\n\x04user\x18\x01 \x03(\x0b\x32\x1a.xray.common.protocol.User\x12\x38\n\x07\x64\x65\x66\x61ult\x18\x02 \x01(\x0b\x32\'.xray.proxy.vmess.inbound.DefaultConfig\x12\x36\n\x06\x64\x65tour\x18\x03 \x01(\x0b\x32&.xray.proxy.vmess.inbound.DetourConfig\x12\x1e\n\x16secure_encryption_only\x18\x04 \x01(\x08\x42j\n\x1c\x63om.xray.proxy.vmess.inboundP\x01Z-github.com/xtls/xray-core/proxy/vmess/inbound\xaa\x02\x18Xray.Proxy.Vmess.Inboundb\x06proto3') + + + +_DETOURCONFIG = DESCRIPTOR.message_types_by_name['DetourConfig'] +_DEFAULTCONFIG = DESCRIPTOR.message_types_by_name['DefaultConfig'] +_CONFIG = DESCRIPTOR.message_types_by_name['Config'] +DetourConfig = _reflection.GeneratedProtocolMessageType('DetourConfig', (_message.Message,), { + 'DESCRIPTOR' : _DETOURCONFIG, + '__module__' : 'proxy.vmess.inbound.config_pb2' + # @@protoc_insertion_point(class_scope:xray.proxy.vmess.inbound.DetourConfig) + }) +_sym_db.RegisterMessage(DetourConfig) + +DefaultConfig = _reflection.GeneratedProtocolMessageType('DefaultConfig', (_message.Message,), { + 'DESCRIPTOR' : _DEFAULTCONFIG, + '__module__' : 'proxy.vmess.inbound.config_pb2' + # @@protoc_insertion_point(class_scope:xray.proxy.vmess.inbound.DefaultConfig) + }) +_sym_db.RegisterMessage(DefaultConfig) + +Config = _reflection.GeneratedProtocolMessageType('Config', (_message.Message,), { + 'DESCRIPTOR' : _CONFIG, + '__module__' : 'proxy.vmess.inbound.config_pb2' + # @@protoc_insertion_point(class_scope:xray.proxy.vmess.inbound.Config) + }) +_sym_db.RegisterMessage(Config) + +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n\034com.xray.proxy.vmess.inboundP\001Z-github.com/xtls/xray-core/proxy/vmess/inbound\252\002\030Xray.Proxy.Vmess.Inbound' + _DETOURCONFIG._serialized_start=90 + _DETOURCONFIG._serialized_end=116 + _DEFAULTCONFIG._serialized_start=118 + _DEFAULTCONFIG._serialized_end=166 + _CONFIG._serialized_start=169 + _CONFIG._serialized_end=365 +# @@protoc_insertion_point(module_scope) diff --git a/xray_api/proto/proxy/vmess/inbound/config_pb2_grpc.py b/xray_api/proto/proxy/vmess/inbound/config_pb2_grpc.py new file mode 100644 index 00000000..2daafffe --- /dev/null +++ b/xray_api/proto/proxy/vmess/inbound/config_pb2_grpc.py @@ -0,0 +1,4 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + diff --git a/xray_api/proto/proxy/vmess/outbound/config_pb2.py b/xray_api/proto/proxy/vmess/outbound/config_pb2.py new file mode 100644 index 00000000..abdb4f95 --- /dev/null +++ b/xray_api/proto/proxy/vmess/outbound/config_pb2.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: proxy/vmess/outbound/config.proto +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from xray_api.proto.common.protocol import server_spec_pb2 as common_dot_protocol_dot_server__spec__pb2 + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n!proxy/vmess/outbound/config.proto\x12\x19xray.proxy.vmess.outbound\x1a!common/protocol/server_spec.proto\"@\n\x06\x43onfig\x12\x36\n\x08Receiver\x18\x01 \x03(\x0b\x32$.xray.common.protocol.ServerEndpointBm\n\x1d\x63om.xray.proxy.vmess.outboundP\x01Z.github.com/xtls/xray-core/proxy/vmess/outbound\xaa\x02\x19Xray.Proxy.Vmess.Outboundb\x06proto3') + + + +_CONFIG = DESCRIPTOR.message_types_by_name['Config'] +Config = _reflection.GeneratedProtocolMessageType('Config', (_message.Message,), { + 'DESCRIPTOR' : _CONFIG, + '__module__' : 'proxy.vmess.outbound.config_pb2' + # @@protoc_insertion_point(class_scope:xray.proxy.vmess.outbound.Config) + }) +_sym_db.RegisterMessage(Config) + +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n\035com.xray.proxy.vmess.outboundP\001Z.github.com/xtls/xray-core/proxy/vmess/outbound\252\002\031Xray.Proxy.Vmess.Outbound' + _CONFIG._serialized_start=99 + _CONFIG._serialized_end=163 +# @@protoc_insertion_point(module_scope) diff --git a/xray_api/proto/proxy/vmess/outbound/config_pb2_grpc.py b/xray_api/proto/proxy/vmess/outbound/config_pb2_grpc.py new file mode 100644 index 00000000..2daafffe --- /dev/null +++ b/xray_api/proto/proxy/vmess/outbound/config_pb2_grpc.py @@ -0,0 +1,4 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + diff --git a/xray_api/proto/transport/global/config_pb2.py b/xray_api/proto/transport/global/config_pb2.py new file mode 100644 index 00000000..74e3c618 --- /dev/null +++ b/xray_api/proto/transport/global/config_pb2.py @@ -0,0 +1,38 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: transport/global/config.proto +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from xray_api.proto.transport.internet import config_pb2 as transport_dot_internet_dot_config__pb2 + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1dtransport/global/config.proto\x12\x0exray.transport\x1a\x1ftransport/internet/config.proto\"R\n\x06\x43onfig\x12\x44\n\x12transport_settings\x18\x01 \x03(\x0b\x32(.xray.transport.internet.TransportConfig:\x02\x18\x01\x42\x61\n\x19\x63om.xray.transport.globalP\x01Z*github.com/xtls/xray-core/transport/global\xaa\x02\x15Xray.Transport.Globalb\x06proto3') + + + +_CONFIG = DESCRIPTOR.message_types_by_name['Config'] +Config = _reflection.GeneratedProtocolMessageType('Config', (_message.Message,), { + 'DESCRIPTOR' : _CONFIG, + '__module__' : 'transport.global.config_pb2' + # @@protoc_insertion_point(class_scope:xray.transport.Config) + }) +_sym_db.RegisterMessage(Config) + +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n\031com.xray.transport.globalP\001Z*github.com/xtls/xray-core/transport/global\252\002\025Xray.Transport.Global' + _CONFIG._options = None + _CONFIG._serialized_options = b'\030\001' + _CONFIG._serialized_start=82 + _CONFIG._serialized_end=164 +# @@protoc_insertion_point(module_scope) diff --git a/xray_api/proto/transport/global/config_pb2_grpc.py b/xray_api/proto/transport/global/config_pb2_grpc.py new file mode 100644 index 00000000..2daafffe --- /dev/null +++ b/xray_api/proto/transport/global/config_pb2_grpc.py @@ -0,0 +1,4 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + diff --git a/xray_api/proto/transport/internet/config_pb2.py b/xray_api/proto/transport/internet/config_pb2.py new file mode 100644 index 00000000..a29bb7f0 --- /dev/null +++ b/xray_api/proto/transport/internet/config_pb2.py @@ -0,0 +1,92 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: transport/internet/config.proto +"""Generated protocol buffer code.""" +from google.protobuf.internal import enum_type_wrapper +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from xray_api.proto.common.serial import typed_message_pb2 as common_dot_serial_dot_typed__message__pb2 + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1ftransport/internet/config.proto\x12\x17xray.transport.internet\x1a!common/serial/typed_message.proto\"\x9e\x01\n\x0fTransportConfig\x12@\n\x08protocol\x18\x01 \x01(\x0e\x32*.xray.transport.internet.TransportProtocolB\x02\x18\x01\x12\x15\n\rprotocol_name\x18\x03 \x01(\t\x12\x32\n\x08settings\x18\x02 \x01(\x0b\x32 .xray.common.serial.TypedMessage\"\xc1\x02\n\x0cStreamConfig\x12@\n\x08protocol\x18\x01 \x01(\x0e\x32*.xray.transport.internet.TransportProtocolB\x02\x18\x01\x12\x15\n\rprotocol_name\x18\x05 \x01(\t\x12\x44\n\x12transport_settings\x18\x02 \x03(\x0b\x32(.xray.transport.internet.TransportConfig\x12\x15\n\rsecurity_type\x18\x03 \x01(\t\x12;\n\x11security_settings\x18\x04 \x03(\x0b\x32 .xray.common.serial.TypedMessage\x12>\n\x0fsocket_settings\x18\x06 \x01(\x0b\x32%.xray.transport.internet.SocketConfig\"7\n\x0bProxyConfig\x12\x0b\n\x03tag\x18\x01 \x01(\t\x12\x1b\n\x13transportLayerProxy\x18\x02 \x01(\x08\"\xb9\x03\n\x0cSocketConfig\x12\x0c\n\x04mark\x18\x01 \x01(\x05\x12\x0b\n\x03tfo\x18\x02 \x01(\x05\x12@\n\x06tproxy\x18\x03 \x01(\x0e\x32\x30.xray.transport.internet.SocketConfig.TProxyMode\x12%\n\x1dreceive_original_dest_address\x18\x04 \x01(\x08\x12\x14\n\x0c\x62ind_address\x18\x05 \x01(\x0c\x12\x11\n\tbind_port\x18\x06 \x01(\r\x12\x1d\n\x15\x61\x63\x63\x65pt_proxy_protocol\x18\x07 \x01(\x08\x12@\n\x0f\x64omain_strategy\x18\x08 \x01(\x0e\x32\'.xray.transport.internet.DomainStrategy\x12\x14\n\x0c\x64ialer_proxy\x18\t \x01(\t\x12\x1f\n\x17tcp_keep_alive_interval\x18\n \x01(\x05\x12\x1b\n\x13tcp_keep_alive_idle\x18\x0b \x01(\x05\x12\x16\n\x0etcp_congestion\x18\x0c \x01(\t\"/\n\nTProxyMode\x12\x07\n\x03Off\x10\x00\x12\n\n\x06TProxy\x10\x01\x12\x0c\n\x08Redirect\x10\x02*Z\n\x11TransportProtocol\x12\x07\n\x03TCP\x10\x00\x12\x07\n\x03UDP\x10\x01\x12\x08\n\x04MKCP\x10\x02\x12\r\n\tWebSocket\x10\x03\x12\x08\n\x04HTTP\x10\x04\x12\x10\n\x0c\x44omainSocket\x10\x05*A\n\x0e\x44omainStrategy\x12\t\n\x05\x41S_IS\x10\x00\x12\n\n\x06USE_IP\x10\x01\x12\x0b\n\x07USE_IP4\x10\x02\x12\x0b\n\x07USE_IP6\x10\x03\x42g\n\x1b\x63om.xray.transport.internetP\x01Z,github.com/xtls/xray-core/transport/internet\xaa\x02\x17Xray.Transport.Internetb\x06proto3') + +_TRANSPORTPROTOCOL = DESCRIPTOR.enum_types_by_name['TransportProtocol'] +TransportProtocol = enum_type_wrapper.EnumTypeWrapper(_TRANSPORTPROTOCOL) +_DOMAINSTRATEGY = DESCRIPTOR.enum_types_by_name['DomainStrategy'] +DomainStrategy = enum_type_wrapper.EnumTypeWrapper(_DOMAINSTRATEGY) +TCP = 0 +UDP = 1 +MKCP = 2 +WebSocket = 3 +HTTP = 4 +DomainSocket = 5 +AS_IS = 0 +USE_IP = 1 +USE_IP4 = 2 +USE_IP6 = 3 + + +_TRANSPORTCONFIG = DESCRIPTOR.message_types_by_name['TransportConfig'] +_STREAMCONFIG = DESCRIPTOR.message_types_by_name['StreamConfig'] +_PROXYCONFIG = DESCRIPTOR.message_types_by_name['ProxyConfig'] +_SOCKETCONFIG = DESCRIPTOR.message_types_by_name['SocketConfig'] +_SOCKETCONFIG_TPROXYMODE = _SOCKETCONFIG.enum_types_by_name['TProxyMode'] +TransportConfig = _reflection.GeneratedProtocolMessageType('TransportConfig', (_message.Message,), { + 'DESCRIPTOR' : _TRANSPORTCONFIG, + '__module__' : 'transport.internet.config_pb2' + # @@protoc_insertion_point(class_scope:xray.transport.internet.TransportConfig) + }) +_sym_db.RegisterMessage(TransportConfig) + +StreamConfig = _reflection.GeneratedProtocolMessageType('StreamConfig', (_message.Message,), { + 'DESCRIPTOR' : _STREAMCONFIG, + '__module__' : 'transport.internet.config_pb2' + # @@protoc_insertion_point(class_scope:xray.transport.internet.StreamConfig) + }) +_sym_db.RegisterMessage(StreamConfig) + +ProxyConfig = _reflection.GeneratedProtocolMessageType('ProxyConfig', (_message.Message,), { + 'DESCRIPTOR' : _PROXYCONFIG, + '__module__' : 'transport.internet.config_pb2' + # @@protoc_insertion_point(class_scope:xray.transport.internet.ProxyConfig) + }) +_sym_db.RegisterMessage(ProxyConfig) + +SocketConfig = _reflection.GeneratedProtocolMessageType('SocketConfig', (_message.Message,), { + 'DESCRIPTOR' : _SOCKETCONFIG, + '__module__' : 'transport.internet.config_pb2' + # @@protoc_insertion_point(class_scope:xray.transport.internet.SocketConfig) + }) +_sym_db.RegisterMessage(SocketConfig) + +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n\033com.xray.transport.internetP\001Z,github.com/xtls/xray-core/transport/internet\252\002\027Xray.Transport.Internet' + _TRANSPORTCONFIG.fields_by_name['protocol']._options = None + _TRANSPORTCONFIG.fields_by_name['protocol']._serialized_options = b'\030\001' + _STREAMCONFIG.fields_by_name['protocol']._options = None + _STREAMCONFIG.fields_by_name['protocol']._serialized_options = b'\030\001' + _TRANSPORTPROTOCOL._serialized_start=1081 + _TRANSPORTPROTOCOL._serialized_end=1171 + _DOMAINSTRATEGY._serialized_start=1173 + _DOMAINSTRATEGY._serialized_end=1238 + _TRANSPORTCONFIG._serialized_start=96 + _TRANSPORTCONFIG._serialized_end=254 + _STREAMCONFIG._serialized_start=257 + _STREAMCONFIG._serialized_end=578 + _PROXYCONFIG._serialized_start=580 + _PROXYCONFIG._serialized_end=635 + _SOCKETCONFIG._serialized_start=638 + _SOCKETCONFIG._serialized_end=1079 + _SOCKETCONFIG_TPROXYMODE._serialized_start=1032 + _SOCKETCONFIG_TPROXYMODE._serialized_end=1079 +# @@protoc_insertion_point(module_scope) diff --git a/xray_api/proto/transport/internet/config_pb2_grpc.py b/xray_api/proto/transport/internet/config_pb2_grpc.py new file mode 100644 index 00000000..2daafffe --- /dev/null +++ b/xray_api/proto/transport/internet/config_pb2_grpc.py @@ -0,0 +1,4 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + diff --git a/xray_api/proto/transport/internet/domainsocket/config_pb2.py b/xray_api/proto/transport/internet/domainsocket/config_pb2.py new file mode 100644 index 00000000..7e25a7c9 --- /dev/null +++ b/xray_api/proto/transport/internet/domainsocket/config_pb2.py @@ -0,0 +1,35 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: transport/internet/domainsocket/config.proto +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n,transport/internet/domainsocket/config.proto\x12$xray.transport.internet.domainsocket\"9\n\x06\x43onfig\x12\x0c\n\x04path\x18\x01 \x01(\t\x12\x10\n\x08\x61\x62stract\x18\x02 \x01(\x08\x12\x0f\n\x07padding\x18\x03 \x01(\x08\x42\x8e\x01\n(com.xray.transport.internet.domainsocketP\x01Z9github.com/xtls/xray-core/transport/internet/domainsocket\xaa\x02$Xray.Transport.Internet.DomainSocketb\x06proto3') + + + +_CONFIG = DESCRIPTOR.message_types_by_name['Config'] +Config = _reflection.GeneratedProtocolMessageType('Config', (_message.Message,), { + 'DESCRIPTOR' : _CONFIG, + '__module__' : 'transport.internet.domainsocket.config_pb2' + # @@protoc_insertion_point(class_scope:xray.transport.internet.domainsocket.Config) + }) +_sym_db.RegisterMessage(Config) + +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n(com.xray.transport.internet.domainsocketP\001Z9github.com/xtls/xray-core/transport/internet/domainsocket\252\002$Xray.Transport.Internet.DomainSocket' + _CONFIG._serialized_start=86 + _CONFIG._serialized_end=143 +# @@protoc_insertion_point(module_scope) diff --git a/xray_api/proto/transport/internet/domainsocket/config_pb2_grpc.py b/xray_api/proto/transport/internet/domainsocket/config_pb2_grpc.py new file mode 100644 index 00000000..2daafffe --- /dev/null +++ b/xray_api/proto/transport/internet/domainsocket/config_pb2_grpc.py @@ -0,0 +1,4 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + diff --git a/xray_api/proto/transport/internet/grpc/config_pb2.py b/xray_api/proto/transport/internet/grpc/config_pb2.py new file mode 100644 index 00000000..4d87a16f --- /dev/null +++ b/xray_api/proto/transport/internet/grpc/config_pb2.py @@ -0,0 +1,35 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: transport/internet/grpc/config.proto +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n$transport/internet/grpc/config.proto\x12%xray.transport.internet.grpc.encoding\"\xb1\x01\n\x06\x43onfig\x12\x0c\n\x04host\x18\x01 \x01(\t\x12\x14\n\x0cservice_name\x18\x02 \x01(\t\x12\x12\n\nmulti_mode\x18\x03 \x01(\x08\x12\x14\n\x0cidle_timeout\x18\x04 \x01(\x05\x12\x1c\n\x14health_check_timeout\x18\x05 \x01(\x05\x12\x1d\n\x15permit_without_stream\x18\x06 \x01(\x08\x12\x1c\n\x14initial_windows_size\x18\x07 \x01(\x05\x42\x33Z1github.com/xtls/xray-core/transport/internet/grpcb\x06proto3') + + + +_CONFIG = DESCRIPTOR.message_types_by_name['Config'] +Config = _reflection.GeneratedProtocolMessageType('Config', (_message.Message,), { + 'DESCRIPTOR' : _CONFIG, + '__module__' : 'transport.internet.grpc.config_pb2' + # @@protoc_insertion_point(class_scope:xray.transport.internet.grpc.encoding.Config) + }) +_sym_db.RegisterMessage(Config) + +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'Z1github.com/xtls/xray-core/transport/internet/grpc' + _CONFIG._serialized_start=80 + _CONFIG._serialized_end=257 +# @@protoc_insertion_point(module_scope) diff --git a/xray_api/proto/transport/internet/grpc/config_pb2_grpc.py b/xray_api/proto/transport/internet/grpc/config_pb2_grpc.py new file mode 100644 index 00000000..2daafffe --- /dev/null +++ b/xray_api/proto/transport/internet/grpc/config_pb2_grpc.py @@ -0,0 +1,4 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + diff --git a/xray_api/proto/transport/internet/grpc/encoding/stream_pb2.py b/xray_api/proto/transport/internet/grpc/encoding/stream_pb2.py new file mode 100644 index 00000000..f211045f --- /dev/null +++ b/xray_api/proto/transport/internet/grpc/encoding/stream_pb2.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: transport/internet/grpc/encoding/stream.proto +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n-transport/internet/grpc/encoding/stream.proto\x12%xray.transport.internet.grpc.encoding\"\x14\n\x04Hunk\x12\x0c\n\x04\x64\x61ta\x18\x01 \x01(\x0c\"\x19\n\tMultiHunk\x12\x0c\n\x04\x64\x61ta\x18\x01 \x03(\x0c\x32\xe6\x01\n\x0bGRPCService\x12\x63\n\x03Tun\x12+.xray.transport.internet.grpc.encoding.Hunk\x1a+.xray.transport.internet.grpc.encoding.Hunk(\x01\x30\x01\x12r\n\x08TunMulti\x12\x30.xray.transport.internet.grpc.encoding.MultiHunk\x1a\x30.xray.transport.internet.grpc.encoding.MultiHunk(\x01\x30\x01\x42\n\x07version\x18\x01 \x01(\x0b\x32-.xray.transport.internet.headers.http.Version\x12<\n\x06method\x18\x02 \x01(\x0b\x32,.xray.transport.internet.headers.http.Method\x12\x0b\n\x03uri\x18\x03 \x03(\t\x12<\n\x06header\x18\x04 \x03(\x0b\x32,.xray.transport.internet.headers.http.Header\"&\n\x06Status\x12\x0c\n\x04\x63ode\x18\x01 \x01(\t\x12\x0e\n\x06reason\x18\x02 \x01(\t\"\xcc\x01\n\x0eResponseConfig\x12>\n\x07version\x18\x01 \x01(\x0b\x32-.xray.transport.internet.headers.http.Version\x12<\n\x06status\x18\x02 \x01(\x0b\x32,.xray.transport.internet.headers.http.Status\x12<\n\x06header\x18\x03 \x03(\x0b\x32,.xray.transport.internet.headers.http.Header\"\x96\x01\n\x06\x43onfig\x12\x44\n\x07request\x18\x01 \x01(\x0b\x32\x33.xray.transport.internet.headers.http.RequestConfig\x12\x46\n\x08response\x18\x02 \x01(\x0b\x32\x34.xray.transport.internet.headers.http.ResponseConfigB\x8e\x01\n(com.xray.transport.internet.headers.httpP\x01Z9github.com/xtls/xray-core/transport/internet/headers/http\xaa\x02$Xray.Transport.Internet.Headers.Httpb\x06proto3') + + + +_HEADER = DESCRIPTOR.message_types_by_name['Header'] +_VERSION = DESCRIPTOR.message_types_by_name['Version'] +_METHOD = DESCRIPTOR.message_types_by_name['Method'] +_REQUESTCONFIG = DESCRIPTOR.message_types_by_name['RequestConfig'] +_STATUS = DESCRIPTOR.message_types_by_name['Status'] +_RESPONSECONFIG = DESCRIPTOR.message_types_by_name['ResponseConfig'] +_CONFIG = DESCRIPTOR.message_types_by_name['Config'] +Header = _reflection.GeneratedProtocolMessageType('Header', (_message.Message,), { + 'DESCRIPTOR' : _HEADER, + '__module__' : 'transport.internet.headers.http.config_pb2' + # @@protoc_insertion_point(class_scope:xray.transport.internet.headers.http.Header) + }) +_sym_db.RegisterMessage(Header) + +Version = _reflection.GeneratedProtocolMessageType('Version', (_message.Message,), { + 'DESCRIPTOR' : _VERSION, + '__module__' : 'transport.internet.headers.http.config_pb2' + # @@protoc_insertion_point(class_scope:xray.transport.internet.headers.http.Version) + }) +_sym_db.RegisterMessage(Version) + +Method = _reflection.GeneratedProtocolMessageType('Method', (_message.Message,), { + 'DESCRIPTOR' : _METHOD, + '__module__' : 'transport.internet.headers.http.config_pb2' + # @@protoc_insertion_point(class_scope:xray.transport.internet.headers.http.Method) + }) +_sym_db.RegisterMessage(Method) + +RequestConfig = _reflection.GeneratedProtocolMessageType('RequestConfig', (_message.Message,), { + 'DESCRIPTOR' : _REQUESTCONFIG, + '__module__' : 'transport.internet.headers.http.config_pb2' + # @@protoc_insertion_point(class_scope:xray.transport.internet.headers.http.RequestConfig) + }) +_sym_db.RegisterMessage(RequestConfig) + +Status = _reflection.GeneratedProtocolMessageType('Status', (_message.Message,), { + 'DESCRIPTOR' : _STATUS, + '__module__' : 'transport.internet.headers.http.config_pb2' + # @@protoc_insertion_point(class_scope:xray.transport.internet.headers.http.Status) + }) +_sym_db.RegisterMessage(Status) + +ResponseConfig = _reflection.GeneratedProtocolMessageType('ResponseConfig', (_message.Message,), { + 'DESCRIPTOR' : _RESPONSECONFIG, + '__module__' : 'transport.internet.headers.http.config_pb2' + # @@protoc_insertion_point(class_scope:xray.transport.internet.headers.http.ResponseConfig) + }) +_sym_db.RegisterMessage(ResponseConfig) + +Config = _reflection.GeneratedProtocolMessageType('Config', (_message.Message,), { + 'DESCRIPTOR' : _CONFIG, + '__module__' : 'transport.internet.headers.http.config_pb2' + # @@protoc_insertion_point(class_scope:xray.transport.internet.headers.http.Config) + }) +_sym_db.RegisterMessage(Config) + +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n(com.xray.transport.internet.headers.httpP\001Z9github.com/xtls/xray-core/transport/internet/headers/http\252\002$Xray.Transport.Internet.Headers.Http' + _HEADER._serialized_start=86 + _HEADER._serialized_end=123 + _VERSION._serialized_start=125 + _VERSION._serialized_end=149 + _METHOD._serialized_start=151 + _METHOD._serialized_end=174 + _REQUESTCONFIG._serialized_start=177 + _REQUESTCONFIG._serialized_end=393 + _STATUS._serialized_start=395 + _STATUS._serialized_end=433 + _RESPONSECONFIG._serialized_start=436 + _RESPONSECONFIG._serialized_end=640 + _CONFIG._serialized_start=643 + _CONFIG._serialized_end=793 +# @@protoc_insertion_point(module_scope) diff --git a/xray_api/proto/transport/internet/headers/http/config_pb2_grpc.py b/xray_api/proto/transport/internet/headers/http/config_pb2_grpc.py new file mode 100644 index 00000000..2daafffe --- /dev/null +++ b/xray_api/proto/transport/internet/headers/http/config_pb2_grpc.py @@ -0,0 +1,4 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + diff --git a/xray_api/proto/transport/internet/headers/noop/config_pb2.py b/xray_api/proto/transport/internet/headers/noop/config_pb2.py new file mode 100644 index 00000000..5f28f022 --- /dev/null +++ b/xray_api/proto/transport/internet/headers/noop/config_pb2.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: transport/internet/headers/noop/config.proto +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n,transport/internet/headers/noop/config.proto\x12$xray.transport.internet.headers.noop\"\x08\n\x06\x43onfig\"\x12\n\x10\x43onnectionConfigB\x8e\x01\n(com.xray.transport.internet.headers.noopP\x01Z9github.com/xtls/xray-core/transport/internet/headers/noop\xaa\x02$Xray.Transport.Internet.Headers.Noopb\x06proto3') + + + +_CONFIG = DESCRIPTOR.message_types_by_name['Config'] +_CONNECTIONCONFIG = DESCRIPTOR.message_types_by_name['ConnectionConfig'] +Config = _reflection.GeneratedProtocolMessageType('Config', (_message.Message,), { + 'DESCRIPTOR' : _CONFIG, + '__module__' : 'transport.internet.headers.noop.config_pb2' + # @@protoc_insertion_point(class_scope:xray.transport.internet.headers.noop.Config) + }) +_sym_db.RegisterMessage(Config) + +ConnectionConfig = _reflection.GeneratedProtocolMessageType('ConnectionConfig', (_message.Message,), { + 'DESCRIPTOR' : _CONNECTIONCONFIG, + '__module__' : 'transport.internet.headers.noop.config_pb2' + # @@protoc_insertion_point(class_scope:xray.transport.internet.headers.noop.ConnectionConfig) + }) +_sym_db.RegisterMessage(ConnectionConfig) + +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n(com.xray.transport.internet.headers.noopP\001Z9github.com/xtls/xray-core/transport/internet/headers/noop\252\002$Xray.Transport.Internet.Headers.Noop' + _CONFIG._serialized_start=86 + _CONFIG._serialized_end=94 + _CONNECTIONCONFIG._serialized_start=96 + _CONNECTIONCONFIG._serialized_end=114 +# @@protoc_insertion_point(module_scope) diff --git a/xray_api/proto/transport/internet/headers/noop/config_pb2_grpc.py b/xray_api/proto/transport/internet/headers/noop/config_pb2_grpc.py new file mode 100644 index 00000000..2daafffe --- /dev/null +++ b/xray_api/proto/transport/internet/headers/noop/config_pb2_grpc.py @@ -0,0 +1,4 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + diff --git a/xray_api/proto/transport/internet/headers/srtp/config_pb2.py b/xray_api/proto/transport/internet/headers/srtp/config_pb2.py new file mode 100644 index 00000000..3853b438 --- /dev/null +++ b/xray_api/proto/transport/internet/headers/srtp/config_pb2.py @@ -0,0 +1,35 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: transport/internet/headers/srtp/config.proto +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n,transport/internet/headers/srtp/config.proto\x12$xray.transport.internet.headers.srtp\"w\n\x06\x43onfig\x12\x0f\n\x07version\x18\x01 \x01(\r\x12\x0f\n\x07padding\x18\x02 \x01(\x08\x12\x11\n\textension\x18\x03 \x01(\x08\x12\x12\n\ncsrc_count\x18\x04 \x01(\r\x12\x0e\n\x06marker\x18\x05 \x01(\x08\x12\x14\n\x0cpayload_type\x18\x06 \x01(\rB\x8e\x01\n(com.xray.transport.internet.headers.srtpP\x01Z9github.com/xtls/xray-core/transport/internet/headers/srtp\xaa\x02$Xray.Transport.Internet.Headers.Srtpb\x06proto3') + + + +_CONFIG = DESCRIPTOR.message_types_by_name['Config'] +Config = _reflection.GeneratedProtocolMessageType('Config', (_message.Message,), { + 'DESCRIPTOR' : _CONFIG, + '__module__' : 'transport.internet.headers.srtp.config_pb2' + # @@protoc_insertion_point(class_scope:xray.transport.internet.headers.srtp.Config) + }) +_sym_db.RegisterMessage(Config) + +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n(com.xray.transport.internet.headers.srtpP\001Z9github.com/xtls/xray-core/transport/internet/headers/srtp\252\002$Xray.Transport.Internet.Headers.Srtp' + _CONFIG._serialized_start=86 + _CONFIG._serialized_end=205 +# @@protoc_insertion_point(module_scope) diff --git a/xray_api/proto/transport/internet/headers/srtp/config_pb2_grpc.py b/xray_api/proto/transport/internet/headers/srtp/config_pb2_grpc.py new file mode 100644 index 00000000..2daafffe --- /dev/null +++ b/xray_api/proto/transport/internet/headers/srtp/config_pb2_grpc.py @@ -0,0 +1,4 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + diff --git a/xray_api/proto/transport/internet/headers/tls/config_pb2.py b/xray_api/proto/transport/internet/headers/tls/config_pb2.py new file mode 100644 index 00000000..08a5e157 --- /dev/null +++ b/xray_api/proto/transport/internet/headers/tls/config_pb2.py @@ -0,0 +1,35 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: transport/internet/headers/tls/config.proto +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n+transport/internet/headers/tls/config.proto\x12#xray.transport.internet.headers.tls\"\x0e\n\x0cPacketConfigB\x8b\x01\n\'com.xray.transport.internet.headers.tlsP\x01Z8github.com/xtls/xray-core/transport/internet/headers/tls\xaa\x02#Xray.Transport.Internet.Headers.Tlsb\x06proto3') + + + +_PACKETCONFIG = DESCRIPTOR.message_types_by_name['PacketConfig'] +PacketConfig = _reflection.GeneratedProtocolMessageType('PacketConfig', (_message.Message,), { + 'DESCRIPTOR' : _PACKETCONFIG, + '__module__' : 'transport.internet.headers.tls.config_pb2' + # @@protoc_insertion_point(class_scope:xray.transport.internet.headers.tls.PacketConfig) + }) +_sym_db.RegisterMessage(PacketConfig) + +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n\'com.xray.transport.internet.headers.tlsP\001Z8github.com/xtls/xray-core/transport/internet/headers/tls\252\002#Xray.Transport.Internet.Headers.Tls' + _PACKETCONFIG._serialized_start=84 + _PACKETCONFIG._serialized_end=98 +# @@protoc_insertion_point(module_scope) diff --git a/xray_api/proto/transport/internet/headers/tls/config_pb2_grpc.py b/xray_api/proto/transport/internet/headers/tls/config_pb2_grpc.py new file mode 100644 index 00000000..2daafffe --- /dev/null +++ b/xray_api/proto/transport/internet/headers/tls/config_pb2_grpc.py @@ -0,0 +1,4 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + diff --git a/xray_api/proto/transport/internet/headers/utp/config_pb2.py b/xray_api/proto/transport/internet/headers/utp/config_pb2.py new file mode 100644 index 00000000..9682ae97 --- /dev/null +++ b/xray_api/proto/transport/internet/headers/utp/config_pb2.py @@ -0,0 +1,35 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: transport/internet/headers/utp/config.proto +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n+transport/internet/headers/utp/config.proto\x12#xray.transport.internet.headers.utp\"\x19\n\x06\x43onfig\x12\x0f\n\x07version\x18\x01 \x01(\rB\x8b\x01\n\'com.xray.transport.internet.headers.utpP\x01Z8github.com/xtls/xray-core/transport/internet/headers/utp\xaa\x02#Xray.Transport.Internet.Headers.Utpb\x06proto3') + + + +_CONFIG = DESCRIPTOR.message_types_by_name['Config'] +Config = _reflection.GeneratedProtocolMessageType('Config', (_message.Message,), { + 'DESCRIPTOR' : _CONFIG, + '__module__' : 'transport.internet.headers.utp.config_pb2' + # @@protoc_insertion_point(class_scope:xray.transport.internet.headers.utp.Config) + }) +_sym_db.RegisterMessage(Config) + +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n\'com.xray.transport.internet.headers.utpP\001Z8github.com/xtls/xray-core/transport/internet/headers/utp\252\002#Xray.Transport.Internet.Headers.Utp' + _CONFIG._serialized_start=84 + _CONFIG._serialized_end=109 +# @@protoc_insertion_point(module_scope) diff --git a/xray_api/proto/transport/internet/headers/utp/config_pb2_grpc.py b/xray_api/proto/transport/internet/headers/utp/config_pb2_grpc.py new file mode 100644 index 00000000..2daafffe --- /dev/null +++ b/xray_api/proto/transport/internet/headers/utp/config_pb2_grpc.py @@ -0,0 +1,4 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + diff --git a/xray_api/proto/transport/internet/headers/wechat/config_pb2.py b/xray_api/proto/transport/internet/headers/wechat/config_pb2.py new file mode 100644 index 00000000..96f37a84 --- /dev/null +++ b/xray_api/proto/transport/internet/headers/wechat/config_pb2.py @@ -0,0 +1,35 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: transport/internet/headers/wechat/config.proto +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n.transport/internet/headers/wechat/config.proto\x12&xray.transport.internet.headers.wechat\"\r\n\x0bVideoConfigB\x94\x01\n*com.xray.transport.internet.headers.wechatP\x01Z;github.com/xtls/xray-core/transport/internet/headers/wechat\xaa\x02&Xray.Transport.Internet.Headers.Wechatb\x06proto3') + + + +_VIDEOCONFIG = DESCRIPTOR.message_types_by_name['VideoConfig'] +VideoConfig = _reflection.GeneratedProtocolMessageType('VideoConfig', (_message.Message,), { + 'DESCRIPTOR' : _VIDEOCONFIG, + '__module__' : 'transport.internet.headers.wechat.config_pb2' + # @@protoc_insertion_point(class_scope:xray.transport.internet.headers.wechat.VideoConfig) + }) +_sym_db.RegisterMessage(VideoConfig) + +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n*com.xray.transport.internet.headers.wechatP\001Z;github.com/xtls/xray-core/transport/internet/headers/wechat\252\002&Xray.Transport.Internet.Headers.Wechat' + _VIDEOCONFIG._serialized_start=90 + _VIDEOCONFIG._serialized_end=103 +# @@protoc_insertion_point(module_scope) diff --git a/xray_api/proto/transport/internet/headers/wechat/config_pb2_grpc.py b/xray_api/proto/transport/internet/headers/wechat/config_pb2_grpc.py new file mode 100644 index 00000000..2daafffe --- /dev/null +++ b/xray_api/proto/transport/internet/headers/wechat/config_pb2_grpc.py @@ -0,0 +1,4 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + diff --git a/xray_api/proto/transport/internet/headers/wireguard/config_pb2.py b/xray_api/proto/transport/internet/headers/wireguard/config_pb2.py new file mode 100644 index 00000000..88637316 --- /dev/null +++ b/xray_api/proto/transport/internet/headers/wireguard/config_pb2.py @@ -0,0 +1,35 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: transport/internet/headers/wireguard/config.proto +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n1transport/internet/headers/wireguard/config.proto\x12)xray.transport.internet.headers.wireguard\"\x11\n\x0fWireguardConfigB\x9d\x01\n-com.xray.transport.internet.headers.wireguardP\x01Z>github.com/xtls/xray-core/transport/internet/headers/wireguard\xaa\x02)Xray.Transport.Internet.Headers.Wireguardb\x06proto3') + + + +_WIREGUARDCONFIG = DESCRIPTOR.message_types_by_name['WireguardConfig'] +WireguardConfig = _reflection.GeneratedProtocolMessageType('WireguardConfig', (_message.Message,), { + 'DESCRIPTOR' : _WIREGUARDCONFIG, + '__module__' : 'transport.internet.headers.wireguard.config_pb2' + # @@protoc_insertion_point(class_scope:xray.transport.internet.headers.wireguard.WireguardConfig) + }) +_sym_db.RegisterMessage(WireguardConfig) + +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n-com.xray.transport.internet.headers.wireguardP\001Z>github.com/xtls/xray-core/transport/internet/headers/wireguard\252\002)Xray.Transport.Internet.Headers.Wireguard' + _WIREGUARDCONFIG._serialized_start=96 + _WIREGUARDCONFIG._serialized_end=113 +# @@protoc_insertion_point(module_scope) diff --git a/xray_api/proto/transport/internet/headers/wireguard/config_pb2_grpc.py b/xray_api/proto/transport/internet/headers/wireguard/config_pb2_grpc.py new file mode 100644 index 00000000..2daafffe --- /dev/null +++ b/xray_api/proto/transport/internet/headers/wireguard/config_pb2_grpc.py @@ -0,0 +1,4 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + diff --git a/xray_api/proto/transport/internet/http/config_pb2.py b/xray_api/proto/transport/internet/http/config_pb2.py new file mode 100644 index 00000000..d2c985e9 --- /dev/null +++ b/xray_api/proto/transport/internet/http/config_pb2.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: transport/internet/http/config.proto +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from xray_api.proto.transport.internet.headers.http import config_pb2 as transport_dot_internet_dot_headers_dot_http_dot_config__pb2 + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n$transport/internet/http/config.proto\x12\x1cxray.transport.internet.http\x1a,transport/internet/headers/http/config.proto\"\xa6\x01\n\x06\x43onfig\x12\x0c\n\x04host\x18\x01 \x03(\t\x12\x0c\n\x04path\x18\x02 \x01(\t\x12\x14\n\x0cidle_timeout\x18\x03 \x01(\x05\x12\x1c\n\x14health_check_timeout\x18\x04 \x01(\x05\x12\x0e\n\x06method\x18\x05 \x01(\t\x12<\n\x06header\x18\x06 \x03(\x0b\x32,.xray.transport.internet.headers.http.HeaderBv\n com.xray.transport.internet.httpP\x01Z1github.com/xtls/xray-core/transport/internet/http\xaa\x02\x1cXray.Transport.Internet.Httpb\x06proto3') + + + +_CONFIG = DESCRIPTOR.message_types_by_name['Config'] +Config = _reflection.GeneratedProtocolMessageType('Config', (_message.Message,), { + 'DESCRIPTOR' : _CONFIG, + '__module__' : 'transport.internet.http.config_pb2' + # @@protoc_insertion_point(class_scope:xray.transport.internet.http.Config) + }) +_sym_db.RegisterMessage(Config) + +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n com.xray.transport.internet.httpP\001Z1github.com/xtls/xray-core/transport/internet/http\252\002\034Xray.Transport.Internet.Http' + _CONFIG._serialized_start=117 + _CONFIG._serialized_end=283 +# @@protoc_insertion_point(module_scope) diff --git a/xray_api/proto/transport/internet/http/config_pb2_grpc.py b/xray_api/proto/transport/internet/http/config_pb2_grpc.py new file mode 100644 index 00000000..2daafffe --- /dev/null +++ b/xray_api/proto/transport/internet/http/config_pb2_grpc.py @@ -0,0 +1,4 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + diff --git a/xray_api/proto/transport/internet/kcp/config_pb2.py b/xray_api/proto/transport/internet/kcp/config_pb2.py new file mode 100644 index 00000000..f7d8c266 --- /dev/null +++ b/xray_api/proto/transport/internet/kcp/config_pb2.py @@ -0,0 +1,116 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: transport/internet/kcp/config.proto +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from xray_api.proto.common.serial import typed_message_pb2 as common_dot_serial_dot_typed__message__pb2 + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n#transport/internet/kcp/config.proto\x12\x1bxray.transport.internet.kcp\x1a!common/serial/typed_message.proto\"\x14\n\x03MTU\x12\r\n\x05value\x18\x01 \x01(\r\"\x14\n\x03TTI\x12\r\n\x05value\x18\x01 \x01(\r\"\x1f\n\x0eUplinkCapacity\x12\r\n\x05value\x18\x01 \x01(\r\"!\n\x10\x44ownlinkCapacity\x12\r\n\x05value\x18\x01 \x01(\r\"\x1b\n\x0bWriteBuffer\x12\x0c\n\x04size\x18\x01 \x01(\r\"\x1a\n\nReadBuffer\x12\x0c\n\x04size\x18\x01 \x01(\r\"!\n\x0f\x43onnectionReuse\x12\x0e\n\x06\x65nable\x18\x01 \x01(\x08\"\x1e\n\x0e\x45ncryptionSeed\x12\x0c\n\x04seed\x18\x01 \x01(\t\"\x82\x04\n\x06\x43onfig\x12-\n\x03mtu\x18\x01 \x01(\x0b\x32 .xray.transport.internet.kcp.MTU\x12-\n\x03tti\x18\x02 \x01(\x0b\x32 .xray.transport.internet.kcp.TTI\x12\x44\n\x0fuplink_capacity\x18\x03 \x01(\x0b\x32+.xray.transport.internet.kcp.UplinkCapacity\x12H\n\x11\x64ownlink_capacity\x18\x04 \x01(\x0b\x32-.xray.transport.internet.kcp.DownlinkCapacity\x12\x12\n\ncongestion\x18\x05 \x01(\x08\x12>\n\x0cwrite_buffer\x18\x06 \x01(\x0b\x32(.xray.transport.internet.kcp.WriteBuffer\x12<\n\x0bread_buffer\x18\x07 \x01(\x0b\x32\'.xray.transport.internet.kcp.ReadBuffer\x12\x37\n\rheader_config\x18\x08 \x01(\x0b\x32 .xray.common.serial.TypedMessage\x12\x39\n\x04seed\x18\n \x01(\x0b\x32+.xray.transport.internet.kcp.EncryptionSeedJ\x04\x08\t\x10\nBs\n\x1f\x63om.xray.transport.internet.kcpP\x01Z0github.com/xtls/xray-core/transport/internet/kcp\xaa\x02\x1bXray.Transport.Internet.Kcpb\x06proto3') + + + +_MTU = DESCRIPTOR.message_types_by_name['MTU'] +_TTI = DESCRIPTOR.message_types_by_name['TTI'] +_UPLINKCAPACITY = DESCRIPTOR.message_types_by_name['UplinkCapacity'] +_DOWNLINKCAPACITY = DESCRIPTOR.message_types_by_name['DownlinkCapacity'] +_WRITEBUFFER = DESCRIPTOR.message_types_by_name['WriteBuffer'] +_READBUFFER = DESCRIPTOR.message_types_by_name['ReadBuffer'] +_CONNECTIONREUSE = DESCRIPTOR.message_types_by_name['ConnectionReuse'] +_ENCRYPTIONSEED = DESCRIPTOR.message_types_by_name['EncryptionSeed'] +_CONFIG = DESCRIPTOR.message_types_by_name['Config'] +MTU = _reflection.GeneratedProtocolMessageType('MTU', (_message.Message,), { + 'DESCRIPTOR' : _MTU, + '__module__' : 'transport.internet.kcp.config_pb2' + # @@protoc_insertion_point(class_scope:xray.transport.internet.kcp.MTU) + }) +_sym_db.RegisterMessage(MTU) + +TTI = _reflection.GeneratedProtocolMessageType('TTI', (_message.Message,), { + 'DESCRIPTOR' : _TTI, + '__module__' : 'transport.internet.kcp.config_pb2' + # @@protoc_insertion_point(class_scope:xray.transport.internet.kcp.TTI) + }) +_sym_db.RegisterMessage(TTI) + +UplinkCapacity = _reflection.GeneratedProtocolMessageType('UplinkCapacity', (_message.Message,), { + 'DESCRIPTOR' : _UPLINKCAPACITY, + '__module__' : 'transport.internet.kcp.config_pb2' + # @@protoc_insertion_point(class_scope:xray.transport.internet.kcp.UplinkCapacity) + }) +_sym_db.RegisterMessage(UplinkCapacity) + +DownlinkCapacity = _reflection.GeneratedProtocolMessageType('DownlinkCapacity', (_message.Message,), { + 'DESCRIPTOR' : _DOWNLINKCAPACITY, + '__module__' : 'transport.internet.kcp.config_pb2' + # @@protoc_insertion_point(class_scope:xray.transport.internet.kcp.DownlinkCapacity) + }) +_sym_db.RegisterMessage(DownlinkCapacity) + +WriteBuffer = _reflection.GeneratedProtocolMessageType('WriteBuffer', (_message.Message,), { + 'DESCRIPTOR' : _WRITEBUFFER, + '__module__' : 'transport.internet.kcp.config_pb2' + # @@protoc_insertion_point(class_scope:xray.transport.internet.kcp.WriteBuffer) + }) +_sym_db.RegisterMessage(WriteBuffer) + +ReadBuffer = _reflection.GeneratedProtocolMessageType('ReadBuffer', (_message.Message,), { + 'DESCRIPTOR' : _READBUFFER, + '__module__' : 'transport.internet.kcp.config_pb2' + # @@protoc_insertion_point(class_scope:xray.transport.internet.kcp.ReadBuffer) + }) +_sym_db.RegisterMessage(ReadBuffer) + +ConnectionReuse = _reflection.GeneratedProtocolMessageType('ConnectionReuse', (_message.Message,), { + 'DESCRIPTOR' : _CONNECTIONREUSE, + '__module__' : 'transport.internet.kcp.config_pb2' + # @@protoc_insertion_point(class_scope:xray.transport.internet.kcp.ConnectionReuse) + }) +_sym_db.RegisterMessage(ConnectionReuse) + +EncryptionSeed = _reflection.GeneratedProtocolMessageType('EncryptionSeed', (_message.Message,), { + 'DESCRIPTOR' : _ENCRYPTIONSEED, + '__module__' : 'transport.internet.kcp.config_pb2' + # @@protoc_insertion_point(class_scope:xray.transport.internet.kcp.EncryptionSeed) + }) +_sym_db.RegisterMessage(EncryptionSeed) + +Config = _reflection.GeneratedProtocolMessageType('Config', (_message.Message,), { + 'DESCRIPTOR' : _CONFIG, + '__module__' : 'transport.internet.kcp.config_pb2' + # @@protoc_insertion_point(class_scope:xray.transport.internet.kcp.Config) + }) +_sym_db.RegisterMessage(Config) + +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n\037com.xray.transport.internet.kcpP\001Z0github.com/xtls/xray-core/transport/internet/kcp\252\002\033Xray.Transport.Internet.Kcp' + _MTU._serialized_start=103 + _MTU._serialized_end=123 + _TTI._serialized_start=125 + _TTI._serialized_end=145 + _UPLINKCAPACITY._serialized_start=147 + _UPLINKCAPACITY._serialized_end=178 + _DOWNLINKCAPACITY._serialized_start=180 + _DOWNLINKCAPACITY._serialized_end=213 + _WRITEBUFFER._serialized_start=215 + _WRITEBUFFER._serialized_end=242 + _READBUFFER._serialized_start=244 + _READBUFFER._serialized_end=270 + _CONNECTIONREUSE._serialized_start=272 + _CONNECTIONREUSE._serialized_end=305 + _ENCRYPTIONSEED._serialized_start=307 + _ENCRYPTIONSEED._serialized_end=337 + _CONFIG._serialized_start=340 + _CONFIG._serialized_end=854 +# @@protoc_insertion_point(module_scope) diff --git a/xray_api/proto/transport/internet/kcp/config_pb2_grpc.py b/xray_api/proto/transport/internet/kcp/config_pb2_grpc.py new file mode 100644 index 00000000..2daafffe --- /dev/null +++ b/xray_api/proto/transport/internet/kcp/config_pb2_grpc.py @@ -0,0 +1,4 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + diff --git a/xray_api/proto/transport/internet/quic/config_pb2.py b/xray_api/proto/transport/internet/quic/config_pb2.py new file mode 100644 index 00000000..c9dc7212 --- /dev/null +++ b/xray_api/proto/transport/internet/quic/config_pb2.py @@ -0,0 +1,37 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: transport/internet/quic/config.proto +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from xray_api.proto.common.serial import typed_message_pb2 as common_dot_serial_dot_typed__message__pb2 +from xray_api.proto.common.protocol import headers_pb2 as common_dot_protocol_dot_headers__pb2 + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n$transport/internet/quic/config.proto\x12\x1cxray.transport.internet.quic\x1a!common/serial/typed_message.proto\x1a\x1d\x63ommon/protocol/headers.proto\"\x7f\n\x06\x43onfig\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x36\n\x08security\x18\x02 \x01(\x0b\x32$.xray.common.protocol.SecurityConfig\x12\x30\n\x06header\x18\x03 \x01(\x0b\x32 .xray.common.serial.TypedMessageBv\n com.xray.transport.internet.quicP\x01Z1github.com/xtls/xray-core/transport/internet/quic\xaa\x02\x1cXray.Transport.Internet.Quicb\x06proto3') + + + +_CONFIG = DESCRIPTOR.message_types_by_name['Config'] +Config = _reflection.GeneratedProtocolMessageType('Config', (_message.Message,), { + 'DESCRIPTOR' : _CONFIG, + '__module__' : 'transport.internet.quic.config_pb2' + # @@protoc_insertion_point(class_scope:xray.transport.internet.quic.Config) + }) +_sym_db.RegisterMessage(Config) + +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n com.xray.transport.internet.quicP\001Z1github.com/xtls/xray-core/transport/internet/quic\252\002\034Xray.Transport.Internet.Quic' + _CONFIG._serialized_start=136 + _CONFIG._serialized_end=263 +# @@protoc_insertion_point(module_scope) diff --git a/xray_api/proto/transport/internet/quic/config_pb2_grpc.py b/xray_api/proto/transport/internet/quic/config_pb2_grpc.py new file mode 100644 index 00000000..2daafffe --- /dev/null +++ b/xray_api/proto/transport/internet/quic/config_pb2_grpc.py @@ -0,0 +1,4 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + diff --git a/xray_api/proto/transport/internet/tcp/config_pb2.py b/xray_api/proto/transport/internet/tcp/config_pb2.py new file mode 100644 index 00000000..6d55457a --- /dev/null +++ b/xray_api/proto/transport/internet/tcp/config_pb2.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: transport/internet/tcp/config.proto +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from xray_api.proto.common.serial import typed_message_pb2 as common_dot_serial_dot_typed__message__pb2 + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n#transport/internet/tcp/config.proto\x12\x1bxray.transport.internet.tcp\x1a!common/serial/typed_message.proto\"h\n\x06\x43onfig\x12\x39\n\x0fheader_settings\x18\x02 \x01(\x0b\x32 .xray.common.serial.TypedMessage\x12\x1d\n\x15\x61\x63\x63\x65pt_proxy_protocol\x18\x03 \x01(\x08J\x04\x08\x01\x10\x02\x42s\n\x1f\x63om.xray.transport.internet.tcpP\x01Z0github.com/xtls/xray-core/transport/internet/tcp\xaa\x02\x1bXray.Transport.Internet.Tcpb\x06proto3') + + + +_CONFIG = DESCRIPTOR.message_types_by_name['Config'] +Config = _reflection.GeneratedProtocolMessageType('Config', (_message.Message,), { + 'DESCRIPTOR' : _CONFIG, + '__module__' : 'transport.internet.tcp.config_pb2' + # @@protoc_insertion_point(class_scope:xray.transport.internet.tcp.Config) + }) +_sym_db.RegisterMessage(Config) + +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n\037com.xray.transport.internet.tcpP\001Z0github.com/xtls/xray-core/transport/internet/tcp\252\002\033Xray.Transport.Internet.Tcp' + _CONFIG._serialized_start=103 + _CONFIG._serialized_end=207 +# @@protoc_insertion_point(module_scope) diff --git a/xray_api/proto/transport/internet/tcp/config_pb2_grpc.py b/xray_api/proto/transport/internet/tcp/config_pb2_grpc.py new file mode 100644 index 00000000..2daafffe --- /dev/null +++ b/xray_api/proto/transport/internet/tcp/config_pb2_grpc.py @@ -0,0 +1,4 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + diff --git a/xray_api/proto/transport/internet/tls/config_pb2.py b/xray_api/proto/transport/internet/tls/config_pb2.py new file mode 100644 index 00000000..559c0577 --- /dev/null +++ b/xray_api/proto/transport/internet/tls/config_pb2.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: transport/internet/tls/config.proto +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n#transport/internet/tls/config.proto\x12\x1bxray.transport.internet.tls\"\x91\x02\n\x0b\x43\x65rtificate\x12\x13\n\x0b\x63\x65rtificate\x18\x01 \x01(\x0c\x12\x0b\n\x03key\x18\x02 \x01(\x0c\x12=\n\x05usage\x18\x03 \x01(\x0e\x32..xray.transport.internet.tls.Certificate.Usage\x12\x15\n\rocsp_stapling\x18\x04 \x01(\x04\x12\x18\n\x10\x63\x65rtificate_path\x18\x05 \x01(\t\x12\x10\n\x08key_path\x18\x06 \x01(\t\x12\x18\n\x10One_time_loading\x18\x07 \x01(\x08\"D\n\x05Usage\x12\x10\n\x0c\x45NCIPHERMENT\x10\x00\x12\x14\n\x10\x41UTHORITY_VERIFY\x10\x01\x12\x13\n\x0f\x41UTHORITY_ISSUE\x10\x02\"\x90\x03\n\x06\x43onfig\x12\x16\n\x0e\x61llow_insecure\x18\x01 \x01(\x08\x12=\n\x0b\x63\x65rtificate\x18\x02 \x03(\x0b\x32(.xray.transport.internet.tls.Certificate\x12\x13\n\x0bserver_name\x18\x03 \x01(\t\x12\x15\n\rnext_protocol\x18\x04 \x03(\t\x12!\n\x19\x65nable_session_resumption\x18\x05 \x01(\x08\x12\x1b\n\x13\x64isable_system_root\x18\x06 \x01(\x08\x12\x13\n\x0bmin_version\x18\x07 \x01(\t\x12\x13\n\x0bmax_version\x18\x08 \x01(\t\x12\x15\n\rcipher_suites\x18\t \x01(\t\x12#\n\x1bprefer_server_cipher_suites\x18\n \x01(\x08\x12\x13\n\x0b\x66ingerprint\x18\x0b \x01(\t\x12\x1a\n\x12reject_unknown_sni\x18\x0c \x01(\x08\x12,\n$pinned_peer_certificate_chain_sha256\x18\r \x03(\x0c\x42s\n\x1f\x63om.xray.transport.internet.tlsP\x01Z0github.com/xtls/xray-core/transport/internet/tls\xaa\x02\x1bXray.Transport.Internet.Tlsb\x06proto3') + + + +_CERTIFICATE = DESCRIPTOR.message_types_by_name['Certificate'] +_CONFIG = DESCRIPTOR.message_types_by_name['Config'] +_CERTIFICATE_USAGE = _CERTIFICATE.enum_types_by_name['Usage'] +Certificate = _reflection.GeneratedProtocolMessageType('Certificate', (_message.Message,), { + 'DESCRIPTOR' : _CERTIFICATE, + '__module__' : 'transport.internet.tls.config_pb2' + # @@protoc_insertion_point(class_scope:xray.transport.internet.tls.Certificate) + }) +_sym_db.RegisterMessage(Certificate) + +Config = _reflection.GeneratedProtocolMessageType('Config', (_message.Message,), { + 'DESCRIPTOR' : _CONFIG, + '__module__' : 'transport.internet.tls.config_pb2' + # @@protoc_insertion_point(class_scope:xray.transport.internet.tls.Config) + }) +_sym_db.RegisterMessage(Config) + +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n\037com.xray.transport.internet.tlsP\001Z0github.com/xtls/xray-core/transport/internet/tls\252\002\033Xray.Transport.Internet.Tls' + _CERTIFICATE._serialized_start=69 + _CERTIFICATE._serialized_end=342 + _CERTIFICATE_USAGE._serialized_start=274 + _CERTIFICATE_USAGE._serialized_end=342 + _CONFIG._serialized_start=345 + _CONFIG._serialized_end=745 +# @@protoc_insertion_point(module_scope) diff --git a/xray_api/proto/transport/internet/tls/config_pb2_grpc.py b/xray_api/proto/transport/internet/tls/config_pb2_grpc.py new file mode 100644 index 00000000..2daafffe --- /dev/null +++ b/xray_api/proto/transport/internet/tls/config_pb2_grpc.py @@ -0,0 +1,4 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + diff --git a/xray_api/proto/transport/internet/udp/config_pb2.py b/xray_api/proto/transport/internet/udp/config_pb2.py new file mode 100644 index 00000000..8902ae90 --- /dev/null +++ b/xray_api/proto/transport/internet/udp/config_pb2.py @@ -0,0 +1,35 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: transport/internet/udp/config.proto +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n#transport/internet/udp/config.proto\x12\x1bxray.transport.internet.udp\"\x08\n\x06\x43onfigBs\n\x1f\x63om.xray.transport.internet.udpP\x01Z0github.com/xtls/xray-core/transport/internet/udp\xaa\x02\x1bXray.Transport.Internet.Udpb\x06proto3') + + + +_CONFIG = DESCRIPTOR.message_types_by_name['Config'] +Config = _reflection.GeneratedProtocolMessageType('Config', (_message.Message,), { + 'DESCRIPTOR' : _CONFIG, + '__module__' : 'transport.internet.udp.config_pb2' + # @@protoc_insertion_point(class_scope:xray.transport.internet.udp.Config) + }) +_sym_db.RegisterMessage(Config) + +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n\037com.xray.transport.internet.udpP\001Z0github.com/xtls/xray-core/transport/internet/udp\252\002\033Xray.Transport.Internet.Udp' + _CONFIG._serialized_start=68 + _CONFIG._serialized_end=76 +# @@protoc_insertion_point(module_scope) diff --git a/xray_api/proto/transport/internet/udp/config_pb2_grpc.py b/xray_api/proto/transport/internet/udp/config_pb2_grpc.py new file mode 100644 index 00000000..2daafffe --- /dev/null +++ b/xray_api/proto/transport/internet/udp/config_pb2_grpc.py @@ -0,0 +1,4 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + diff --git a/xray_api/proto/transport/internet/websocket/config_pb2.py b/xray_api/proto/transport/internet/websocket/config_pb2.py new file mode 100644 index 00000000..e0d04d93 --- /dev/null +++ b/xray_api/proto/transport/internet/websocket/config_pb2.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: transport/internet/websocket/config.proto +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n)transport/internet/websocket/config.proto\x12!xray.transport.internet.websocket\"$\n\x06Header\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t\"\x82\x01\n\x06\x43onfig\x12\x0c\n\x04path\x18\x02 \x01(\t\x12\x39\n\x06header\x18\x03 \x03(\x0b\x32).xray.transport.internet.websocket.Header\x12\x1d\n\x15\x61\x63\x63\x65pt_proxy_protocol\x18\x04 \x01(\x08\x12\n\n\x02\x65\x64\x18\x05 \x01(\rJ\x04\x08\x01\x10\x02\x42\x85\x01\n%com.xray.transport.internet.websocketP\x01Z6github.com/xtls/xray-core/transport/internet/websocket\xaa\x02!Xray.Transport.Internet.Websocketb\x06proto3') + + + +_HEADER = DESCRIPTOR.message_types_by_name['Header'] +_CONFIG = DESCRIPTOR.message_types_by_name['Config'] +Header = _reflection.GeneratedProtocolMessageType('Header', (_message.Message,), { + 'DESCRIPTOR' : _HEADER, + '__module__' : 'transport.internet.websocket.config_pb2' + # @@protoc_insertion_point(class_scope:xray.transport.internet.websocket.Header) + }) +_sym_db.RegisterMessage(Header) + +Config = _reflection.GeneratedProtocolMessageType('Config', (_message.Message,), { + 'DESCRIPTOR' : _CONFIG, + '__module__' : 'transport.internet.websocket.config_pb2' + # @@protoc_insertion_point(class_scope:xray.transport.internet.websocket.Config) + }) +_sym_db.RegisterMessage(Config) + +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n%com.xray.transport.internet.websocketP\001Z6github.com/xtls/xray-core/transport/internet/websocket\252\002!Xray.Transport.Internet.Websocket' + _HEADER._serialized_start=80 + _HEADER._serialized_end=116 + _CONFIG._serialized_start=119 + _CONFIG._serialized_end=249 +# @@protoc_insertion_point(module_scope) diff --git a/xray_api/proto/transport/internet/websocket/config_pb2_grpc.py b/xray_api/proto/transport/internet/websocket/config_pb2_grpc.py new file mode 100644 index 00000000..2daafffe --- /dev/null +++ b/xray_api/proto/transport/internet/websocket/config_pb2_grpc.py @@ -0,0 +1,4 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + diff --git a/xray_api/proto/transport/internet/xtls/config_pb2.py b/xray_api/proto/transport/internet/xtls/config_pb2.py new file mode 100644 index 00000000..7338eb4f --- /dev/null +++ b/xray_api/proto/transport/internet/xtls/config_pb2.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: transport/internet/xtls/config.proto +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n$transport/internet/xtls/config.proto\x12\x1cxray.transport.internet.xtls\"\x92\x02\n\x0b\x43\x65rtificate\x12\x13\n\x0b\x63\x65rtificate\x18\x01 \x01(\x0c\x12\x0b\n\x03key\x18\x02 \x01(\x0c\x12>\n\x05usage\x18\x03 \x01(\x0e\x32/.xray.transport.internet.xtls.Certificate.Usage\x12\x15\n\rocsp_stapling\x18\x04 \x01(\x04\x12\x18\n\x10\x63\x65rtificate_path\x18\x05 \x01(\t\x12\x10\n\x08key_path\x18\x06 \x01(\t\x12\x18\n\x10One_time_loading\x18\x07 \x01(\x08\"D\n\x05Usage\x12\x10\n\x0c\x45NCIPHERMENT\x10\x00\x12\x14\n\x10\x41UTHORITY_VERIFY\x10\x01\x12\x13\n\x0f\x41UTHORITY_ISSUE\x10\x02\"\xfc\x02\n\x06\x43onfig\x12\x16\n\x0e\x61llow_insecure\x18\x01 \x01(\x08\x12>\n\x0b\x63\x65rtificate\x18\x02 \x03(\x0b\x32).xray.transport.internet.xtls.Certificate\x12\x13\n\x0bserver_name\x18\x03 \x01(\t\x12\x15\n\rnext_protocol\x18\x04 \x03(\t\x12!\n\x19\x65nable_session_resumption\x18\x05 \x01(\x08\x12\x1b\n\x13\x64isable_system_root\x18\x06 \x01(\x08\x12\x13\n\x0bmin_version\x18\x07 \x01(\t\x12\x13\n\x0bmax_version\x18\x08 \x01(\t\x12\x15\n\rcipher_suites\x18\t \x01(\t\x12#\n\x1bprefer_server_cipher_suites\x18\n \x01(\x08\x12\x1a\n\x12reject_unknown_sni\x18\x0c \x01(\x08\x12,\n$pinned_peer_certificate_chain_sha256\x18\r \x03(\x0c\x42v\n com.xray.transport.internet.xtlsP\x01Z1github.com/xtls/xray-core/transport/internet/xtls\xaa\x02\x1cXray.Transport.Internet.Xtlsb\x06proto3') + + + +_CERTIFICATE = DESCRIPTOR.message_types_by_name['Certificate'] +_CONFIG = DESCRIPTOR.message_types_by_name['Config'] +_CERTIFICATE_USAGE = _CERTIFICATE.enum_types_by_name['Usage'] +Certificate = _reflection.GeneratedProtocolMessageType('Certificate', (_message.Message,), { + 'DESCRIPTOR' : _CERTIFICATE, + '__module__' : 'transport.internet.xtls.config_pb2' + # @@protoc_insertion_point(class_scope:xray.transport.internet.xtls.Certificate) + }) +_sym_db.RegisterMessage(Certificate) + +Config = _reflection.GeneratedProtocolMessageType('Config', (_message.Message,), { + 'DESCRIPTOR' : _CONFIG, + '__module__' : 'transport.internet.xtls.config_pb2' + # @@protoc_insertion_point(class_scope:xray.transport.internet.xtls.Config) + }) +_sym_db.RegisterMessage(Config) + +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n com.xray.transport.internet.xtlsP\001Z1github.com/xtls/xray-core/transport/internet/xtls\252\002\034Xray.Transport.Internet.Xtls' + _CERTIFICATE._serialized_start=71 + _CERTIFICATE._serialized_end=345 + _CERTIFICATE_USAGE._serialized_start=277 + _CERTIFICATE_USAGE._serialized_end=345 + _CONFIG._serialized_start=348 + _CONFIG._serialized_end=728 +# @@protoc_insertion_point(module_scope) diff --git a/xray_api/proto/transport/internet/xtls/config_pb2_grpc.py b/xray_api/proto/transport/internet/xtls/config_pb2_grpc.py new file mode 100644 index 00000000..2daafffe --- /dev/null +++ b/xray_api/proto/transport/internet/xtls/config_pb2_grpc.py @@ -0,0 +1,4 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + diff --git a/xray_api/proxyman.py b/xray_api/proxyman.py new file mode 100644 index 00000000..7c64a03a --- /dev/null +++ b/xray_api/proxyman.py @@ -0,0 +1,89 @@ +import grpc + +from .base import XRayBase +from .exceptions import RelatedError +from .proto.app.proxyman.command import command_pb2, command_pb2_grpc +from .proto.common.protocol import user_pb2 +from .types.account import Account +from .types.message import Message, TypedMessage + +try: + from .proto.core import config_pb2 as core_config_pb2 +except ModuleNotFoundError: + from .proto import config_pb2 as core_config_pb2 + + +class Proxyman(XRayBase): + def alter_inbound(self, tag: str, operation: TypedMessage) -> bool: + stub = command_pb2_grpc.HandlerServiceStub(self._channel) + try: + stub.AlterInbound(command_pb2.AlterInboundRequest(tag=tag, operation=operation)) + return True + + except grpc.RpcError as e: + raise RelatedError(e) + + def alter_outbound(self, tag: str, operation: TypedMessage) -> bool: + stub = command_pb2_grpc.HandlerServiceStub(self._channel) + try: + stub.AlterInbound(command_pb2.AlterOutboundRequest(tag=tag, operation=operation)) + return True + + except grpc.RpcError as e: + raise RelatedError(e) + + def add_inbound_user(self, tag: str, user: Account) -> bool: + return self.alter_inbound( + tag=tag, + operation=Message( + command_pb2.AddUserOperation( + user=user_pb2.User( + level=user.level, + email=user.email, + account=user.message + ) + ) + )) + + def remove_inbound_user(self, tag: str, email: str) -> bool: + return self.alter_inbound( + tag=tag, + operation=Message( + command_pb2.RemoveUserOperation( + email=email + ) + )) + + def add_outbound_user(self, tag: str, user: Account) -> bool: + return self.alter_outbound( + tag=tag, + operation=Message( + command_pb2.AddUserOperation( + user=user_pb2.User( + level=user.level, + email=user.email, + account=user.message + ) + ) + )) + + def remove_outbound_user(self, tag: str, email: str) -> bool: + return self.alter_outbound( + tag=tag, + operation=Message( + command_pb2.RemoveUserOperation( + email=email + ) + )) + + def add_inbound(self): + raise NotImplementedError + + def remove_inbound(self): + raise NotImplementedError + + def add_outbound(self): + raise NotImplementedError + + def remove_outbound(self): + raise NotImplementedError diff --git a/xray_api/stats.py b/xray_api/stats.py new file mode 100644 index 00000000..57b73aad --- /dev/null +++ b/xray_api/stats.py @@ -0,0 +1,110 @@ +import typing +from dataclasses import dataclass + +from .base import XRayBase +from .proto.app.stats.command import command_pb2, command_pb2_grpc + + +@dataclass +class SysStatsResponse: + num_goroutine: int + num_gc: int + alloc: int + total_alloc: int + sys: int + mallocs: int + frees: int + live_objects: int + pause_total_ns: int + uptime: int + + +@dataclass +class StatResponse: + name: str + type: str + link: str + value: int + + +@dataclass +class UserStatsResponse: + email: str + uplink: int + downlink: int + + +@dataclass +class InboundStatsResponse: + tag: str + uplink: int + downlink: int + + +@dataclass +class OutboundStatsResponse: + tag: str + uplink: int + downlink: int + + +class Stats(XRayBase): + def get_sys_stats(self) -> SysStatsResponse: + stub = command_pb2_grpc.StatsServiceStub(self._channel) + r = stub.GetSysStats(command_pb2.SysStatsRequest()) + return SysStatsResponse( + num_goroutine=r.NumGoroutine, + num_gc=r.NumGC, + alloc=r.Alloc, + total_alloc=r.TotalAlloc, + sys=r.Sys, + mallocs=r.Mallocs, + frees=r.Frees, + live_objects=r.LiveObjects, + pause_total_ns=r.PauseTotalNs, + uptime=r.Uptime + ) + + def query_stats(self, pattern: str, reset: bool = False) -> typing.Iterable[StatResponse]: + stub = command_pb2_grpc.StatsServiceStub(self._channel) + r = stub.QueryStats(command_pb2.QueryStatsRequest(pattern=pattern, reset=reset)) + for stat in r.stat: + type, name, _, link = stat.name.split('>>>') + yield StatResponse(name, type, link, stat.value) + + def get_users_stats(self, reset: bool = False) -> typing.Iterable[StatResponse]: + return self.query_stats("user>>>", reset=reset) + + def get_inbounds_stats(self, reset: bool = False) -> typing.Iterable[StatResponse]: + return self.query_stats("inbound>>>", reset=reset) + + def get_outbounds_stats(self, reset: bool = False) -> typing.Iterable[StatResponse]: + return self.query_stats("outbound>>>", reset=reset) + + def get_user_stats(self, email: str, reset: bool = False) -> typing.Iterable[StatResponse]: + uplink, downlink = 0, 0 + for stat in self.query_stats(f"user>>>{email}>>>", reset=reset): + if stat.link == 'uplink': + uplink = stat.value + if stat.link == 'downlink': + downlink = stat.value + + return UserStatsResponse(email=email, uplink=uplink, downlink=downlink) + + def get_inbound_stats(self, tag: str, reset: bool = False) -> typing.Iterable[StatResponse]: + uplink, downlink = 0, 0 + for stat in self.query_stats(f"inbound>>>{tag}>>>", reset=reset): + if stat.link == 'uplink': + uplink = stat.value + if stat.link == 'downlink': + downlink = stat.value + return InboundStatsResponse(tag=tag, uplink=uplink, downlink=downlink) + + def get_outbound_stats(self, tag: str, reset: bool = False) -> typing.Iterable[StatResponse]: + uplink, downlink = 0, 0 + for stat in self.query_stats(f"outbound>>>{tag}>>>", reset=reset): + if stat.link == 'uplink': + uplink = stat.value + if stat.link == 'downlink': + downlink = stat.value + return OutboundStatsResponse(tag=tag, uplink=uplink, downlink=downlink) diff --git a/xray_api/types/__init__.py b/xray_api/types/__init__.py new file mode 100644 index 00000000..50ca48b9 --- /dev/null +++ b/xray_api/types/__init__.py @@ -0,0 +1,3 @@ +from .account import (Account, ShadowsocksAccount, TrojanAccount, VLESSAccount, + VMessAccount) +from .message import Message, TypedMessage diff --git a/xray_api/types/account.py b/xray_api/types/account.py new file mode 100755 index 00000000..6fba082c --- /dev/null +++ b/xray_api/types/account.py @@ -0,0 +1,60 @@ +from abc import ABC, abstractproperty +from uuid import UUID + +from pydantic import BaseModel + +from ..proto.common.serial.typed_message_pb2 import TypedMessage +from ..proto.proxy.shadowsocks.config_pb2 import \ + Account as ShadowsocksAccountPb2 +from ..proto.proxy.shadowsocks.config_pb2 import \ + CipherType as ShadowsocksCipherType +from ..proto.proxy.trojan.config_pb2 import Account as TrojanAccountPb2 +from ..proto.proxy.vless.account_pb2 import Account as VLESSAccountPb2 +from ..proto.proxy.vmess.account_pb2 import Account as VMessAccountPb2 +from .message import Message + + +class Account(BaseModel, ABC): + email: str + level: int = 0 + + @abstractproperty + def message(self) -> TypedMessage: + pass + + def __repr__(self) -> str: + return f"<{self.__class__.__name__} {self.email}>" + + +class VMessAccount(Account): + id: UUID + + @property + def message(self): + return Message(VMessAccountPb2(id=str(self.id), alter_id=0)) + + +class VLESSAccount(Account): + id: UUID + flow: str = "" + + @property + def message(self): + return Message(VLESSAccountPb2(id=str(self.id), flow=self.flow)) + + +class TrojanAccount(Account): + password: str + + @property + def message(self): + return Message(TrojanAccountPb2(password=self.password)) + + +class ShadowsocksAccount(Account): + password: str + cipher_type: str = "CHACHA20_POLY1305" + + @property + def message(self): + return Message(ShadowsocksAccountPb2(password=self.password, cipher_type=self.cipher_type)) diff --git a/xray_api/types/message.py b/xray_api/types/message.py new file mode 100644 index 00000000..eef60c13 --- /dev/null +++ b/xray_api/types/message.py @@ -0,0 +1,9 @@ +from ..proto.common.serial.typed_message_pb2 import TypedMessage + + +class Message(): + def __new__(cls, message) -> TypedMessage: + return TypedMessage( + type=message.DESCRIPTOR.full_name, + value=message.SerializeToString() + )