mirror of
https://github.com/Gozargah/Marzban.git
synced 2026-05-17 00:25:53 +03:00
Initial commit
This commit is contained in:
14
.env.example
Normal file
14
.env.example
Normal file
@@ -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"
|
||||
153
.gitignore
vendored
Normal file
153
.gitignore
vendored
Normal file
@@ -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
|
||||
13
README.md
Executable file
13
README.md
Executable file
@@ -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`
|
||||
8
TODO.md
Normal file
8
TODO.md
Normal file
@@ -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
|
||||
99
alembic.ini
Normal file
99
alembic.ini
Normal file
@@ -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
|
||||
23
app/__init__.py
Executable file
23
app/__init__.py
Executable file
@@ -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()
|
||||
47
app/db/__init__.py
Normal file
47
app/db/__init__.py
Normal file
@@ -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",
|
||||
]
|
||||
8
app/db/base.py
Normal file
8
app/db/base.py
Normal file
@@ -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()
|
||||
82
app/db/crud.py
Normal file
82
app/db/crud.py
Normal file
@@ -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
|
||||
1
app/db/migrations/README
Normal file
1
app/db/migrations/README
Normal file
@@ -0,0 +1 @@
|
||||
Generic single-database configuration.
|
||||
82
app/db/migrations/env.py
Normal file
82
app/db/migrations/env.py
Normal file
@@ -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()
|
||||
24
app/db/migrations/script.py.mako
Normal file
24
app/db/migrations/script.py.mako
Normal file
@@ -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"}
|
||||
39
app/db/migrations/versions/3cf36a5fde73_init_system_table.py
Normal file
39
app/db/migrations/versions/3cf36a5fde73_init_system_table.py
Normal file
@@ -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 ###
|
||||
42
app/db/migrations/versions/94a5cc12c0d6_init_user_table.py
Normal file
42
app/db/migrations/versions/94a5cc12c0d6_init_user_table.py
Normal file
@@ -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 ###
|
||||
37
app/db/migrations/versions/9d5a518ae432_init_jwt_table.py
Normal file
37
app/db/migrations/versions/9d5a518ae432_init_jwt_table.py
Normal file
@@ -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 ###
|
||||
35
app/db/models.py
Normal file
35
app/db/models.py
Normal file
@@ -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())
|
||||
13
app/jobs/__init__.py
Normal file
13
app/jobs/__init__.py
Normal file
@@ -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))
|
||||
15
app/jobs/add_db_users.py
Normal file
15
app/jobs/add_db_users.py
Normal file
@@ -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
|
||||
36
app/jobs/record_usages.py
Normal file
36
app/jobs/record_usages.py
Normal file
@@ -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)
|
||||
31
app/jobs/review_users.py
Normal file
31
app/jobs/review_users.py
Normal file
@@ -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)
|
||||
38
app/jwt.py
Normal file
38
app/jwt.py
Normal file
@@ -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
|
||||
4
app/models/__init__.py
Normal file
4
app/models/__init__.py
Normal file
@@ -0,0 +1,4 @@
|
||||
from .admin import *
|
||||
from .proxy import *
|
||||
from .system import *
|
||||
from .user import *
|
||||
10
app/models/admin.py
Normal file
10
app/models/admin.py
Normal file
@@ -0,0 +1,10 @@
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
class Token(BaseModel):
|
||||
access_token: str
|
||||
token_type: str
|
||||
|
||||
|
||||
class Admin(BaseModel):
|
||||
username: str
|
||||
71
app/models/proxy.py
Normal file
71
app/models/proxy.py
Normal file
@@ -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)
|
||||
10
app/models/system.py
Normal file
10
app/models/system.py
Normal file
@@ -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
|
||||
72
app/models/user.py
Normal file
72
app/models/user.py
Normal file
@@ -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
|
||||
158
app/utils.py
Normal file
158
app/utils.py
Normal file
@@ -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
|
||||
3
app/views/__init__.py
Normal file
3
app/views/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from .admin import *
|
||||
from .system import *
|
||||
from .user import *
|
||||
34
app/views/admin.py
Normal file
34
app/views/admin.py
Normal file
@@ -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}
|
||||
24
app/views/system.py
Normal file
24
app/views/system.py
Normal file
@@ -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,
|
||||
)
|
||||
157
app/views/user.py
Normal file
157
app/views/user.py
Normal file
@@ -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)
|
||||
71
app/xray/__init__.py
Normal file
71
app/xray/__init__.py
Normal file
@@ -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"
|
||||
]
|
||||
95
app/xray/config.py
Normal file
95
app/xray/config.py
Normal file
@@ -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)
|
||||
66
app/xray/core.py
Normal file
66
app/xray/core.py
Normal file
@@ -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
|
||||
40
config.py
Executable file
40
config.py
Executable file
@@ -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")
|
||||
}
|
||||
9
main.py
Normal file
9
main.py
Normal file
@@ -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)
|
||||
52
requirements.txt
Normal file
52
requirements.txt
Normal file
@@ -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
|
||||
85
xray.json
Normal file
85
xray.json
Normal file
@@ -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"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
17
xray_api/__init__.py
Normal file
17
xray_api/__init__.py
Normal file
@@ -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"
|
||||
]
|
||||
8
xray_api/base.py
Normal file
8
xray_api/base.py
Normal file
@@ -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}")
|
||||
51
xray_api/exceptions.py
Executable file
51
xray_api/exceptions.py
Executable file
@@ -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)
|
||||
46
xray_api/proto/app/commander/config_pb2.py
Normal file
46
xray_api/proto/app/commander/config_pb2.py
Normal file
@@ -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)
|
||||
4
xray_api/proto/app/commander/config_pb2_grpc.py
Normal file
4
xray_api/proto/app/commander/config_pb2_grpc.py
Normal file
@@ -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
|
||||
|
||||
45
xray_api/proto/app/dispatcher/config_pb2.py
Normal file
45
xray_api/proto/app/dispatcher/config_pb2.py
Normal file
@@ -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)
|
||||
4
xray_api/proto/app/dispatcher/config_pb2_grpc.py
Normal file
4
xray_api/proto/app/dispatcher/config_pb2_grpc.py
Normal file
@@ -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
|
||||
|
||||
114
xray_api/proto/app/dns/config_pb2.py
Normal file
114
xray_api/proto/app/dns/config_pb2.py
Normal file
@@ -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)
|
||||
4
xray_api/proto/app/dns/config_pb2_grpc.py
Normal file
4
xray_api/proto/app/dns/config_pb2_grpc.py
Normal file
@@ -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
|
||||
|
||||
45
xray_api/proto/app/dns/fakedns/fakedns_pb2.py
Normal file
45
xray_api/proto/app/dns/fakedns/fakedns_pb2.py
Normal file
@@ -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)
|
||||
4
xray_api/proto/app/dns/fakedns/fakedns_pb2_grpc.py
Normal file
4
xray_api/proto/app/dns/fakedns/fakedns_pb2_grpc.py
Normal file
@@ -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
|
||||
|
||||
58
xray_api/proto/app/log/command/config_pb2.py
Normal file
58
xray_api/proto/app/log/command/config_pb2.py
Normal file
@@ -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)
|
||||
66
xray_api/proto/app/log/command/config_pb2_grpc.py
Normal file
66
xray_api/proto/app/log/command/config_pb2_grpc.py
Normal file
@@ -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)
|
||||
45
xray_api/proto/app/log/config_pb2.py
Normal file
45
xray_api/proto/app/log/config_pb2.py
Normal file
@@ -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)
|
||||
4
xray_api/proto/app/log/config_pb2_grpc.py
Normal file
4
xray_api/proto/app/log/config_pb2_grpc.py
Normal file
@@ -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
|
||||
|
||||
35
xray_api/proto/app/metrics/config_pb2.py
Normal file
35
xray_api/proto/app/metrics/config_pb2.py
Normal file
@@ -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)
|
||||
4
xray_api/proto/app/metrics/config_pb2_grpc.py
Normal file
4
xray_api/proto/app/metrics/config_pb2_grpc.py
Normal file
@@ -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
|
||||
|
||||
59
xray_api/proto/app/observatory/command/command_pb2.py
Normal file
59
xray_api/proto/app/observatory/command/command_pb2.py
Normal file
@@ -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)
|
||||
66
xray_api/proto/app/observatory/command/command_pb2_grpc.py
Normal file
66
xray_api/proto/app/observatory/command/command_pb2_grpc.py
Normal file
@@ -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)
|
||||
75
xray_api/proto/app/observatory/config_pb2.py
Normal file
75
xray_api/proto/app/observatory/config_pb2.py
Normal file
@@ -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)
|
||||
4
xray_api/proto/app/observatory/config_pb2_grpc.py
Normal file
4
xray_api/proto/app/observatory/config_pb2_grpc.py
Normal file
@@ -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
|
||||
|
||||
122
xray_api/proto/app/policy/config_pb2.py
Normal file
122
xray_api/proto/app/policy/config_pb2.py
Normal file
@@ -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)
|
||||
4
xray_api/proto/app/policy/config_pb2_grpc.py
Normal file
4
xray_api/proto/app/policy/config_pb2_grpc.py
Normal file
@@ -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
|
||||
|
||||
181
xray_api/proto/app/proxyman/command/command_pb2.py
Normal file
181
xray_api/proto/app/proxyman/command/command_pb2.py
Normal file
@@ -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)
|
||||
231
xray_api/proto/app/proxyman/command/command_pb2_grpc.py
Normal file
231
xray_api/proto/app/proxyman/command/command_pb2_grpc.py
Normal file
@@ -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)
|
||||
143
xray_api/proto/app/proxyman/config_pb2.py
Normal file
143
xray_api/proto/app/proxyman/config_pb2.py
Normal file
@@ -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)
|
||||
4
xray_api/proto/app/proxyman/config_pb2_grpc.py
Normal file
4
xray_api/proto/app/proxyman/config_pb2_grpc.py
Normal file
@@ -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
|
||||
|
||||
68
xray_api/proto/app/reverse/config_pb2.py
Normal file
68
xray_api/proto/app/reverse/config_pb2.py
Normal file
@@ -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)
|
||||
4
xray_api/proto/app/reverse/config_pb2_grpc.py
Normal file
4
xray_api/proto/app/reverse/config_pb2_grpc.py
Normal file
@@ -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
|
||||
|
||||
82
xray_api/proto/app/router/command/command_pb2.py
Normal file
82
xray_api/proto/app/router/command/command_pb2.py
Normal file
@@ -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)
|
||||
99
xray_api/proto/app/router/command/command_pb2_grpc.py
Normal file
99
xray_api/proto/app/router/command/command_pb2_grpc.py
Normal file
@@ -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)
|
||||
142
xray_api/proto/app/router/config_pb2.py
Normal file
142
xray_api/proto/app/router/config_pb2.py
Normal file
@@ -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)
|
||||
4
xray_api/proto/app/router/config_pb2_grpc.py
Normal file
4
xray_api/proto/app/router/config_pb2_grpc.py
Normal file
@@ -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
|
||||
|
||||
108
xray_api/proto/app/stats/command/command_pb2.py
Normal file
108
xray_api/proto/app/stats/command/command_pb2.py
Normal file
@@ -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)
|
||||
132
xray_api/proto/app/stats/command/command_pb2_grpc.py
Normal file
132
xray_api/proto/app/stats/command/command_pb2_grpc.py
Normal file
@@ -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)
|
||||
45
xray_api/proto/app/stats/config_pb2.py
Normal file
45
xray_api/proto/app/stats/config_pb2.py
Normal file
@@ -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)
|
||||
4
xray_api/proto/app/stats/config_pb2_grpc.py
Normal file
4
xray_api/proto/app/stats/config_pb2_grpc.py
Normal file
@@ -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
|
||||
|
||||
35
xray_api/proto/common/log/log_pb2.py
Normal file
35
xray_api/proto/common/log/log_pb2.py
Normal file
@@ -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)
|
||||
4
xray_api/proto/common/log/log_pb2_grpc.py
Normal file
4
xray_api/proto/common/log/log_pb2_grpc.py
Normal file
@@ -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
|
||||
|
||||
35
xray_api/proto/common/net/address_pb2.py
Normal file
35
xray_api/proto/common/net/address_pb2.py
Normal file
@@ -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)
|
||||
4
xray_api/proto/common/net/address_pb2_grpc.py
Normal file
4
xray_api/proto/common/net/address_pb2_grpc.py
Normal file
@@ -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
|
||||
|
||||
37
xray_api/proto/common/net/destination_pb2.py
Normal file
37
xray_api/proto/common/net/destination_pb2.py
Normal file
@@ -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)
|
||||
4
xray_api/proto/common/net/destination_pb2_grpc.py
Normal file
4
xray_api/proto/common/net/destination_pb2_grpc.py
Normal file
@@ -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
|
||||
|
||||
47
xray_api/proto/common/net/network_pb2.py
Normal file
47
xray_api/proto/common/net/network_pb2.py
Normal file
@@ -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)
|
||||
4
xray_api/proto/common/net/network_pb2_grpc.py
Normal file
4
xray_api/proto/common/net/network_pb2_grpc.py
Normal file
@@ -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
|
||||
|
||||
45
xray_api/proto/common/net/port_pb2.py
Normal file
45
xray_api/proto/common/net/port_pb2.py
Normal file
@@ -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)
|
||||
4
xray_api/proto/common/net/port_pb2_grpc.py
Normal file
4
xray_api/proto/common/net/port_pb2_grpc.py
Normal file
@@ -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
|
||||
|
||||
47
xray_api/proto/common/protocol/headers_pb2.py
Normal file
47
xray_api/proto/common/protocol/headers_pb2.py
Normal file
@@ -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)
|
||||
4
xray_api/proto/common/protocol/headers_pb2_grpc.py
Normal file
4
xray_api/proto/common/protocol/headers_pb2_grpc.py
Normal file
@@ -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
|
||||
|
||||
37
xray_api/proto/common/protocol/server_spec_pb2.py
Normal file
37
xray_api/proto/common/protocol/server_spec_pb2.py
Normal file
@@ -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)
|
||||
4
xray_api/proto/common/protocol/server_spec_pb2_grpc.py
Normal file
4
xray_api/proto/common/protocol/server_spec_pb2_grpc.py
Normal file
@@ -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
|
||||
|
||||
36
xray_api/proto/common/protocol/user_pb2.py
Normal file
36
xray_api/proto/common/protocol/user_pb2.py
Normal file
@@ -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)
|
||||
4
xray_api/proto/common/protocol/user_pb2_grpc.py
Normal file
4
xray_api/proto/common/protocol/user_pb2_grpc.py
Normal file
@@ -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
|
||||
|
||||
35
xray_api/proto/common/serial/typed_message_pb2.py
Normal file
35
xray_api/proto/common/serial/typed_message_pb2.py
Normal file
@@ -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)
|
||||
4
xray_api/proto/common/serial/typed_message_pb2_grpc.py
Normal file
4
xray_api/proto/common/serial/typed_message_pb2_grpc.py
Normal file
@@ -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
|
||||
|
||||
103
xray_api/proto/compile.py
Executable file
103
xray_api/proto/compile.py
Executable file
@@ -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.")
|
||||
60
xray_api/proto/core/config_pb2.py
Normal file
60
xray_api/proto/core/config_pb2.py
Normal file
@@ -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)
|
||||
4
xray_api/proto/core/config_pb2_grpc.py
Normal file
4
xray_api/proto/core/config_pb2_grpc.py
Normal file
@@ -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
|
||||
|
||||
56
xray_api/proto/proxy/blackhole/config_pb2.py
Normal file
56
xray_api/proto/proxy/blackhole/config_pb2.py
Normal file
@@ -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)
|
||||
4
xray_api/proto/proxy/blackhole/config_pb2_grpc.py
Normal file
4
xray_api/proto/proxy/blackhole/config_pb2_grpc.py
Normal file
@@ -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
|
||||
|
||||
36
xray_api/proto/proxy/dns/config_pb2.py
Normal file
36
xray_api/proto/proxy/dns/config_pb2.py
Normal file
@@ -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)
|
||||
4
xray_api/proto/proxy/dns/config_pb2_grpc.py
Normal file
4
xray_api/proto/proxy/dns/config_pb2_grpc.py
Normal file
@@ -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
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user