From c962d163d2ca5b5e7eab7f31f8a8cd986ea57b4b Mon Sep 17 00:00:00 2001 From: Dawsh Date: Sat, 18 May 2024 00:25:24 +0330 Subject: [PATCH] refactor: make backends extensible (#2) * refactor: add black for formatting and some half-way refactorings, not functional yet. * refactor: use hatch * fix: some fixes to get stuff working * fix: get some xray functionality working * fix: get user addition/removal/update working * fix: xray logs * fix: xray core restart * fix: user usages * feat: log user modifications --- .gitignore | 2 + marznode.py | 2 +- marznode/__init__.py | 1 + marznode/backends/__init__.py | 0 marznode/backends/base.py | 37 +++ marznode/{ => backends}/xray/__init__.py | 0 .../config.py => backends/xray/_config.py} | 216 ++++++++--------- .../base.py => backends/xray/_runner.py} | 31 +-- .../utils.py => backends/xray/_utils.py} | 16 +- .../xray/api}/__init__.py | 8 +- .../{xray_api => backends/xray/api}/base.py | 11 +- .../xray/api}/exceptions.py | 10 +- marznode/backends/xray/api/proto/__init__.py | 0 .../backends/xray/api/proto/app/__init__.py | 0 .../xray/api/proto/app/commander/__init__.py | 0 .../api}/proto/app/commander/config_grpc.py | 0 .../api}/proto/app/commander/config_pb2.py | 4 +- .../xray/api/proto/app/dispatcher/__init__.py | 0 .../api}/proto/app/dispatcher/config_grpc.py | 0 .../api}/proto/app/dispatcher/config_pb2.py | 2 +- .../xray/api/proto/app/dns/__init__.py | 0 .../xray/api}/proto/app/dns/config_grpc.py | 0 .../xray/api}/proto/app/dns/config_pb2.py | 8 +- .../api/proto/app/dns/fakedns/__init__.py | 0 .../proto/app/dns/fakedns/fakedns_grpc.py | 0 .../api}/proto/app/dns/fakedns/fakedns_pb2.py | 2 +- .../xray/api/proto/app/log/__init__.py | 0 .../api/proto/app/log/command/__init__.py | 0 .../api}/proto/app/log/command/config_grpc.py | 10 +- .../api}/proto/app/log/command/config_pb2.py | 2 +- .../xray/api}/proto/app/log/config_grpc.py | 0 .../xray/api}/proto/app/log/config_pb2.py | 4 +- .../xray/api/proto/app/metrics/__init__.py | 0 .../api}/proto/app/metrics/config_grpc.py | 0 .../xray/api}/proto/app/metrics/config_pb2.py | 2 +- .../api/proto/app/observatory/__init__.py | 0 .../app/observatory/burst/config_grpc.py | 3 + .../proto/app/observatory/burst/config_pb2.py | 29 +++ .../proto/app/observatory/command/__init__.py | 0 .../app/observatory/command/command_grpc.py | 12 +- .../app/observatory/command/command_pb2.py | 4 +- .../api}/proto/app/observatory/config_grpc.py | 0 .../api/proto/app/observatory/config_pb2.py | 37 +++ .../xray/api/proto/app/policy/__init__.py | 0 .../xray/api}/proto/app/policy/config_grpc.py | 0 .../xray/api}/proto/app/policy/config_pb2.py | 2 +- .../xray/api/proto/app/proxyman/__init__.py | 0 .../proto/app/proxyman/command/__init__.py | 0 .../app/proxyman/command/command_grpc.py | 56 ++--- .../proto/app/proxyman/command/command_pb2.py | 8 +- .../api}/proto/app/proxyman/config_grpc.py | 0 .../api}/proto/app/proxyman/config_pb2.py | 10 +- .../xray/api/proto/app/reverse/__init__.py | 0 .../api}/proto/app/reverse/config_grpc.py | 0 .../xray/api}/proto/app/reverse/config_pb2.py | 2 +- .../xray/api/proto/app/router/__init__.py | 0 .../api/proto/app/router/command/__init__.py | 0 .../proto/app/router/command/command_grpc.py | 89 +++++++ .../proto/app/router/command/command_pb2.py | 28 ++- .../xray/api}/proto/app/router/config_grpc.py | 0 .../xray/api/proto/app/router/config_pb2.py | 68 ++++++ .../xray/api/proto/app/stats/__init__.py | 0 .../api/proto/app/stats/command/__init__.py | 0 .../proto/app/stats/command/command_grpc.py | 26 +-- .../proto/app/stats/command/command_pb2.py | 2 +- .../xray/api}/proto/app/stats/config_grpc.py | 0 .../xray/api}/proto/app/stats/config_pb2.py | 2 +- .../xray/api/proto/common/__init__.py | 0 .../xray/api/proto/common/log/__init__.py | 0 .../xray/api}/proto/common/log/log_grpc.py | 0 .../xray/api}/proto/common/log/log_pb2.py | 2 +- .../xray/api/proto/common/net/__init__.py | 0 .../api}/proto/common/net/address_grpc.py | 0 .../xray/api}/proto/common/net/address_pb2.py | 2 +- .../api}/proto/common/net/destination_grpc.py | 0 .../api}/proto/common/net/destination_pb2.py | 6 +- .../api}/proto/common/net/network_grpc.py | 0 .../xray/api}/proto/common/net/network_pb2.py | 2 +- .../xray/api}/proto/common/net/port_grpc.py | 0 .../xray/api}/proto/common/net/port_pb2.py | 2 +- .../api/proto/common/protocol/__init__.py | 0 .../proto/common/protocol/headers_grpc.py | 0 .../api}/proto/common/protocol/headers_pb2.py | 2 +- .../proto/common/protocol/server_spec_grpc.py | 0 .../proto/common/protocol/server_spec_pb2.py | 6 +- .../api}/proto/common/protocol/user_grpc.py | 0 .../api}/proto/common/protocol/user_pb2.py | 4 +- .../xray/api/proto/common/serial/__init__.py | 0 .../proto/common/serial/typed_message_grpc.py | 0 .../proto/common/serial/typed_message_pb2.py | 2 +- .../xray/api}/proto/compile.py | 66 +++--- .../backends/xray/api/proto/core/__init__.py | 0 .../xray/api}/proto/core/config_grpc.py | 0 .../xray/api}/proto/core/config_pb2.py | 6 +- .../backends/xray/api/proto/proxy/__init__.py | 0 .../api/proto/proxy/blackhole/__init__.py | 0 .../api}/proto/proxy/blackhole/config_grpc.py | 0 .../api}/proto/proxy/blackhole/config_pb2.py | 4 +- .../xray/api/proto/proxy/dns/__init__.py | 0 .../xray/api}/proto/proxy/dns/config_grpc.py | 0 .../xray/api}/proto/proxy/dns/config_pb2.py | 4 +- .../xray/api/proto/proxy/dokodemo/__init__.py | 0 .../api}/proto/proxy/dokodemo/config_grpc.py | 0 .../api}/proto/proxy/dokodemo/config_pb2.py | 6 +- .../xray/api/proto/proxy/freedom/__init__.py | 0 .../api}/proto/proxy/freedom/config_grpc.py | 0 .../api}/proto/proxy/freedom/config_pb2.py | 12 +- .../xray/api/proto/proxy/http/__init__.py | 0 .../xray/api}/proto/proxy/http/config_grpc.py | 0 .../xray/api}/proto/proxy/http/config_pb2.py | 4 +- .../xray/api/proto/proxy/loopback/__init__.py | 0 .../api}/proto/proxy/loopback/config_grpc.py | 0 .../api}/proto/proxy/loopback/config_pb2.py | 2 +- .../api/proto/proxy/shadowsocks/__init__.py | 0 .../proto/proxy/shadowsocks/config_grpc.py | 0 .../proto/proxy/shadowsocks/config_pb2.py | 8 +- .../proto/proxy/shadowsocks_2022/__init__.py | 0 .../proxy/shadowsocks_2022/config_grpc.py | 0 .../proxy/shadowsocks_2022/config_pb2.py | 6 +- .../xray/api/proto/proxy/socks/__init__.py | 0 .../api}/proto/proxy/socks/config_grpc.py | 0 .../xray/api}/proto/proxy/socks/config_pb2.py | 6 +- .../xray/api/proto/proxy/trojan/__init__.py | 0 .../api}/proto/proxy/trojan/config_grpc.py | 0 .../api}/proto/proxy/trojan/config_pb2.py | 6 +- .../xray/api/proto/proxy/vless/__init__.py | 0 .../api}/proto/proxy/vless/account_grpc.py | 0 .../api}/proto/proxy/vless/account_pb2.py | 2 +- .../proto/proxy/vless/encoding/__init__.py | 0 .../proto/proxy/vless/encoding/addons_grpc.py | 0 .../proto/proxy/vless/encoding/addons_pb2.py | 2 +- .../api/proto/proxy/vless/inbound/__init__.py | 0 .../proto/proxy/vless/inbound/config_grpc.py | 0 .../proto/proxy/vless/inbound/config_pb2.py | 4 +- .../proto/proxy/vless/outbound/__init__.py | 0 .../proto/proxy/vless/outbound/config_grpc.py | 0 .../proto/proxy/vless/outbound/config_pb2.py | 4 +- .../xray/api/proto/proxy/vmess/__init__.py | 0 .../api}/proto/proxy/vmess/account_grpc.py | 0 .../api}/proto/proxy/vmess/account_pb2.py | 4 +- .../api/proto/proxy/vmess/inbound/__init__.py | 0 .../proto/proxy/vmess/inbound/config_grpc.py | 0 .../proto/proxy/vmess/inbound/config_pb2.py | 4 +- .../proto/proxy/vmess/outbound/__init__.py | 0 .../proto/proxy/vmess/outbound/config_grpc.py | 0 .../proto/proxy/vmess/outbound/config_pb2.py | 4 +- .../api/proto/proxy/wireguard/__init__.py | 0 .../api}/proto/proxy/wireguard/config_grpc.py | 0 .../api}/proto/proxy/wireguard/config_pb2.py | 2 +- .../xray/api/proto/transport/__init__.py | 0 .../api/proto/transport/global/__init__.py | 0 .../proto/transport/global/config_grpc.py | 0 .../api}/proto/transport/global/config_pb2.py | 4 +- .../api/proto/transport/internet/__init__.py | 0 .../proto/transport/internet/config_grpc.py | 0 .../proto/transport/internet/config_pb2.py | 4 +- .../internet/domainsocket/__init__.py | 0 .../internet/domainsocket/config_grpc.py | 0 .../internet/domainsocket/config_pb2.py | 2 +- .../proto/transport/internet/grpc/__init__.py | 0 .../transport/internet/grpc/config_grpc.py | 0 .../transport/internet/grpc/config_pb2.py | 6 +- .../internet/grpc/encoding/__init__.py | 0 .../internet/grpc/encoding/stream_grpc.py | 18 +- .../internet/grpc/encoding/stream_pb2.py | 2 +- .../transport/internet/headers/__init__.py | 0 .../internet/headers/dns/__init__.py | 0 .../internet/headers/dns/config_grpc.py | 0 .../internet/headers/dns/config_pb2.py | 2 +- .../internet/headers/http/__init__.py | 0 .../internet/headers/http/config_grpc.py | 0 .../internet/headers/http/config_pb2.py | 2 +- .../internet/headers/noop/__init__.py | 0 .../internet/headers/noop/config_grpc.py | 0 .../internet/headers/noop/config_pb2.py | 2 +- .../internet/headers/srtp/__init__.py | 0 .../internet/headers/srtp/config_grpc.py | 0 .../internet/headers/srtp/config_pb2.py | 2 +- .../internet/headers/tls/__init__.py | 0 .../internet/headers/tls/config_grpc.py | 0 .../internet/headers/tls/config_pb2.py | 2 +- .../internet/headers/utp/__init__.py | 0 .../internet/headers/utp/config_grpc.py | 0 .../internet/headers/utp/config_pb2.py | 2 +- .../internet/headers/wechat/__init__.py | 0 .../internet/headers/wechat/config_grpc.py | 0 .../internet/headers/wechat/config_pb2.py | 2 +- .../internet/headers/wireguard/__init__.py | 0 .../internet/headers/wireguard/config_grpc.py | 0 .../internet/headers/wireguard/config_pb2.py | 2 +- .../proto/transport/internet/http/__init__.py | 0 .../transport/internet/http/config_grpc.py | 0 .../transport/internet/http/config_pb2.py | 4 +- .../internet/httpupgrade/config_grpc.py | 3 + .../internet/httpupgrade/config_pb2.py | 27 +++ .../proto/transport/internet/kcp/__init__.py | 0 .../transport/internet/kcp/config_grpc.py | 0 .../transport/internet/kcp/config_pb2.py | 4 +- .../proto/transport/internet/quic/__init__.py | 0 .../transport/internet/quic/config_grpc.py | 0 .../transport/internet/quic/config_pb2.py | 6 +- .../transport/internet/reality/__init__.py | 0 .../transport/internet/reality/config_grpc.py | 0 .../transport/internet/reality/config_pb2.py | 6 +- .../proto/transport/internet/tcp/__init__.py | 0 .../transport/internet/tcp/config_grpc.py | 0 .../transport/internet/tcp/config_pb2.py | 4 +- .../proto/transport/internet/tls/__init__.py | 0 .../transport/internet/tls/config_grpc.py | 0 .../transport/internet/tls/config_pb2.py | 2 +- .../proto/transport/internet/udp/__init__.py | 0 .../transport/internet/udp/config_grpc.py | 0 .../transport/internet/udp/config_pb2.py | 2 +- .../transport/internet/websocket/__init__.py | 0 .../internet/websocket/config_grpc.py | 0 .../internet/websocket/config_pb2.py | 2 +- .../xray/api}/proxyman.py | 20 +- .../{xray_api => backends/xray/api}/stats.py | 44 ++-- marznode/backends/xray/api/types/__init__.py | 7 + .../xray/api}/types/account.py | 29 +-- .../xray/api}/types/message.py | 4 +- marznode/backends/xray/interface.py | 93 ++++++++ marznode/config.py | 1 + marznode/marznode.py | 37 +-- marznode/models/__init__.py | 4 + marznode/models/inbound.py | 7 + marznode/models/user.py | 13 ++ marznode/service/__init__.py | 5 +- marznode/service/service.py | 218 +++++++++--------- marznode/storage/__init__.py | 6 +- marznode/storage/base.py | 33 ++- marznode/storage/memory.py | 37 +-- marznode/utils/key_gen.py | 1 + marznode/utils/network.py | 1 - marznode/utils/ssl.py | 15 +- .../proto/app/observatory/config_pb2.py | 35 --- .../proto/app/router/command/command_grpc.py | 57 ----- .../xray_api/proto/app/router/config_pb2.py | 63 ----- marznode/xray_api/types/__init__.py | 2 - pyproject.toml | 43 ++++ 240 files changed, 1067 insertions(+), 750 deletions(-) create mode 100644 marznode/backends/__init__.py create mode 100644 marznode/backends/base.py rename marznode/{ => backends}/xray/__init__.py (100%) rename marznode/{xray/config.py => backends/xray/_config.py} (52%) rename marznode/{xray/base.py => backends/xray/_runner.py} (82%) rename marznode/{xray/utils.py => backends/xray/_utils.py} (73%) rename marznode/{xray_api => backends/xray/api}/__init__.py (81%) rename marznode/{xray_api => backends/xray/api}/base.py (62%) rename marznode/{xray_api => backends/xray/api}/exceptions.py (87%) create mode 100644 marznode/backends/xray/api/proto/__init__.py create mode 100644 marznode/backends/xray/api/proto/app/__init__.py create mode 100644 marznode/backends/xray/api/proto/app/commander/__init__.py rename marznode/{xray_api => backends/xray/api}/proto/app/commander/config_grpc.py (100%) rename marznode/{xray_api => backends/xray/api}/proto/app/commander/config_pb2.py (90%) create mode 100644 marznode/backends/xray/api/proto/app/dispatcher/__init__.py rename marznode/{xray_api => backends/xray/api}/proto/app/dispatcher/config_grpc.py (100%) rename marznode/{xray_api => backends/xray/api}/proto/app/dispatcher/config_pb2.py (97%) create mode 100644 marznode/backends/xray/api/proto/app/dns/__init__.py rename marznode/{xray_api => backends/xray/api}/proto/app/dns/config_grpc.py (100%) rename marznode/{xray_api => backends/xray/api}/proto/app/dns/config_pb2.py (92%) create mode 100644 marznode/backends/xray/api/proto/app/dns/fakedns/__init__.py rename marznode/{xray_api => backends/xray/api}/proto/app/dns/fakedns/fakedns_grpc.py (100%) rename marznode/{xray_api => backends/xray/api}/proto/app/dns/fakedns/fakedns_pb2.py (97%) create mode 100644 marznode/backends/xray/api/proto/app/log/__init__.py create mode 100644 marznode/backends/xray/api/proto/app/log/command/__init__.py rename marznode/{xray_api => backends/xray/api}/proto/app/log/command/config_grpc.py (69%) rename marznode/{xray_api => backends/xray/api}/proto/app/log/command/config_pb2.py (98%) rename marznode/{xray_api => backends/xray/api}/proto/app/log/config_grpc.py (100%) rename marznode/{xray_api => backends/xray/api}/proto/app/log/config_pb2.py (93%) create mode 100644 marznode/backends/xray/api/proto/app/metrics/__init__.py rename marznode/{xray_api => backends/xray/api}/proto/app/metrics/config_grpc.py (100%) rename marznode/{xray_api => backends/xray/api}/proto/app/metrics/config_pb2.py (97%) create mode 100644 marznode/backends/xray/api/proto/app/observatory/__init__.py create mode 100644 marznode/backends/xray/api/proto/app/observatory/burst/config_grpc.py create mode 100644 marznode/backends/xray/api/proto/app/observatory/burst/config_pb2.py create mode 100644 marznode/backends/xray/api/proto/app/observatory/command/__init__.py rename marznode/{xray_api => backends/xray/api}/proto/app/observatory/command/command_grpc.py (66%) rename marznode/{xray_api => backends/xray/api}/proto/app/observatory/command/command_pb2.py (93%) rename marznode/{xray_api => backends/xray/api}/proto/app/observatory/config_grpc.py (100%) create mode 100644 marznode/backends/xray/api/proto/app/observatory/config_pb2.py create mode 100644 marznode/backends/xray/api/proto/app/policy/__init__.py rename marznode/{xray_api => backends/xray/api}/proto/app/policy/config_grpc.py (100%) rename marznode/{xray_api => backends/xray/api}/proto/app/policy/config_pb2.py (99%) create mode 100644 marznode/backends/xray/api/proto/app/proxyman/__init__.py create mode 100644 marznode/backends/xray/api/proto/app/proxyman/command/__init__.py rename marznode/{xray_api => backends/xray/api}/proto/app/proxyman/command/command_grpc.py (59%) rename marznode/{xray_api => backends/xray/api}/proto/app/proxyman/command/command_pb2.py (93%) rename marznode/{xray_api => backends/xray/api}/proto/app/proxyman/config_grpc.py (100%) rename marznode/{xray_api => backends/xray/api}/proto/app/proxyman/config_pb2.py (91%) create mode 100644 marznode/backends/xray/api/proto/app/reverse/__init__.py rename marznode/{xray_api => backends/xray/api}/proto/app/reverse/config_grpc.py (100%) rename marznode/{xray_api => backends/xray/api}/proto/app/reverse/config_pb2.py (98%) create mode 100644 marznode/backends/xray/api/proto/app/router/__init__.py create mode 100644 marznode/backends/xray/api/proto/app/router/command/__init__.py create mode 100644 marznode/backends/xray/api/proto/app/router/command/command_grpc.py rename marznode/{xray_api => backends/xray/api}/proto/app/router/command/command_pb2.py (51%) rename marznode/{xray_api => backends/xray/api}/proto/app/router/config_grpc.py (100%) create mode 100644 marznode/backends/xray/api/proto/app/router/config_pb2.py create mode 100644 marznode/backends/xray/api/proto/app/stats/__init__.py create mode 100644 marznode/backends/xray/api/proto/app/stats/command/__init__.py rename marznode/{xray_api => backends/xray/api}/proto/app/stats/command/command_grpc.py (63%) rename marznode/{xray_api => backends/xray/api}/proto/app/stats/command/command_pb2.py (99%) rename marznode/{xray_api => backends/xray/api}/proto/app/stats/config_grpc.py (100%) rename marznode/{xray_api => backends/xray/api}/proto/app/stats/config_pb2.py (97%) create mode 100644 marznode/backends/xray/api/proto/common/__init__.py create mode 100644 marznode/backends/xray/api/proto/common/log/__init__.py rename marznode/{xray_api => backends/xray/api}/proto/common/log/log_grpc.py (100%) rename marznode/{xray_api => backends/xray/api}/proto/common/log/log_pb2.py (97%) create mode 100644 marznode/backends/xray/api/proto/common/net/__init__.py rename marznode/{xray_api => backends/xray/api}/proto/common/net/address_grpc.py (100%) rename marznode/{xray_api => backends/xray/api}/proto/common/net/address_pb2.py (97%) rename marznode/{xray_api => backends/xray/api}/proto/common/net/destination_grpc.py (100%) rename marznode/{xray_api => backends/xray/api}/proto/common/net/destination_pb2.py (86%) rename marznode/{xray_api => backends/xray/api}/proto/common/net/network_grpc.py (100%) rename marznode/{xray_api => backends/xray/api}/proto/common/net/network_pb2.py (98%) rename marznode/{xray_api => backends/xray/api}/proto/common/net/port_grpc.py (100%) rename marznode/{xray_api => backends/xray/api}/proto/common/net/port_pb2.py (97%) create mode 100644 marznode/backends/xray/api/proto/common/protocol/__init__.py rename marznode/{xray_api => backends/xray/api}/proto/common/protocol/headers_grpc.py (100%) rename marznode/{xray_api => backends/xray/api}/proto/common/protocol/headers_pb2.py (98%) rename marznode/{xray_api => backends/xray/api}/proto/common/protocol/server_spec_grpc.py (100%) rename marznode/{xray_api => backends/xray/api}/proto/common/protocol/server_spec_pb2.py (86%) rename marznode/{xray_api => backends/xray/api}/proto/common/protocol/user_grpc.py (100%) rename marznode/{xray_api => backends/xray/api}/proto/common/protocol/user_pb2.py (90%) create mode 100644 marznode/backends/xray/api/proto/common/serial/__init__.py rename marznode/{xray_api => backends/xray/api}/proto/common/serial/typed_message_grpc.py (100%) rename marznode/{xray_api => backends/xray/api}/proto/common/serial/typed_message_pb2.py (97%) rename marznode/{xray_api => backends/xray/api}/proto/compile.py (50%) create mode 100644 marznode/backends/xray/api/proto/core/__init__.py rename marznode/{xray_api => backends/xray/api}/proto/core/config_grpc.py (100%) rename marznode/{xray_api => backends/xray/api}/proto/core/config_pb2.py (92%) create mode 100644 marznode/backends/xray/api/proto/proxy/__init__.py create mode 100644 marznode/backends/xray/api/proto/proxy/blackhole/__init__.py rename marznode/{xray_api => backends/xray/api}/proto/proxy/blackhole/config_grpc.py (100%) rename marznode/{xray_api => backends/xray/api}/proto/proxy/blackhole/config_pb2.py (91%) create mode 100644 marznode/backends/xray/api/proto/proxy/dns/__init__.py rename marznode/{xray_api => backends/xray/api}/proto/proxy/dns/config_grpc.py (100%) rename marznode/{xray_api => backends/xray/api}/proto/proxy/dns/config_pb2.py (90%) create mode 100644 marznode/backends/xray/api/proto/proxy/dokodemo/__init__.py rename marznode/{xray_api => backends/xray/api}/proto/proxy/dokodemo/config_grpc.py (100%) rename marznode/{xray_api => backends/xray/api}/proto/proxy/dokodemo/config_pb2.py (89%) create mode 100644 marznode/backends/xray/api/proto/proxy/freedom/__init__.py rename marznode/{xray_api => backends/xray/api}/proto/proxy/freedom/config_grpc.py (100%) rename marznode/{xray_api => backends/xray/api}/proto/proxy/freedom/config_pb2.py (69%) create mode 100644 marznode/backends/xray/api/proto/proxy/http/__init__.py rename marznode/{xray_api => backends/xray/api}/proto/proxy/http/config_grpc.py (100%) rename marznode/{xray_api => backends/xray/api}/proto/proxy/http/config_pb2.py (94%) create mode 100644 marznode/backends/xray/api/proto/proxy/loopback/__init__.py rename marznode/{xray_api => backends/xray/api}/proto/proxy/loopback/config_grpc.py (100%) rename marznode/{xray_api => backends/xray/api}/proto/proxy/loopback/config_pb2.py (97%) create mode 100644 marznode/backends/xray/api/proto/proxy/shadowsocks/__init__.py rename marznode/{xray_api => backends/xray/api}/proto/proxy/shadowsocks/config_grpc.py (100%) rename marznode/{xray_api => backends/xray/api}/proto/proxy/shadowsocks/config_pb2.py (86%) create mode 100644 marznode/backends/xray/api/proto/proxy/shadowsocks_2022/__init__.py rename marznode/{xray_api => backends/xray/api}/proto/proxy/shadowsocks_2022/config_grpc.py (100%) rename marznode/{xray_api => backends/xray/api}/proto/proxy/shadowsocks_2022/config_pb2.py (93%) create mode 100644 marznode/backends/xray/api/proto/proxy/socks/__init__.py rename marznode/{xray_api => backends/xray/api}/proto/proxy/socks/config_grpc.py (100%) rename marznode/{xray_api => backends/xray/api}/proto/proxy/socks/config_pb2.py (92%) create mode 100644 marznode/backends/xray/api/proto/proxy/trojan/__init__.py rename marznode/{xray_api => backends/xray/api}/proto/proxy/trojan/config_grpc.py (100%) rename marznode/{xray_api => backends/xray/api}/proto/proxy/trojan/config_pb2.py (89%) create mode 100644 marznode/backends/xray/api/proto/proxy/vless/__init__.py rename marznode/{xray_api => backends/xray/api}/proto/proxy/vless/account_grpc.py (100%) rename marznode/{xray_api => backends/xray/api}/proto/proxy/vless/account_pb2.py (97%) create mode 100644 marznode/backends/xray/api/proto/proxy/vless/encoding/__init__.py rename marznode/{xray_api => backends/xray/api}/proto/proxy/vless/encoding/addons_grpc.py (100%) rename marznode/{xray_api => backends/xray/api}/proto/proxy/vless/encoding/addons_pb2.py (97%) create mode 100644 marznode/backends/xray/api/proto/proxy/vless/inbound/__init__.py rename marznode/{xray_api => backends/xray/api}/proto/proxy/vless/inbound/config_grpc.py (100%) rename marznode/{xray_api => backends/xray/api}/proto/proxy/vless/inbound/config_pb2.py (93%) create mode 100644 marznode/backends/xray/api/proto/proxy/vless/outbound/__init__.py rename marznode/{xray_api => backends/xray/api}/proto/proxy/vless/outbound/config_grpc.py (100%) rename marznode/{xray_api => backends/xray/api}/proto/proxy/vless/outbound/config_pb2.py (90%) create mode 100644 marznode/backends/xray/api/proto/proxy/vmess/__init__.py rename marznode/{xray_api => backends/xray/api}/proto/proxy/vmess/account_grpc.py (100%) rename marznode/{xray_api => backends/xray/api}/proto/proxy/vmess/account_pb2.py (90%) create mode 100644 marznode/backends/xray/api/proto/proxy/vmess/inbound/__init__.py rename marznode/{xray_api => backends/xray/api}/proto/proxy/vmess/inbound/config_grpc.py (100%) rename marznode/{xray_api => backends/xray/api}/proto/proxy/vmess/inbound/config_pb2.py (93%) create mode 100644 marznode/backends/xray/api/proto/proxy/vmess/outbound/__init__.py rename marznode/{xray_api => backends/xray/api}/proto/proxy/vmess/outbound/config_grpc.py (100%) rename marznode/{xray_api => backends/xray/api}/proto/proxy/vmess/outbound/config_pb2.py (90%) create mode 100644 marznode/backends/xray/api/proto/proxy/wireguard/__init__.py rename marznode/{xray_api => backends/xray/api}/proto/proxy/wireguard/config_grpc.py (100%) rename marznode/{xray_api => backends/xray/api}/proto/proxy/wireguard/config_pb2.py (98%) create mode 100644 marznode/backends/xray/api/proto/transport/__init__.py create mode 100644 marznode/backends/xray/api/proto/transport/global/__init__.py rename marznode/{xray_api => backends/xray/api}/proto/transport/global/config_grpc.py (100%) rename marznode/{xray_api => backends/xray/api}/proto/transport/global/config_pb2.py (91%) create mode 100644 marznode/backends/xray/api/proto/transport/internet/__init__.py rename marznode/{xray_api => backends/xray/api}/proto/transport/internet/config_grpc.py (100%) rename marznode/{xray_api => backends/xray/api}/proto/transport/internet/config_pb2.py (96%) create mode 100644 marznode/backends/xray/api/proto/transport/internet/domainsocket/__init__.py rename marznode/{xray_api => backends/xray/api}/proto/transport/internet/domainsocket/config_grpc.py (100%) rename marznode/{xray_api => backends/xray/api}/proto/transport/internet/domainsocket/config_pb2.py (97%) create mode 100644 marznode/backends/xray/api/proto/transport/internet/grpc/__init__.py rename marznode/{xray_api => backends/xray/api}/proto/transport/internet/grpc/config_grpc.py (100%) rename marznode/{xray_api => backends/xray/api}/proto/transport/internet/grpc/config_pb2.py (66%) create mode 100644 marznode/backends/xray/api/proto/transport/internet/grpc/encoding/__init__.py rename marznode/{xray_api => backends/xray/api}/proto/transport/internet/grpc/encoding/stream_grpc.py (64%) rename marznode/{xray_api => backends/xray/api}/proto/transport/internet/grpc/encoding/stream_pb2.py (98%) create mode 100644 marznode/backends/xray/api/proto/transport/internet/headers/__init__.py create mode 100644 marznode/backends/xray/api/proto/transport/internet/headers/dns/__init__.py rename marznode/{xray_api => backends/xray/api}/proto/transport/internet/headers/dns/config_grpc.py (100%) rename marznode/{xray_api => backends/xray/api}/proto/transport/internet/headers/dns/config_pb2.py (97%) create mode 100644 marznode/backends/xray/api/proto/transport/internet/headers/http/__init__.py rename marznode/{xray_api => backends/xray/api}/proto/transport/internet/headers/http/config_grpc.py (100%) rename marznode/{xray_api => backends/xray/api}/proto/transport/internet/headers/http/config_pb2.py (98%) create mode 100644 marznode/backends/xray/api/proto/transport/internet/headers/noop/__init__.py rename marznode/{xray_api => backends/xray/api}/proto/transport/internet/headers/noop/config_grpc.py (100%) rename marznode/{xray_api => backends/xray/api}/proto/transport/internet/headers/noop/config_pb2.py (97%) create mode 100644 marznode/backends/xray/api/proto/transport/internet/headers/srtp/__init__.py rename marznode/{xray_api => backends/xray/api}/proto/transport/internet/headers/srtp/config_grpc.py (100%) rename marznode/{xray_api => backends/xray/api}/proto/transport/internet/headers/srtp/config_pb2.py (98%) create mode 100644 marznode/backends/xray/api/proto/transport/internet/headers/tls/__init__.py rename marznode/{xray_api => backends/xray/api}/proto/transport/internet/headers/tls/config_grpc.py (100%) rename marznode/{xray_api => backends/xray/api}/proto/transport/internet/headers/tls/config_pb2.py (97%) create mode 100644 marznode/backends/xray/api/proto/transport/internet/headers/utp/__init__.py rename marznode/{xray_api => backends/xray/api}/proto/transport/internet/headers/utp/config_grpc.py (100%) rename marznode/{xray_api => backends/xray/api}/proto/transport/internet/headers/utp/config_pb2.py (97%) create mode 100644 marznode/backends/xray/api/proto/transport/internet/headers/wechat/__init__.py rename marznode/{xray_api => backends/xray/api}/proto/transport/internet/headers/wechat/config_grpc.py (100%) rename marznode/{xray_api => backends/xray/api}/proto/transport/internet/headers/wechat/config_pb2.py (97%) create mode 100644 marznode/backends/xray/api/proto/transport/internet/headers/wireguard/__init__.py rename marznode/{xray_api => backends/xray/api}/proto/transport/internet/headers/wireguard/config_grpc.py (100%) rename marznode/{xray_api => backends/xray/api}/proto/transport/internet/headers/wireguard/config_pb2.py (97%) create mode 100644 marznode/backends/xray/api/proto/transport/internet/http/__init__.py rename marznode/{xray_api => backends/xray/api}/proto/transport/internet/http/config_grpc.py (100%) rename marznode/{xray_api => backends/xray/api}/proto/transport/internet/http/config_pb2.py (90%) create mode 100644 marznode/backends/xray/api/proto/transport/internet/httpupgrade/config_grpc.py create mode 100644 marznode/backends/xray/api/proto/transport/internet/httpupgrade/config_pb2.py create mode 100644 marznode/backends/xray/api/proto/transport/internet/kcp/__init__.py rename marznode/{xray_api => backends/xray/api}/proto/transport/internet/kcp/config_grpc.py (100%) rename marznode/{xray_api => backends/xray/api}/proto/transport/internet/kcp/config_pb2.py (95%) create mode 100644 marznode/backends/xray/api/proto/transport/internet/quic/__init__.py rename marznode/{xray_api => backends/xray/api}/proto/transport/internet/quic/config_grpc.py (100%) rename marznode/{xray_api => backends/xray/api}/proto/transport/internet/quic/config_pb2.py (85%) create mode 100644 marznode/backends/xray/api/proto/transport/internet/reality/__init__.py rename marznode/{xray_api => backends/xray/api}/proto/transport/internet/reality/config_grpc.py (100%) rename marznode/{xray_api => backends/xray/api}/proto/transport/internet/reality/config_pb2.py (81%) create mode 100644 marznode/backends/xray/api/proto/transport/internet/tcp/__init__.py rename marznode/{xray_api => backends/xray/api}/proto/transport/internet/tcp/config_grpc.py (100%) rename marznode/{xray_api => backends/xray/api}/proto/transport/internet/tcp/config_pb2.py (90%) create mode 100644 marznode/backends/xray/api/proto/transport/internet/tls/__init__.py rename marznode/{xray_api => backends/xray/api}/proto/transport/internet/tls/config_grpc.py (100%) rename marznode/{xray_api => backends/xray/api}/proto/transport/internet/tls/config_pb2.py (98%) create mode 100644 marznode/backends/xray/api/proto/transport/internet/udp/__init__.py rename marznode/{xray_api => backends/xray/api}/proto/transport/internet/udp/config_grpc.py (100%) rename marznode/{xray_api => backends/xray/api}/proto/transport/internet/udp/config_pb2.py (97%) create mode 100644 marznode/backends/xray/api/proto/transport/internet/websocket/__init__.py rename marznode/{xray_api => backends/xray/api}/proto/transport/internet/websocket/config_grpc.py (100%) rename marznode/{xray_api => backends/xray/api}/proto/transport/internet/websocket/config_pb2.py (98%) rename marznode/{xray_api => backends/xray/api}/proxyman.py (77%) rename marznode/{xray_api => backends/xray/api}/stats.py (81%) create mode 100644 marznode/backends/xray/api/types/__init__.py rename marznode/{xray_api => backends/xray/api}/types/account.py (79%) rename marznode/{xray_api => backends/xray/api}/types/message.py (72%) create mode 100644 marznode/backends/xray/interface.py create mode 100644 marznode/models/__init__.py create mode 100644 marznode/models/inbound.py create mode 100644 marznode/models/user.py delete mode 100644 marznode/xray_api/proto/app/observatory/config_pb2.py delete mode 100644 marznode/xray_api/proto/app/router/command/command_grpc.py delete mode 100644 marznode/xray_api/proto/app/router/config_pb2.py delete mode 100644 marznode/xray_api/types/__init__.py create mode 100644 pyproject.toml diff --git a/.gitignore b/.gitignore index 5568647..e32c0b5 100644 --- a/.gitignore +++ b/.gitignore @@ -169,3 +169,5 @@ xray-core *config.json bin/ pyvenv.cfg +_version.py + diff --git a/marznode.py b/marznode.py index af63a2a..eddf47d 100644 --- a/marznode.py +++ b/marznode.py @@ -4,6 +4,6 @@ from marznode.marznode import main -if __name__ == '__main__': +if __name__ == "__main__": loop = asyncio.new_event_loop() loop.run_until_complete(main()) diff --git a/marznode/__init__.py b/marznode/__init__.py index 616be9c..16a4ef0 100644 --- a/marznode/__init__.py +++ b/marznode/__init__.py @@ -1,4 +1,5 @@ """Initiate logger for marznode""" + import logging from marznode import config diff --git a/marznode/backends/__init__.py b/marznode/backends/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/marznode/backends/base.py b/marznode/backends/base.py new file mode 100644 index 0000000..3d72e58 --- /dev/null +++ b/marznode/backends/base.py @@ -0,0 +1,37 @@ +"""What a vpn server should do""" + +from abc import ABC, abstractmethod +from collections.abc import AsyncIterator +from typing import Any + +from marznode.models import User, Inbound + + +class VPNBackend(ABC): + @abstractmethod + def contains_tag(self, tag: str) -> bool: + raise NotImplementedError + + @abstractmethod + async def start(self) -> None: + raise NotImplementedError + + @abstractmethod + async def restart(self, backend_config: Any) -> None: + raise NotImplementedError + + @abstractmethod + async def add_user(self, user: User, inbound: Inbound) -> None: + raise NotImplementedError + + @abstractmethod + async def remove_user(self, user: User, inbound: Inbound) -> None: + raise NotImplementedError + + @abstractmethod + def get_logs(self, include_buffer: bool) -> AsyncIterator: + raise NotImplementedError + + @abstractmethod + async def get_usages(self): + raise NotImplementedError diff --git a/marznode/xray/__init__.py b/marznode/backends/xray/__init__.py similarity index 100% rename from marznode/xray/__init__.py rename to marznode/backends/xray/__init__.py diff --git a/marznode/xray/config.py b/marznode/backends/xray/_config.py similarity index 52% rename from marznode/xray/config.py rename to marznode/backends/xray/_config.py index 225a96e..47015e7 100644 --- a/marznode/xray/config.py +++ b/marznode/backends/xray/_config.py @@ -1,34 +1,29 @@ import json -from copy import deepcopy -from pathlib import PosixPath -from typing import Union import commentjson from marznode.config import XRAY_EXECUTABLE_PATH -from marznode.storage.base import BaseStorage -from .utils import get_x25519 +from ._utils import get_x25519 class XrayConfig(dict): - def __init__(self, - config: str, - storage: BaseStorage, - api_host: str = "127.0.0.1", - api_port: int = 8080): + def __init__( + self, + config: str, + api_host: str = "127.0.0.1", + api_port: int = 8080, + ): try: # considering string as json config = commentjson.loads(config) except (json.JSONDecodeError, ValueError): # considering string as file path - with open(config, 'r') as file: + with open(config, "r") as file: config = commentjson.loads(file.read()) self.api_host = api_host self.api_port = api_port - self.storage = storage - super().__init__(config) self._validate() @@ -50,36 +45,25 @@ def _apply_api(self): return self["api"] = { - "services": [ - "HandlerService", - "StatsService", - "LoggerService" - ], - "tag": "API" + "services": ["HandlerService", "StatsService", "LoggerService"], + "tag": "API", } self["stats"] = {} self["policy"] = { - "levels": { - "0": { - "statsUserUplink": True, - "statsUserDownlink": True - } - }, + "levels": {"0": {"statsUserUplink": True, "statsUserDownlink": True}}, "system": { "statsInboundDownlink": False, "statsInboundUplink": False, "statsOutboundDownlink": True, - "statsOutboundUplink": True - } + "statsOutboundUplink": True, + }, } inbound = { "listen": self.api_host, "port": self.api_port, "protocol": "dokodemo-door", - "settings": { - "address": self.api_host - }, - "tag": "API_INBOUND" + "settings": {"address": self.api_host}, + "tag": "API_INBOUND", } try: self["inbounds"].insert(0, inbound) @@ -87,13 +71,7 @@ def _apply_api(self): self["inbounds"] = [] self["inbounds"].insert(0, inbound) - rule = { - "inboundTag": [ - "API_INBOUND" - ], - "outboundTag": "API", - "type": "field" - } + rule = {"inboundTag": ["API_INBOUND"], "outboundTag": "API", "type": "field"} try: self["routing"]["rules"].insert(0, rule) except KeyError: @@ -107,41 +85,45 @@ def _validate(self): if not self.get("outbounds"): raise ValueError("config doesn't have outbounds") - for inbound in self['inbounds']: + for inbound in self["inbounds"]: if not inbound.get("tag"): raise ValueError("all inbounds must have a unique tag") - for outbound in self['outbounds']: + for outbound in self["outbounds"]: if not outbound.get("tag"): raise ValueError("all outbounds must have a unique tag") def _resolve_inbounds(self): - for inbound in self['inbounds']: - if not inbound['protocol'].lower() in {"vmess", "trojan", "vless", "shadowsocks"}: + for inbound in self["inbounds"]: + if not inbound["protocol"].lower() in { + "vmess", + "trojan", + "vless", + "shadowsocks", + }: continue - if not inbound.get('settings'): - inbound['settings'] = {} - if not inbound['settings'].get('clients'): - inbound['settings']['clients'] = [] - self._addr_clients_by_tag[inbound['tag'] - ] = inbound['settings']['clients'] + if not inbound.get("settings"): + inbound["settings"] = {} + if not inbound["settings"].get("clients"): + inbound["settings"]["clients"] = [] + self._addr_clients_by_tag[inbound["tag"]] = inbound["settings"]["clients"] settings = { "tag": inbound["tag"], "protocol": inbound["protocol"], "port": None, "network": "tcp", - "tls": 'none', + "tls": "none", "sni": [], "host": [], "path": "", "header_type": "", - "is_fallback": False + "is_fallback": False, } # port settings try: - settings['port'] = inbound['port'] + settings["port"] = inbound["port"] except KeyError: if not self._fallbacks_inbound: raise ValueError( @@ -149,14 +131,14 @@ def _resolve_inbounds(self): "\nset XRAY_FALLBACKS_INBOUND_TAG if you're using an inbound containing fallbacks" ) try: - settings['port'] = self._fallbacks_inbound['port'] - settings['is_fallback'] = True + settings["port"] = self._fallbacks_inbound["port"] + settings["is_fallback"] = True except KeyError: raise ValueError("fallbacks inbound doesn't have port") # stream settings - if stream := inbound.get('streamSettings'): - net = stream.get('network', 'tcp') + if stream := inbound.get("streamSettings"): + net = stream.get("network", "tcp") net_settings = stream.get(f"{net}Settings", {}) security = stream.get("security") tls_settings = stream.get(f"{security}Settings") @@ -168,112 +150,113 @@ def _resolve_inbounds(self): tls_settings = self._fallbacks_inbound.get( 'streamSettings', {}).get(f"{security}Settings", {})""" - settings['network'] = net + settings["network"] = net - if security == 'tls': - settings['tls'] = 'tls' - elif security == 'reality': - settings['fp'] = 'chrome' - settings['tls'] = 'reality' - settings['sni'] = tls_settings.get('serverNames', []) + if security == "tls": + settings["tls"] = "tls" + elif security == "reality": + settings["fp"] = "chrome" + settings["tls"] = "reality" + settings["sni"] = tls_settings.get("serverNames", []) try: - settings['pbk'] = tls_settings['publicKey'] + settings["pbk"] = tls_settings["publicKey"] except KeyError: - pvk = tls_settings.get('privateKey') + pvk = tls_settings.get("privateKey") if not pvk: raise ValueError( - f"You need to provide privateKey in realitySettings of {inbound['tag']}") + f"You need to provide privateKey in realitySettings of {inbound['tag']}" + ) try: x25519 = get_x25519(XRAY_EXECUTABLE_PATH, pvk) - settings['pbk'] = x25519['public_key'] + settings["pbk"] = x25519["public_key"] except ImportError: pass - if not settings.get('pbk'): + if not settings.get("pbk"): raise ValueError( - f"You need to provide publicKey in realitySettings of {inbound['tag']}") + f"You need to provide publicKey in realitySettings of {inbound['tag']}" + ) try: - settings['sid'] = tls_settings.get('shortIds')[0] + settings["sid"] = tls_settings.get("shortIds")[0] except (IndexError, TypeError): raise ValueError( - f"You need to define at least one shortID in realitySettings of {inbound['tag']}") + f"You need to define at least one shortID in realitySettings of {inbound['tag']}" + ) - if net == 'tcp': - header = net_settings.get('header', {}) - request = header.get('request', {}) - path = request.get('path') - host = request.get('headers', {}).get('Host') + if net == "tcp": + header = net_settings.get("header", {}) + request = header.get("request", {}) + path = request.get("path") + host = request.get("headers", {}).get("Host") - settings['header_type'] = header.get('type', '') + settings["header_type"] = header.get("type", "") if isinstance(path, str) or isinstance(host, str): - raise ValueError(f"Settings of {inbound['tag']} for path and host must be list, not str\n" - "https://xtls.github.io/config/transports/tcp.html#httpheaderobject") + raise ValueError( + f"Settings of {inbound['tag']} for path and host must be list, not str\n" + "https://xtls.github.io/config/transports/tcp.html#httpheaderobject" + ) if path and isinstance(path, list): - settings['path'] = path[0] + settings["path"] = path[0] if host and isinstance(host, list): - settings['host'] = host + settings["host"] = host - elif net == 'ws': - path = net_settings.get('path', '') - host = net_settings.get('headers', {}).get('Host') + elif net == "ws": + path = net_settings.get("path", "") + host = net_settings.get("headers", {}).get("Host") - settings['header_type'] = '' + settings["header_type"] = "" if isinstance(path, list) or isinstance(host, list): - raise ValueError(f"Settings of {inbound['tag']} for path and host must be str, not list\n" - "https://xtls.github.io/config/transports/websocket.html#websocketobject") + raise ValueError( + f"Settings of {inbound['tag']} for path and host must be str, not list\n" + "https://xtls.github.io/config/transports/websocket.html#websocketobject" + ) if isinstance(path, str): - settings['path'] = path + settings["path"] = path if isinstance(host, str): - settings['host'] = [host] + settings["host"] = [host] - elif net == 'grpc': - settings['header_type'] = '' - settings['path'] = net_settings.get('serviceName', '') - settings['host'] = [] + elif net == "grpc": + settings["header_type"] = "" + settings["path"] = net_settings.get("serviceName", "") + settings["host"] = [] else: - settings['path'] = net_settings.get('path', '') - host = net_settings.get( - 'host', {}) or net_settings.get('Host', {}) + settings["path"] = net_settings.get("path", "") + host = net_settings.get("host", {}) or net_settings.get("Host", {}) if host and isinstance(host, list): - settings['host'] = host[0] + settings["host"] = host[0] elif host and isinstance(host, str): - settings['host'] = host + settings["host"] = host self.inbounds.append(settings) - self.inbounds_by_tag[inbound['tag']] = settings + self.inbounds_by_tag[inbound["tag"]] = settings try: - self.inbounds_by_protocol[inbound['protocol']].append(settings) + self.inbounds_by_protocol[inbound["protocol"]].append(settings) except KeyError: - self.inbounds_by_protocol[inbound['protocol']] = [settings] - - self.storage.set_inbounds(self.inbounds_by_tag) + self.inbounds_by_protocol[inbound["protocol"]] = [settings] def add_inbound_client(self, inbound_tag: str, email: str, settings: dict): inbound = self.inbounds_by_tag.get(inbound_tag, {}) client = {"email": email, **settings} # XTLS currently only supports transmission methods of TCP and mKCP - if client.get('flow') and ( - inbound.get('network', 'tcp') not in ('tcp', 'kcp') - or - ( - inbound.get('network', 'tcp') in ('tcp', 'kcp') - and - inbound.get('tls') not in ('tls', 'reality') + if client.get("flow") and ( + inbound.get("network", "tcp") not in ("tcp", "kcp") + or ( + inbound.get("network", "tcp") in ("tcp", "kcp") + and inbound.get("tls") not in ("tls", "reality") ) - or - inbound.get('header_type') == 'http' + or inbound.get("header_type") == "http" ): - del client['flow'] + del client["flow"] try: self._addr_clients_by_tag[inbound_tag].append(client) @@ -282,15 +265,14 @@ def add_inbound_client(self, inbound_tag: str, email: str, settings: dict): return client def get_inbound(self, tag) -> dict: - for inbound in self['inbounds']: - if inbound['tag'] == tag: + 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: + for outbound in self["outbounds"]: + if outbound["tag"] == tag: return outbound def to_json(self, **json_kwargs): return json.dumps(self, **json_kwargs) - diff --git a/marznode/xray/base.py b/marznode/backends/xray/_runner.py similarity index 82% rename from marznode/xray/base.py rename to marznode/backends/xray/_runner.py index 5019d89..990c578 100644 --- a/marznode/xray/base.py +++ b/marznode/backends/xray/_runner.py @@ -1,4 +1,5 @@ """run xray and capture the logs""" + import asyncio import atexit import logging @@ -6,17 +7,16 @@ from anyio import create_memory_object_stream, ClosedResourceError, BrokenResourceError -from .config import XrayConfig -from .utils import get_version +from ._config import XrayConfig +from ._utils import get_version logger = logging.getLogger(__name__) class XrayCore: """runs and captures xray logs""" - def __init__(self, - executable_path: str, - assets_path: str): + + def __init__(self, executable_path: str, assets_path: str): self.executable_path = executable_path self.assets_path = assets_path @@ -26,9 +26,7 @@ def __init__(self, self._snd_streams, self._rcv_streams = [], [] self._logs_buffer = deque(maxlen=100) - self._env = { - "XRAY_LOCATION_ASSET": assets_path - } + self._env = {"XRAY_LOCATION_ASSET": assets_path} atexit.register(lambda: self.stop() if self.started else None) @@ -36,27 +34,22 @@ async 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' + if config.get("log", {}).get("logLevel") in ("none", "error"): + config["log"]["logLevel"] = "warning" - cmd = [ - self.executable_path, - "run", - '-config', - 'stdin:' - ] + cmd = [self.executable_path, "run", "-config", "stdin:"] self.process = await asyncio.create_subprocess_shell( " ".join(cmd), env=self._env, stdin=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE, - stdout=asyncio.subprocess.PIPE + stdout=asyncio.subprocess.PIPE, ) self.process.stdin.write(str.encode(config.to_json())) await self.process.stdin.drain() self.process.stdin.close() await self.process.stdin.wait_closed() - logger.warning("Xray core %s started", self.version) + logger.info("Xray core %s started", self.version) asyncio.create_task(self.__capture_process_logs()) @@ -94,7 +87,7 @@ async def __capture_process_logs(self): continue self._logs_buffer.append(output) - async def get_logs_stm(self): + def get_logs_stm(self): new_snd_stm, new_rcv_stm = create_memory_object_stream() self._snd_streams.append(new_snd_stm) return new_rcv_stm diff --git a/marznode/xray/utils.py b/marznode/backends/xray/_utils.py similarity index 73% rename from marznode/xray/utils.py rename to marznode/backends/xray/_utils.py index 7bbabc7..5d11985 100644 --- a/marznode/xray/utils.py +++ b/marznode/backends/xray/_utils.py @@ -1,4 +1,5 @@ """xray utilities""" + import re import subprocess from typing import Dict @@ -11,8 +12,8 @@ def get_version(xray_path: str) -> str | None: :return: xray version """ cmd = [xray_path, "version"] - output = subprocess.check_output(cmd, stderr=subprocess.STDOUT).decode('utf-8') - match = re.match(r'^Xray (\d+\.\d+\.\d+)', output) + output = subprocess.check_output(cmd, stderr=subprocess.STDOUT).decode("utf-8") + match = re.match(r"^Xray (\d+\.\d+\.\d+)", output) if match: return match.groups()[0] return None @@ -27,13 +28,10 @@ def get_x25519(xray_path: str, private_key: str = None) -> Dict[str, str] | None """ cmd = [xray_path, "x25519"] if private_key: - cmd.extend(['-i', private_key]) - output = subprocess.check_output(cmd, stderr=subprocess.STDOUT).decode('utf-8') - match = re.match(r'Private key: (.+)\nPublic key: (.+)', output) + cmd.extend(["-i", private_key]) + output = subprocess.check_output(cmd, stderr=subprocess.STDOUT).decode("utf-8") + match = re.match(r"Private key: (.+)\nPublic key: (.+)", output) if match: private, public = match.groups() - return { - "private_key": private, - "public_key": public - } + return {"private_key": private, "public_key": public} return None diff --git a/marznode/xray_api/__init__.py b/marznode/backends/xray/api/__init__.py similarity index 81% rename from marznode/xray_api/__init__.py rename to marznode/backends/xray/api/__init__.py index 2d002f1..3b2bdcb 100644 --- a/marznode/xray_api/__init__.py +++ b/marznode/backends/xray/api/__init__.py @@ -1,4 +1,5 @@ """Implementation of xray's API to alter xray users/inbounds""" + from . import exceptions from . import exceptions as exc from . import types @@ -10,9 +11,4 @@ class XrayAPI(Proxyman, Stats): """XRay api methods, containing both stats and proxyman commands""" -__all__ = [ - "XrayAPI", - "exceptions", - "exc", - "types" -] +__all__ = ["XrayAPI", "exceptions", "exc", "types"] diff --git a/marznode/xray_api/base.py b/marznode/backends/xray/api/base.py similarity index 62% rename from marznode/xray_api/base.py rename to marznode/backends/xray/api/base.py index 07a923d..1228308 100644 --- a/marznode/xray_api/base.py +++ b/marznode/backends/xray/api/base.py @@ -1,14 +1,17 @@ """Implements initiation method to connect to xray api address""" + import atexit import ssl -import grpclib +from grpclib import client class XrayAPIBase: """Base for all Xray connections""" - def __init__(self, address: str, port: int, ssl_cert: str = None, ssl_target_name: str = None): + def __init__( + self, address: str, port: int, ssl_cert: str = None, ssl_target_name: str = None + ): """Initializes data for creating a grpc channel""" self.ssl_context = None if ssl_cert: @@ -16,5 +19,5 @@ def __init__(self, address: str, port: int, ssl_cert: str = None, ssl_target_nam self.ssl_context.check_hostname = False self.address = address self.port = port - self._channel = grpclib.client.Channel(self.address, self.port, ssl=self.ssl_context) - atexit.register(self._channel.close) \ No newline at end of file + self._channel = client.Channel(self.address, self.port, ssl=self.ssl_context) + atexit.register(self._channel.close) diff --git a/marznode/xray_api/exceptions.py b/marznode/backends/xray/api/exceptions.py similarity index 87% rename from marznode/xray_api/exceptions.py rename to marznode/backends/xray/api/exceptions.py index 1660266..543229a 100755 --- a/marznode/xray_api/exceptions.py +++ b/marznode/backends/xray/api/exceptions.py @@ -1,4 +1,5 @@ """defines errors to match against grpc errors. since all errors are returned as grpcerror""" + import re import grpclib @@ -44,14 +45,19 @@ def __init__(self, details, tag): class UnknownError(XrayError): - def __init__(self, details=''): + def __init__(self, details=""): super().__init__(details) class RelatedError(XrayError): def __new__(cls, error: grpclib.exceptions.GRPCError): details = error.message - for exc in (EmailExistsError, EmailNotFoundError, TagNotFoundError, XConnectionError): + for exc in ( + EmailExistsError, + EmailNotFoundError, + TagNotFoundError, + XConnectionError, + ): args = exc.REGEXP.findall(details) if not args: continue diff --git a/marznode/backends/xray/api/proto/__init__.py b/marznode/backends/xray/api/proto/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/marznode/backends/xray/api/proto/app/__init__.py b/marznode/backends/xray/api/proto/app/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/marznode/backends/xray/api/proto/app/commander/__init__.py b/marznode/backends/xray/api/proto/app/commander/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/marznode/xray_api/proto/app/commander/config_grpc.py b/marznode/backends/xray/api/proto/app/commander/config_grpc.py similarity index 100% rename from marznode/xray_api/proto/app/commander/config_grpc.py rename to marznode/backends/xray/api/proto/app/commander/config_grpc.py diff --git a/marznode/xray_api/proto/app/commander/config_pb2.py b/marznode/backends/xray/api/proto/app/commander/config_pb2.py similarity index 90% rename from marznode/xray_api/proto/app/commander/config_pb2.py rename to marznode/backends/xray/api/proto/app/commander/config_pb2.py index 7760f0f..245e9ef 100644 --- a/marznode/xray_api/proto/app/commander/config_pb2.py +++ b/marznode/backends/xray/api/proto/app/commander/config_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: app/commander/config.proto -# Protobuf Python Version: 4.25.0 +# Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool @@ -12,7 +12,7 @@ _sym_db = _symbol_database.Default() -from marznode.xray_api.proto.common.serial import typed_message_pb2 as common_dot_serial_dot_typed__message__pb2 +from marznode.backends.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') diff --git a/marznode/backends/xray/api/proto/app/dispatcher/__init__.py b/marznode/backends/xray/api/proto/app/dispatcher/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/marznode/xray_api/proto/app/dispatcher/config_grpc.py b/marznode/backends/xray/api/proto/app/dispatcher/config_grpc.py similarity index 100% rename from marznode/xray_api/proto/app/dispatcher/config_grpc.py rename to marznode/backends/xray/api/proto/app/dispatcher/config_grpc.py diff --git a/marznode/xray_api/proto/app/dispatcher/config_pb2.py b/marznode/backends/xray/api/proto/app/dispatcher/config_pb2.py similarity index 97% rename from marznode/xray_api/proto/app/dispatcher/config_pb2.py rename to marznode/backends/xray/api/proto/app/dispatcher/config_pb2.py index 968a58d..bb47550 100644 --- a/marznode/xray_api/proto/app/dispatcher/config_pb2.py +++ b/marznode/backends/xray/api/proto/app/dispatcher/config_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: app/dispatcher/config.proto -# Protobuf Python Version: 4.25.0 +# Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool diff --git a/marznode/backends/xray/api/proto/app/dns/__init__.py b/marznode/backends/xray/api/proto/app/dns/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/marznode/xray_api/proto/app/dns/config_grpc.py b/marznode/backends/xray/api/proto/app/dns/config_grpc.py similarity index 100% rename from marznode/xray_api/proto/app/dns/config_grpc.py rename to marznode/backends/xray/api/proto/app/dns/config_grpc.py diff --git a/marznode/xray_api/proto/app/dns/config_pb2.py b/marznode/backends/xray/api/proto/app/dns/config_pb2.py similarity index 92% rename from marznode/xray_api/proto/app/dns/config_pb2.py rename to marznode/backends/xray/api/proto/app/dns/config_pb2.py index 945a292..73f35ab 100644 --- a/marznode/xray_api/proto/app/dns/config_pb2.py +++ b/marznode/backends/xray/api/proto/app/dns/config_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: app/dns/config.proto -# Protobuf Python Version: 4.25.0 +# Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool @@ -12,9 +12,9 @@ _sym_db = _symbol_database.Default() -from marznode.xray_api.proto.common.net import address_pb2 as common_dot_net_dot_address__pb2 -from marznode.xray_api.proto.common.net import destination_pb2 as common_dot_net_dot_destination__pb2 -from marznode.xray_api.proto.app.router import config_pb2 as app_dot_router_dot_config__pb2 +from marznode.backends.xray.api.proto.common.net import address_pb2 as common_dot_net_dot_address__pb2 +from marznode.backends.xray.api.proto.common.net import destination_pb2 as common_dot_net_dot_destination__pb2 +from marznode.backends.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\"\xbf\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\x12\x33\n\x0equery_strategy\x18\x07 \x01(\x0e\x32\x1b.xray.app.dns.QueryStrategy\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') diff --git a/marznode/backends/xray/api/proto/app/dns/fakedns/__init__.py b/marznode/backends/xray/api/proto/app/dns/fakedns/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/marznode/xray_api/proto/app/dns/fakedns/fakedns_grpc.py b/marznode/backends/xray/api/proto/app/dns/fakedns/fakedns_grpc.py similarity index 100% rename from marznode/xray_api/proto/app/dns/fakedns/fakedns_grpc.py rename to marznode/backends/xray/api/proto/app/dns/fakedns/fakedns_grpc.py diff --git a/marznode/xray_api/proto/app/dns/fakedns/fakedns_pb2.py b/marznode/backends/xray/api/proto/app/dns/fakedns/fakedns_pb2.py similarity index 97% rename from marznode/xray_api/proto/app/dns/fakedns/fakedns_pb2.py rename to marznode/backends/xray/api/proto/app/dns/fakedns/fakedns_pb2.py index 4b9bb98..d99387b 100644 --- a/marznode/xray_api/proto/app/dns/fakedns/fakedns_pb2.py +++ b/marznode/backends/xray/api/proto/app/dns/fakedns/fakedns_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: app/dns/fakedns/fakedns.proto -# Protobuf Python Version: 4.25.0 +# Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool diff --git a/marznode/backends/xray/api/proto/app/log/__init__.py b/marznode/backends/xray/api/proto/app/log/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/marznode/backends/xray/api/proto/app/log/command/__init__.py b/marznode/backends/xray/api/proto/app/log/command/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/marznode/xray_api/proto/app/log/command/config_grpc.py b/marznode/backends/xray/api/proto/app/log/command/config_grpc.py similarity index 69% rename from marznode/xray_api/proto/app/log/command/config_grpc.py rename to marznode/backends/xray/api/proto/app/log/command/config_grpc.py index f080815..91ca8de 100644 --- a/marznode/xray_api/proto/app/log/command/config_grpc.py +++ b/marznode/backends/xray/api/proto/app/log/command/config_grpc.py @@ -9,7 +9,7 @@ if typing.TYPE_CHECKING: import grpclib.server -import marznode.xray_api.proto.app.log.command.config_pb2 +import marznode.backends.xray.api.proto.app.log.command.config_pb2 class LoggerServiceBase(abc.ABC): @@ -23,8 +23,8 @@ def __mapping__(self) -> typing.Dict[str, grpclib.const.Handler]: '/xray.app.log.command.LoggerService/RestartLogger': grpclib.const.Handler( self.RestartLogger, grpclib.const.Cardinality.UNARY_UNARY, - marznode.xray_api.proto.app.log.command.config_pb2.RestartLoggerRequest, - marznode.xray_api.proto.app.log.command.config_pb2.RestartLoggerResponse, + marznode.backends.xray.api.proto.app.log.command.config_pb2.RestartLoggerRequest, + marznode.backends.xray.api.proto.app.log.command.config_pb2.RestartLoggerResponse, ), } @@ -35,6 +35,6 @@ def __init__(self, channel: grpclib.client.Channel) -> None: self.RestartLogger = grpclib.client.UnaryUnaryMethod( channel, '/xray.app.log.command.LoggerService/RestartLogger', - marznode.xray_api.proto.app.log.command.config_pb2.RestartLoggerRequest, - marznode.xray_api.proto.app.log.command.config_pb2.RestartLoggerResponse, + marznode.backends.xray.api.proto.app.log.command.config_pb2.RestartLoggerRequest, + marznode.backends.xray.api.proto.app.log.command.config_pb2.RestartLoggerResponse, ) diff --git a/marznode/xray_api/proto/app/log/command/config_pb2.py b/marznode/backends/xray/api/proto/app/log/command/config_pb2.py similarity index 98% rename from marznode/xray_api/proto/app/log/command/config_pb2.py rename to marznode/backends/xray/api/proto/app/log/command/config_pb2.py index e993d34..7ecaf9f 100644 --- a/marznode/xray_api/proto/app/log/command/config_pb2.py +++ b/marznode/backends/xray/api/proto/app/log/command/config_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: app/log/command/config.proto -# Protobuf Python Version: 4.25.0 +# Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool diff --git a/marznode/xray_api/proto/app/log/config_grpc.py b/marznode/backends/xray/api/proto/app/log/config_grpc.py similarity index 100% rename from marznode/xray_api/proto/app/log/config_grpc.py rename to marznode/backends/xray/api/proto/app/log/config_grpc.py diff --git a/marznode/xray_api/proto/app/log/config_pb2.py b/marznode/backends/xray/api/proto/app/log/config_pb2.py similarity index 93% rename from marznode/xray_api/proto/app/log/config_pb2.py rename to marznode/backends/xray/api/proto/app/log/config_pb2.py index 531456a..c76fd98 100644 --- a/marznode/xray_api/proto/app/log/config_pb2.py +++ b/marznode/backends/xray/api/proto/app/log/config_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: app/log/config.proto -# Protobuf Python Version: 4.25.0 +# Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool @@ -12,7 +12,7 @@ _sym_db = _symbol_database.Default() -from marznode.xray_api.proto.common.log import log_pb2 as common_dot_log_dot_log__pb2 +from marznode.backends.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') diff --git a/marznode/backends/xray/api/proto/app/metrics/__init__.py b/marznode/backends/xray/api/proto/app/metrics/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/marznode/xray_api/proto/app/metrics/config_grpc.py b/marznode/backends/xray/api/proto/app/metrics/config_grpc.py similarity index 100% rename from marznode/xray_api/proto/app/metrics/config_grpc.py rename to marznode/backends/xray/api/proto/app/metrics/config_grpc.py diff --git a/marznode/xray_api/proto/app/metrics/config_pb2.py b/marznode/backends/xray/api/proto/app/metrics/config_pb2.py similarity index 97% rename from marznode/xray_api/proto/app/metrics/config_pb2.py rename to marznode/backends/xray/api/proto/app/metrics/config_pb2.py index d7617e4..b4845bf 100644 --- a/marznode/xray_api/proto/app/metrics/config_pb2.py +++ b/marznode/backends/xray/api/proto/app/metrics/config_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: app/metrics/config.proto -# Protobuf Python Version: 4.25.0 +# Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool diff --git a/marznode/backends/xray/api/proto/app/observatory/__init__.py b/marznode/backends/xray/api/proto/app/observatory/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/marznode/backends/xray/api/proto/app/observatory/burst/config_grpc.py b/marznode/backends/xray/api/proto/app/observatory/burst/config_grpc.py new file mode 100644 index 0000000..4848484 --- /dev/null +++ b/marznode/backends/xray/api/proto/app/observatory/burst/config_grpc.py @@ -0,0 +1,3 @@ +# Generated by the Protocol Buffers compiler. DO NOT EDIT! +# source: app/observatory/burst/config.proto +# plugin: grpclib.plugin.main diff --git a/marznode/backends/xray/api/proto/app/observatory/burst/config_pb2.py b/marznode/backends/xray/api/proto/app/observatory/burst/config_pb2.py new file mode 100644 index 0000000..b341380 --- /dev/null +++ b/marznode/backends/xray/api/proto/app/observatory/burst/config_pb2.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: app/observatory/burst/config.proto +# Protobuf Python Version: 4.25.1 +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import symbol_database as _symbol_database +from google.protobuf.internal import builder as _builder +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\"app/observatory/burst/config.proto\x12\x1fxray.core.app.observatory.burst\"j\n\x06\x43onfig\x12\x18\n\x10subject_selector\x18\x02 \x03(\t\x12\x46\n\x0bping_config\x18\x03 \x01(\x0b\x32\x31.xray.core.app.observatory.burst.HealthPingConfig\"w\n\x10HealthPingConfig\x12\x13\n\x0b\x64\x65stination\x18\x01 \x01(\t\x12\x14\n\x0c\x63onnectivity\x18\x02 \x01(\t\x12\x10\n\x08interval\x18\x03 \x01(\x03\x12\x15\n\rsamplingCount\x18\x04 \x01(\x05\x12\x0f\n\x07timeout\x18\x05 \x01(\x03\x42p\n\x1e\x63om.xray.app.observatory.burstP\x01Z/github.com/xtls/xray-core/app/observatory/burst\xaa\x02\x1aXray.App.Observatory.Burstb\x06proto3') + +_globals = globals() +_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) +_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'app.observatory.burst.config_pb2', _globals) +if _descriptor._USE_C_DESCRIPTORS == False: + _globals['DESCRIPTOR']._options = None + _globals['DESCRIPTOR']._serialized_options = b'\n\036com.xray.app.observatory.burstP\001Z/github.com/xtls/xray-core/app/observatory/burst\252\002\032Xray.App.Observatory.Burst' + _globals['_CONFIG']._serialized_start=71 + _globals['_CONFIG']._serialized_end=177 + _globals['_HEALTHPINGCONFIG']._serialized_start=179 + _globals['_HEALTHPINGCONFIG']._serialized_end=298 +# @@protoc_insertion_point(module_scope) diff --git a/marznode/backends/xray/api/proto/app/observatory/command/__init__.py b/marznode/backends/xray/api/proto/app/observatory/command/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/marznode/xray_api/proto/app/observatory/command/command_grpc.py b/marznode/backends/xray/api/proto/app/observatory/command/command_grpc.py similarity index 66% rename from marznode/xray_api/proto/app/observatory/command/command_grpc.py rename to marznode/backends/xray/api/proto/app/observatory/command/command_grpc.py index f6a4c82..8cc66b5 100644 --- a/marznode/xray_api/proto/app/observatory/command/command_grpc.py +++ b/marznode/backends/xray/api/proto/app/observatory/command/command_grpc.py @@ -9,8 +9,8 @@ if typing.TYPE_CHECKING: import grpclib.server -import marznode.xray_api.proto.app.observatory.config_pb2 -import marznode.xray_api.proto.app.observatory.command.command_pb2 +import marznode.backends.xray.api.proto.app.observatory.config_pb2 +import marznode.backends.xray.api.proto.app.observatory.command.command_pb2 class ObservatoryServiceBase(abc.ABC): @@ -24,8 +24,8 @@ def __mapping__(self) -> typing.Dict[str, grpclib.const.Handler]: '/xray.core.app.observatory.command.ObservatoryService/GetOutboundStatus': grpclib.const.Handler( self.GetOutboundStatus, grpclib.const.Cardinality.UNARY_UNARY, - marznode.xray_api.proto.app.observatory.command.command_pb2.GetOutboundStatusRequest, - marznode.xray_api.proto.app.observatory.command.command_pb2.GetOutboundStatusResponse, + marznode.backends.xray.api.proto.app.observatory.command.command_pb2.GetOutboundStatusRequest, + marznode.backends.xray.api.proto.app.observatory.command.command_pb2.GetOutboundStatusResponse, ), } @@ -36,6 +36,6 @@ def __init__(self, channel: grpclib.client.Channel) -> None: self.GetOutboundStatus = grpclib.client.UnaryUnaryMethod( channel, '/xray.core.app.observatory.command.ObservatoryService/GetOutboundStatus', - marznode.xray_api.proto.app.observatory.command.command_pb2.GetOutboundStatusRequest, - marznode.xray_api.proto.app.observatory.command.command_pb2.GetOutboundStatusResponse, + marznode.backends.xray.api.proto.app.observatory.command.command_pb2.GetOutboundStatusRequest, + marznode.backends.xray.api.proto.app.observatory.command.command_pb2.GetOutboundStatusResponse, ) diff --git a/marznode/xray_api/proto/app/observatory/command/command_pb2.py b/marznode/backends/xray/api/proto/app/observatory/command/command_pb2.py similarity index 93% rename from marznode/xray_api/proto/app/observatory/command/command_pb2.py rename to marznode/backends/xray/api/proto/app/observatory/command/command_pb2.py index 9589ddd..e8a18cc 100644 --- a/marznode/xray_api/proto/app/observatory/command/command_pb2.py +++ b/marznode/backends/xray/api/proto/app/observatory/command/command_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: app/observatory/command/command.proto -# Protobuf Python Version: 4.25.0 +# Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool @@ -12,7 +12,7 @@ _sym_db = _symbol_database.Default() -from marznode.xray_api.proto.app.observatory import config_pb2 as app_dot_observatory_dot_config__pb2 +from marznode.backends.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') diff --git a/marznode/xray_api/proto/app/observatory/config_grpc.py b/marznode/backends/xray/api/proto/app/observatory/config_grpc.py similarity index 100% rename from marznode/xray_api/proto/app/observatory/config_grpc.py rename to marznode/backends/xray/api/proto/app/observatory/config_grpc.py diff --git a/marznode/backends/xray/api/proto/app/observatory/config_pb2.py b/marznode/backends/xray/api/proto/app/observatory/config_pb2.py new file mode 100644 index 0000000..0a5c6cb --- /dev/null +++ b/marznode/backends/xray/api/proto/app/observatory/config_pb2.py @@ -0,0 +1,37 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: app/observatory/config.proto +# Protobuf Python Version: 4.25.1 +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import symbol_database as _symbol_database +from google.protobuf.internal import builder as _builder +# @@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\"v\n\x1bHealthPingMeasurementResult\x12\x0b\n\x03\x61ll\x18\x01 \x01(\x03\x12\x0c\n\x04\x66\x61il\x18\x02 \x01(\x03\x12\x11\n\tdeviation\x18\x03 \x01(\x03\x12\x0f\n\x07\x61verage\x18\x04 \x01(\x03\x12\x0b\n\x03max\x18\x05 \x01(\x03\x12\x0b\n\x03min\x18\x06 \x01(\x03\"\xdb\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\x12K\n\x0bhealth_ping\x18\x07 \x01(\x0b\x32\x36.xray.core.app.observatory.HealthPingMeasurementResult\"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') + +_globals = globals() +_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) +_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'app.observatory.config_pb2', _globals) +if _descriptor._USE_C_DESCRIPTORS == False: + _globals['DESCRIPTOR']._options = None + _globals['DESCRIPTOR']._serialized_options = b'\n\030com.xray.app.observatoryP\001Z)github.com/xtls/xray-core/app/observatory\252\002\024Xray.App.Observatory' + _globals['_OBSERVATIONRESULT']._serialized_start=59 + _globals['_OBSERVATIONRESULT']._serialized_end=137 + _globals['_HEALTHPINGMEASUREMENTRESULT']._serialized_start=139 + _globals['_HEALTHPINGMEASUREMENTRESULT']._serialized_end=257 + _globals['_OUTBOUNDSTATUS']._serialized_start=260 + _globals['_OUTBOUNDSTATUS']._serialized_end=479 + _globals['_PROBERESULT']._serialized_start=481 + _globals['_PROBERESULT']._serialized_end=551 + _globals['_INTENSITY']._serialized_start=553 + _globals['_INTENSITY']._serialized_end=588 + _globals['_CONFIG']._serialized_start=590 + _globals['_CONFIG']._serialized_end=695 +# @@protoc_insertion_point(module_scope) diff --git a/marznode/backends/xray/api/proto/app/policy/__init__.py b/marznode/backends/xray/api/proto/app/policy/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/marznode/xray_api/proto/app/policy/config_grpc.py b/marznode/backends/xray/api/proto/app/policy/config_grpc.py similarity index 100% rename from marznode/xray_api/proto/app/policy/config_grpc.py rename to marznode/backends/xray/api/proto/app/policy/config_grpc.py diff --git a/marznode/xray_api/proto/app/policy/config_pb2.py b/marznode/backends/xray/api/proto/app/policy/config_pb2.py similarity index 99% rename from marznode/xray_api/proto/app/policy/config_pb2.py rename to marznode/backends/xray/api/proto/app/policy/config_pb2.py index 0cacc66..75b54a9 100644 --- a/marznode/xray_api/proto/app/policy/config_pb2.py +++ b/marznode/backends/xray/api/proto/app/policy/config_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: app/policy/config.proto -# Protobuf Python Version: 4.25.0 +# Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool diff --git a/marznode/backends/xray/api/proto/app/proxyman/__init__.py b/marznode/backends/xray/api/proto/app/proxyman/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/marznode/backends/xray/api/proto/app/proxyman/command/__init__.py b/marznode/backends/xray/api/proto/app/proxyman/command/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/marznode/xray_api/proto/app/proxyman/command/command_grpc.py b/marznode/backends/xray/api/proto/app/proxyman/command/command_grpc.py similarity index 59% rename from marznode/xray_api/proto/app/proxyman/command/command_grpc.py rename to marznode/backends/xray/api/proto/app/proxyman/command/command_grpc.py index de7845a..798553d 100644 --- a/marznode/xray_api/proto/app/proxyman/command/command_grpc.py +++ b/marznode/backends/xray/api/proto/app/proxyman/command/command_grpc.py @@ -9,10 +9,10 @@ if typing.TYPE_CHECKING: import grpclib.server -import marznode.xray_api.proto.common.protocol.user_pb2 -import marznode.xray_api.proto.common.serial.typed_message_pb2 -import marznode.xray_api.proto.core.config_pb2 -import marznode.xray_api.proto.app.proxyman.command.command_pb2 +import marznode.backends.xray.api.proto.common.protocol.user_pb2 +import marznode.backends.xray.api.proto.common.serial.typed_message_pb2 +import marznode.backends.xray.api.proto.core.config_pb2 +import marznode.backends.xray.api.proto.app.proxyman.command.command_pb2 class HandlerServiceBase(abc.ABC): @@ -46,38 +46,38 @@ def __mapping__(self) -> typing.Dict[str, grpclib.const.Handler]: '/xray.app.proxyman.command.HandlerService/AddInbound': grpclib.const.Handler( self.AddInbound, grpclib.const.Cardinality.UNARY_UNARY, - marznode.xray_api.proto.app.proxyman.command.command_pb2.AddInboundRequest, - marznode.xray_api.proto.app.proxyman.command.command_pb2.AddInboundResponse, + marznode.backends.xray.api.proto.app.proxyman.command.command_pb2.AddInboundRequest, + marznode.backends.xray.api.proto.app.proxyman.command.command_pb2.AddInboundResponse, ), '/xray.app.proxyman.command.HandlerService/RemoveInbound': grpclib.const.Handler( self.RemoveInbound, grpclib.const.Cardinality.UNARY_UNARY, - marznode.xray_api.proto.app.proxyman.command.command_pb2.RemoveInboundRequest, - marznode.xray_api.proto.app.proxyman.command.command_pb2.RemoveInboundResponse, + marznode.backends.xray.api.proto.app.proxyman.command.command_pb2.RemoveInboundRequest, + marznode.backends.xray.api.proto.app.proxyman.command.command_pb2.RemoveInboundResponse, ), '/xray.app.proxyman.command.HandlerService/AlterInbound': grpclib.const.Handler( self.AlterInbound, grpclib.const.Cardinality.UNARY_UNARY, - marznode.xray_api.proto.app.proxyman.command.command_pb2.AlterInboundRequest, - marznode.xray_api.proto.app.proxyman.command.command_pb2.AlterInboundResponse, + marznode.backends.xray.api.proto.app.proxyman.command.command_pb2.AlterInboundRequest, + marznode.backends.xray.api.proto.app.proxyman.command.command_pb2.AlterInboundResponse, ), '/xray.app.proxyman.command.HandlerService/AddOutbound': grpclib.const.Handler( self.AddOutbound, grpclib.const.Cardinality.UNARY_UNARY, - marznode.xray_api.proto.app.proxyman.command.command_pb2.AddOutboundRequest, - marznode.xray_api.proto.app.proxyman.command.command_pb2.AddOutboundResponse, + marznode.backends.xray.api.proto.app.proxyman.command.command_pb2.AddOutboundRequest, + marznode.backends.xray.api.proto.app.proxyman.command.command_pb2.AddOutboundResponse, ), '/xray.app.proxyman.command.HandlerService/RemoveOutbound': grpclib.const.Handler( self.RemoveOutbound, grpclib.const.Cardinality.UNARY_UNARY, - marznode.xray_api.proto.app.proxyman.command.command_pb2.RemoveOutboundRequest, - marznode.xray_api.proto.app.proxyman.command.command_pb2.RemoveOutboundResponse, + marznode.backends.xray.api.proto.app.proxyman.command.command_pb2.RemoveOutboundRequest, + marznode.backends.xray.api.proto.app.proxyman.command.command_pb2.RemoveOutboundResponse, ), '/xray.app.proxyman.command.HandlerService/AlterOutbound': grpclib.const.Handler( self.AlterOutbound, grpclib.const.Cardinality.UNARY_UNARY, - marznode.xray_api.proto.app.proxyman.command.command_pb2.AlterOutboundRequest, - marznode.xray_api.proto.app.proxyman.command.command_pb2.AlterOutboundResponse, + marznode.backends.xray.api.proto.app.proxyman.command.command_pb2.AlterOutboundRequest, + marznode.backends.xray.api.proto.app.proxyman.command.command_pb2.AlterOutboundResponse, ), } @@ -88,36 +88,36 @@ def __init__(self, channel: grpclib.client.Channel) -> None: self.AddInbound = grpclib.client.UnaryUnaryMethod( channel, '/xray.app.proxyman.command.HandlerService/AddInbound', - marznode.xray_api.proto.app.proxyman.command.command_pb2.AddInboundRequest, - marznode.xray_api.proto.app.proxyman.command.command_pb2.AddInboundResponse, + marznode.backends.xray.api.proto.app.proxyman.command.command_pb2.AddInboundRequest, + marznode.backends.xray.api.proto.app.proxyman.command.command_pb2.AddInboundResponse, ) self.RemoveInbound = grpclib.client.UnaryUnaryMethod( channel, '/xray.app.proxyman.command.HandlerService/RemoveInbound', - marznode.xray_api.proto.app.proxyman.command.command_pb2.RemoveInboundRequest, - marznode.xray_api.proto.app.proxyman.command.command_pb2.RemoveInboundResponse, + marznode.backends.xray.api.proto.app.proxyman.command.command_pb2.RemoveInboundRequest, + marznode.backends.xray.api.proto.app.proxyman.command.command_pb2.RemoveInboundResponse, ) self.AlterInbound = grpclib.client.UnaryUnaryMethod( channel, '/xray.app.proxyman.command.HandlerService/AlterInbound', - marznode.xray_api.proto.app.proxyman.command.command_pb2.AlterInboundRequest, - marznode.xray_api.proto.app.proxyman.command.command_pb2.AlterInboundResponse, + marznode.backends.xray.api.proto.app.proxyman.command.command_pb2.AlterInboundRequest, + marznode.backends.xray.api.proto.app.proxyman.command.command_pb2.AlterInboundResponse, ) self.AddOutbound = grpclib.client.UnaryUnaryMethod( channel, '/xray.app.proxyman.command.HandlerService/AddOutbound', - marznode.xray_api.proto.app.proxyman.command.command_pb2.AddOutboundRequest, - marznode.xray_api.proto.app.proxyman.command.command_pb2.AddOutboundResponse, + marznode.backends.xray.api.proto.app.proxyman.command.command_pb2.AddOutboundRequest, + marznode.backends.xray.api.proto.app.proxyman.command.command_pb2.AddOutboundResponse, ) self.RemoveOutbound = grpclib.client.UnaryUnaryMethod( channel, '/xray.app.proxyman.command.HandlerService/RemoveOutbound', - marznode.xray_api.proto.app.proxyman.command.command_pb2.RemoveOutboundRequest, - marznode.xray_api.proto.app.proxyman.command.command_pb2.RemoveOutboundResponse, + marznode.backends.xray.api.proto.app.proxyman.command.command_pb2.RemoveOutboundRequest, + marznode.backends.xray.api.proto.app.proxyman.command.command_pb2.RemoveOutboundResponse, ) self.AlterOutbound = grpclib.client.UnaryUnaryMethod( channel, '/xray.app.proxyman.command.HandlerService/AlterOutbound', - marznode.xray_api.proto.app.proxyman.command.command_pb2.AlterOutboundRequest, - marznode.xray_api.proto.app.proxyman.command.command_pb2.AlterOutboundResponse, + marznode.backends.xray.api.proto.app.proxyman.command.command_pb2.AlterOutboundRequest, + marznode.backends.xray.api.proto.app.proxyman.command.command_pb2.AlterOutboundResponse, ) diff --git a/marznode/xray_api/proto/app/proxyman/command/command_pb2.py b/marznode/backends/xray/api/proto/app/proxyman/command/command_pb2.py similarity index 93% rename from marznode/xray_api/proto/app/proxyman/command/command_pb2.py rename to marznode/backends/xray/api/proto/app/proxyman/command/command_pb2.py index cff8651..a69364f 100644 --- a/marznode/xray_api/proto/app/proxyman/command/command_pb2.py +++ b/marznode/backends/xray/api/proto/app/proxyman/command/command_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: app/proxyman/command/command.proto -# Protobuf Python Version: 4.25.0 +# Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool @@ -12,9 +12,9 @@ _sym_db = _symbol_database.Default() -from marznode.xray_api.proto.common.protocol import user_pb2 as common_dot_protocol_dot_user__pb2 -from marznode.xray_api.proto.common.serial import typed_message_pb2 as common_dot_serial_dot_typed__message__pb2 -from marznode.xray_api.proto.core import config_pb2 as core_dot_config__pb2 +from marznode.backends.xray.api.proto.common.protocol import user_pb2 as common_dot_protocol_dot_user__pb2 +from marznode.backends.xray.api.proto.common.serial import typed_message_pb2 as common_dot_serial_dot_typed__message__pb2 +from marznode.backends.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') diff --git a/marznode/xray_api/proto/app/proxyman/config_grpc.py b/marznode/backends/xray/api/proto/app/proxyman/config_grpc.py similarity index 100% rename from marznode/xray_api/proto/app/proxyman/config_grpc.py rename to marznode/backends/xray/api/proto/app/proxyman/config_grpc.py diff --git a/marznode/xray_api/proto/app/proxyman/config_pb2.py b/marznode/backends/xray/api/proto/app/proxyman/config_pb2.py similarity index 91% rename from marznode/xray_api/proto/app/proxyman/config_pb2.py rename to marznode/backends/xray/api/proto/app/proxyman/config_pb2.py index 0310c6d..30425a9 100644 --- a/marznode/xray_api/proto/app/proxyman/config_pb2.py +++ b/marznode/backends/xray/api/proto/app/proxyman/config_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: app/proxyman/config.proto -# Protobuf Python Version: 4.25.0 +# Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool @@ -12,10 +12,10 @@ _sym_db = _symbol_database.Default() -from marznode.xray_api.proto.common.net import address_pb2 as common_dot_net_dot_address__pb2 -from marznode.xray_api.proto.common.net import port_pb2 as common_dot_net_dot_port__pb2 -from marznode.xray_api.proto.transport.internet import config_pb2 as transport_dot_internet_dot_config__pb2 -from marznode.xray_api.proto.common.serial import typed_message_pb2 as common_dot_serial_dot_typed__message__pb2 +from marznode.backends.xray.api.proto.common.net import address_pb2 as common_dot_net_dot_address__pb2 +from marznode.backends.xray.api.proto.common.net import port_pb2 as common_dot_net_dot_port__pb2 +from marznode.backends.xray.api.proto.transport.internet import config_pb2 as transport_dot_internet_dot_config__pb2 +from marznode.backends.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\"l\n\x12MultiplexingConfig\x12\x0f\n\x07\x65nabled\x18\x01 \x01(\x08\x12\x13\n\x0b\x63oncurrency\x18\x02 \x01(\x05\x12\x17\n\x0fxudpConcurrency\x18\x03 \x01(\x05\x12\x17\n\x0fxudpProxyUDP443\x18\x04 \x01(\t*#\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') diff --git a/marznode/backends/xray/api/proto/app/reverse/__init__.py b/marznode/backends/xray/api/proto/app/reverse/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/marznode/xray_api/proto/app/reverse/config_grpc.py b/marznode/backends/xray/api/proto/app/reverse/config_grpc.py similarity index 100% rename from marznode/xray_api/proto/app/reverse/config_grpc.py rename to marznode/backends/xray/api/proto/app/reverse/config_grpc.py diff --git a/marznode/xray_api/proto/app/reverse/config_pb2.py b/marznode/backends/xray/api/proto/app/reverse/config_pb2.py similarity index 98% rename from marznode/xray_api/proto/app/reverse/config_pb2.py rename to marznode/backends/xray/api/proto/app/reverse/config_pb2.py index e70ec37..65d1a55 100644 --- a/marznode/xray_api/proto/app/reverse/config_pb2.py +++ b/marznode/backends/xray/api/proto/app/reverse/config_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: app/reverse/config.proto -# Protobuf Python Version: 4.25.0 +# Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool diff --git a/marznode/backends/xray/api/proto/app/router/__init__.py b/marznode/backends/xray/api/proto/app/router/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/marznode/backends/xray/api/proto/app/router/command/__init__.py b/marznode/backends/xray/api/proto/app/router/command/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/marznode/backends/xray/api/proto/app/router/command/command_grpc.py b/marznode/backends/xray/api/proto/app/router/command/command_grpc.py new file mode 100644 index 0000000..2565d63 --- /dev/null +++ b/marznode/backends/xray/api/proto/app/router/command/command_grpc.py @@ -0,0 +1,89 @@ +# Generated by the Protocol Buffers compiler. DO NOT EDIT! +# source: app/router/command/command.proto +# plugin: grpclib.plugin.main +import abc +import typing + +import grpclib.const +import grpclib.client +if typing.TYPE_CHECKING: + import grpclib.server + +import marznode.backends.xray.api.proto.common.net.network_pb2 +import marznode.backends.xray.api.proto.app.router.command.command_pb2 + + +class RoutingServiceBase(abc.ABC): + + @abc.abstractmethod + async def SubscribeRoutingStats(self, stream: 'grpclib.server.Stream[app.router.command.command_pb2.SubscribeRoutingStatsRequest, app.router.command.command_pb2.RoutingContext]') -> None: + pass + + @abc.abstractmethod + async def TestRoute(self, stream: 'grpclib.server.Stream[app.router.command.command_pb2.TestRouteRequest, app.router.command.command_pb2.RoutingContext]') -> None: + pass + + @abc.abstractmethod + async def GetBalancerInfo(self, stream: 'grpclib.server.Stream[app.router.command.command_pb2.GetBalancerInfoRequest, app.router.command.command_pb2.GetBalancerInfoResponse]') -> None: + pass + + @abc.abstractmethod + async def OverrideBalancerTarget(self, stream: 'grpclib.server.Stream[app.router.command.command_pb2.OverrideBalancerTargetRequest, app.router.command.command_pb2.OverrideBalancerTargetResponse]') -> None: + pass + + def __mapping__(self) -> typing.Dict[str, grpclib.const.Handler]: + return { + '/xray.app.router.command.RoutingService/SubscribeRoutingStats': grpclib.const.Handler( + self.SubscribeRoutingStats, + grpclib.const.Cardinality.UNARY_STREAM, + marznode.backends.xray.api.proto.app.router.command.command_pb2.SubscribeRoutingStatsRequest, + marznode.backends.xray.api.proto.app.router.command.command_pb2.RoutingContext, + ), + '/xray.app.router.command.RoutingService/TestRoute': grpclib.const.Handler( + self.TestRoute, + grpclib.const.Cardinality.UNARY_UNARY, + marznode.backends.xray.api.proto.app.router.command.command_pb2.TestRouteRequest, + marznode.backends.xray.api.proto.app.router.command.command_pb2.RoutingContext, + ), + '/xray.app.router.command.RoutingService/GetBalancerInfo': grpclib.const.Handler( + self.GetBalancerInfo, + grpclib.const.Cardinality.UNARY_UNARY, + marznode.backends.xray.api.proto.app.router.command.command_pb2.GetBalancerInfoRequest, + marznode.backends.xray.api.proto.app.router.command.command_pb2.GetBalancerInfoResponse, + ), + '/xray.app.router.command.RoutingService/OverrideBalancerTarget': grpclib.const.Handler( + self.OverrideBalancerTarget, + grpclib.const.Cardinality.UNARY_UNARY, + marznode.backends.xray.api.proto.app.router.command.command_pb2.OverrideBalancerTargetRequest, + marznode.backends.xray.api.proto.app.router.command.command_pb2.OverrideBalancerTargetResponse, + ), + } + + +class RoutingServiceStub: + + def __init__(self, channel: grpclib.client.Channel) -> None: + self.SubscribeRoutingStats = grpclib.client.UnaryStreamMethod( + channel, + '/xray.app.router.command.RoutingService/SubscribeRoutingStats', + marznode.backends.xray.api.proto.app.router.command.command_pb2.SubscribeRoutingStatsRequest, + marznode.backends.xray.api.proto.app.router.command.command_pb2.RoutingContext, + ) + self.TestRoute = grpclib.client.UnaryUnaryMethod( + channel, + '/xray.app.router.command.RoutingService/TestRoute', + marznode.backends.xray.api.proto.app.router.command.command_pb2.TestRouteRequest, + marznode.backends.xray.api.proto.app.router.command.command_pb2.RoutingContext, + ) + self.GetBalancerInfo = grpclib.client.UnaryUnaryMethod( + channel, + '/xray.app.router.command.RoutingService/GetBalancerInfo', + marznode.backends.xray.api.proto.app.router.command.command_pb2.GetBalancerInfoRequest, + marznode.backends.xray.api.proto.app.router.command.command_pb2.GetBalancerInfoResponse, + ) + self.OverrideBalancerTarget = grpclib.client.UnaryUnaryMethod( + channel, + '/xray.app.router.command.RoutingService/OverrideBalancerTarget', + marznode.backends.xray.api.proto.app.router.command.command_pb2.OverrideBalancerTargetRequest, + marznode.backends.xray.api.proto.app.router.command.command_pb2.OverrideBalancerTargetResponse, + ) diff --git a/marznode/xray_api/proto/app/router/command/command_pb2.py b/marznode/backends/xray/api/proto/app/router/command/command_pb2.py similarity index 51% rename from marznode/xray_api/proto/app/router/command/command_pb2.py rename to marznode/backends/xray/api/proto/app/router/command/command_pb2.py index b9673b0..3a4f2d9 100644 --- a/marznode/xray_api/proto/app/router/command/command_pb2.py +++ b/marznode/backends/xray/api/proto/app/router/command/command_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: app/router/command/command.proto -# Protobuf Python Version: 4.25.0 +# Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool @@ -12,10 +12,10 @@ _sym_db = _symbol_database.Default() -from marznode.xray_api.proto.common.net import network_pb2 as common_dot_net_dot_network__pb2 +from marznode.backends.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') +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\"\"\n\x13PrincipleTargetInfo\x12\x0b\n\x03tag\x18\x01 \x03(\t\"\x1e\n\x0cOverrideInfo\x12\x0e\n\x06target\x18\x02 \x01(\t\"\x8e\x01\n\x0b\x42\x61lancerMsg\x12\x37\n\x08override\x18\x05 \x01(\x0b\x32%.xray.app.router.command.OverrideInfo\x12\x46\n\x10principle_target\x18\x06 \x01(\x0b\x32,.xray.app.router.command.PrincipleTargetInfo\"%\n\x16GetBalancerInfoRequest\x12\x0b\n\x03tag\x18\x01 \x01(\t\"Q\n\x17GetBalancerInfoResponse\x12\x36\n\x08\x62\x61lancer\x18\x01 \x01(\x0b\x32$.xray.app.router.command.BalancerMsg\"D\n\x1dOverrideBalancerTargetRequest\x12\x13\n\x0b\x62\x61lancerTag\x18\x01 \x01(\t\x12\x0e\n\x06target\x18\x02 \x01(\t\" \n\x1eOverrideBalancerTargetResponse\"\x08\n\x06\x43onfig2\xf6\x03\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\x12v\n\x0fGetBalancerInfo\x12/.xray.app.router.command.GetBalancerInfoRequest\x1a\x30.xray.app.router.command.GetBalancerInfoResponse\"\x00\x12\x8b\x01\n\x16OverrideBalancerTarget\x12\x36.xray.app.router.command.OverrideBalancerTargetRequest\x1a\x37.xray.app.router.command.OverrideBalancerTargetResponse\"\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') _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) @@ -33,8 +33,22 @@ _globals['_SUBSCRIBEROUTINGSTATSREQUEST']._serialized_end=531 _globals['_TESTROUTEREQUEST']._serialized_start=534 _globals['_TESTROUTEREQUEST']._serialized_end=664 - _globals['_CONFIG']._serialized_start=666 - _globals['_CONFIG']._serialized_end=674 - _globals['_ROUTINGSERVICE']._serialized_start=677 - _globals['_ROUTINGSERVICE']._serialized_end=917 + _globals['_PRINCIPLETARGETINFO']._serialized_start=666 + _globals['_PRINCIPLETARGETINFO']._serialized_end=700 + _globals['_OVERRIDEINFO']._serialized_start=702 + _globals['_OVERRIDEINFO']._serialized_end=732 + _globals['_BALANCERMSG']._serialized_start=735 + _globals['_BALANCERMSG']._serialized_end=877 + _globals['_GETBALANCERINFOREQUEST']._serialized_start=879 + _globals['_GETBALANCERINFOREQUEST']._serialized_end=916 + _globals['_GETBALANCERINFORESPONSE']._serialized_start=918 + _globals['_GETBALANCERINFORESPONSE']._serialized_end=999 + _globals['_OVERRIDEBALANCERTARGETREQUEST']._serialized_start=1001 + _globals['_OVERRIDEBALANCERTARGETREQUEST']._serialized_end=1069 + _globals['_OVERRIDEBALANCERTARGETRESPONSE']._serialized_start=1071 + _globals['_OVERRIDEBALANCERTARGETRESPONSE']._serialized_end=1103 + _globals['_CONFIG']._serialized_start=1105 + _globals['_CONFIG']._serialized_end=1113 + _globals['_ROUTINGSERVICE']._serialized_start=1116 + _globals['_ROUTINGSERVICE']._serialized_end=1618 # @@protoc_insertion_point(module_scope) diff --git a/marznode/xray_api/proto/app/router/config_grpc.py b/marznode/backends/xray/api/proto/app/router/config_grpc.py similarity index 100% rename from marznode/xray_api/proto/app/router/config_grpc.py rename to marznode/backends/xray/api/proto/app/router/config_grpc.py diff --git a/marznode/backends/xray/api/proto/app/router/config_pb2.py b/marznode/backends/xray/api/proto/app/router/config_pb2.py new file mode 100644 index 0000000..85f4a0a --- /dev/null +++ b/marznode/backends/xray/api/proto/app/router/config_pb2.py @@ -0,0 +1,68 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: app/router/config.proto +# Protobuf Python Version: 4.25.1 +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import symbol_database as _symbol_database +from google.protobuf.internal import builder as _builder +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from marznode.backends.xray.api.proto.common.serial import typed_message_pb2 as common_dot_serial_dot_typed__message__pb2 +from marznode.backends.xray.api.proto.common.net import port_pb2 as common_dot_net_dot_port__pb2 +from marznode.backends.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!common/serial/typed_message.proto\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\"\xdd\x05\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@\n\nattributes\x18\x0f \x03(\x0b\x32,.xray.app.router.RoutingRule.AttributesEntry\x12\x16\n\x0e\x64omain_matcher\x18\x11 \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\x42\x0c\n\ntarget_tag\"\x9c\x01\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\x12;\n\x11strategy_settings\x18\x04 \x01(\x0b\x32 .xray.common.serial.TypedMessage\x12\x14\n\x0c\x66\x61llback_tag\x18\x05 \x01(\t\">\n\x0eStrategyWeight\x12\x0e\n\x06regexp\x18\x01 \x01(\x08\x12\r\n\x05match\x18\x02 \x01(\t\x12\r\n\x05value\x18\x03 \x01(\x02\"\x91\x01\n\x17StrategyLeastLoadConfig\x12.\n\x05\x63osts\x18\x02 \x03(\x0b\x32\x1f.xray.app.router.StrategyWeight\x12\x11\n\tbaselines\x18\x03 \x03(\x03\x12\x10\n\x08\x65xpected\x18\x04 \x01(\x05\x12\x0e\n\x06maxRTT\x18\x05 \x01(\x03\x12\x11\n\ttolerance\x18\x06 \x01(\x02\"\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') + +_globals = globals() +_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) +_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'app.router.config_pb2', _globals) +if _descriptor._USE_C_DESCRIPTORS == False: + _globals['DESCRIPTOR']._options = None + _globals['DESCRIPTOR']._serialized_options = b'\n\023com.xray.app.routerP\001Z$github.com/xtls/xray-core/app/router\252\002\017Xray.App.Router' + _globals['_ROUTINGRULE_ATTRIBUTESENTRY']._options = None + _globals['_ROUTINGRULE_ATTRIBUTESENTRY']._serialized_options = b'8\001' + _globals['_ROUTINGRULE'].fields_by_name['cidr']._options = None + _globals['_ROUTINGRULE'].fields_by_name['cidr']._serialized_options = b'\030\001' + _globals['_ROUTINGRULE'].fields_by_name['port_range']._options = None + _globals['_ROUTINGRULE'].fields_by_name['port_range']._serialized_options = b'\030\001' + _globals['_ROUTINGRULE'].fields_by_name['network_list']._options = None + _globals['_ROUTINGRULE'].fields_by_name['network_list']._serialized_options = b'\030\001' + _globals['_ROUTINGRULE'].fields_by_name['source_cidr']._options = None + _globals['_ROUTINGRULE'].fields_by_name['source_cidr']._serialized_options = b'\030\001' + _globals['_DOMAIN']._serialized_start=129 + _globals['_DOMAIN']._serialized_end=386 + _globals['_DOMAIN_ATTRIBUTE']._serialized_start=252 + _globals['_DOMAIN_ATTRIBUTE']._serialized_end=334 + _globals['_DOMAIN_TYPE']._serialized_start=336 + _globals['_DOMAIN_TYPE']._serialized_end=386 + _globals['_CIDR']._serialized_start=388 + _globals['_CIDR']._serialized_end=422 + _globals['_GEOIP']._serialized_start=424 + _globals['_GEOIP']._serialized_end=513 + _globals['_GEOIPLIST']._serialized_start=515 + _globals['_GEOIPLIST']._serialized_end=565 + _globals['_GEOSITE']._serialized_start=567 + _globals['_GEOSITE']._serialized_end=639 + _globals['_GEOSITELIST']._serialized_start=641 + _globals['_GEOSITELIST']._serialized_end=695 + _globals['_ROUTINGRULE']._serialized_start=698 + _globals['_ROUTINGRULE']._serialized_end=1431 + _globals['_ROUTINGRULE_ATTRIBUTESENTRY']._serialized_start=1368 + _globals['_ROUTINGRULE_ATTRIBUTESENTRY']._serialized_end=1417 + _globals['_BALANCINGRULE']._serialized_start=1434 + _globals['_BALANCINGRULE']._serialized_end=1590 + _globals['_STRATEGYWEIGHT']._serialized_start=1592 + _globals['_STRATEGYWEIGHT']._serialized_end=1654 + _globals['_STRATEGYLEASTLOADCONFIG']._serialized_start=1657 + _globals['_STRATEGYLEASTLOADCONFIG']._serialized_end=1802 + _globals['_CONFIG']._serialized_start=1805 + _globals['_CONFIG']._serialized_end=2051 + _globals['_CONFIG_DOMAINSTRATEGY']._serialized_start=1980 + _globals['_CONFIG_DOMAINSTRATEGY']._serialized_end=2051 +# @@protoc_insertion_point(module_scope) diff --git a/marznode/backends/xray/api/proto/app/stats/__init__.py b/marznode/backends/xray/api/proto/app/stats/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/marznode/backends/xray/api/proto/app/stats/command/__init__.py b/marznode/backends/xray/api/proto/app/stats/command/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/marznode/xray_api/proto/app/stats/command/command_grpc.py b/marznode/backends/xray/api/proto/app/stats/command/command_grpc.py similarity index 63% rename from marznode/xray_api/proto/app/stats/command/command_grpc.py rename to marznode/backends/xray/api/proto/app/stats/command/command_grpc.py index 59bc50a..9cba68c 100644 --- a/marznode/xray_api/proto/app/stats/command/command_grpc.py +++ b/marznode/backends/xray/api/proto/app/stats/command/command_grpc.py @@ -9,7 +9,7 @@ if typing.TYPE_CHECKING: import grpclib.server -import marznode.xray_api.proto.app.stats.command.command_pb2 +import marznode.backends.xray.api.proto.app.stats.command.command_pb2 class StatsServiceBase(abc.ABC): @@ -31,20 +31,20 @@ def __mapping__(self) -> typing.Dict[str, grpclib.const.Handler]: '/xray.app.stats.command.StatsService/GetStats': grpclib.const.Handler( self.GetStats, grpclib.const.Cardinality.UNARY_UNARY, - marznode.xray_api.proto.app.stats.command.command_pb2.GetStatsRequest, - marznode.xray_api.proto.app.stats.command.command_pb2.GetStatsResponse, + marznode.backends.xray.api.proto.app.stats.command.command_pb2.GetStatsRequest, + marznode.backends.xray.api.proto.app.stats.command.command_pb2.GetStatsResponse, ), '/xray.app.stats.command.StatsService/QueryStats': grpclib.const.Handler( self.QueryStats, grpclib.const.Cardinality.UNARY_UNARY, - marznode.xray_api.proto.app.stats.command.command_pb2.QueryStatsRequest, - marznode.xray_api.proto.app.stats.command.command_pb2.QueryStatsResponse, + marznode.backends.xray.api.proto.app.stats.command.command_pb2.QueryStatsRequest, + marznode.backends.xray.api.proto.app.stats.command.command_pb2.QueryStatsResponse, ), '/xray.app.stats.command.StatsService/GetSysStats': grpclib.const.Handler( self.GetSysStats, grpclib.const.Cardinality.UNARY_UNARY, - marznode.xray_api.proto.app.stats.command.command_pb2.SysStatsRequest, - marznode.xray_api.proto.app.stats.command.command_pb2.SysStatsResponse, + marznode.backends.xray.api.proto.app.stats.command.command_pb2.SysStatsRequest, + marznode.backends.xray.api.proto.app.stats.command.command_pb2.SysStatsResponse, ), } @@ -55,18 +55,18 @@ def __init__(self, channel: grpclib.client.Channel) -> None: self.GetStats = grpclib.client.UnaryUnaryMethod( channel, '/xray.app.stats.command.StatsService/GetStats', - marznode.xray_api.proto.app.stats.command.command_pb2.GetStatsRequest, - marznode.xray_api.proto.app.stats.command.command_pb2.GetStatsResponse, + marznode.backends.xray.api.proto.app.stats.command.command_pb2.GetStatsRequest, + marznode.backends.xray.api.proto.app.stats.command.command_pb2.GetStatsResponse, ) self.QueryStats = grpclib.client.UnaryUnaryMethod( channel, '/xray.app.stats.command.StatsService/QueryStats', - marznode.xray_api.proto.app.stats.command.command_pb2.QueryStatsRequest, - marznode.xray_api.proto.app.stats.command.command_pb2.QueryStatsResponse, + marznode.backends.xray.api.proto.app.stats.command.command_pb2.QueryStatsRequest, + marznode.backends.xray.api.proto.app.stats.command.command_pb2.QueryStatsResponse, ) self.GetSysStats = grpclib.client.UnaryUnaryMethod( channel, '/xray.app.stats.command.StatsService/GetSysStats', - marznode.xray_api.proto.app.stats.command.command_pb2.SysStatsRequest, - marznode.xray_api.proto.app.stats.command.command_pb2.SysStatsResponse, + marznode.backends.xray.api.proto.app.stats.command.command_pb2.SysStatsRequest, + marznode.backends.xray.api.proto.app.stats.command.command_pb2.SysStatsResponse, ) diff --git a/marznode/xray_api/proto/app/stats/command/command_pb2.py b/marznode/backends/xray/api/proto/app/stats/command/command_pb2.py similarity index 99% rename from marznode/xray_api/proto/app/stats/command/command_pb2.py rename to marznode/backends/xray/api/proto/app/stats/command/command_pb2.py index 6c0c1ee..5574a40 100644 --- a/marznode/xray_api/proto/app/stats/command/command_pb2.py +++ b/marznode/backends/xray/api/proto/app/stats/command/command_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: app/stats/command/command.proto -# Protobuf Python Version: 4.25.0 +# Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool diff --git a/marznode/xray_api/proto/app/stats/config_grpc.py b/marznode/backends/xray/api/proto/app/stats/config_grpc.py similarity index 100% rename from marznode/xray_api/proto/app/stats/config_grpc.py rename to marznode/backends/xray/api/proto/app/stats/config_grpc.py diff --git a/marznode/xray_api/proto/app/stats/config_pb2.py b/marznode/backends/xray/api/proto/app/stats/config_pb2.py similarity index 97% rename from marznode/xray_api/proto/app/stats/config_pb2.py rename to marznode/backends/xray/api/proto/app/stats/config_pb2.py index 6a0c65d..99c964d 100644 --- a/marznode/xray_api/proto/app/stats/config_pb2.py +++ b/marznode/backends/xray/api/proto/app/stats/config_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: app/stats/config.proto -# Protobuf Python Version: 4.25.0 +# Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool diff --git a/marznode/backends/xray/api/proto/common/__init__.py b/marznode/backends/xray/api/proto/common/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/marznode/backends/xray/api/proto/common/log/__init__.py b/marznode/backends/xray/api/proto/common/log/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/marznode/xray_api/proto/common/log/log_grpc.py b/marznode/backends/xray/api/proto/common/log/log_grpc.py similarity index 100% rename from marznode/xray_api/proto/common/log/log_grpc.py rename to marznode/backends/xray/api/proto/common/log/log_grpc.py diff --git a/marznode/xray_api/proto/common/log/log_pb2.py b/marznode/backends/xray/api/proto/common/log/log_pb2.py similarity index 97% rename from marznode/xray_api/proto/common/log/log_pb2.py rename to marznode/backends/xray/api/proto/common/log/log_pb2.py index 846b927..9f8e5f3 100644 --- a/marznode/xray_api/proto/common/log/log_pb2.py +++ b/marznode/backends/xray/api/proto/common/log/log_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: common/log/log.proto -# Protobuf Python Version: 4.25.0 +# Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool diff --git a/marznode/backends/xray/api/proto/common/net/__init__.py b/marznode/backends/xray/api/proto/common/net/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/marznode/xray_api/proto/common/net/address_grpc.py b/marznode/backends/xray/api/proto/common/net/address_grpc.py similarity index 100% rename from marznode/xray_api/proto/common/net/address_grpc.py rename to marznode/backends/xray/api/proto/common/net/address_grpc.py diff --git a/marznode/xray_api/proto/common/net/address_pb2.py b/marznode/backends/xray/api/proto/common/net/address_pb2.py similarity index 97% rename from marznode/xray_api/proto/common/net/address_pb2.py rename to marznode/backends/xray/api/proto/common/net/address_pb2.py index 9ff6741..2f451da 100644 --- a/marznode/xray_api/proto/common/net/address_pb2.py +++ b/marznode/backends/xray/api/proto/common/net/address_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: common/net/address.proto -# Protobuf Python Version: 4.25.0 +# Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool diff --git a/marznode/xray_api/proto/common/net/destination_grpc.py b/marznode/backends/xray/api/proto/common/net/destination_grpc.py similarity index 100% rename from marznode/xray_api/proto/common/net/destination_grpc.py rename to marznode/backends/xray/api/proto/common/net/destination_grpc.py diff --git a/marznode/xray_api/proto/common/net/destination_pb2.py b/marznode/backends/xray/api/proto/common/net/destination_pb2.py similarity index 86% rename from marznode/xray_api/proto/common/net/destination_pb2.py rename to marznode/backends/xray/api/proto/common/net/destination_pb2.py index d490cdc..984022c 100644 --- a/marznode/xray_api/proto/common/net/destination_pb2.py +++ b/marznode/backends/xray/api/proto/common/net/destination_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: common/net/destination.proto -# Protobuf Python Version: 4.25.0 +# Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool @@ -12,8 +12,8 @@ _sym_db = _symbol_database.Default() -from marznode.xray_api.proto.common.net import network_pb2 as common_dot_net_dot_network__pb2 -from marznode.xray_api.proto.common.net import address_pb2 as common_dot_net_dot_address__pb2 +from marznode.backends.xray.api.proto.common.net import network_pb2 as common_dot_net_dot_network__pb2 +from marznode.backends.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') diff --git a/marznode/xray_api/proto/common/net/network_grpc.py b/marznode/backends/xray/api/proto/common/net/network_grpc.py similarity index 100% rename from marznode/xray_api/proto/common/net/network_grpc.py rename to marznode/backends/xray/api/proto/common/net/network_grpc.py diff --git a/marznode/xray_api/proto/common/net/network_pb2.py b/marznode/backends/xray/api/proto/common/net/network_pb2.py similarity index 98% rename from marznode/xray_api/proto/common/net/network_pb2.py rename to marznode/backends/xray/api/proto/common/net/network_pb2.py index 149f2cd..934933c 100644 --- a/marznode/xray_api/proto/common/net/network_pb2.py +++ b/marznode/backends/xray/api/proto/common/net/network_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: common/net/network.proto -# Protobuf Python Version: 4.25.0 +# Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool diff --git a/marznode/xray_api/proto/common/net/port_grpc.py b/marznode/backends/xray/api/proto/common/net/port_grpc.py similarity index 100% rename from marznode/xray_api/proto/common/net/port_grpc.py rename to marznode/backends/xray/api/proto/common/net/port_grpc.py diff --git a/marznode/xray_api/proto/common/net/port_pb2.py b/marznode/backends/xray/api/proto/common/net/port_pb2.py similarity index 97% rename from marznode/xray_api/proto/common/net/port_pb2.py rename to marznode/backends/xray/api/proto/common/net/port_pb2.py index 584d03a..7f69361 100644 --- a/marznode/xray_api/proto/common/net/port_pb2.py +++ b/marznode/backends/xray/api/proto/common/net/port_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: common/net/port.proto -# Protobuf Python Version: 4.25.0 +# Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool diff --git a/marznode/backends/xray/api/proto/common/protocol/__init__.py b/marznode/backends/xray/api/proto/common/protocol/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/marznode/xray_api/proto/common/protocol/headers_grpc.py b/marznode/backends/xray/api/proto/common/protocol/headers_grpc.py similarity index 100% rename from marznode/xray_api/proto/common/protocol/headers_grpc.py rename to marznode/backends/xray/api/proto/common/protocol/headers_grpc.py diff --git a/marznode/xray_api/proto/common/protocol/headers_pb2.py b/marznode/backends/xray/api/proto/common/protocol/headers_pb2.py similarity index 98% rename from marznode/xray_api/proto/common/protocol/headers_pb2.py rename to marznode/backends/xray/api/proto/common/protocol/headers_pb2.py index 6dbf0a0..3d5d94a 100644 --- a/marznode/xray_api/proto/common/protocol/headers_pb2.py +++ b/marznode/backends/xray/api/proto/common/protocol/headers_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: common/protocol/headers.proto -# Protobuf Python Version: 4.25.0 +# Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool diff --git a/marznode/xray_api/proto/common/protocol/server_spec_grpc.py b/marznode/backends/xray/api/proto/common/protocol/server_spec_grpc.py similarity index 100% rename from marznode/xray_api/proto/common/protocol/server_spec_grpc.py rename to marznode/backends/xray/api/proto/common/protocol/server_spec_grpc.py diff --git a/marznode/xray_api/proto/common/protocol/server_spec_pb2.py b/marznode/backends/xray/api/proto/common/protocol/server_spec_pb2.py similarity index 86% rename from marznode/xray_api/proto/common/protocol/server_spec_pb2.py rename to marznode/backends/xray/api/proto/common/protocol/server_spec_pb2.py index 1d0c0d1..02e77f3 100644 --- a/marznode/xray_api/proto/common/protocol/server_spec_pb2.py +++ b/marznode/backends/xray/api/proto/common/protocol/server_spec_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: common/protocol/server_spec.proto -# Protobuf Python Version: 4.25.0 +# Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool @@ -12,8 +12,8 @@ _sym_db = _symbol_database.Default() -from marznode.xray_api.proto.common.net import address_pb2 as common_dot_net_dot_address__pb2 -from marznode.xray_api.proto.common.protocol import user_pb2 as common_dot_protocol_dot_user__pb2 +from marznode.backends.xray.api.proto.common.net import address_pb2 as common_dot_net_dot_address__pb2 +from marznode.backends.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') diff --git a/marznode/xray_api/proto/common/protocol/user_grpc.py b/marznode/backends/xray/api/proto/common/protocol/user_grpc.py similarity index 100% rename from marznode/xray_api/proto/common/protocol/user_grpc.py rename to marznode/backends/xray/api/proto/common/protocol/user_grpc.py diff --git a/marznode/xray_api/proto/common/protocol/user_pb2.py b/marznode/backends/xray/api/proto/common/protocol/user_pb2.py similarity index 90% rename from marznode/xray_api/proto/common/protocol/user_pb2.py rename to marznode/backends/xray/api/proto/common/protocol/user_pb2.py index 0616de5..092cea9 100644 --- a/marznode/xray_api/proto/common/protocol/user_pb2.py +++ b/marznode/backends/xray/api/proto/common/protocol/user_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: common/protocol/user.proto -# Protobuf Python Version: 4.25.0 +# Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool @@ -12,7 +12,7 @@ _sym_db = _symbol_database.Default() -from marznode.xray_api.proto.common.serial import typed_message_pb2 as common_dot_serial_dot_typed__message__pb2 +from marznode.backends.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') diff --git a/marznode/backends/xray/api/proto/common/serial/__init__.py b/marznode/backends/xray/api/proto/common/serial/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/marznode/xray_api/proto/common/serial/typed_message_grpc.py b/marznode/backends/xray/api/proto/common/serial/typed_message_grpc.py similarity index 100% rename from marznode/xray_api/proto/common/serial/typed_message_grpc.py rename to marznode/backends/xray/api/proto/common/serial/typed_message_grpc.py diff --git a/marznode/xray_api/proto/common/serial/typed_message_pb2.py b/marznode/backends/xray/api/proto/common/serial/typed_message_pb2.py similarity index 97% rename from marznode/xray_api/proto/common/serial/typed_message_pb2.py rename to marznode/backends/xray/api/proto/common/serial/typed_message_pb2.py index db733e3..ef2ea54 100644 --- a/marznode/xray_api/proto/common/serial/typed_message_pb2.py +++ b/marznode/backends/xray/api/proto/common/serial/typed_message_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: common/serial/typed_message.proto -# Protobuf Python Version: 4.25.0 +# Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool diff --git a/marznode/xray_api/proto/compile.py b/marznode/backends/xray/api/proto/compile.py similarity index 50% rename from marznode/xray_api/proto/compile.py rename to marznode/backends/xray/api/proto/compile.py index ba23258..8d0009a 100755 --- a/marznode/xray_api/proto/compile.py +++ b/marznode/backends/xray/api/proto/compile.py @@ -22,39 +22,45 @@ def compile_proto_from_source(dist): # 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') + 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' + 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 = 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 = '' + 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) + 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'--grpclib_python_out={dist} ' + proto_files + command = ( + f"{sys.executable} -m grpc.tools.protoc " + f"-I={v2ray_dir} " + f"--python_out={dist} " + f"--grpclib_python_out={dist} " + proto_files + ) os.system(command) @@ -67,36 +73,42 @@ def fix_proto_imports(dist): parent_dir = curr_dir.parent imports = [] - for f in os.listdir('.'): - if os.path.isdir(f) and not f.startswith('__'): + for f in os.listdir("."): + if os.path.isdir(f) and not f.startswith("__"): imports.append(f) - new_imp = f'marznode.{parent_dir.name}.{curr_dir.name}.' + '{}' + # new_imp = f"marznode.{parent_dir.name}.{curr_dir.name}." + "{}" - for root, dirs, files in os.walk('.'): + for root, dirs, files in os.walk("."): for file in files: - if file == 'compile.py': + if file == "compile.py": continue if file.endswith(".py"): path = Path(root) / file - with open(path, 'r') as pyfile: + with open(path, "r") as pyfile: content = pyfile.read() for imp in imports: - content = re.sub(fr"^([^'\r\n]*){imp}([\s\.].*)$", - fr"\1marznode.{parent_dir.name}.{curr_dir.name}.{imp}\2", content, - flags=re.MULTILINE) - content = re.sub(fr"^(.*importlib\.import_module\(\'){imp}(.*)$", - fr"\1marznode.{parent_dir.name}.{curr_dir.name}.{imp}\2", content, - flags=re.MULTILINE) - - with open(path, 'w') as pyfile: + content = re.sub( + rf"^([^'\r\n]*){imp}([\s\.].*)$", + rf"\1marznode.backends.xray.{parent_dir.name}.{curr_dir.name}.{imp}\2", + content, + flags=re.MULTILINE, + ) + content = re.sub( + rf"^(.*importlib\.import_module\(\'){imp}(.*)$", + rf"\1marznode.backends.xray.{parent_dir.name}.{curr_dir.name}.{imp}\2", + content, + flags=re.MULTILINE, + ) + + with open(path, "w") as pyfile: pyfile.write(content) if __name__ == "__main__": print("Compiling source...") - compile_proto_from_source('.') + compile_proto_from_source(".") print("Fixing imports...") - fix_proto_imports('.') + fix_proto_imports(".") print("Done.") diff --git a/marznode/backends/xray/api/proto/core/__init__.py b/marznode/backends/xray/api/proto/core/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/marznode/xray_api/proto/core/config_grpc.py b/marznode/backends/xray/api/proto/core/config_grpc.py similarity index 100% rename from marznode/xray_api/proto/core/config_grpc.py rename to marznode/backends/xray/api/proto/core/config_grpc.py diff --git a/marznode/xray_api/proto/core/config_pb2.py b/marznode/backends/xray/api/proto/core/config_pb2.py similarity index 92% rename from marznode/xray_api/proto/core/config_pb2.py rename to marznode/backends/xray/api/proto/core/config_pb2.py index 584c2ac..6ca66e7 100644 --- a/marznode/xray_api/proto/core/config_pb2.py +++ b/marznode/backends/xray/api/proto/core/config_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: core/config.proto -# Protobuf Python Version: 4.25.0 +# Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool @@ -12,9 +12,9 @@ _sym_db = _symbol_database.Default() -from marznode.xray_api.proto.common.serial import typed_message_pb2 as common_dot_serial_dot_typed__message__pb2 +from marznode.backends.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('marznode.xray_api.proto.transport.global.config_pb2') +transport_dot_global_dot_config__pb2 = importlib.import_module('marznode.backends.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') diff --git a/marznode/backends/xray/api/proto/proxy/__init__.py b/marznode/backends/xray/api/proto/proxy/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/marznode/backends/xray/api/proto/proxy/blackhole/__init__.py b/marznode/backends/xray/api/proto/proxy/blackhole/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/marznode/xray_api/proto/proxy/blackhole/config_grpc.py b/marznode/backends/xray/api/proto/proxy/blackhole/config_grpc.py similarity index 100% rename from marznode/xray_api/proto/proxy/blackhole/config_grpc.py rename to marznode/backends/xray/api/proto/proxy/blackhole/config_grpc.py diff --git a/marznode/xray_api/proto/proxy/blackhole/config_pb2.py b/marznode/backends/xray/api/proto/proxy/blackhole/config_pb2.py similarity index 91% rename from marznode/xray_api/proto/proxy/blackhole/config_pb2.py rename to marznode/backends/xray/api/proto/proxy/blackhole/config_pb2.py index c1eefd3..bcc0869 100644 --- a/marznode/xray_api/proto/proxy/blackhole/config_pb2.py +++ b/marznode/backends/xray/api/proto/proxy/blackhole/config_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: proxy/blackhole/config.proto -# Protobuf Python Version: 4.25.0 +# Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool @@ -12,7 +12,7 @@ _sym_db = _symbol_database.Default() -from marznode.xray_api.proto.common.serial import typed_message_pb2 as common_dot_serial_dot_typed__message__pb2 +from marznode.backends.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') diff --git a/marznode/backends/xray/api/proto/proxy/dns/__init__.py b/marznode/backends/xray/api/proto/proxy/dns/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/marznode/xray_api/proto/proxy/dns/config_grpc.py b/marznode/backends/xray/api/proto/proxy/dns/config_grpc.py similarity index 100% rename from marznode/xray_api/proto/proxy/dns/config_grpc.py rename to marznode/backends/xray/api/proto/proxy/dns/config_grpc.py diff --git a/marznode/xray_api/proto/proxy/dns/config_pb2.py b/marznode/backends/xray/api/proto/proxy/dns/config_pb2.py similarity index 90% rename from marznode/xray_api/proto/proxy/dns/config_pb2.py rename to marznode/backends/xray/api/proto/proxy/dns/config_pb2.py index a3b6560..9cb07f1 100644 --- a/marznode/xray_api/proto/proxy/dns/config_pb2.py +++ b/marznode/backends/xray/api/proto/proxy/dns/config_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: proxy/dns/config.proto -# Protobuf Python Version: 4.25.0 +# Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool @@ -12,7 +12,7 @@ _sym_db = _symbol_database.Default() -from marznode.xray_api.proto.common.net import destination_pb2 as common_dot_net_dot_destination__pb2 +from marznode.backends.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\"]\n\x06\x43onfig\x12)\n\x06server\x18\x01 \x01(\x0b\x32\x19.xray.common.net.Endpoint\x12\x12\n\nuser_level\x18\x02 \x01(\r\x12\x14\n\x0cnon_IP_query\x18\x03 \x01(\tBL\n\x12\x63om.xray.proxy.dnsP\x01Z#github.com/xtls/xray-core/proxy/dns\xaa\x02\x0eXray.Proxy.Dnsb\x06proto3') diff --git a/marznode/backends/xray/api/proto/proxy/dokodemo/__init__.py b/marznode/backends/xray/api/proto/proxy/dokodemo/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/marznode/xray_api/proto/proxy/dokodemo/config_grpc.py b/marznode/backends/xray/api/proto/proxy/dokodemo/config_grpc.py similarity index 100% rename from marznode/xray_api/proto/proxy/dokodemo/config_grpc.py rename to marznode/backends/xray/api/proto/proxy/dokodemo/config_grpc.py diff --git a/marznode/xray_api/proto/proxy/dokodemo/config_pb2.py b/marznode/backends/xray/api/proto/proxy/dokodemo/config_pb2.py similarity index 89% rename from marznode/xray_api/proto/proxy/dokodemo/config_pb2.py rename to marznode/backends/xray/api/proto/proxy/dokodemo/config_pb2.py index da97b14..bee1a18 100644 --- a/marznode/xray_api/proto/proxy/dokodemo/config_pb2.py +++ b/marznode/backends/xray/api/proto/proxy/dokodemo/config_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: proxy/dokodemo/config.proto -# Protobuf Python Version: 4.25.0 +# Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool @@ -12,8 +12,8 @@ _sym_db = _symbol_database.Default() -from marznode.xray_api.proto.common.net import address_pb2 as common_dot_net_dot_address__pb2 -from marznode.xray_api.proto.common.net import network_pb2 as common_dot_net_dot_network__pb2 +from marznode.backends.xray.api.proto.common.net import address_pb2 as common_dot_net_dot_address__pb2 +from marznode.backends.xray.api.proto.common.net import network_pb2 as common_dot_net_dot_network__pb2 DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1bproxy/dokodemo/config.proto\x12\x13xray.proxy.dokodemo\x1a\x18\x63ommon/net/address.proto\x1a\x18\x63ommon/net/network.proto\"\xea\x01\n\x06\x43onfig\x12,\n\x07\x61\x64\x64ress\x18\x01 \x01(\x0b\x32\x1b.xray.common.net.IPOrDomain\x12\x0c\n\x04port\x18\x02 \x01(\r\x12\x36\n\x0cnetwork_list\x18\x03 \x01(\x0b\x32\x1c.xray.common.net.NetworkListB\x02\x18\x01\x12*\n\x08networks\x18\x07 \x03(\x0e\x32\x18.xray.common.net.Network\x12\x13\n\x07timeout\x18\x04 \x01(\rB\x02\x18\x01\x12\x17\n\x0f\x66ollow_redirect\x18\x05 \x01(\x08\x12\x12\n\nuser_level\x18\x06 \x01(\rB[\n\x17\x63om.xray.proxy.dokodemoP\x01Z(github.com/xtls/xray-core/proxy/dokodemo\xaa\x02\x13Xray.Proxy.Dokodemob\x06proto3') diff --git a/marznode/backends/xray/api/proto/proxy/freedom/__init__.py b/marznode/backends/xray/api/proto/proxy/freedom/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/marznode/xray_api/proto/proxy/freedom/config_grpc.py b/marznode/backends/xray/api/proto/proxy/freedom/config_grpc.py similarity index 100% rename from marznode/xray_api/proto/proxy/freedom/config_grpc.py rename to marznode/backends/xray/api/proto/proxy/freedom/config_grpc.py diff --git a/marznode/xray_api/proto/proxy/freedom/config_pb2.py b/marznode/backends/xray/api/proto/proxy/freedom/config_pb2.py similarity index 69% rename from marznode/xray_api/proto/proxy/freedom/config_pb2.py rename to marznode/backends/xray/api/proto/proxy/freedom/config_pb2.py index f359d10..6c154e5 100644 --- a/marznode/xray_api/proto/proxy/freedom/config_pb2.py +++ b/marznode/backends/xray/api/proto/proxy/freedom/config_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: proxy/freedom/config.proto -# Protobuf Python Version: 4.25.0 +# Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool @@ -12,10 +12,10 @@ _sym_db = _symbol_database.Default() -from marznode.xray_api.proto.common.protocol import server_spec_pb2 as common_dot_protocol_dot_server__spec__pb2 +from marznode.backends.xray.api.proto.common.protocol import server_spec_pb2 as common_dot_protocol_dot_server__spec__pb2 -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1aproxy/freedom/config.proto\x12\x12xray.proxy.freedom\x1a!common/protocol/server_spec.proto\"K\n\x13\x44\x65stinationOverride\x12\x34\n\x06server\x18\x01 \x01(\x0b\x32$.xray.common.protocol.ServerEndpoint\"\x88\x01\n\x08\x46ragment\x12\x14\n\x0cpackets_from\x18\x01 \x01(\x04\x12\x12\n\npackets_to\x18\x02 \x01(\x04\x12\x12\n\nlength_min\x18\x03 \x01(\x04\x12\x12\n\nlength_max\x18\x04 \x01(\x04\x12\x14\n\x0cinterval_min\x18\x05 \x01(\x04\x12\x14\n\x0cinterval_max\x18\x06 \x01(\x04\"\x98\x03\n\x06\x43onfig\x12\x42\n\x0f\x64omain_strategy\x18\x01 \x01(\x0e\x32).xray.proxy.freedom.Config.DomainStrategy\x12\x13\n\x07timeout\x18\x02 \x01(\rB\x02\x18\x01\x12\x45\n\x14\x64\x65stination_override\x18\x03 \x01(\x0b\x32\'.xray.proxy.freedom.DestinationOverride\x12\x12\n\nuser_level\x18\x04 \x01(\r\x12.\n\x08\x66ragment\x18\x05 \x01(\x0b\x32\x1c.xray.proxy.freedom.Fragment\"\xa9\x01\n\x0e\x44omainStrategy\x12\t\n\x05\x41S_IS\x10\x00\x12\n\n\x06USE_IP\x10\x01\x12\x0b\n\x07USE_IP4\x10\x02\x12\x0b\n\x07USE_IP6\x10\x03\x12\x0c\n\x08USE_IP46\x10\x04\x12\x0c\n\x08USE_IP64\x10\x05\x12\x0c\n\x08\x46ORCE_IP\x10\x06\x12\r\n\tFORCE_IP4\x10\x07\x12\r\n\tFORCE_IP6\x10\x08\x12\x0e\n\nFORCE_IP46\x10\t\x12\x0e\n\nFORCE_IP64\x10\nBX\n\x16\x63om.xray.proxy.freedomP\x01Z\'github.com/xtls/xray-core/proxy/freedom\xaa\x02\x12Xray.Proxy.Freedomb\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1aproxy/freedom/config.proto\x12\x12xray.proxy.freedom\x1a!common/protocol/server_spec.proto\"K\n\x13\x44\x65stinationOverride\x12\x34\n\x06server\x18\x01 \x01(\x0b\x32$.xray.common.protocol.ServerEndpoint\"\x88\x01\n\x08\x46ragment\x12\x14\n\x0cpackets_from\x18\x01 \x01(\x04\x12\x12\n\npackets_to\x18\x02 \x01(\x04\x12\x12\n\nlength_min\x18\x03 \x01(\x04\x12\x12\n\nlength_max\x18\x04 \x01(\x04\x12\x14\n\x0cinterval_min\x18\x05 \x01(\x04\x12\x14\n\x0cinterval_max\x18\x06 \x01(\x04\"\xb0\x03\n\x06\x43onfig\x12\x42\n\x0f\x64omain_strategy\x18\x01 \x01(\x0e\x32).xray.proxy.freedom.Config.DomainStrategy\x12\x13\n\x07timeout\x18\x02 \x01(\rB\x02\x18\x01\x12\x45\n\x14\x64\x65stination_override\x18\x03 \x01(\x0b\x32\'.xray.proxy.freedom.DestinationOverride\x12\x12\n\nuser_level\x18\x04 \x01(\r\x12.\n\x08\x66ragment\x18\x05 \x01(\x0b\x32\x1c.xray.proxy.freedom.Fragment\x12\x16\n\x0eproxy_protocol\x18\x06 \x01(\r\"\xa9\x01\n\x0e\x44omainStrategy\x12\t\n\x05\x41S_IS\x10\x00\x12\n\n\x06USE_IP\x10\x01\x12\x0b\n\x07USE_IP4\x10\x02\x12\x0b\n\x07USE_IP6\x10\x03\x12\x0c\n\x08USE_IP46\x10\x04\x12\x0c\n\x08USE_IP64\x10\x05\x12\x0c\n\x08\x46ORCE_IP\x10\x06\x12\r\n\tFORCE_IP4\x10\x07\x12\r\n\tFORCE_IP6\x10\x08\x12\x0e\n\nFORCE_IP46\x10\t\x12\x0e\n\nFORCE_IP64\x10\nBX\n\x16\x63om.xray.proxy.freedomP\x01Z\'github.com/xtls/xray-core/proxy/freedom\xaa\x02\x12Xray.Proxy.Freedomb\x06proto3') _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) @@ -30,7 +30,7 @@ _globals['_FRAGMENT']._serialized_start=163 _globals['_FRAGMENT']._serialized_end=299 _globals['_CONFIG']._serialized_start=302 - _globals['_CONFIG']._serialized_end=710 - _globals['_CONFIG_DOMAINSTRATEGY']._serialized_start=541 - _globals['_CONFIG_DOMAINSTRATEGY']._serialized_end=710 + _globals['_CONFIG']._serialized_end=734 + _globals['_CONFIG_DOMAINSTRATEGY']._serialized_start=565 + _globals['_CONFIG_DOMAINSTRATEGY']._serialized_end=734 # @@protoc_insertion_point(module_scope) diff --git a/marznode/backends/xray/api/proto/proxy/http/__init__.py b/marznode/backends/xray/api/proto/proxy/http/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/marznode/xray_api/proto/proxy/http/config_grpc.py b/marznode/backends/xray/api/proto/proxy/http/config_grpc.py similarity index 100% rename from marznode/xray_api/proto/proxy/http/config_grpc.py rename to marznode/backends/xray/api/proto/proxy/http/config_grpc.py diff --git a/marznode/xray_api/proto/proxy/http/config_pb2.py b/marznode/backends/xray/api/proto/proxy/http/config_pb2.py similarity index 94% rename from marznode/xray_api/proto/proxy/http/config_pb2.py rename to marznode/backends/xray/api/proto/proxy/http/config_pb2.py index e33b77d..c3230d2 100644 --- a/marznode/xray_api/proto/proxy/http/config_pb2.py +++ b/marznode/backends/xray/api/proto/proxy/http/config_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: proxy/http/config.proto -# Protobuf Python Version: 4.25.0 +# Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool @@ -12,7 +12,7 @@ _sym_db = _symbol_database.Default() -from marznode.xray_api.proto.common.protocol import server_spec_pb2 as common_dot_protocol_dot_server__spec__pb2 +from marznode.backends.xray.api.proto.common.protocol import server_spec_pb2 as common_dot_protocol_dot_server__spec__pb2 DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x17proxy/http/config.proto\x12\x0fxray.proxy.http\x1a!common/protocol/server_spec.proto\"-\n\x07\x41\x63\x63ount\x12\x10\n\x08username\x18\x01 \x01(\t\x12\x10\n\x08password\x18\x02 \x01(\t\"\xc2\x01\n\x0cServerConfig\x12\x13\n\x07timeout\x18\x01 \x01(\rB\x02\x18\x01\x12=\n\x08\x61\x63\x63ounts\x18\x02 \x03(\x0b\x32+.xray.proxy.http.ServerConfig.AccountsEntry\x12\x19\n\x11\x61llow_transparent\x18\x03 \x01(\x08\x12\x12\n\nuser_level\x18\x04 \x01(\r\x1a/\n\rAccountsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"$\n\x06Header\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t\"m\n\x0c\x43lientConfig\x12\x34\n\x06server\x18\x01 \x03(\x0b\x32$.xray.common.protocol.ServerEndpoint\x12\'\n\x06header\x18\x02 \x03(\x0b\x32\x17.xray.proxy.http.HeaderBO\n\x13\x63om.xray.proxy.httpP\x01Z$github.com/xtls/xray-core/proxy/http\xaa\x02\x0fXray.Proxy.Httpb\x06proto3') diff --git a/marznode/backends/xray/api/proto/proxy/loopback/__init__.py b/marznode/backends/xray/api/proto/proxy/loopback/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/marznode/xray_api/proto/proxy/loopback/config_grpc.py b/marznode/backends/xray/api/proto/proxy/loopback/config_grpc.py similarity index 100% rename from marznode/xray_api/proto/proxy/loopback/config_grpc.py rename to marznode/backends/xray/api/proto/proxy/loopback/config_grpc.py diff --git a/marznode/xray_api/proto/proxy/loopback/config_pb2.py b/marznode/backends/xray/api/proto/proxy/loopback/config_pb2.py similarity index 97% rename from marznode/xray_api/proto/proxy/loopback/config_pb2.py rename to marznode/backends/xray/api/proto/proxy/loopback/config_pb2.py index 2f21c5b..c94a932 100644 --- a/marznode/xray_api/proto/proxy/loopback/config_pb2.py +++ b/marznode/backends/xray/api/proto/proxy/loopback/config_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: proxy/loopback/config.proto -# Protobuf Python Version: 4.25.0 +# Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool diff --git a/marznode/backends/xray/api/proto/proxy/shadowsocks/__init__.py b/marznode/backends/xray/api/proto/proxy/shadowsocks/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/marznode/xray_api/proto/proxy/shadowsocks/config_grpc.py b/marznode/backends/xray/api/proto/proxy/shadowsocks/config_grpc.py similarity index 100% rename from marznode/xray_api/proto/proxy/shadowsocks/config_grpc.py rename to marznode/backends/xray/api/proto/proxy/shadowsocks/config_grpc.py diff --git a/marznode/xray_api/proto/proxy/shadowsocks/config_pb2.py b/marznode/backends/xray/api/proto/proxy/shadowsocks/config_pb2.py similarity index 86% rename from marznode/xray_api/proto/proxy/shadowsocks/config_pb2.py rename to marznode/backends/xray/api/proto/proxy/shadowsocks/config_pb2.py index d4ef5f7..5120456 100644 --- a/marznode/xray_api/proto/proxy/shadowsocks/config_pb2.py +++ b/marznode/backends/xray/api/proto/proxy/shadowsocks/config_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: proxy/shadowsocks/config.proto -# Protobuf Python Version: 4.25.0 +# Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool @@ -12,9 +12,9 @@ _sym_db = _symbol_database.Default() -from marznode.xray_api.proto.common.net import network_pb2 as common_dot_net_dot_network__pb2 -from marznode.xray_api.proto.common.protocol import user_pb2 as common_dot_protocol_dot_user__pb2 -from marznode.xray_api.proto.common.protocol import server_spec_pb2 as common_dot_protocol_dot_server__spec__pb2 +from marznode.backends.xray.api.proto.common.net import network_pb2 as common_dot_net_dot_network__pb2 +from marznode.backends.xray.api.proto.common.protocol import user_pb2 as common_dot_protocol_dot_user__pb2 +from marznode.backends.xray.api.proto.common.protocol import server_spec_pb2 as common_dot_protocol_dot_server__spec__pb2 DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1eproxy/shadowsocks/config.proto\x12\x16xray.proxy.shadowsocks\x1a\x18\x63ommon/net/network.proto\x1a\x1a\x63ommon/protocol/user.proto\x1a!common/protocol/server_spec.proto\"f\n\x07\x41\x63\x63ount\x12\x10\n\x08password\x18\x01 \x01(\t\x12\x37\n\x0b\x63ipher_type\x18\x02 \x01(\x0e\x32\".xray.proxy.shadowsocks.CipherType\x12\x10\n\x08iv_check\x18\x03 \x01(\x08\"d\n\x0cServerConfig\x12)\n\x05users\x18\x01 \x03(\x0b\x32\x1a.xray.common.protocol.User\x12)\n\x07network\x18\x02 \x03(\x0e\x32\x18.xray.common.net.Network\"D\n\x0c\x43lientConfig\x12\x34\n\x06server\x18\x01 \x03(\x0b\x32$.xray.common.protocol.ServerEndpoint*t\n\nCipherType\x12\x0b\n\x07UNKNOWN\x10\x00\x12\x0f\n\x0b\x41\x45S_128_GCM\x10\x05\x12\x0f\n\x0b\x41\x45S_256_GCM\x10\x06\x12\x15\n\x11\x43HACHA20_POLY1305\x10\x07\x12\x16\n\x12XCHACHA20_POLY1305\x10\x08\x12\x08\n\x04NONE\x10\tBd\n\x1a\x63om.xray.proxy.shadowsocksP\x01Z+github.com/xtls/xray-core/proxy/shadowsocks\xaa\x02\x16Xray.Proxy.Shadowsocksb\x06proto3') diff --git a/marznode/backends/xray/api/proto/proxy/shadowsocks_2022/__init__.py b/marznode/backends/xray/api/proto/proxy/shadowsocks_2022/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/marznode/xray_api/proto/proxy/shadowsocks_2022/config_grpc.py b/marznode/backends/xray/api/proto/proxy/shadowsocks_2022/config_grpc.py similarity index 100% rename from marznode/xray_api/proto/proxy/shadowsocks_2022/config_grpc.py rename to marznode/backends/xray/api/proto/proxy/shadowsocks_2022/config_grpc.py diff --git a/marznode/xray_api/proto/proxy/shadowsocks_2022/config_pb2.py b/marznode/backends/xray/api/proto/proxy/shadowsocks_2022/config_pb2.py similarity index 93% rename from marznode/xray_api/proto/proxy/shadowsocks_2022/config_pb2.py rename to marznode/backends/xray/api/proto/proxy/shadowsocks_2022/config_pb2.py index 8a04ab5..20ec8e9 100644 --- a/marznode/xray_api/proto/proxy/shadowsocks_2022/config_pb2.py +++ b/marznode/backends/xray/api/proto/proxy/shadowsocks_2022/config_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: proxy/shadowsocks_2022/config.proto -# Protobuf Python Version: 4.25.0 +# Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool @@ -12,8 +12,8 @@ _sym_db = _symbol_database.Default() -from marznode.xray_api.proto.common.net import network_pb2 as common_dot_net_dot_network__pb2 -from marznode.xray_api.proto.common.net import address_pb2 as common_dot_net_dot_address__pb2 +from marznode.backends.xray.api.proto.common.net import network_pb2 as common_dot_net_dot_network__pb2 +from marznode.backends.xray.api.proto.common.net import address_pb2 as common_dot_net_dot_address__pb2 DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n#proxy/shadowsocks_2022/config.proto\x12\x1bxray.proxy.shadowsocks_2022\x1a\x18\x63ommon/net/network.proto\x1a\x18\x63ommon/net/address.proto\"t\n\x0cServerConfig\x12\x0e\n\x06method\x18\x01 \x01(\t\x12\x0b\n\x03key\x18\x02 \x01(\t\x12\r\n\x05\x65mail\x18\x03 \x01(\t\x12\r\n\x05level\x18\x04 \x01(\x05\x12)\n\x07network\x18\x05 \x03(\x0e\x32\x18.xray.common.net.Network\"\x91\x01\n\x15MultiUserServerConfig\x12\x0e\n\x06method\x18\x01 \x01(\t\x12\x0b\n\x03key\x18\x02 \x01(\t\x12\x30\n\x05users\x18\x03 \x03(\x0b\x32!.xray.proxy.shadowsocks_2022.User\x12)\n\x07network\x18\x04 \x03(\x0e\x32\x18.xray.common.net.Network\"y\n\x10RelayDestination\x12\x0b\n\x03key\x18\x01 \x01(\t\x12,\n\x07\x61\x64\x64ress\x18\x02 \x01(\x0b\x32\x1b.xray.common.net.IPOrDomain\x12\x0c\n\x04port\x18\x03 \x01(\r\x12\r\n\x05\x65mail\x18\x04 \x01(\t\x12\r\n\x05level\x18\x05 \x01(\x05\"\xa0\x01\n\x11RelayServerConfig\x12\x0e\n\x06method\x18\x01 \x01(\t\x12\x0b\n\x03key\x18\x02 \x01(\t\x12\x43\n\x0c\x64\x65stinations\x18\x03 \x03(\x0b\x32-.xray.proxy.shadowsocks_2022.RelayDestination\x12)\n\x07network\x18\x04 \x03(\x0e\x32\x18.xray.common.net.Network\"1\n\x04User\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05\x65mail\x18\x02 \x01(\t\x12\r\n\x05level\x18\x03 \x01(\x05\"\x9b\x01\n\x0c\x43lientConfig\x12,\n\x07\x61\x64\x64ress\x18\x01 \x01(\x0b\x32\x1b.xray.common.net.IPOrDomain\x12\x0c\n\x04port\x18\x02 \x01(\r\x12\x0e\n\x06method\x18\x03 \x01(\t\x12\x0b\n\x03key\x18\x04 \x01(\t\x12\x14\n\x0cudp_over_tcp\x18\x05 \x01(\x08\x12\x1c\n\x14udp_over_tcp_version\x18\x06 \x01(\rBr\n\x1f\x63om.xray.proxy.shadowsocks_2022P\x01Z0github.com/xtls/xray-core/proxy/shadowsocks_2022\xaa\x02\x1aXray.Proxy.Shadowsocks2022b\x06proto3') diff --git a/marznode/backends/xray/api/proto/proxy/socks/__init__.py b/marznode/backends/xray/api/proto/proxy/socks/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/marznode/xray_api/proto/proxy/socks/config_grpc.py b/marznode/backends/xray/api/proto/proxy/socks/config_grpc.py similarity index 100% rename from marznode/xray_api/proto/proxy/socks/config_grpc.py rename to marznode/backends/xray/api/proto/proxy/socks/config_grpc.py diff --git a/marznode/xray_api/proto/proxy/socks/config_pb2.py b/marznode/backends/xray/api/proto/proxy/socks/config_pb2.py similarity index 92% rename from marznode/xray_api/proto/proxy/socks/config_pb2.py rename to marznode/backends/xray/api/proto/proxy/socks/config_pb2.py index 11b8d77..756fa1b 100644 --- a/marznode/xray_api/proto/proxy/socks/config_pb2.py +++ b/marznode/backends/xray/api/proto/proxy/socks/config_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: proxy/socks/config.proto -# Protobuf Python Version: 4.25.0 +# Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool @@ -12,8 +12,8 @@ _sym_db = _symbol_database.Default() -from marznode.xray_api.proto.common.net import address_pb2 as common_dot_net_dot_address__pb2 -from marznode.xray_api.proto.common.protocol import server_spec_pb2 as common_dot_protocol_dot_server__spec__pb2 +from marznode.backends.xray.api.proto.common.net import address_pb2 as common_dot_net_dot_address__pb2 +from marznode.backends.xray.api.proto.common.protocol import server_spec_pb2 as common_dot_protocol_dot_server__spec__pb2 DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x18proxy/socks/config.proto\x12\x10xray.proxy.socks\x1a\x18\x63ommon/net/address.proto\x1a!common/protocol/server_spec.proto\"-\n\x07\x41\x63\x63ount\x12\x10\n\x08username\x18\x01 \x01(\t\x12\x10\n\x08password\x18\x02 \x01(\t\"\x9a\x02\n\x0cServerConfig\x12-\n\tauth_type\x18\x01 \x01(\x0e\x32\x1a.xray.proxy.socks.AuthType\x12>\n\x08\x61\x63\x63ounts\x18\x02 \x03(\x0b\x32,.xray.proxy.socks.ServerConfig.AccountsEntry\x12,\n\x07\x61\x64\x64ress\x18\x03 \x01(\x0b\x32\x1b.xray.common.net.IPOrDomain\x12\x13\n\x0budp_enabled\x18\x04 \x01(\x08\x12\x13\n\x07timeout\x18\x05 \x01(\rB\x02\x18\x01\x12\x12\n\nuser_level\x18\x06 \x01(\r\x1a/\n\rAccountsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"p\n\x0c\x43lientConfig\x12\x34\n\x06server\x18\x01 \x03(\x0b\x32$.xray.common.protocol.ServerEndpoint\x12*\n\x07version\x18\x02 \x01(\x0e\x32\x19.xray.proxy.socks.Version*%\n\x08\x41uthType\x12\x0b\n\x07NO_AUTH\x10\x00\x12\x0c\n\x08PASSWORD\x10\x01*.\n\x07Version\x12\n\n\x06SOCKS5\x10\x00\x12\n\n\x06SOCKS4\x10\x01\x12\x0b\n\x07SOCKS4A\x10\x02\x42R\n\x14\x63om.xray.proxy.socksP\x01Z%github.com/xtls/xray-core/proxy/socks\xaa\x02\x10Xray.Proxy.Socksb\x06proto3') diff --git a/marznode/backends/xray/api/proto/proxy/trojan/__init__.py b/marznode/backends/xray/api/proto/proxy/trojan/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/marznode/xray_api/proto/proxy/trojan/config_grpc.py b/marznode/backends/xray/api/proto/proxy/trojan/config_grpc.py similarity index 100% rename from marznode/xray_api/proto/proxy/trojan/config_grpc.py rename to marznode/backends/xray/api/proto/proxy/trojan/config_grpc.py diff --git a/marznode/xray_api/proto/proxy/trojan/config_pb2.py b/marznode/backends/xray/api/proto/proxy/trojan/config_pb2.py similarity index 89% rename from marznode/xray_api/proto/proxy/trojan/config_pb2.py rename to marznode/backends/xray/api/proto/proxy/trojan/config_pb2.py index 82b0001..a45c89c 100644 --- a/marznode/xray_api/proto/proxy/trojan/config_pb2.py +++ b/marznode/backends/xray/api/proto/proxy/trojan/config_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: proxy/trojan/config.proto -# Protobuf Python Version: 4.25.0 +# Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool @@ -12,8 +12,8 @@ _sym_db = _symbol_database.Default() -from marznode.xray_api.proto.common.protocol import user_pb2 as common_dot_protocol_dot_user__pb2 -from marznode.xray_api.proto.common.protocol import server_spec_pb2 as common_dot_protocol_dot_server__spec__pb2 +from marznode.backends.xray.api.proto.common.protocol import user_pb2 as common_dot_protocol_dot_user__pb2 +from marznode.backends.xray.api.proto.common.protocol import server_spec_pb2 as common_dot_protocol_dot_server__spec__pb2 DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x19proxy/trojan/config.proto\x12\x11xray.proxy.trojan\x1a\x1a\x63ommon/protocol/user.proto\x1a!common/protocol/server_spec.proto\"\x1b\n\x07\x41\x63\x63ount\x12\x10\n\x08password\x18\x01 \x01(\t\"^\n\x08\x46\x61llback\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0c\n\x04\x61lpn\x18\x02 \x01(\t\x12\x0c\n\x04path\x18\x03 \x01(\t\x12\x0c\n\x04type\x18\x04 \x01(\t\x12\x0c\n\x04\x64\x65st\x18\x05 \x01(\t\x12\x0c\n\x04xver\x18\x06 \x01(\x04\"D\n\x0c\x43lientConfig\x12\x34\n\x06server\x18\x01 \x03(\x0b\x32$.xray.common.protocol.ServerEndpoint\"i\n\x0cServerConfig\x12)\n\x05users\x18\x01 \x03(\x0b\x32\x1a.xray.common.protocol.User\x12.\n\tfallbacks\x18\x02 \x03(\x0b\x32\x1b.xray.proxy.trojan.FallbackBU\n\x15\x63om.xray.proxy.trojanP\x01Z&github.com/xtls/xray-core/proxy/trojan\xaa\x02\x11Xray.Proxy.Trojanb\x06proto3') diff --git a/marznode/backends/xray/api/proto/proxy/vless/__init__.py b/marznode/backends/xray/api/proto/proxy/vless/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/marznode/xray_api/proto/proxy/vless/account_grpc.py b/marznode/backends/xray/api/proto/proxy/vless/account_grpc.py similarity index 100% rename from marznode/xray_api/proto/proxy/vless/account_grpc.py rename to marznode/backends/xray/api/proto/proxy/vless/account_grpc.py diff --git a/marznode/xray_api/proto/proxy/vless/account_pb2.py b/marznode/backends/xray/api/proto/proxy/vless/account_pb2.py similarity index 97% rename from marznode/xray_api/proto/proxy/vless/account_pb2.py rename to marznode/backends/xray/api/proto/proxy/vless/account_pb2.py index c82a02c..98649d2 100644 --- a/marznode/xray_api/proto/proxy/vless/account_pb2.py +++ b/marznode/backends/xray/api/proto/proxy/vless/account_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: proxy/vless/account.proto -# Protobuf Python Version: 4.25.0 +# Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool diff --git a/marznode/backends/xray/api/proto/proxy/vless/encoding/__init__.py b/marznode/backends/xray/api/proto/proxy/vless/encoding/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/marznode/xray_api/proto/proxy/vless/encoding/addons_grpc.py b/marznode/backends/xray/api/proto/proxy/vless/encoding/addons_grpc.py similarity index 100% rename from marznode/xray_api/proto/proxy/vless/encoding/addons_grpc.py rename to marznode/backends/xray/api/proto/proxy/vless/encoding/addons_grpc.py diff --git a/marznode/xray_api/proto/proxy/vless/encoding/addons_pb2.py b/marznode/backends/xray/api/proto/proxy/vless/encoding/addons_pb2.py similarity index 97% rename from marznode/xray_api/proto/proxy/vless/encoding/addons_pb2.py rename to marznode/backends/xray/api/proto/proxy/vless/encoding/addons_pb2.py index e9e5ccc..b1a167f 100644 --- a/marznode/xray_api/proto/proxy/vless/encoding/addons_pb2.py +++ b/marznode/backends/xray/api/proto/proxy/vless/encoding/addons_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: proxy/vless/encoding/addons.proto -# Protobuf Python Version: 4.25.0 +# Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool diff --git a/marznode/backends/xray/api/proto/proxy/vless/inbound/__init__.py b/marznode/backends/xray/api/proto/proxy/vless/inbound/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/marznode/xray_api/proto/proxy/vless/inbound/config_grpc.py b/marznode/backends/xray/api/proto/proxy/vless/inbound/config_grpc.py similarity index 100% rename from marznode/xray_api/proto/proxy/vless/inbound/config_grpc.py rename to marznode/backends/xray/api/proto/proxy/vless/inbound/config_grpc.py diff --git a/marznode/xray_api/proto/proxy/vless/inbound/config_pb2.py b/marznode/backends/xray/api/proto/proxy/vless/inbound/config_pb2.py similarity index 93% rename from marznode/xray_api/proto/proxy/vless/inbound/config_pb2.py rename to marznode/backends/xray/api/proto/proxy/vless/inbound/config_pb2.py index 418e3ce..4dc6aac 100644 --- a/marznode/xray_api/proto/proxy/vless/inbound/config_pb2.py +++ b/marznode/backends/xray/api/proto/proxy/vless/inbound/config_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: proxy/vless/inbound/config.proto -# Protobuf Python Version: 4.25.0 +# Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool @@ -12,7 +12,7 @@ _sym_db = _symbol_database.Default() -from marznode.xray_api.proto.common.protocol import user_pb2 as common_dot_protocol_dot_user__pb2 +from marznode.backends.xray.api.proto.common.protocol import user_pb2 as common_dot_protocol_dot_user__pb2 DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n proxy/vless/inbound/config.proto\x12\x18xray.proxy.vless.inbound\x1a\x1a\x63ommon/protocol/user.proto\"^\n\x08\x46\x61llback\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0c\n\x04\x61lpn\x18\x02 \x01(\t\x12\x0c\n\x04path\x18\x03 \x01(\t\x12\x0c\n\x04type\x18\x04 \x01(\t\x12\x0c\n\x04\x64\x65st\x18\x05 \x01(\t\x12\x0c\n\x04xver\x18\x06 \x01(\x04\"\x80\x01\n\x06\x43onfig\x12+\n\x07\x63lients\x18\x01 \x03(\x0b\x32\x1a.xray.common.protocol.User\x12\x12\n\ndecryption\x18\x02 \x01(\t\x12\x35\n\tfallbacks\x18\x03 \x03(\x0b\x32\".xray.proxy.vless.inbound.FallbackBj\n\x1c\x63om.xray.proxy.vless.inboundP\x01Z-github.aaakk.us.kg/xtls/xray-core/proxy/vless/inbound\xaa\x02\x18Xray.Proxy.Vless.Inboundb\x06proto3') diff --git a/marznode/backends/xray/api/proto/proxy/vless/outbound/__init__.py b/marznode/backends/xray/api/proto/proxy/vless/outbound/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/marznode/xray_api/proto/proxy/vless/outbound/config_grpc.py b/marznode/backends/xray/api/proto/proxy/vless/outbound/config_grpc.py similarity index 100% rename from marznode/xray_api/proto/proxy/vless/outbound/config_grpc.py rename to marznode/backends/xray/api/proto/proxy/vless/outbound/config_grpc.py diff --git a/marznode/xray_api/proto/proxy/vless/outbound/config_pb2.py b/marznode/backends/xray/api/proto/proxy/vless/outbound/config_pb2.py similarity index 90% rename from marznode/xray_api/proto/proxy/vless/outbound/config_pb2.py rename to marznode/backends/xray/api/proto/proxy/vless/outbound/config_pb2.py index 8f628d8..2a03c67 100644 --- a/marznode/xray_api/proto/proxy/vless/outbound/config_pb2.py +++ b/marznode/backends/xray/api/proto/proxy/vless/outbound/config_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: proxy/vless/outbound/config.proto -# Protobuf Python Version: 4.25.0 +# Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool @@ -12,7 +12,7 @@ _sym_db = _symbol_database.Default() -from marznode.xray_api.proto.common.protocol import server_spec_pb2 as common_dot_protocol_dot_server__spec__pb2 +from marznode.backends.xray.api.proto.common.protocol import server_spec_pb2 as common_dot_protocol_dot_server__spec__pb2 DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n!proxy/vless/outbound/config.proto\x12\x19xray.proxy.vless.outbound\x1a!common/protocol/server_spec.proto\"=\n\x06\x43onfig\x12\x33\n\x05vnext\x18\x01 \x03(\x0b\x32$.xray.common.protocol.ServerEndpointBm\n\x1d\x63om.xray.proxy.vless.outboundP\x01Z.github.com/xtls/xray-core/proxy/vless/outbound\xaa\x02\x19Xray.Proxy.Vless.Outboundb\x06proto3') diff --git a/marznode/backends/xray/api/proto/proxy/vmess/__init__.py b/marznode/backends/xray/api/proto/proxy/vmess/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/marznode/xray_api/proto/proxy/vmess/account_grpc.py b/marznode/backends/xray/api/proto/proxy/vmess/account_grpc.py similarity index 100% rename from marznode/xray_api/proto/proxy/vmess/account_grpc.py rename to marznode/backends/xray/api/proto/proxy/vmess/account_grpc.py diff --git a/marznode/xray_api/proto/proxy/vmess/account_pb2.py b/marznode/backends/xray/api/proto/proxy/vmess/account_pb2.py similarity index 90% rename from marznode/xray_api/proto/proxy/vmess/account_pb2.py rename to marznode/backends/xray/api/proto/proxy/vmess/account_pb2.py index 7382544..ebd5529 100644 --- a/marznode/xray_api/proto/proxy/vmess/account_pb2.py +++ b/marznode/backends/xray/api/proto/proxy/vmess/account_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: proxy/vmess/account.proto -# Protobuf Python Version: 4.25.0 +# Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool @@ -12,7 +12,7 @@ _sym_db = _symbol_database.Default() -from marznode.xray_api.proto.common.protocol import headers_pb2 as common_dot_protocol_dot_headers__pb2 +from marznode.backends.xray.api.proto.common.protocol import headers_pb2 as common_dot_protocol_dot_headers__pb2 DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x19proxy/vmess/account.proto\x12\x10xray.proxy.vmess\x1a\x1d\x63ommon/protocol/headers.proto\"m\n\x07\x41\x63\x63ount\x12\n\n\x02id\x18\x01 \x01(\t\x12?\n\x11security_settings\x18\x03 \x01(\x0b\x32$.xray.common.protocol.SecurityConfig\x12\x15\n\rtests_enabled\x18\x04 \x01(\tBR\n\x14\x63om.xray.proxy.vmessP\x01Z%github.com/xtls/xray-core/proxy/vmess\xaa\x02\x10Xray.Proxy.Vmessb\x06proto3') diff --git a/marznode/backends/xray/api/proto/proxy/vmess/inbound/__init__.py b/marznode/backends/xray/api/proto/proxy/vmess/inbound/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/marznode/xray_api/proto/proxy/vmess/inbound/config_grpc.py b/marznode/backends/xray/api/proto/proxy/vmess/inbound/config_grpc.py similarity index 100% rename from marznode/xray_api/proto/proxy/vmess/inbound/config_grpc.py rename to marznode/backends/xray/api/proto/proxy/vmess/inbound/config_grpc.py diff --git a/marznode/xray_api/proto/proxy/vmess/inbound/config_pb2.py b/marznode/backends/xray/api/proto/proxy/vmess/inbound/config_pb2.py similarity index 93% rename from marznode/xray_api/proto/proxy/vmess/inbound/config_pb2.py rename to marznode/backends/xray/api/proto/proxy/vmess/inbound/config_pb2.py index 9f8a06f..cc93763 100644 --- a/marznode/xray_api/proto/proxy/vmess/inbound/config_pb2.py +++ b/marznode/backends/xray/api/proto/proxy/vmess/inbound/config_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: proxy/vmess/inbound/config.proto -# Protobuf Python Version: 4.25.0 +# Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool @@ -12,7 +12,7 @@ _sym_db = _symbol_database.Default() -from marznode.xray_api.proto.common.protocol import user_pb2 as common_dot_protocol_dot_user__pb2 +from marznode.backends.xray.api.proto.common.protocol import user_pb2 as common_dot_protocol_dot_user__pb2 DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n proxy/vmess/inbound/config.proto\x12\x18xray.proxy.vmess.inbound\x1a\x1a\x63ommon/protocol/user.proto\"\x1a\n\x0c\x44\x65tourConfig\x12\n\n\x02to\x18\x01 \x01(\t\"\x1e\n\rDefaultConfig\x12\r\n\x05level\x18\x02 \x01(\r\"\xa4\x01\n\x06\x43onfig\x12(\n\x04user\x18\x01 \x03(\x0b\x32\x1a.xray.common.protocol.User\x12\x38\n\x07\x64\x65\x66\x61ult\x18\x02 \x01(\x0b\x32\'.xray.proxy.vmess.inbound.DefaultConfig\x12\x36\n\x06\x64\x65tour\x18\x03 \x01(\x0b\x32&.xray.proxy.vmess.inbound.DetourConfigBj\n\x1c\x63om.xray.proxy.vmess.inboundP\x01Z-github.aaakk.us.kg/xtls/xray-core/proxy/vmess/inbound\xaa\x02\x18Xray.Proxy.Vmess.Inboundb\x06proto3') diff --git a/marznode/backends/xray/api/proto/proxy/vmess/outbound/__init__.py b/marznode/backends/xray/api/proto/proxy/vmess/outbound/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/marznode/xray_api/proto/proxy/vmess/outbound/config_grpc.py b/marznode/backends/xray/api/proto/proxy/vmess/outbound/config_grpc.py similarity index 100% rename from marznode/xray_api/proto/proxy/vmess/outbound/config_grpc.py rename to marznode/backends/xray/api/proto/proxy/vmess/outbound/config_grpc.py diff --git a/marznode/xray_api/proto/proxy/vmess/outbound/config_pb2.py b/marznode/backends/xray/api/proto/proxy/vmess/outbound/config_pb2.py similarity index 90% rename from marznode/xray_api/proto/proxy/vmess/outbound/config_pb2.py rename to marznode/backends/xray/api/proto/proxy/vmess/outbound/config_pb2.py index 8585a42..f8277c1 100644 --- a/marznode/xray_api/proto/proxy/vmess/outbound/config_pb2.py +++ b/marznode/backends/xray/api/proto/proxy/vmess/outbound/config_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: proxy/vmess/outbound/config.proto -# Protobuf Python Version: 4.25.0 +# Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool @@ -12,7 +12,7 @@ _sym_db = _symbol_database.Default() -from marznode.xray_api.proto.common.protocol import server_spec_pb2 as common_dot_protocol_dot_server__spec__pb2 +from marznode.backends.xray.api.proto.common.protocol import server_spec_pb2 as common_dot_protocol_dot_server__spec__pb2 DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n!proxy/vmess/outbound/config.proto\x12\x19xray.proxy.vmess.outbound\x1a!common/protocol/server_spec.proto\"@\n\x06\x43onfig\x12\x36\n\x08Receiver\x18\x01 \x03(\x0b\x32$.xray.common.protocol.ServerEndpointBm\n\x1d\x63om.xray.proxy.vmess.outboundP\x01Z.github.com/xtls/xray-core/proxy/vmess/outbound\xaa\x02\x19Xray.Proxy.Vmess.Outboundb\x06proto3') diff --git a/marznode/backends/xray/api/proto/proxy/wireguard/__init__.py b/marznode/backends/xray/api/proto/proxy/wireguard/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/marznode/xray_api/proto/proxy/wireguard/config_grpc.py b/marznode/backends/xray/api/proto/proxy/wireguard/config_grpc.py similarity index 100% rename from marznode/xray_api/proto/proxy/wireguard/config_grpc.py rename to marznode/backends/xray/api/proto/proxy/wireguard/config_grpc.py diff --git a/marznode/xray_api/proto/proxy/wireguard/config_pb2.py b/marznode/backends/xray/api/proto/proxy/wireguard/config_pb2.py similarity index 98% rename from marznode/xray_api/proto/proxy/wireguard/config_pb2.py rename to marznode/backends/xray/api/proto/proxy/wireguard/config_pb2.py index a692590..b1708b0 100644 --- a/marznode/xray_api/proto/proxy/wireguard/config_pb2.py +++ b/marznode/backends/xray/api/proto/proxy/wireguard/config_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: proxy/wireguard/config.proto -# Protobuf Python Version: 4.25.0 +# Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool diff --git a/marznode/backends/xray/api/proto/transport/__init__.py b/marznode/backends/xray/api/proto/transport/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/marznode/backends/xray/api/proto/transport/global/__init__.py b/marznode/backends/xray/api/proto/transport/global/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/marznode/xray_api/proto/transport/global/config_grpc.py b/marznode/backends/xray/api/proto/transport/global/config_grpc.py similarity index 100% rename from marznode/xray_api/proto/transport/global/config_grpc.py rename to marznode/backends/xray/api/proto/transport/global/config_grpc.py diff --git a/marznode/xray_api/proto/transport/global/config_pb2.py b/marznode/backends/xray/api/proto/transport/global/config_pb2.py similarity index 91% rename from marznode/xray_api/proto/transport/global/config_pb2.py rename to marznode/backends/xray/api/proto/transport/global/config_pb2.py index 00718bf..f024110 100644 --- a/marznode/xray_api/proto/transport/global/config_pb2.py +++ b/marznode/backends/xray/api/proto/transport/global/config_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: transport/global/config.proto -# Protobuf Python Version: 4.25.0 +# Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool @@ -12,7 +12,7 @@ _sym_db = _symbol_database.Default() -from marznode.xray_api.proto.transport.internet import config_pb2 as transport_dot_internet_dot_config__pb2 +from marznode.backends.xray.api.proto.transport.internet import config_pb2 as transport_dot_internet_dot_config__pb2 DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1dtransport/global/config.proto\x12\x0exray.transport\x1a\x1ftransport/internet/config.proto\"R\n\x06\x43onfig\x12\x44\n\x12transport_settings\x18\x01 \x03(\x0b\x32(.xray.transport.internet.TransportConfig:\x02\x18\x01\x42\x61\n\x19\x63om.xray.transport.globalP\x01Z*github.com/xtls/xray-core/transport/global\xaa\x02\x15Xray.Transport.Globalb\x06proto3') diff --git a/marznode/backends/xray/api/proto/transport/internet/__init__.py b/marznode/backends/xray/api/proto/transport/internet/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/marznode/xray_api/proto/transport/internet/config_grpc.py b/marznode/backends/xray/api/proto/transport/internet/config_grpc.py similarity index 100% rename from marznode/xray_api/proto/transport/internet/config_grpc.py rename to marznode/backends/xray/api/proto/transport/internet/config_grpc.py diff --git a/marznode/xray_api/proto/transport/internet/config_pb2.py b/marznode/backends/xray/api/proto/transport/internet/config_pb2.py similarity index 96% rename from marznode/xray_api/proto/transport/internet/config_pb2.py rename to marznode/backends/xray/api/proto/transport/internet/config_pb2.py index 3b45bfa..75e29ad 100644 --- a/marznode/xray_api/proto/transport/internet/config_pb2.py +++ b/marznode/backends/xray/api/proto/transport/internet/config_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: transport/internet/config.proto -# Protobuf Python Version: 4.25.0 +# Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool @@ -12,7 +12,7 @@ _sym_db = _symbol_database.Default() -from marznode.xray_api.proto.common.serial import typed_message_pb2 as common_dot_serial_dot_typed__message__pb2 +from marznode.backends.xray.api.proto.common.serial import typed_message_pb2 as common_dot_serial_dot_typed__message__pb2 DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1ftransport/internet/config.proto\x12\x17xray.transport.internet\x1a!common/serial/typed_message.proto\"\x9e\x01\n\x0fTransportConfig\x12@\n\x08protocol\x18\x01 \x01(\x0e\x32*.xray.transport.internet.TransportProtocolB\x02\x18\x01\x12\x15\n\rprotocol_name\x18\x03 \x01(\t\x12\x32\n\x08settings\x18\x02 \x01(\x0b\x32 .xray.common.serial.TypedMessage\"\xc1\x02\n\x0cStreamConfig\x12@\n\x08protocol\x18\x01 \x01(\x0e\x32*.xray.transport.internet.TransportProtocolB\x02\x18\x01\x12\x15\n\rprotocol_name\x18\x05 \x01(\t\x12\x44\n\x12transport_settings\x18\x02 \x03(\x0b\x32(.xray.transport.internet.TransportConfig\x12\x15\n\rsecurity_type\x18\x03 \x01(\t\x12;\n\x11security_settings\x18\x04 \x03(\x0b\x32 .xray.common.serial.TypedMessage\x12>\n\x0fsocket_settings\x18\x06 \x01(\x0b\x32%.xray.transport.internet.SocketConfig\"7\n\x0bProxyConfig\x12\x0b\n\x03tag\x18\x01 \x01(\t\x12\x1b\n\x13transportLayerProxy\x18\x02 \x01(\x08\"\xce\x04\n\x0cSocketConfig\x12\x0c\n\x04mark\x18\x01 \x01(\x05\x12\x0b\n\x03tfo\x18\x02 \x01(\x05\x12@\n\x06tproxy\x18\x03 \x01(\x0e\x32\x30.xray.transport.internet.SocketConfig.TProxyMode\x12%\n\x1dreceive_original_dest_address\x18\x04 \x01(\x08\x12\x14\n\x0c\x62ind_address\x18\x05 \x01(\x0c\x12\x11\n\tbind_port\x18\x06 \x01(\r\x12\x1d\n\x15\x61\x63\x63\x65pt_proxy_protocol\x18\x07 \x01(\x08\x12@\n\x0f\x64omain_strategy\x18\x08 \x01(\x0e\x32\'.xray.transport.internet.DomainStrategy\x12\x14\n\x0c\x64ialer_proxy\x18\t \x01(\t\x12\x1f\n\x17tcp_keep_alive_interval\x18\n \x01(\x05\x12\x1b\n\x13tcp_keep_alive_idle\x18\x0b \x01(\x05\x12\x16\n\x0etcp_congestion\x18\x0c \x01(\t\x12\x11\n\tinterface\x18\r \x01(\t\x12\x0e\n\x06v6only\x18\x0e \x01(\x08\x12\x18\n\x10tcp_window_clamp\x18\x0f \x01(\x05\x12\x18\n\x10tcp_user_timeout\x18\x10 \x01(\x05\x12\x13\n\x0btcp_max_seg\x18\x11 \x01(\x05\x12\x14\n\x0ctcp_no_delay\x18\x12 \x01(\x08\x12\x11\n\ttcp_mptcp\x18\x13 \x01(\x08\"/\n\nTProxyMode\x12\x07\n\x03Off\x10\x00\x12\n\n\x06TProxy\x10\x01\x12\x0c\n\x08Redirect\x10\x02*Z\n\x11TransportProtocol\x12\x07\n\x03TCP\x10\x00\x12\x07\n\x03UDP\x10\x01\x12\x08\n\x04MKCP\x10\x02\x12\r\n\tWebSocket\x10\x03\x12\x08\n\x04HTTP\x10\x04\x12\x10\n\x0c\x44omainSocket\x10\x05*\xa9\x01\n\x0e\x44omainStrategy\x12\t\n\x05\x41S_IS\x10\x00\x12\n\n\x06USE_IP\x10\x01\x12\x0b\n\x07USE_IP4\x10\x02\x12\x0b\n\x07USE_IP6\x10\x03\x12\x0c\n\x08USE_IP46\x10\x04\x12\x0c\n\x08USE_IP64\x10\x05\x12\x0c\n\x08\x46ORCE_IP\x10\x06\x12\r\n\tFORCE_IP4\x10\x07\x12\r\n\tFORCE_IP6\x10\x08\x12\x0e\n\nFORCE_IP46\x10\t\x12\x0e\n\nFORCE_IP64\x10\nBg\n\x1b\x63om.xray.transport.internetP\x01Z,github.com/xtls/xray-core/transport/internet\xaa\x02\x17Xray.Transport.Internetb\x06proto3') diff --git a/marznode/backends/xray/api/proto/transport/internet/domainsocket/__init__.py b/marznode/backends/xray/api/proto/transport/internet/domainsocket/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/marznode/xray_api/proto/transport/internet/domainsocket/config_grpc.py b/marznode/backends/xray/api/proto/transport/internet/domainsocket/config_grpc.py similarity index 100% rename from marznode/xray_api/proto/transport/internet/domainsocket/config_grpc.py rename to marznode/backends/xray/api/proto/transport/internet/domainsocket/config_grpc.py diff --git a/marznode/xray_api/proto/transport/internet/domainsocket/config_pb2.py b/marznode/backends/xray/api/proto/transport/internet/domainsocket/config_pb2.py similarity index 97% rename from marznode/xray_api/proto/transport/internet/domainsocket/config_pb2.py rename to marznode/backends/xray/api/proto/transport/internet/domainsocket/config_pb2.py index 0f7e059..f25738b 100644 --- a/marznode/xray_api/proto/transport/internet/domainsocket/config_pb2.py +++ b/marznode/backends/xray/api/proto/transport/internet/domainsocket/config_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: transport/internet/domainsocket/config.proto -# Protobuf Python Version: 4.25.0 +# Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool diff --git a/marznode/backends/xray/api/proto/transport/internet/grpc/__init__.py b/marznode/backends/xray/api/proto/transport/internet/grpc/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/marznode/xray_api/proto/transport/internet/grpc/config_grpc.py b/marznode/backends/xray/api/proto/transport/internet/grpc/config_grpc.py similarity index 100% rename from marznode/xray_api/proto/transport/internet/grpc/config_grpc.py rename to marznode/backends/xray/api/proto/transport/internet/grpc/config_grpc.py diff --git a/marznode/xray_api/proto/transport/internet/grpc/config_pb2.py b/marznode/backends/xray/api/proto/transport/internet/grpc/config_pb2.py similarity index 66% rename from marznode/xray_api/proto/transport/internet/grpc/config_pb2.py rename to marznode/backends/xray/api/proto/transport/internet/grpc/config_pb2.py index ef1725f..d04d6f9 100644 --- a/marznode/xray_api/proto/transport/internet/grpc/config_pb2.py +++ b/marznode/backends/xray/api/proto/transport/internet/grpc/config_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: transport/internet/grpc/config.proto -# Protobuf Python Version: 4.25.0 +# Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool @@ -14,7 +14,7 @@ -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n$transport/internet/grpc/config.proto\x12%xray.transport.internet.grpc.encoding\"\xc5\x01\n\x06\x43onfig\x12\x0c\n\x04host\x18\x01 \x01(\t\x12\x14\n\x0cservice_name\x18\x02 \x01(\t\x12\x12\n\nmulti_mode\x18\x03 \x01(\x08\x12\x14\n\x0cidle_timeout\x18\x04 \x01(\x05\x12\x1c\n\x14health_check_timeout\x18\x05 \x01(\x05\x12\x1d\n\x15permit_without_stream\x18\x06 \x01(\x08\x12\x1c\n\x14initial_windows_size\x18\x07 \x01(\x05\x12\x12\n\nuser_agent\x18\x08 \x01(\tB3Z1github.com/xtls/xray-core/transport/internet/grpcb\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n$transport/internet/grpc/config.proto\x12%xray.transport.internet.grpc.encoding\"\xca\x01\n\x06\x43onfig\x12\x11\n\tauthority\x18\x01 \x01(\t\x12\x14\n\x0cservice_name\x18\x02 \x01(\t\x12\x12\n\nmulti_mode\x18\x03 \x01(\x08\x12\x14\n\x0cidle_timeout\x18\x04 \x01(\x05\x12\x1c\n\x14health_check_timeout\x18\x05 \x01(\x05\x12\x1d\n\x15permit_without_stream\x18\x06 \x01(\x08\x12\x1c\n\x14initial_windows_size\x18\x07 \x01(\x05\x12\x12\n\nuser_agent\x18\x08 \x01(\tB3Z1github.com/xtls/xray-core/transport/internet/grpcb\x06proto3') _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) @@ -23,5 +23,5 @@ _globals['DESCRIPTOR']._options = None _globals['DESCRIPTOR']._serialized_options = b'Z1github.com/xtls/xray-core/transport/internet/grpc' _globals['_CONFIG']._serialized_start=80 - _globals['_CONFIG']._serialized_end=277 + _globals['_CONFIG']._serialized_end=282 # @@protoc_insertion_point(module_scope) diff --git a/marznode/backends/xray/api/proto/transport/internet/grpc/encoding/__init__.py b/marznode/backends/xray/api/proto/transport/internet/grpc/encoding/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/marznode/xray_api/proto/transport/internet/grpc/encoding/stream_grpc.py b/marznode/backends/xray/api/proto/transport/internet/grpc/encoding/stream_grpc.py similarity index 64% rename from marznode/xray_api/proto/transport/internet/grpc/encoding/stream_grpc.py rename to marznode/backends/xray/api/proto/transport/internet/grpc/encoding/stream_grpc.py index 79d4d7c..9e5b134 100644 --- a/marznode/xray_api/proto/transport/internet/grpc/encoding/stream_grpc.py +++ b/marznode/backends/xray/api/proto/transport/internet/grpc/encoding/stream_grpc.py @@ -9,7 +9,7 @@ if typing.TYPE_CHECKING: import grpclib.server -import marznode.xray_api.proto.transport.internet.grpc.encoding.stream_pb2 +import marznode.backends.xray.api.proto.transport.internet.grpc.encoding.stream_pb2 class GRPCServiceBase(abc.ABC): @@ -27,14 +27,14 @@ def __mapping__(self) -> typing.Dict[str, grpclib.const.Handler]: '/xray.transport.internet.grpc.encoding.GRPCService/Tun': grpclib.const.Handler( self.Tun, grpclib.const.Cardinality.STREAM_STREAM, - marznode.xray_api.proto.transport.internet.grpc.encoding.stream_pb2.Hunk, - marznode.xray_api.proto.transport.internet.grpc.encoding.stream_pb2.Hunk, + marznode.backends.xray.api.proto.transport.internet.grpc.encoding.stream_pb2.Hunk, + marznode.backends.xray.api.proto.transport.internet.grpc.encoding.stream_pb2.Hunk, ), '/xray.transport.internet.grpc.encoding.GRPCService/TunMulti': grpclib.const.Handler( self.TunMulti, grpclib.const.Cardinality.STREAM_STREAM, - marznode.xray_api.proto.transport.internet.grpc.encoding.stream_pb2.MultiHunk, - marznode.xray_api.proto.transport.internet.grpc.encoding.stream_pb2.MultiHunk, + marznode.backends.xray.api.proto.transport.internet.grpc.encoding.stream_pb2.MultiHunk, + marznode.backends.xray.api.proto.transport.internet.grpc.encoding.stream_pb2.MultiHunk, ), } @@ -45,12 +45,12 @@ def __init__(self, channel: grpclib.client.Channel) -> None: self.Tun = grpclib.client.StreamStreamMethod( channel, '/xray.transport.internet.grpc.encoding.GRPCService/Tun', - marznode.xray_api.proto.transport.internet.grpc.encoding.stream_pb2.Hunk, - marznode.xray_api.proto.transport.internet.grpc.encoding.stream_pb2.Hunk, + marznode.backends.xray.api.proto.transport.internet.grpc.encoding.stream_pb2.Hunk, + marznode.backends.xray.api.proto.transport.internet.grpc.encoding.stream_pb2.Hunk, ) self.TunMulti = grpclib.client.StreamStreamMethod( channel, '/xray.transport.internet.grpc.encoding.GRPCService/TunMulti', - marznode.xray_api.proto.transport.internet.grpc.encoding.stream_pb2.MultiHunk, - marznode.xray_api.proto.transport.internet.grpc.encoding.stream_pb2.MultiHunk, + marznode.backends.xray.api.proto.transport.internet.grpc.encoding.stream_pb2.MultiHunk, + marznode.backends.xray.api.proto.transport.internet.grpc.encoding.stream_pb2.MultiHunk, ) diff --git a/marznode/xray_api/proto/transport/internet/grpc/encoding/stream_pb2.py b/marznode/backends/xray/api/proto/transport/internet/grpc/encoding/stream_pb2.py similarity index 98% rename from marznode/xray_api/proto/transport/internet/grpc/encoding/stream_pb2.py rename to marznode/backends/xray/api/proto/transport/internet/grpc/encoding/stream_pb2.py index 6d83f94..6e555f9 100644 --- a/marznode/xray_api/proto/transport/internet/grpc/encoding/stream_pb2.py +++ b/marznode/backends/xray/api/proto/transport/internet/grpc/encoding/stream_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: transport/internet/grpc/encoding/stream.proto -# Protobuf Python Version: 4.25.0 +# Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool diff --git a/marznode/backends/xray/api/proto/transport/internet/headers/__init__.py b/marznode/backends/xray/api/proto/transport/internet/headers/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/marznode/backends/xray/api/proto/transport/internet/headers/dns/__init__.py b/marznode/backends/xray/api/proto/transport/internet/headers/dns/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/marznode/xray_api/proto/transport/internet/headers/dns/config_grpc.py b/marznode/backends/xray/api/proto/transport/internet/headers/dns/config_grpc.py similarity index 100% rename from marznode/xray_api/proto/transport/internet/headers/dns/config_grpc.py rename to marznode/backends/xray/api/proto/transport/internet/headers/dns/config_grpc.py diff --git a/marznode/xray_api/proto/transport/internet/headers/dns/config_pb2.py b/marznode/backends/xray/api/proto/transport/internet/headers/dns/config_pb2.py similarity index 97% rename from marznode/xray_api/proto/transport/internet/headers/dns/config_pb2.py rename to marznode/backends/xray/api/proto/transport/internet/headers/dns/config_pb2.py index b3b987f..8567c85 100644 --- a/marznode/xray_api/proto/transport/internet/headers/dns/config_pb2.py +++ b/marznode/backends/xray/api/proto/transport/internet/headers/dns/config_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: transport/internet/headers/dns/config.proto -# Protobuf Python Version: 4.25.0 +# Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool diff --git a/marznode/backends/xray/api/proto/transport/internet/headers/http/__init__.py b/marznode/backends/xray/api/proto/transport/internet/headers/http/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/marznode/xray_api/proto/transport/internet/headers/http/config_grpc.py b/marznode/backends/xray/api/proto/transport/internet/headers/http/config_grpc.py similarity index 100% rename from marznode/xray_api/proto/transport/internet/headers/http/config_grpc.py rename to marznode/backends/xray/api/proto/transport/internet/headers/http/config_grpc.py diff --git a/marznode/xray_api/proto/transport/internet/headers/http/config_pb2.py b/marznode/backends/xray/api/proto/transport/internet/headers/http/config_pb2.py similarity index 98% rename from marznode/xray_api/proto/transport/internet/headers/http/config_pb2.py rename to marznode/backends/xray/api/proto/transport/internet/headers/http/config_pb2.py index 76fc820..7a4d66b 100644 --- a/marznode/xray_api/proto/transport/internet/headers/http/config_pb2.py +++ b/marznode/backends/xray/api/proto/transport/internet/headers/http/config_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: transport/internet/headers/http/config.proto -# Protobuf Python Version: 4.25.0 +# Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool diff --git a/marznode/backends/xray/api/proto/transport/internet/headers/noop/__init__.py b/marznode/backends/xray/api/proto/transport/internet/headers/noop/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/marznode/xray_api/proto/transport/internet/headers/noop/config_grpc.py b/marznode/backends/xray/api/proto/transport/internet/headers/noop/config_grpc.py similarity index 100% rename from marznode/xray_api/proto/transport/internet/headers/noop/config_grpc.py rename to marznode/backends/xray/api/proto/transport/internet/headers/noop/config_grpc.py diff --git a/marznode/xray_api/proto/transport/internet/headers/noop/config_pb2.py b/marznode/backends/xray/api/proto/transport/internet/headers/noop/config_pb2.py similarity index 97% rename from marznode/xray_api/proto/transport/internet/headers/noop/config_pb2.py rename to marznode/backends/xray/api/proto/transport/internet/headers/noop/config_pb2.py index 9c7dbb4..6134f8b 100644 --- a/marznode/xray_api/proto/transport/internet/headers/noop/config_pb2.py +++ b/marznode/backends/xray/api/proto/transport/internet/headers/noop/config_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: transport/internet/headers/noop/config.proto -# Protobuf Python Version: 4.25.0 +# Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool diff --git a/marznode/backends/xray/api/proto/transport/internet/headers/srtp/__init__.py b/marznode/backends/xray/api/proto/transport/internet/headers/srtp/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/marznode/xray_api/proto/transport/internet/headers/srtp/config_grpc.py b/marznode/backends/xray/api/proto/transport/internet/headers/srtp/config_grpc.py similarity index 100% rename from marznode/xray_api/proto/transport/internet/headers/srtp/config_grpc.py rename to marznode/backends/xray/api/proto/transport/internet/headers/srtp/config_grpc.py diff --git a/marznode/xray_api/proto/transport/internet/headers/srtp/config_pb2.py b/marznode/backends/xray/api/proto/transport/internet/headers/srtp/config_pb2.py similarity index 98% rename from marznode/xray_api/proto/transport/internet/headers/srtp/config_pb2.py rename to marznode/backends/xray/api/proto/transport/internet/headers/srtp/config_pb2.py index 766510e..69e791a 100644 --- a/marznode/xray_api/proto/transport/internet/headers/srtp/config_pb2.py +++ b/marznode/backends/xray/api/proto/transport/internet/headers/srtp/config_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: transport/internet/headers/srtp/config.proto -# Protobuf Python Version: 4.25.0 +# Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool diff --git a/marznode/backends/xray/api/proto/transport/internet/headers/tls/__init__.py b/marznode/backends/xray/api/proto/transport/internet/headers/tls/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/marznode/xray_api/proto/transport/internet/headers/tls/config_grpc.py b/marznode/backends/xray/api/proto/transport/internet/headers/tls/config_grpc.py similarity index 100% rename from marznode/xray_api/proto/transport/internet/headers/tls/config_grpc.py rename to marznode/backends/xray/api/proto/transport/internet/headers/tls/config_grpc.py diff --git a/marznode/xray_api/proto/transport/internet/headers/tls/config_pb2.py b/marznode/backends/xray/api/proto/transport/internet/headers/tls/config_pb2.py similarity index 97% rename from marznode/xray_api/proto/transport/internet/headers/tls/config_pb2.py rename to marznode/backends/xray/api/proto/transport/internet/headers/tls/config_pb2.py index e9fbee9..616e5ca 100644 --- a/marznode/xray_api/proto/transport/internet/headers/tls/config_pb2.py +++ b/marznode/backends/xray/api/proto/transport/internet/headers/tls/config_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: transport/internet/headers/tls/config.proto -# Protobuf Python Version: 4.25.0 +# Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool diff --git a/marznode/backends/xray/api/proto/transport/internet/headers/utp/__init__.py b/marznode/backends/xray/api/proto/transport/internet/headers/utp/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/marznode/xray_api/proto/transport/internet/headers/utp/config_grpc.py b/marznode/backends/xray/api/proto/transport/internet/headers/utp/config_grpc.py similarity index 100% rename from marznode/xray_api/proto/transport/internet/headers/utp/config_grpc.py rename to marznode/backends/xray/api/proto/transport/internet/headers/utp/config_grpc.py diff --git a/marznode/xray_api/proto/transport/internet/headers/utp/config_pb2.py b/marznode/backends/xray/api/proto/transport/internet/headers/utp/config_pb2.py similarity index 97% rename from marznode/xray_api/proto/transport/internet/headers/utp/config_pb2.py rename to marznode/backends/xray/api/proto/transport/internet/headers/utp/config_pb2.py index d45fa57..c794752 100644 --- a/marznode/xray_api/proto/transport/internet/headers/utp/config_pb2.py +++ b/marznode/backends/xray/api/proto/transport/internet/headers/utp/config_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: transport/internet/headers/utp/config.proto -# Protobuf Python Version: 4.25.0 +# Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool diff --git a/marznode/backends/xray/api/proto/transport/internet/headers/wechat/__init__.py b/marznode/backends/xray/api/proto/transport/internet/headers/wechat/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/marznode/xray_api/proto/transport/internet/headers/wechat/config_grpc.py b/marznode/backends/xray/api/proto/transport/internet/headers/wechat/config_grpc.py similarity index 100% rename from marznode/xray_api/proto/transport/internet/headers/wechat/config_grpc.py rename to marznode/backends/xray/api/proto/transport/internet/headers/wechat/config_grpc.py diff --git a/marznode/xray_api/proto/transport/internet/headers/wechat/config_pb2.py b/marznode/backends/xray/api/proto/transport/internet/headers/wechat/config_pb2.py similarity index 97% rename from marznode/xray_api/proto/transport/internet/headers/wechat/config_pb2.py rename to marznode/backends/xray/api/proto/transport/internet/headers/wechat/config_pb2.py index 8a3e4f3..2bc4814 100644 --- a/marznode/xray_api/proto/transport/internet/headers/wechat/config_pb2.py +++ b/marznode/backends/xray/api/proto/transport/internet/headers/wechat/config_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: transport/internet/headers/wechat/config.proto -# Protobuf Python Version: 4.25.0 +# Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool diff --git a/marznode/backends/xray/api/proto/transport/internet/headers/wireguard/__init__.py b/marznode/backends/xray/api/proto/transport/internet/headers/wireguard/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/marznode/xray_api/proto/transport/internet/headers/wireguard/config_grpc.py b/marznode/backends/xray/api/proto/transport/internet/headers/wireguard/config_grpc.py similarity index 100% rename from marznode/xray_api/proto/transport/internet/headers/wireguard/config_grpc.py rename to marznode/backends/xray/api/proto/transport/internet/headers/wireguard/config_grpc.py diff --git a/marznode/xray_api/proto/transport/internet/headers/wireguard/config_pb2.py b/marznode/backends/xray/api/proto/transport/internet/headers/wireguard/config_pb2.py similarity index 97% rename from marznode/xray_api/proto/transport/internet/headers/wireguard/config_pb2.py rename to marznode/backends/xray/api/proto/transport/internet/headers/wireguard/config_pb2.py index f9b646c..9829ccc 100644 --- a/marznode/xray_api/proto/transport/internet/headers/wireguard/config_pb2.py +++ b/marznode/backends/xray/api/proto/transport/internet/headers/wireguard/config_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: transport/internet/headers/wireguard/config.proto -# Protobuf Python Version: 4.25.0 +# Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool diff --git a/marznode/backends/xray/api/proto/transport/internet/http/__init__.py b/marznode/backends/xray/api/proto/transport/internet/http/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/marznode/xray_api/proto/transport/internet/http/config_grpc.py b/marznode/backends/xray/api/proto/transport/internet/http/config_grpc.py similarity index 100% rename from marznode/xray_api/proto/transport/internet/http/config_grpc.py rename to marznode/backends/xray/api/proto/transport/internet/http/config_grpc.py diff --git a/marznode/xray_api/proto/transport/internet/http/config_pb2.py b/marznode/backends/xray/api/proto/transport/internet/http/config_pb2.py similarity index 90% rename from marznode/xray_api/proto/transport/internet/http/config_pb2.py rename to marznode/backends/xray/api/proto/transport/internet/http/config_pb2.py index 6884e25..fe2d64c 100644 --- a/marznode/xray_api/proto/transport/internet/http/config_pb2.py +++ b/marznode/backends/xray/api/proto/transport/internet/http/config_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: transport/internet/http/config.proto -# Protobuf Python Version: 4.25.0 +# Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool @@ -12,7 +12,7 @@ _sym_db = _symbol_database.Default() -from marznode.xray_api.proto.transport.internet.headers.http import config_pb2 as transport_dot_internet_dot_headers_dot_http_dot_config__pb2 +from marznode.backends.xray.api.proto.transport.internet.headers.http import config_pb2 as transport_dot_internet_dot_headers_dot_http_dot_config__pb2 DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n$transport/internet/http/config.proto\x12\x1cxray.transport.internet.http\x1a,transport/internet/headers/http/config.proto\"\xa6\x01\n\x06\x43onfig\x12\x0c\n\x04host\x18\x01 \x03(\t\x12\x0c\n\x04path\x18\x02 \x01(\t\x12\x14\n\x0cidle_timeout\x18\x03 \x01(\x05\x12\x1c\n\x14health_check_timeout\x18\x04 \x01(\x05\x12\x0e\n\x06method\x18\x05 \x01(\t\x12<\n\x06header\x18\x06 \x03(\x0b\x32,.xray.transport.internet.headers.http.HeaderBv\n com.xray.transport.internet.httpP\x01Z1github.com/xtls/xray-core/transport/internet/http\xaa\x02\x1cXray.Transport.Internet.Httpb\x06proto3') diff --git a/marznode/backends/xray/api/proto/transport/internet/httpupgrade/config_grpc.py b/marznode/backends/xray/api/proto/transport/internet/httpupgrade/config_grpc.py new file mode 100644 index 0000000..937a12d --- /dev/null +++ b/marznode/backends/xray/api/proto/transport/internet/httpupgrade/config_grpc.py @@ -0,0 +1,3 @@ +# Generated by the Protocol Buffers compiler. DO NOT EDIT! +# source: transport/internet/httpupgrade/config.proto +# plugin: grpclib.plugin.main diff --git a/marznode/backends/xray/api/proto/transport/internet/httpupgrade/config_pb2.py b/marznode/backends/xray/api/proto/transport/internet/httpupgrade/config_pb2.py new file mode 100644 index 0000000..fbd8bb9 --- /dev/null +++ b/marznode/backends/xray/api/proto/transport/internet/httpupgrade/config_pb2.py @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: transport/internet/httpupgrade/config.proto +# Protobuf Python Version: 4.25.1 +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import symbol_database as _symbol_database +from google.protobuf.internal import builder as _builder +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n+transport/internet/httpupgrade/config.proto\x12#xray.transport.internet.httpupgrade\"I\n\x06\x43onfig\x12\x0c\n\x04path\x18\x02 \x01(\t\x12\x0c\n\x04host\x18\x03 \x01(\t\x12\x1d\n\x15\x61\x63\x63\x65pt_proxy_protocol\x18\x04 \x01(\x08J\x04\x08\x01\x10\x02\x42\x8b\x01\n\'com.xray.transport.internet.httpupgradeP\x01Z8github.com/xtls/xray-core/transport/internet/httpupgrade\xaa\x02#Xray.Transport.Internet.HttpUpgradeb\x06proto3') + +_globals = globals() +_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) +_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'transport.internet.httpupgrade.config_pb2', _globals) +if _descriptor._USE_C_DESCRIPTORS == False: + _globals['DESCRIPTOR']._options = None + _globals['DESCRIPTOR']._serialized_options = b'\n\'com.xray.transport.internet.httpupgradeP\001Z8github.com/xtls/xray-core/transport/internet/httpupgrade\252\002#Xray.Transport.Internet.HttpUpgrade' + _globals['_CONFIG']._serialized_start=84 + _globals['_CONFIG']._serialized_end=157 +# @@protoc_insertion_point(module_scope) diff --git a/marznode/backends/xray/api/proto/transport/internet/kcp/__init__.py b/marznode/backends/xray/api/proto/transport/internet/kcp/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/marznode/xray_api/proto/transport/internet/kcp/config_grpc.py b/marznode/backends/xray/api/proto/transport/internet/kcp/config_grpc.py similarity index 100% rename from marznode/xray_api/proto/transport/internet/kcp/config_grpc.py rename to marznode/backends/xray/api/proto/transport/internet/kcp/config_grpc.py diff --git a/marznode/xray_api/proto/transport/internet/kcp/config_pb2.py b/marznode/backends/xray/api/proto/transport/internet/kcp/config_pb2.py similarity index 95% rename from marznode/xray_api/proto/transport/internet/kcp/config_pb2.py rename to marznode/backends/xray/api/proto/transport/internet/kcp/config_pb2.py index 04acc75..b7d461a 100644 --- a/marznode/xray_api/proto/transport/internet/kcp/config_pb2.py +++ b/marznode/backends/xray/api/proto/transport/internet/kcp/config_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: transport/internet/kcp/config.proto -# Protobuf Python Version: 4.25.0 +# Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool @@ -12,7 +12,7 @@ _sym_db = _symbol_database.Default() -from marznode.xray_api.proto.common.serial import typed_message_pb2 as common_dot_serial_dot_typed__message__pb2 +from marznode.backends.xray.api.proto.common.serial import typed_message_pb2 as common_dot_serial_dot_typed__message__pb2 DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n#transport/internet/kcp/config.proto\x12\x1bxray.transport.internet.kcp\x1a!common/serial/typed_message.proto\"\x14\n\x03MTU\x12\r\n\x05value\x18\x01 \x01(\r\"\x14\n\x03TTI\x12\r\n\x05value\x18\x01 \x01(\r\"\x1f\n\x0eUplinkCapacity\x12\r\n\x05value\x18\x01 \x01(\r\"!\n\x10\x44ownlinkCapacity\x12\r\n\x05value\x18\x01 \x01(\r\"\x1b\n\x0bWriteBuffer\x12\x0c\n\x04size\x18\x01 \x01(\r\"\x1a\n\nReadBuffer\x12\x0c\n\x04size\x18\x01 \x01(\r\"!\n\x0f\x43onnectionReuse\x12\x0e\n\x06\x65nable\x18\x01 \x01(\x08\"\x1e\n\x0e\x45ncryptionSeed\x12\x0c\n\x04seed\x18\x01 \x01(\t\"\x82\x04\n\x06\x43onfig\x12-\n\x03mtu\x18\x01 \x01(\x0b\x32 .xray.transport.internet.kcp.MTU\x12-\n\x03tti\x18\x02 \x01(\x0b\x32 .xray.transport.internet.kcp.TTI\x12\x44\n\x0fuplink_capacity\x18\x03 \x01(\x0b\x32+.xray.transport.internet.kcp.UplinkCapacity\x12H\n\x11\x64ownlink_capacity\x18\x04 \x01(\x0b\x32-.xray.transport.internet.kcp.DownlinkCapacity\x12\x12\n\ncongestion\x18\x05 \x01(\x08\x12>\n\x0cwrite_buffer\x18\x06 \x01(\x0b\x32(.xray.transport.internet.kcp.WriteBuffer\x12<\n\x0bread_buffer\x18\x07 \x01(\x0b\x32\'.xray.transport.internet.kcp.ReadBuffer\x12\x37\n\rheader_config\x18\x08 \x01(\x0b\x32 .xray.common.serial.TypedMessage\x12\x39\n\x04seed\x18\n \x01(\x0b\x32+.xray.transport.internet.kcp.EncryptionSeedJ\x04\x08\t\x10\nBs\n\x1f\x63om.xray.transport.internet.kcpP\x01Z0github.com/xtls/xray-core/transport/internet/kcp\xaa\x02\x1bXray.Transport.Internet.Kcpb\x06proto3') diff --git a/marznode/backends/xray/api/proto/transport/internet/quic/__init__.py b/marznode/backends/xray/api/proto/transport/internet/quic/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/marznode/xray_api/proto/transport/internet/quic/config_grpc.py b/marznode/backends/xray/api/proto/transport/internet/quic/config_grpc.py similarity index 100% rename from marznode/xray_api/proto/transport/internet/quic/config_grpc.py rename to marznode/backends/xray/api/proto/transport/internet/quic/config_grpc.py diff --git a/marznode/xray_api/proto/transport/internet/quic/config_pb2.py b/marznode/backends/xray/api/proto/transport/internet/quic/config_pb2.py similarity index 85% rename from marznode/xray_api/proto/transport/internet/quic/config_pb2.py rename to marznode/backends/xray/api/proto/transport/internet/quic/config_pb2.py index b87f082..ba9d6b7 100644 --- a/marznode/xray_api/proto/transport/internet/quic/config_pb2.py +++ b/marznode/backends/xray/api/proto/transport/internet/quic/config_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: transport/internet/quic/config.proto -# Protobuf Python Version: 4.25.0 +# Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool @@ -12,8 +12,8 @@ _sym_db = _symbol_database.Default() -from marznode.xray_api.proto.common.serial import typed_message_pb2 as common_dot_serial_dot_typed__message__pb2 -from marznode.xray_api.proto.common.protocol import headers_pb2 as common_dot_protocol_dot_headers__pb2 +from marznode.backends.xray.api.proto.common.serial import typed_message_pb2 as common_dot_serial_dot_typed__message__pb2 +from marznode.backends.xray.api.proto.common.protocol import headers_pb2 as common_dot_protocol_dot_headers__pb2 DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n$transport/internet/quic/config.proto\x12\x1cxray.transport.internet.quic\x1a!common/serial/typed_message.proto\x1a\x1d\x63ommon/protocol/headers.proto\"\x7f\n\x06\x43onfig\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x36\n\x08security\x18\x02 \x01(\x0b\x32$.xray.common.protocol.SecurityConfig\x12\x30\n\x06header\x18\x03 \x01(\x0b\x32 .xray.common.serial.TypedMessageBv\n com.xray.transport.internet.quicP\x01Z1github.com/xtls/xray-core/transport/internet/quic\xaa\x02\x1cXray.Transport.Internet.Quicb\x06proto3') diff --git a/marznode/backends/xray/api/proto/transport/internet/reality/__init__.py b/marznode/backends/xray/api/proto/transport/internet/reality/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/marznode/xray_api/proto/transport/internet/reality/config_grpc.py b/marznode/backends/xray/api/proto/transport/internet/reality/config_grpc.py similarity index 100% rename from marznode/xray_api/proto/transport/internet/reality/config_grpc.py rename to marznode/backends/xray/api/proto/transport/internet/reality/config_grpc.py diff --git a/marznode/xray_api/proto/transport/internet/reality/config_pb2.py b/marznode/backends/xray/api/proto/transport/internet/reality/config_pb2.py similarity index 81% rename from marznode/xray_api/proto/transport/internet/reality/config_pb2.py rename to marznode/backends/xray/api/proto/transport/internet/reality/config_pb2.py index 969d24c..0599c5e 100644 --- a/marznode/xray_api/proto/transport/internet/reality/config_pb2.py +++ b/marznode/backends/xray/api/proto/transport/internet/reality/config_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: transport/internet/reality/config.proto -# Protobuf Python Version: 4.25.0 +# Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool @@ -14,7 +14,7 @@ -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\'transport/internet/reality/config.proto\x12\x1fxray.transport.internet.reality\"\xb9\x02\n\x06\x43onfig\x12\x0c\n\x04show\x18\x01 \x01(\x08\x12\x0c\n\x04\x64\x65st\x18\x02 \x01(\t\x12\x0c\n\x04type\x18\x03 \x01(\t\x12\x0c\n\x04xver\x18\x04 \x01(\x04\x12\x14\n\x0cserver_names\x18\x05 \x03(\t\x12\x13\n\x0bprivate_key\x18\x06 \x01(\x0c\x12\x16\n\x0emin_client_ver\x18\x07 \x01(\x0c\x12\x16\n\x0emax_client_ver\x18\x08 \x01(\x0c\x12\x15\n\rmax_time_diff\x18\t \x01(\x04\x12\x11\n\tshort_ids\x18\n \x03(\x0c\x12\x13\n\x0b\x46ingerprint\x18\x15 \x01(\t\x12\x13\n\x0bserver_name\x18\x16 \x01(\t\x12\x12\n\npublic_key\x18\x17 \x01(\x0c\x12\x10\n\x08short_id\x18\x18 \x01(\x0c\x12\x10\n\x08spider_x\x18\x19 \x01(\t\x12\x10\n\x08spider_y\x18\x1a \x03(\x03\x42\x7f\n#com.xray.transport.internet.realityP\x01Z4github.com/xtls/xray-core/transport/internet/reality\xaa\x02\x1fXray.Transport.Internet.Realityb\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\'transport/internet/reality/config.proto\x12\x1fxray.transport.internet.reality\"\xd1\x02\n\x06\x43onfig\x12\x0c\n\x04show\x18\x01 \x01(\x08\x12\x0c\n\x04\x64\x65st\x18\x02 \x01(\t\x12\x0c\n\x04type\x18\x03 \x01(\t\x12\x0c\n\x04xver\x18\x04 \x01(\x04\x12\x14\n\x0cserver_names\x18\x05 \x03(\t\x12\x13\n\x0bprivate_key\x18\x06 \x01(\x0c\x12\x16\n\x0emin_client_ver\x18\x07 \x01(\x0c\x12\x16\n\x0emax_client_ver\x18\x08 \x01(\x0c\x12\x15\n\rmax_time_diff\x18\t \x01(\x04\x12\x11\n\tshort_ids\x18\n \x03(\x0c\x12\x13\n\x0b\x46ingerprint\x18\x15 \x01(\t\x12\x13\n\x0bserver_name\x18\x16 \x01(\t\x12\x12\n\npublic_key\x18\x17 \x01(\x0c\x12\x10\n\x08short_id\x18\x18 \x01(\x0c\x12\x10\n\x08spider_x\x18\x19 \x01(\t\x12\x10\n\x08spider_y\x18\x1a \x03(\x03\x12\x16\n\x0emaster_key_log\x18\x1b \x01(\tB\x7f\n#com.xray.transport.internet.realityP\x01Z4github.com/xtls/xray-core/transport/internet/reality\xaa\x02\x1fXray.Transport.Internet.Realityb\x06proto3') _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) @@ -23,5 +23,5 @@ _globals['DESCRIPTOR']._options = None _globals['DESCRIPTOR']._serialized_options = b'\n#com.xray.transport.internet.realityP\001Z4github.com/xtls/xray-core/transport/internet/reality\252\002\037Xray.Transport.Internet.Reality' _globals['_CONFIG']._serialized_start=77 - _globals['_CONFIG']._serialized_end=390 + _globals['_CONFIG']._serialized_end=414 # @@protoc_insertion_point(module_scope) diff --git a/marznode/backends/xray/api/proto/transport/internet/tcp/__init__.py b/marznode/backends/xray/api/proto/transport/internet/tcp/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/marznode/xray_api/proto/transport/internet/tcp/config_grpc.py b/marznode/backends/xray/api/proto/transport/internet/tcp/config_grpc.py similarity index 100% rename from marznode/xray_api/proto/transport/internet/tcp/config_grpc.py rename to marznode/backends/xray/api/proto/transport/internet/tcp/config_grpc.py diff --git a/marznode/xray_api/proto/transport/internet/tcp/config_pb2.py b/marznode/backends/xray/api/proto/transport/internet/tcp/config_pb2.py similarity index 90% rename from marznode/xray_api/proto/transport/internet/tcp/config_pb2.py rename to marznode/backends/xray/api/proto/transport/internet/tcp/config_pb2.py index 53705bf..f152be6 100644 --- a/marznode/xray_api/proto/transport/internet/tcp/config_pb2.py +++ b/marznode/backends/xray/api/proto/transport/internet/tcp/config_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: transport/internet/tcp/config.proto -# Protobuf Python Version: 4.25.0 +# Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool @@ -12,7 +12,7 @@ _sym_db = _symbol_database.Default() -from marznode.xray_api.proto.common.serial import typed_message_pb2 as common_dot_serial_dot_typed__message__pb2 +from marznode.backends.xray.api.proto.common.serial import typed_message_pb2 as common_dot_serial_dot_typed__message__pb2 DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n#transport/internet/tcp/config.proto\x12\x1bxray.transport.internet.tcp\x1a!common/serial/typed_message.proto\"h\n\x06\x43onfig\x12\x39\n\x0fheader_settings\x18\x02 \x01(\x0b\x32 .xray.common.serial.TypedMessage\x12\x1d\n\x15\x61\x63\x63\x65pt_proxy_protocol\x18\x03 \x01(\x08J\x04\x08\x01\x10\x02\x42s\n\x1f\x63om.xray.transport.internet.tcpP\x01Z0github.com/xtls/xray-core/transport/internet/tcp\xaa\x02\x1bXray.Transport.Internet.Tcpb\x06proto3') diff --git a/marznode/backends/xray/api/proto/transport/internet/tls/__init__.py b/marznode/backends/xray/api/proto/transport/internet/tls/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/marznode/xray_api/proto/transport/internet/tls/config_grpc.py b/marznode/backends/xray/api/proto/transport/internet/tls/config_grpc.py similarity index 100% rename from marznode/xray_api/proto/transport/internet/tls/config_grpc.py rename to marznode/backends/xray/api/proto/transport/internet/tls/config_grpc.py diff --git a/marznode/xray_api/proto/transport/internet/tls/config_pb2.py b/marznode/backends/xray/api/proto/transport/internet/tls/config_pb2.py similarity index 98% rename from marznode/xray_api/proto/transport/internet/tls/config_pb2.py rename to marznode/backends/xray/api/proto/transport/internet/tls/config_pb2.py index 81f1c2f..1c699a2 100644 --- a/marznode/xray_api/proto/transport/internet/tls/config_pb2.py +++ b/marznode/backends/xray/api/proto/transport/internet/tls/config_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: transport/internet/tls/config.proto -# Protobuf Python Version: 4.25.0 +# Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool diff --git a/marznode/backends/xray/api/proto/transport/internet/udp/__init__.py b/marznode/backends/xray/api/proto/transport/internet/udp/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/marznode/xray_api/proto/transport/internet/udp/config_grpc.py b/marznode/backends/xray/api/proto/transport/internet/udp/config_grpc.py similarity index 100% rename from marznode/xray_api/proto/transport/internet/udp/config_grpc.py rename to marznode/backends/xray/api/proto/transport/internet/udp/config_grpc.py diff --git a/marznode/xray_api/proto/transport/internet/udp/config_pb2.py b/marznode/backends/xray/api/proto/transport/internet/udp/config_pb2.py similarity index 97% rename from marznode/xray_api/proto/transport/internet/udp/config_pb2.py rename to marznode/backends/xray/api/proto/transport/internet/udp/config_pb2.py index b0081b1..73fcc25 100644 --- a/marznode/xray_api/proto/transport/internet/udp/config_pb2.py +++ b/marznode/backends/xray/api/proto/transport/internet/udp/config_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: transport/internet/udp/config.proto -# Protobuf Python Version: 4.25.0 +# Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool diff --git a/marznode/backends/xray/api/proto/transport/internet/websocket/__init__.py b/marznode/backends/xray/api/proto/transport/internet/websocket/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/marznode/xray_api/proto/transport/internet/websocket/config_grpc.py b/marznode/backends/xray/api/proto/transport/internet/websocket/config_grpc.py similarity index 100% rename from marznode/xray_api/proto/transport/internet/websocket/config_grpc.py rename to marznode/backends/xray/api/proto/transport/internet/websocket/config_grpc.py diff --git a/marznode/xray_api/proto/transport/internet/websocket/config_pb2.py b/marznode/backends/xray/api/proto/transport/internet/websocket/config_pb2.py similarity index 98% rename from marznode/xray_api/proto/transport/internet/websocket/config_pb2.py rename to marznode/backends/xray/api/proto/transport/internet/websocket/config_pb2.py index 67c039c..45cbc37 100644 --- a/marznode/xray_api/proto/transport/internet/websocket/config_pb2.py +++ b/marznode/backends/xray/api/proto/transport/internet/websocket/config_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: transport/internet/websocket/config.proto -# Protobuf Python Version: 4.25.0 +# Protobuf Python Version: 4.25.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool diff --git a/marznode/xray_api/proxyman.py b/marznode/backends/xray/api/proxyman.py similarity index 77% rename from marznode/xray_api/proxyman.py rename to marznode/backends/xray/api/proxyman.py index 5812f3e..29a768a 100644 --- a/marznode/xray_api/proxyman.py +++ b/marznode/backends/xray/api/proxyman.py @@ -1,4 +1,5 @@ """Methods to update Xray-core users/inbounds""" + import grpclib from .base import XrayAPIBase @@ -23,7 +24,9 @@ class Proxyman(XrayAPIBase): async def __alter_inbound(self, tag: str, operation: TypedMessage) -> None: stub = command_grpc.HandlerServiceStub(self._channel) try: - await stub.AlterInbound(command_pb2.AlterInboundRequest(tag=tag, operation=operation)) + await stub.AlterInbound( + command_pb2.AlterInboundRequest(tag=tag, operation=operation) + ) except grpclib.exceptions.GRPCError as error: raise RelatedError(error) from error @@ -34,21 +37,16 @@ async def add_inbound_user(self, tag: str, user: Account) -> None: operation=Message( command_pb2.AddUserOperation( user=user_pb2.User( - level=user.level, - email=user.email, - account=user.message + level=user.level, email=user.email, account=user.message ) ) - )) + ), + ) async def remove_inbound_user(self, tag: str, email: str) -> None: """Removes a user from an inbound""" await self.__alter_inbound( - tag=tag, - operation=Message( - command_pb2.RemoveUserOperation( - email=email - ) - )) + tag=tag, operation=Message(command_pb2.RemoveUserOperation(email=email)) + ) # TODO: implement add/remove inbound/outbound if necessary diff --git a/marznode/xray_api/stats.py b/marznode/backends/xray/api/stats.py similarity index 81% rename from marznode/xray_api/stats.py rename to marznode/backends/xray/api/stats.py index 9d43fbf..5893a33 100644 --- a/marznode/xray_api/stats.py +++ b/marznode/backends/xray/api/stats.py @@ -1,6 +1,6 @@ """Construct types and a class for getting statistics from Xray-core""" + # pylint: disable=E1101 -import typing from dataclasses import dataclass import grpclib @@ -13,6 +13,7 @@ @dataclass class SysStatsResponse: """Stores system statistics""" + num_goroutine: int num_gc: int alloc: int @@ -28,6 +29,7 @@ class SysStatsResponse: @dataclass class StatResponse: """Stores xray statistics""" + name: str type: str link: str @@ -37,6 +39,7 @@ class StatResponse: @dataclass class UserStatsResponse: """Stores statistics of a user""" + email: str uplink: int downlink: int @@ -45,6 +48,7 @@ class UserStatsResponse: @dataclass class InboundStatsResponse: """Stores statistics of an inbound""" + tag: str uplink: int downlink: int @@ -53,6 +57,7 @@ class InboundStatsResponse: @dataclass class OutboundStatsResponse: """Stores statistics of an outbound""" + tag: str uplink: int downlink: int @@ -81,10 +86,12 @@ async def get_sys_stats(self) -> SysStatsResponse: frees=response.Frees, live_objects=response.LiveObjects, pause_total_ns=response.PauseTotalNs, - uptime=response.Uptime + uptime=response.Uptime, ) - async def __query_stats(self, pattern: str, reset: bool = False) -> list[StatResponse]: + async def __query_stats( + self, pattern: str, reset: bool = False + ) -> list[StatResponse]: """Get statistics from Xray-core Args: @@ -92,14 +99,15 @@ async def __query_stats(self, pattern: str, reset: bool = False) -> list[StatRes reset: whether to reset xray statistics or not.""" try: stub = command_grpc.StatsServiceStub(self._channel) - response = await stub.QueryStats(command_pb2.QueryStatsRequest(pattern=pattern, - reset=reset)) + response = await stub.QueryStats( + command_pb2.QueryStatsRequest(pattern=pattern, reset=reset) + ) except grpclib.exceptions.GRPCError as error: raise RelatedError(error) from error results = [] for stat in response.stat: - type_, name, _, link = stat.name.split('>>>') + type_, name, _, link = stat.name.split(">>>") results.append(StatResponse(name, type_, link, stat.value)) return results @@ -115,33 +123,39 @@ async def get_outbounds_stats(self, reset: bool = False) -> list[StatResponse]: """returns statistics of all outbounds""" return await self.__query_stats("outbound>>>", reset=reset) - async def get_user_stats(self, email: str, reset: bool = False) -> UserStatsResponse: + async def get_user_stats( + self, email: str, reset: bool = False + ) -> UserStatsResponse: """returns statistics of a specific user""" uplink, downlink = 0, 0 for stat in await self.__query_stats(f"user>>>{email}>>>", reset=reset): - if stat.link == 'uplink': + if stat.link == "uplink": uplink = stat.value - elif stat.link == 'downlink': + elif stat.link == "downlink": downlink = stat.value return UserStatsResponse(email=email, uplink=uplink, downlink=downlink) - async def get_inbound_stats(self, tag: str, reset: bool = False) -> InboundStatsResponse: + async def get_inbound_stats( + self, tag: str, reset: bool = False + ) -> InboundStatsResponse: """returns statistics of an inbound""" uplink, downlink = 0, 0 for stat in await self.__query_stats(f"inbound>>>{tag}>>>", reset=reset): - if stat.link == 'uplink': + if stat.link == "uplink": uplink = stat.value - elif stat.link == 'downlink': + elif stat.link == "downlink": downlink = stat.value return InboundStatsResponse(tag=tag, uplink=uplink, downlink=downlink) - async def get_outbound_stats(self, tag: str, reset: bool = False) -> OutboundStatsResponse: + async def get_outbound_stats( + self, tag: str, reset: bool = False + ) -> OutboundStatsResponse: """returns statistics of an outbound""" uplink, downlink = 0, 0 for stat in await self.__query_stats(f"outbound>>>{tag}>>>", reset=reset): - if stat.link == 'uplink': + if stat.link == "uplink": uplink = stat.value - elif stat.link == 'downlink': + elif stat.link == "downlink": downlink = stat.value return OutboundStatsResponse(tag=tag, uplink=uplink, downlink=downlink) diff --git a/marznode/backends/xray/api/types/__init__.py b/marznode/backends/xray/api/types/__init__.py new file mode 100644 index 0000000..1f471b8 --- /dev/null +++ b/marznode/backends/xray/api/types/__init__.py @@ -0,0 +1,7 @@ +from .account import ( + Account, + ShadowsocksAccount, + TrojanAccount, + VLESSAccount, + VMessAccount, +) diff --git a/marznode/xray_api/types/account.py b/marznode/backends/xray/api/types/account.py similarity index 79% rename from marznode/xray_api/types/account.py rename to marznode/backends/xray/api/types/account.py index 27f1dec..9e87d83 100755 --- a/marznode/xray_api/types/account.py +++ b/marznode/backends/xray/api/types/account.py @@ -1,4 +1,5 @@ """Implements accounts for different protocols in Xray-core""" + # pylint: disable=E0611,C0115 from abc import ABC, abstractmethod from enum import Enum @@ -9,14 +10,14 @@ from .message import Message from ..proto.common.serial.typed_message_pb2 import TypedMessage -from ..proto.proxy.shadowsocks.config_pb2 import \ - Account as ShadowsocksAccountPb2 +from ..proto.proxy.shadowsocks.config_pb2 import Account as ShadowsocksAccountPb2 + # from ..proto.proxy.shadowsocks.config_pb2 import \ # CipherType as ShadowsocksCiphers from ..proto.proxy.trojan.config_pb2 import Account as TrojanAccountPb2 from ..proto.proxy.vless.account_pb2 import Account as VLESSAccountPb2 from ..proto.proxy.vmess.account_pb2 import Account as VMessAccountPb2 -from ...utils.key_gen import generate_uuid, generate_password +from marznode.utils.key_gen import generate_uuid, generate_password class Account(BaseModel, ABC): @@ -29,16 +30,16 @@ class Account(BaseModel, ABC): def message(self) -> TypedMessage: pass - @field_validator('id', 'password', check_fields=False) + @field_validator("id", "password", check_fields=False) @classmethod def generate_creds(cls, v: str, info: ValidationInfo): if v: return v if "seed" in info.data: seed = info.data["seed"] - if info.field_name == 'id': + if info.field_name == "id": return generate_uuid(seed) - elif info.field_name == 'password': + elif info.field_name == "password": return generate_password(seed) raise ValidationError("Both password/id and seed are empty") @@ -55,8 +56,8 @@ def message(self): class XTLSFlows(str, Enum): - NONE = '' - VISION = 'xtls-rprx-vision' + NONE = "" + VISION = "xtls-rprx-vision" class VLESSAccount(Account): @@ -77,9 +78,9 @@ def message(self): class ShadowsocksMethods(str, Enum): - AES_128_GCM = 'aes-128-gcm' - AES_256_GCM = 'aes-256-gcm' - CHACHA20_POLY1305 = 'chacha20-ietf-poly1305' + AES_128_GCM = "aes-128-gcm" + AES_256_GCM = "aes-256-gcm" + CHACHA20_POLY1305 = "chacha20-ietf-poly1305" class ShadowsocksAccount(Account): @@ -92,12 +93,14 @@ def cipher_type(self): @property def message(self): - return Message(ShadowsocksAccountPb2(password=self.password, cipher_type=self.cipher_type)) + return Message( + ShadowsocksAccountPb2(password=self.password, cipher_type=self.cipher_type) + ) accounts_map = { "shadowsocks": ShadowsocksAccount, "trojan": TrojanAccount, "vmess": VMessAccount, - "vless": VLESSAccount + "vless": VLESSAccount, } diff --git a/marznode/xray_api/types/message.py b/marznode/backends/xray/api/types/message.py similarity index 72% rename from marznode/xray_api/types/message.py rename to marznode/backends/xray/api/types/message.py index c5d9d09..4f018d8 100644 --- a/marznode/xray_api/types/message.py +++ b/marznode/backends/xray/api/types/message.py @@ -1,4 +1,5 @@ """Defines a class to return typed message for xray api""" + # pylint: disable=E0611 from ..proto.common.serial.typed_message_pb2 import TypedMessage @@ -6,6 +7,5 @@ class Message: def __new__(cls, message) -> TypedMessage: return TypedMessage( - type=message.DESCRIPTOR.full_name, - value=message.SerializeToString() + type=message.DESCRIPTOR.full_name, value=message.SerializeToString() ) diff --git a/marznode/backends/xray/interface.py b/marznode/backends/xray/interface.py new file mode 100644 index 0000000..7a51e1c --- /dev/null +++ b/marznode/backends/xray/interface.py @@ -0,0 +1,93 @@ +"""What a vpn server should do""" + +import asyncio +import logging +from collections import defaultdict + +from marznode import config +from marznode.backends.base import VPNBackend +from marznode.backends.xray._config import XrayConfig +from marznode.backends.xray._runner import XrayCore +from marznode.backends.xray.api import XrayAPI +from marznode.backends.xray.api.exceptions import ( + EmailExistsError, + EmailNotFoundError, + TagNotFoundError, +) +from marznode.backends.xray.api.types.account import accounts_map +from marznode.models import User, Inbound +from marznode.storage import BaseStorage +from marznode.utils.network import find_free_port + +logger = logging.getLogger(__name__) + + +class XrayBackend(VPNBackend): + def __init__(self, storage: BaseStorage): + xray_api_port = find_free_port() + self._config = XrayConfig(config.XRAY_CONFIG_PATH, api_port=xray_api_port) + xray_inbounds = [ + Inbound(tag=i["tag"], protocol=i["protocol"], config=i) + for i in self._config.inbounds_by_tag.values() + ] + storage.set_inbounds(xray_inbounds) + self._inbound_tags = {i.tag for i in xray_inbounds} + self._api = XrayAPI("127.0.0.1", xray_api_port) + self._runner = XrayCore(config.XRAY_EXECUTABLE_PATH, config.XRAY_ASSETS_PATH) + + def contains_tag(self, tag: str) -> bool: + return tag in self._inbound_tags + + async def start(self): + await self._runner.start(self._config) + + async def restart(self, backend_config: str | None) -> list[Inbound] | None: + # xray_config = backend_config if backend_config else self._config + if not backend_config: + return await self._runner.restart(self._config) + api_port = find_free_port() + xray_config = XrayConfig(backend_config, api_port=api_port) + xray_inbounds = [ + Inbound(tag=i["tag"], protocol=i["protocol"], config=i) + for i in self._config.inbounds_by_tag.values() + ] + await self._runner.restart(xray_config) + self._api = XrayAPI("127.0.0.1", api_port) + await asyncio.sleep(0.1) # wait until xray api is up, + # I'd rather check if the port is open manually but this is lazier. for now. + return xray_inbounds + + async def add_user(self, user: User, inbound: Inbound): + email = f"{user.id}.{user.username}" + + account_class = accounts_map[inbound.protocol] + user_account = account_class(email=email, seed=user.key) + + try: + await self._api.add_inbound_user(inbound.tag, user_account) + except (EmailExistsError, TagNotFoundError): + raise + + async def remove_user(self, user: User, inbound: Inbound): + email = f"{user.id}.{user.username}" + try: + await self._api.remove_inbound_user(inbound.tag, email) + except (EmailNotFoundError, TagNotFoundError): + raise + + async def get_usages(self, reset: bool = True) -> dict[int, int]: + api_stats = await self._api.get_users_stats(reset=reset) + stats = defaultdict(int) + for stat in api_stats: + uid = int(stat.name.split(".")[0]) + stats[uid] += stat.value + return stats + + async def get_logs(self, include_buffer: bool = True): + if include_buffer: + for line in self._runner.get_buffer(): + yield line + log_stm = self._runner.get_logs_stm() + async with log_stm: + async for line in log_stm: + yield line diff --git a/marznode/config.py b/marznode/config.py index 9bf73a3..f4f55cf 100644 --- a/marznode/config.py +++ b/marznode/config.py @@ -1,4 +1,5 @@ """loads config files from environment and env file""" + from decouple import config from dotenv import load_dotenv diff --git a/marznode/marznode.py b/marznode/marznode.py index b71fb01..fdf8a1f 100644 --- a/marznode/marznode.py +++ b/marznode/marznode.py @@ -1,4 +1,5 @@ """start up and run marznode""" + import logging import os import sys @@ -8,13 +9,11 @@ from grpclib.utils import graceful_exit from marznode import config +from marznode.backends.xray.interface import XrayBackend from marznode.service import MarzService from marznode.storage import MemoryStorage from marznode.utils.ssl import generate_keypair, create_secure_context -from marznode.utils.network import find_free_port -from marznode.xray.base import XrayCore -from marznode.xray.config import XrayConfig -from marznode.xray_api import XrayAPI + logger = logging.getLogger(__name__) @@ -24,28 +23,30 @@ async def main(): if config.INSECURE: ssl_context = None else: - if not all((os.path.isfile(config.SSL_CERT_FILE), - os.path.isfile(config.SSL_KEY_FILE))): + if not all( + (os.path.isfile(config.SSL_CERT_FILE), os.path.isfile(config.SSL_KEY_FILE)) + ): logger.info("Generating a keypair for Marz-node.") generate_keypair(config.SSL_KEY_FILE, config.SSL_CERT_FILE) - + if not os.path.isfile(config.SSL_CLIENT_CERT_FILE): logger.error("No certificate provided for the client; exiting.") sys.exit(1) - ssl_context = create_secure_context(config.SSL_CERT_FILE, - config.SSL_KEY_FILE, - trusted=config.SSL_CLIENT_CERT_FILE) - - xray_api_port = find_free_port() + ssl_context = create_secure_context( + config.SSL_CERT_FILE, + config.SSL_KEY_FILE, + trusted=config.SSL_CLIENT_CERT_FILE, + ) storage = MemoryStorage() - xray_config = XrayConfig(config.XRAY_CONFIG_PATH, storage, api_port=xray_api_port) - xray = XrayCore(config.XRAY_EXECUTABLE_PATH, config.XRAY_ASSETS_PATH) - await xray.start(xray_config) - xray_api = XrayAPI("127.0.0.1", xray_api_port) - server = Server([MarzService(xray_api, storage, xray), Health()]) + xray_backend = XrayBackend(storage) + await xray_backend.start() + backends = [xray_backend] + server = Server([MarzService(storage, backends), Health()]) with graceful_exit([server]): await server.start(config.SERVICE_ADDRESS, config.SERVICE_PORT, ssl=ssl_context) - logger.info("Node service running on %s:%i", config.SERVICE_ADDRESS, config.SERVICE_PORT) + logger.info( + "Node service running on %s:%i", config.SERVICE_ADDRESS, config.SERVICE_PORT + ) await server.wait_closed() diff --git a/marznode/models/__init__.py b/marznode/models/__init__.py new file mode 100644 index 0000000..2219cb7 --- /dev/null +++ b/marznode/models/__init__.py @@ -0,0 +1,4 @@ +from .inbound import Inbound +from .user import User + +User.model_rebuild() diff --git a/marznode/models/inbound.py b/marznode/models/inbound.py new file mode 100644 index 0000000..985d608 --- /dev/null +++ b/marznode/models/inbound.py @@ -0,0 +1,7 @@ +from pydantic import BaseModel + + +class Inbound(BaseModel): + tag: str + protocol: str + config: dict diff --git a/marznode/models/user.py b/marznode/models/user.py new file mode 100644 index 0000000..bb2260b --- /dev/null +++ b/marznode/models/user.py @@ -0,0 +1,13 @@ +from typing import TYPE_CHECKING + +from pydantic import BaseModel + +if TYPE_CHECKING: + from marznode.models import Inbound + + +class User(BaseModel): + id: int + username: str + key: str + inbounds: list["Inbound"] = [] diff --git a/marznode/service/__init__.py b/marznode/service/__init__.py index 482827d..8192b65 100644 --- a/marznode/service/__init__.py +++ b/marznode/service/__init__.py @@ -1,6 +1,5 @@ """Implementation of xray's API to alter xray users/inbounds""" + from .service import MarzService -__all__ = [ - "MarzService" -] +__all__ = ["MarzService"] diff --git a/marznode/service/service.py b/marznode/service/service.py index c46f691..8adb906 100644 --- a/marznode/service/service.py +++ b/marznode/service/service.py @@ -2,6 +2,7 @@ The grpc Service to add/update/delete users Right now it only supports Xray but that is subject to change """ + import json import logging from collections import defaultdict @@ -9,154 +10,143 @@ from grpclib.server import Stream from marznode.storage import BaseStorage -from marznode.utils.network import find_free_port -from marznode.xray_api import XrayAPI -from marznode.xray_api.exceptions import EmailExistsError, EmailNotFoundError -from marznode.xray_api.types.account import accounts_map from .service_grpc import MarzServiceBase -from .service_pb2 import UserData, Empty, InboundsResponse, Inbound, UsersStats, LogLine +from .service_pb2 import ( + UserData, + UsersData, + Empty, + InboundsResponse, + Inbound, + UsersStats, + LogLine, +) from .service_pb2 import XrayConfig as XrayConfig_pb2 from .. import config -from ..xray.base import XrayCore -from ..xray.config import XrayConfig -from ..xray_api import XrayAPI +from marznode.backends.base import VPNBackend +from ..models import User, Inbound as InboundModel logger = logging.getLogger(__name__) class MarzService(MarzServiceBase): """Add/Update/Delete users based on calls from the client""" - def __init__(self, api: XrayAPI, storage: BaseStorage, xray: XrayCore): - self.api = api - self.storage = storage - self.xray = xray - async def _add_user(self, user_data: UserData): - user = user_data.user - inbound_addition_list = [i.tag for i in user_data.inbounds] - inbound_additions = await self.storage.list_inbounds(tag=inbound_addition_list) - await self.storage.add_user({"id": user.id, - "username": user.username, - "key": user.key}, - [i["tag"] for i in inbound_additions]) - storage_user = await self.storage.list_users(user.id) - await self._add_user_to_inbounds(storage_user, set(inbound_addition_list)) - - async def _add_user_to_inbounds(self, storage_user, inbounds: set[str]): - logger.info("Adding user `%s` to inbounds `%s`", storage_user["username"], str(inbounds)) - inbound_additions = await self.storage.list_inbounds(tag=inbounds) - email = f"{storage_user['id']}.{storage_user['username']}" - key = storage_user['key'] - for i in inbound_additions: - account_class = accounts_map[i["protocol"]] - user_account = account_class(email=email, seed=key) - inbound_tag = i["tag"] - try: - await self.api.add_inbound_user(inbound_tag, user_account) - except EmailExistsError: - logger.warning("Request to add an already existing user `%s` to tag `%s`.", - email, inbound_tag) - else: - logger.debug("User `%s` added to inbound `%s`", email, inbound_tag) - - async def _remove_user(self, user): - tags = user["inbound_tags"] - email = f"{user['id']}.{user['username']}" - - await self._remove_email_from_inbounds(email, tags) - await self.storage.remove_user(user["id"]) - - async def _remove_email_from_inbounds(self, email, tags: list[str]): - for tag in tags: - try: - await self.api.remove_inbound_user(tag, email) - except EmailNotFoundError: - logger.warning("Request to remove non existing user `%s` from tag `%s`", - email, tag) - else: - logger.debug("User `%s` removed from inbound `%s`", email, tag) + def __init__(self, storage: BaseStorage, backends: list[VPNBackend]): + self._backends = backends + self._storage = storage + + def _resolve_tag(self, inbound_tag: str) -> VPNBackend: + for backend in self._backends: + if backend.contains_tag(inbound_tag): + return backend + raise + + async def _add_user(self, user: User, inbounds: list[Inbound]): + for inbound in inbounds: + backend = self._resolve_tag(inbound.tag) + logger.debug("adding user `%s` to inbound `%s`", user.username, inbound.tag) + await backend.add_user(user, inbound) + + async def _remove_user(self, user: User, inbounds: list[InboundModel]): + for inbound in inbounds: + backend = self._resolve_tag(inbound.tag) + logger.debug("removing user `%s` from inbound `%s`", user.username, inbound.tag) + await backend.remove_user(user, inbound) async def _update_user(self, user_data: UserData): - logger.debug(user_data) user = user_data.user - storage_user = await self.storage.list_users(user.id) - if not storage_user: - return await self._add_user(user_data) - elif not user_data.inbounds: - return await self._remove_user(storage_user) - - storage_inbounds = set(storage_user["inbound_tags"]) - new_inbounds = {i.tag for i in user_data.inbounds} - added_inbounds = new_inbounds - storage_inbounds - removed_inbounds = storage_inbounds - new_inbounds - email = f"{storage_user['id']}.{storage_user['username']}" - await self._remove_email_from_inbounds(email, removed_inbounds) - await self._add_user_to_inbounds(storage_user, added_inbounds) - self.storage.storage["users"][user.id]["inbound_tags"] = new_inbounds - - async def SyncUsers(self, - stream: 'Stream[UserData,' - 'Empty]') -> None: + user = User(id=user.id, username=user.username, key=user.key) + storage_user = await self._storage.list_users(user.id) + if not storage_user and len(user_data.inbounds) > 0: + """add the user in case there isn't any currently + and the inbounds is non-empty""" + inbound_tags = [i.tag for i in user_data.inbounds] + inbound_additions = await self._storage.list_inbounds(tag=inbound_tags) + await self._add_user(user, inbound_additions) + await self._storage.update_user_inbounds( + user, + [i for i in inbound_additions], + ) + return + elif not user_data.inbounds and storage_user: + """remove in case we have th user but client has sent + us an empty list of inbounds""" + await self._remove_user(storage_user, storage_user.inbounds) + return await self._storage.remove_user(user) + + """otherwise synchronize the user with what + the client has sent us""" + storage_tags = {i.tag for i in storage_user.inbounds} + new_tags = {i.tag for i in user_data.inbounds} + added_tags = new_tags - storage_tags + removed_tags = storage_tags - new_tags + new_inbounds = await self._storage.list_inbounds(tag=list(new_tags)) + added_inbounds = await self._storage.list_inbounds(tag=list(added_tags)) + removed_inbounds = await self._storage.list_inbounds(tag=list(removed_tags)) + await self._remove_user(storage_user, removed_inbounds) + await self._add_user(storage_user, added_inbounds) + await self._storage.update_user_inbounds(storage_user, new_inbounds) + + async def SyncUsers(self, stream: "Stream[UserData," "Empty]") -> None: async for user_data in stream: await self._update_user(user_data) - async def FetchInbounds(self, - stream: 'grpclib.server.Stream[marznode.service.service_pb2.Empty, ' - 'marznode.service.service_pb2.InboundsResponse]') -> None: + async def FetchInbounds( + self, + stream: Stream[Empty, InboundsResponse], + ) -> None: await stream.recv_message() - stored_inbounds = await self.storage.list_inbounds() - inbounds = [Inbound(tag=i["tag"], config=json.dumps(i)) for i in stored_inbounds] + stored_inbounds = await self._storage.list_inbounds() + inbounds = [ + Inbound(tag=i.tag, config=json.dumps(i.config)) for i in stored_inbounds + ] await stream.send_message(InboundsResponse(inbounds=inbounds)) - async def RepopulateUsers(self, - stream: 'grpclib.server.Stream[marznode.service.service_pb2.UsersData, ' - 'marznode.service.service_pb2.Empty]') -> None: + async def RepopulateUsers( + self, + stream: Stream[UsersData, Empty], + ) -> None: users_data = (await stream.recv_message()).users_data for user_data in users_data: await self._update_user(user_data) user_ids = {user_data.user.id for user_data in users_data} - for storage_user in await self.storage.list_users(): - if storage_user["id"] not in user_ids: - await self._remove_user(storage_user) + for storage_user in await self._storage.list_users(): + if storage_user.id not in user_ids: + await self._remove_user(storage_user, storage_user.inbounds) await stream.send_message(Empty()) - async def FetchUsersStats(self, - stream: Stream[Empty, UsersStats]) -> None: + async def FetchUsersStats(self, stream: Stream[Empty, UsersStats]) -> None: await stream.recv_message() - api_stats = await self.api.get_users_stats(reset=True) - stats = defaultdict(int) - for stat in api_stats: - uid = int(stat.name.split(".")[0]) - stats[uid] += stat.value - user_stats = [UsersStats.UserStats(uid=uid, usage=usage) for uid, usage in stats.items()] + stats = await self._backends[0].get_usages() + logger.debug(stats) + user_stats = [ + UsersStats.UserStats(uid=uid, usage=usage) for uid, usage in stats.items() + ] await stream.send_message(UsersStats(users_stats=user_stats)) - async def StreamXrayLogs(self, - stream: Stream[Empty, LogLine]) -> None: + async def StreamXrayLogs(self, stream: Stream[Empty, LogLine]) -> None: req = await stream.recv_message() - if req.include_buffer: - for line in self.xray.get_buffer(): - await stream.send_message(LogLine(line=line)) - log_stm = await self.xray.get_logs_stm() - async with log_stm: - async for line in log_stm: - await stream.send_message(LogLine(line=line)) + async for line in self._backends[0].get_logs(req.include_buffer): + await stream.send_message(LogLine(line=line)) async def FetchXrayConfig(self, stream: Stream[Empty, XrayConfig_pb2]) -> None: await stream.recv_message() - with open(config.XRAY_CONFIG_PATH, 'r') as f: + with open(config.XRAY_CONFIG_PATH, "r") as f: content = f.read() await stream.send_message(XrayConfig_pb2(configuration=content)) - async def RestartXray(self, stream: Stream[XrayConfig_pb2, InboundsResponse]) -> None: + async def RestartXray( + self, stream: Stream[XrayConfig_pb2, InboundsResponse] + ) -> None: message = await stream.recv_message() - api_port = find_free_port() - xconfig = XrayConfig(message.configuration, storage=self.storage, api_port=api_port) - await self.storage.flush_users() - await self.xray.restart(xconfig) - stored_inbounds = await self.storage.list_inbounds() - inbounds = [Inbound(tag=i["tag"], config=json.dumps(i)) for i in stored_inbounds] - await stream.send_message(InboundsResponse(inbounds=inbounds)) - with open(config.XRAY_CONFIG_PATH, 'w') as f: + + await self._storage.flush_users() + inbounds = await self._backends[0].restart(message.configuration) + if inbounds: + self._storage.set_inbounds(inbounds) + pb2_inbounds = [ + Inbound(tag=i.tag, config=json.dumps(i.config)) for i in inbounds + ] + await stream.send_message(InboundsResponse(inbounds=pb2_inbounds)) + with open(config.XRAY_CONFIG_PATH, "w") as f: f.write(message.configuration) - self.api = XrayAPI("127.0.0.1", api_port) diff --git a/marznode/storage/__init__.py b/marznode/storage/__init__.py index ff5a7ee..4ff41a5 100644 --- a/marznode/storage/__init__.py +++ b/marznode/storage/__init__.py @@ -1,8 +1,6 @@ """A module to store marznode data""" + from .base import BaseStorage from .memory import MemoryStorage -__all__ = [ - "BaseStorage", - "MemoryStorage" -] +__all__ = ["BaseStorage", "MemoryStorage"] diff --git a/marznode/storage/base.py b/marznode/storage/base.py index aa5b446..3db0499 100644 --- a/marznode/storage/base.py +++ b/marznode/storage/base.py @@ -1,11 +1,15 @@ """The base for marznode storage""" + from abc import ABC, abstractmethod +from marznode.models import Inbound, User + class BaseStorage(ABC): """Base class for marznode storage""" + @abstractmethod - async def list_users(self, user_id: int | None = None) -> list[dict] | dict: + async def list_users(self, user_id: int | None = None) -> list[User] | User: """ lists users in the storage :param user_id: if specified only one or no user(s) will be returned @@ -13,8 +17,9 @@ async def list_users(self, user_id: int | None = None) -> list[dict] | dict: """ @abstractmethod - async def list_inbounds(self, tag: list[str] | str | None = None, - include_users: bool = False) -> list[dict] | dict: + async def list_inbounds( + self, tag: list[str] | str | None = None, include_users: bool = False + ) -> list[Inbound] | Inbound: """ lists all inbounds or the one specified by tag :param tag: specify one or more tags @@ -23,30 +28,19 @@ async def list_inbounds(self, tag: list[str] | str | None = None, """ @abstractmethod - async def update_user_inbounds(self, user_id: int, inbound_additions: list[str], - inbound_reductions: list[str]) -> None: + async def update_user_inbounds(self, user: User, inbounds: list[Inbound]) -> None: """ removes all previous inbound tags from the user and sets them to inbounds - :param user_id: the user - :param inbound_additions: list of inbounds to be added - :param inbound_reductions: list of inbounds to be removed - :return: nothing - """ - - @abstractmethod - async def add_user(self, user: dict, inbounds: list[str]) -> None: - """ - adds a user :param user: the user - :param inbounds: list of inbound tags + :param inbounds: list of inbounds to be set :return: nothing """ @abstractmethod - async def remove_user(self, user_id: int) -> None: + async def remove_user(self, user: User) -> None: """ removes a user and all the inbounds - :param user_id: the user's id + :param user: the user :return: nothing """ @@ -57,7 +51,8 @@ async def flush_users(self) -> None: :return: nothing """ - def set_inbounds(self, inbounds: dict[str, dict]) -> None: + @abstractmethod + def set_inbounds(self, inbounds: list[Inbound]) -> None: """ resets all inbounds :param inbounds: inbounds diff --git a/marznode/storage/memory.py b/marznode/storage/memory.py index 5f92312..b91b425 100644 --- a/marznode/storage/memory.py +++ b/marznode/storage/memory.py @@ -1,5 +1,7 @@ """Storage backend for storing marznode data in memory""" + from .base import BaseStorage +from ..models import User, Inbound class MemoryStorage(BaseStorage): @@ -7,37 +9,40 @@ class MemoryStorage(BaseStorage): note that this isn't fit to use in production since data gets wiped on restarts so if Marzneshin is down users are lost until it gets back up """ + def __init__(self): self.storage = dict({"users": {}, "inbounds": {}}) - async def list_users(self, user_id: int | None = None) -> list[dict] | dict | None: + async def list_users(self, user_id: int | None = None) -> list[User] | User | None: if user_id: return self.storage["users"].get(user_id) return list(self.storage["users"].values()) - async def list_inbounds(self, - tag: list[str] | str | None = None, - include_users: bool = False - ) -> list[dict] | dict | None: + async def list_inbounds( + self, tag: list[str] | str | None = None, include_users: bool = False + ) -> list[Inbound] | Inbound | None: if tag is not None: if isinstance(tag, str): return self.storage["inbounds"][tag] - return [self.storage["inbounds"][t] for t in tag if t in self.storage["inbounds"]] + return [ + self.storage["inbounds"][t] + for t in tag + if t in self.storage["inbounds"] + ] # return [i for i in self.storage["inbounds"].values() if i.tag in tag] return list(self.storage["inbounds"].values()) - async def add_user(self, user: dict, inbounds: list[str]) -> None: - self.storage["users"][user["id"]] = {**user, "inbound_tags": inbounds} - - async def remove_user(self, user_id: int) -> None: - del self.storage["users"][user_id] + async def remove_user(self, user: User) -> None: + del self.storage["users"][user.id] - async def update_user_inbounds(self, user_id: int, inbound_additions: list[str], - inbound_reductions: list[str]) -> None: - self.storage["users"][user_id]["inbound_tags"] = inbounds + async def update_user_inbounds(self, user: User, inbounds: list[Inbound]) -> None: + if self.storage["users"].get(user.id): + self.storage["users"][user.id].inbounds = inbounds + user.inbounds = inbounds + self.storage["users"][user.id] = user - def set_inbounds(self, inbounds: dict[str, dict]) -> None: - self.storage["inbounds"] = inbounds + def set_inbounds(self, inbounds: list[Inbound]) -> None: + self.storage["inbounds"] = {i.tag: i for i in inbounds} async def flush_users(self): self.storage["users"] = {} diff --git a/marznode/utils/key_gen.py b/marznode/utils/key_gen.py index 13e008d..e8ef607 100644 --- a/marznode/utils/key_gen.py +++ b/marznode/utils/key_gen.py @@ -1,4 +1,5 @@ """Used to generate uuid/password based on the seed""" + import uuid import xxhash diff --git a/marznode/utils/network.py b/marznode/utils/network.py index 0686529..ea56f6c 100644 --- a/marznode/utils/network.py +++ b/marznode/utils/network.py @@ -8,4 +8,3 @@ def find_free_port(): s.close() return port - diff --git a/marznode/utils/ssl.py b/marznode/utils/ssl.py index b45e407..aa486b5 100644 --- a/marznode/utils/ssl.py +++ b/marznode/utils/ssl.py @@ -1,4 +1,5 @@ """utilities for ssl key generation and context creation""" + import ssl from OpenSSL import crypto @@ -17,7 +18,7 @@ def generate_random_certificate() -> tuple: cert.gmtime_adj_notAfter(10 * 365 * 24 * 60 * 60) cert.set_issuer(cert.get_subject()) cert.set_pubkey(k) - cert.sign(k, 'sha512') + cert.sign(k, "sha512") cert_pem = crypto.dump_certificate(crypto.FILETYPE_PEM, cert).decode("utf-8") key_pem = crypto.dump_privatekey(crypto.FILETYPE_PEM, k).decode("utf-8") @@ -33,14 +34,16 @@ def generate_keypair(key_path: str, cert_path: str) -> None: """ key, cert = generate_random_certificate() - with open(key_path, 'w', encoding="utf-8") as file: + with open(key_path, "w", encoding="utf-8") as file: file.write(key) - with open(cert_path, 'w', encoding="utf-8") as file: + with open(cert_path, "w", encoding="utf-8") as file: file.write(cert) -def create_secure_context(server_cert: str, server_key: str, *, trusted: str) -> ssl.SSLContext: +def create_secure_context( + server_cert: str, server_key: str, *, trusted: str +) -> ssl.SSLContext: """ creates a context in which the client is verified by the certificate specified as trusted :param server_cert: path to server certificate @@ -54,6 +57,6 @@ def create_secure_context(server_cert: str, server_key: str, *, trusted: str) -> ) ctx.verify_mode = ssl.CERT_REQUIRED ctx.load_cert_chain(server_cert, server_key) - ctx.set_ciphers('ECDHE+AESGCM:ECDHE+CHACHA20:DHE+AESGCM:DHE+CHACHA20') - ctx.set_alpn_protocols(['h2']) + ctx.set_ciphers("ECDHE+AESGCM:ECDHE+CHACHA20:DHE+AESGCM:DHE+CHACHA20") + ctx.set_alpn_protocols(["h2"]) return ctx diff --git a/marznode/xray_api/proto/app/observatory/config_pb2.py b/marznode/xray_api/proto/app/observatory/config_pb2.py deleted file mode 100644 index 4bdd319..0000000 --- a/marznode/xray_api/proto/app/observatory/config_pb2.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: app/observatory/config.proto -# Protobuf Python Version: 4.25.0 -"""Generated protocol buffer code.""" -from google.protobuf import descriptor as _descriptor -from google.protobuf import descriptor_pool as _descriptor_pool -from google.protobuf import symbol_database as _symbol_database -from google.protobuf.internal import builder as _builder -# @@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') - -_globals = globals() -_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) -_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'app.observatory.config_pb2', _globals) -if _descriptor._USE_C_DESCRIPTORS == False: - _globals['DESCRIPTOR']._options = None - _globals['DESCRIPTOR']._serialized_options = b'\n\030com.xray.app.observatoryP\001Z)github.com/xtls/xray-core/app/observatory\252\002\024Xray.App.Observatory' - _globals['_OBSERVATIONRESULT']._serialized_start=59 - _globals['_OBSERVATIONRESULT']._serialized_end=137 - _globals['_OUTBOUNDSTATUS']._serialized_start=140 - _globals['_OUTBOUNDSTATUS']._serialized_end=282 - _globals['_PROBERESULT']._serialized_start=284 - _globals['_PROBERESULT']._serialized_end=354 - _globals['_INTENSITY']._serialized_start=356 - _globals['_INTENSITY']._serialized_end=391 - _globals['_CONFIG']._serialized_start=393 - _globals['_CONFIG']._serialized_end=498 -# @@protoc_insertion_point(module_scope) diff --git a/marznode/xray_api/proto/app/router/command/command_grpc.py b/marznode/xray_api/proto/app/router/command/command_grpc.py deleted file mode 100644 index c4a7063..0000000 --- a/marznode/xray_api/proto/app/router/command/command_grpc.py +++ /dev/null @@ -1,57 +0,0 @@ -# Generated by the Protocol Buffers compiler. DO NOT EDIT! -# source: app/router/command/command.proto -# plugin: grpclib.plugin.main -import abc -import typing - -import grpclib.const -import grpclib.client -if typing.TYPE_CHECKING: - import grpclib.server - -import marznode.xray_api.proto.common.net.network_pb2 -import marznode.xray_api.proto.app.router.command.command_pb2 - - -class RoutingServiceBase(abc.ABC): - - @abc.abstractmethod - async def SubscribeRoutingStats(self, stream: 'grpclib.server.Stream[app.router.command.command_pb2.SubscribeRoutingStatsRequest, app.router.command.command_pb2.RoutingContext]') -> None: - pass - - @abc.abstractmethod - async def TestRoute(self, stream: 'grpclib.server.Stream[app.router.command.command_pb2.TestRouteRequest, app.router.command.command_pb2.RoutingContext]') -> None: - pass - - def __mapping__(self) -> typing.Dict[str, grpclib.const.Handler]: - return { - '/xray.app.router.command.RoutingService/SubscribeRoutingStats': grpclib.const.Handler( - self.SubscribeRoutingStats, - grpclib.const.Cardinality.UNARY_STREAM, - marznode.xray_api.proto.app.router.command.command_pb2.SubscribeRoutingStatsRequest, - marznode.xray_api.proto.app.router.command.command_pb2.RoutingContext, - ), - '/xray.app.router.command.RoutingService/TestRoute': grpclib.const.Handler( - self.TestRoute, - grpclib.const.Cardinality.UNARY_UNARY, - marznode.xray_api.proto.app.router.command.command_pb2.TestRouteRequest, - marznode.xray_api.proto.app.router.command.command_pb2.RoutingContext, - ), - } - - -class RoutingServiceStub: - - def __init__(self, channel: grpclib.client.Channel) -> None: - self.SubscribeRoutingStats = grpclib.client.UnaryStreamMethod( - channel, - '/xray.app.router.command.RoutingService/SubscribeRoutingStats', - marznode.xray_api.proto.app.router.command.command_pb2.SubscribeRoutingStatsRequest, - marznode.xray_api.proto.app.router.command.command_pb2.RoutingContext, - ) - self.TestRoute = grpclib.client.UnaryUnaryMethod( - channel, - '/xray.app.router.command.RoutingService/TestRoute', - marznode.xray_api.proto.app.router.command.command_pb2.TestRouteRequest, - marznode.xray_api.proto.app.router.command.command_pb2.RoutingContext, - ) diff --git a/marznode/xray_api/proto/app/router/config_pb2.py b/marznode/xray_api/proto/app/router/config_pb2.py deleted file mode 100644 index 74b24f3..0000000 --- a/marznode/xray_api/proto/app/router/config_pb2.py +++ /dev/null @@ -1,63 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: app/router/config.proto -# Protobuf Python Version: 4.25.0 -"""Generated protocol buffer code.""" -from google.protobuf import descriptor as _descriptor -from google.protobuf import descriptor_pool as _descriptor_pool -from google.protobuf import symbol_database as _symbol_database -from google.protobuf.internal import builder as _builder -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from marznode.xray_api.proto.common.net import port_pb2 as common_dot_net_dot_port__pb2 -from marznode.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\"\xdd\x05\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@\n\nattributes\x18\x0f \x03(\x0b\x32,.xray.app.router.RoutingRule.AttributesEntry\x12\x16\n\x0e\x64omain_matcher\x18\x11 \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\x42\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') - -_globals = globals() -_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) -_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'app.router.config_pb2', _globals) -if _descriptor._USE_C_DESCRIPTORS == False: - _globals['DESCRIPTOR']._options = None - _globals['DESCRIPTOR']._serialized_options = b'\n\023com.xray.app.routerP\001Z$github.com/xtls/xray-core/app/router\252\002\017Xray.App.Router' - _globals['_ROUTINGRULE_ATTRIBUTESENTRY']._options = None - _globals['_ROUTINGRULE_ATTRIBUTESENTRY']._serialized_options = b'8\001' - _globals['_ROUTINGRULE'].fields_by_name['cidr']._options = None - _globals['_ROUTINGRULE'].fields_by_name['cidr']._serialized_options = b'\030\001' - _globals['_ROUTINGRULE'].fields_by_name['port_range']._options = None - _globals['_ROUTINGRULE'].fields_by_name['port_range']._serialized_options = b'\030\001' - _globals['_ROUTINGRULE'].fields_by_name['network_list']._options = None - _globals['_ROUTINGRULE'].fields_by_name['network_list']._serialized_options = b'\030\001' - _globals['_ROUTINGRULE'].fields_by_name['source_cidr']._options = None - _globals['_ROUTINGRULE'].fields_by_name['source_cidr']._serialized_options = b'\030\001' - _globals['_DOMAIN']._serialized_start=94 - _globals['_DOMAIN']._serialized_end=351 - _globals['_DOMAIN_ATTRIBUTE']._serialized_start=217 - _globals['_DOMAIN_ATTRIBUTE']._serialized_end=299 - _globals['_DOMAIN_TYPE']._serialized_start=301 - _globals['_DOMAIN_TYPE']._serialized_end=351 - _globals['_CIDR']._serialized_start=353 - _globals['_CIDR']._serialized_end=387 - _globals['_GEOIP']._serialized_start=389 - _globals['_GEOIP']._serialized_end=478 - _globals['_GEOIPLIST']._serialized_start=480 - _globals['_GEOIPLIST']._serialized_end=530 - _globals['_GEOSITE']._serialized_start=532 - _globals['_GEOSITE']._serialized_end=604 - _globals['_GEOSITELIST']._serialized_start=606 - _globals['_GEOSITELIST']._serialized_end=660 - _globals['_ROUTINGRULE']._serialized_start=663 - _globals['_ROUTINGRULE']._serialized_end=1396 - _globals['_ROUTINGRULE_ATTRIBUTESENTRY']._serialized_start=1333 - _globals['_ROUTINGRULE_ATTRIBUTESENTRY']._serialized_end=1382 - _globals['_BALANCINGRULE']._serialized_start=1398 - _globals['_BALANCINGRULE']._serialized_end=1471 - _globals['_CONFIG']._serialized_start=1474 - _globals['_CONFIG']._serialized_end=1720 - _globals['_CONFIG_DOMAINSTRATEGY']._serialized_start=1649 - _globals['_CONFIG_DOMAINSTRATEGY']._serialized_end=1720 -# @@protoc_insertion_point(module_scope) diff --git a/marznode/xray_api/types/__init__.py b/marznode/xray_api/types/__init__.py deleted file mode 100644 index 7396d86..0000000 --- a/marznode/xray_api/types/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -from .account import (Account, ShadowsocksAccount, TrojanAccount, VLESSAccount, - VMessAccount) diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..5b7bafd --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,43 @@ +[build-system] +requires = ["hatchling", "hatch-vcs"] +build-backend = "hatchling.build" + +[project] +name = "marznode" +dynamic = ["version"] +dependencies = [ + "anyio >= 4.2.0", + "commentjson >= 0.9.0", + "grpclib >= 0.4.7", + "pydantic >= 2.6.0", + "pyOpenSSL >= 24.0.0", + "python-decouple >= 3.8", + "Requests >= 2.31.0", + "xxhash >= 3.4.1", +] +requires-python = ">= 3.10" +authors = [ + {name = "Dawsh", email = "dawsh@duck.com"} +] +maintainers = [ + {name = "Dawsh", email = "dawsh@duck.com"} +] +description = "yet another controller for vpn servers" +readme = "README.md" +keywords = ["marzneshin", "xray", "xray-core", "vpn", "proxy"] + +[project.urls] +Homepage = "https://github.com/khodedawsh/marznode" +Repository = "https://github.com/khodedawsh/marznode.git" +Issues = "https://github.com/khodedawsh/marznode/issues" + +[tool.black] +extend-exclude = "(.*_grpc.py|.*_pb2.py)" + +[tool.hatch] + +[tool.hatch.version] +source = "vcs" + +[tool.hatch.build.hooks.vcs] +version-file = "marznode/_version.py" \ No newline at end of file