From 714269cc0cfa8e1946e4b45d60f2f6c03deb9d29 Mon Sep 17 00:00:00 2001 From: Dnomd343 Date: Tue, 3 Jan 2023 13:48:12 +0800 Subject: [PATCH] feat: vless encode framework --- Encoder/VLESS.py | 7 +++++++ Encoder/__init__.py | 4 ++++ encoder_test.py | 29 ++++++++++++++++++++++++++++- 3 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 Encoder/VLESS.py create mode 100644 Encoder/__init__.py diff --git a/Encoder/VLESS.py b/Encoder/VLESS.py new file mode 100644 index 0000000..738bd48 --- /dev/null +++ b/Encoder/VLESS.py @@ -0,0 +1,7 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +def vless(info: dict) -> str: + """ + https://github.com/XTLS/Xray-core/discussions/716 + """ diff --git a/Encoder/__init__.py b/Encoder/__init__.py new file mode 100644 index 0000000..92950cc --- /dev/null +++ b/Encoder/__init__.py @@ -0,0 +1,4 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +from Encoder.VLESS import vless diff --git a/encoder_test.py b/encoder_test.py index 336e80f..96deacc 100755 --- a/encoder_test.py +++ b/encoder_test.py @@ -1,4 +1,31 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- -print('encoder test') +from Filter import Filter + +vless_demo_1 = { + 'type': 'vless', + 'name': '🇭🇰 DataGrids DMIT XTLS 1Gbps', + 'info': { + 'server': '54.142.232.16', + 'port': 52227, + 'method': 'none', + 'id': '75e6edee-2c30-41b0-9d88-676c4fb19ee8', + 'stream': { + 'type': 'tcp', + 'obfs': None, + 'secure': { + 'type': 'xtls', + 'sni': 'proxy.demo.com', + 'alpn': None, + 'verify': True, + 'flow': 'xtls-direct', + 'udp443': False + } + } + } +} + +vless_demo_1['info'] = Filter('vless', vless_demo_1['info']) + +print(vless_demo_1)