From 2c916b86eb58c4f01095aa3a094a0091c07dc6ce Mon Sep 17 00:00:00 2001 From: dnomd343 Date: Sat, 30 Jul 2022 18:22:12 +0800 Subject: [PATCH] update: complete VMess test --- Tester/V2ray.py | 9 ++------- Tester/VMess.py | 39 ++++++--------------------------------- test.py | 2 +- 3 files changed, 9 insertions(+), 41 deletions(-) diff --git a/Tester/V2ray.py b/Tester/V2ray.py index c0aa35a..4448805 100644 --- a/Tester/V2ray.py +++ b/Tester/V2ray.py @@ -3,7 +3,6 @@ import copy import itertools - from Basis.Functions import genFlag from Basis.Methods import quicMethods from Basis.Methods import udpObfuscations @@ -138,7 +137,7 @@ def h2Stream() -> dict: 'type': 'h2', 'host': settings['host'], 'path': path, - 'secure': None, # HTTP/2 force enable tls + 'secure': None, # HTTP/2 stream force enable tls }, 'server': { 'network': 'http', @@ -159,7 +158,7 @@ def quicStream(method: str, obfs: str) -> dict: 'method': method, 'passwd': passwd, 'obfs': obfs, - 'secure': None, # QUIC force enable tls + 'secure': None, # QUIC stream force enable tls }, 'server': { 'network': 'quic', @@ -213,10 +212,6 @@ def loadStream() -> list: for isMulti in [False, True]: addStream(grpcStream(isMulti)) # gRPC stream addStream(addSecure(grpcStream(isMulti))) # gRPC stream with TLS - - # for stream in streams: - # os.system('echo \'%s\' | jq .' % json.dumps(stream)) - return streams diff --git a/Tester/VMess.py b/Tester/VMess.py index b3ce325..67cbcdc 100644 --- a/Tester/VMess.py +++ b/Tester/VMess.py @@ -21,9 +21,6 @@ settings = { # 'serverBind': '::1', # 'clientBind': '::1', 'workDir': '/tmp/ProxyC', - 'host': '343.re', - 'cert': '/etc/ssl/certs/343.re/fullchain.pem', - 'key': '/etc/ssl/certs/343.re/privkey.pem', } @@ -74,7 +71,7 @@ def loadTest(method: str, aid: int, stream: dict) -> dict: } configName = 'vmess_%s_%i_%s' % (method, aid, md5Sum(stream['caption'])[:8]) testInfo = { # release test info - 'title': 'VMess test: security = %s | alterId = %i [%s]' % (method, aid, stream['caption']), + 'title': 'VMess test: %s [security = %s | alterId = %i]' % (stream['caption'], method, aid), 'client': loadClient(configName + '_client.json', proxyInfo, socksInfo), 'server': loadServer(configName + '_server.json', proxyInfo, stream['server']), 'socks': socksInfo, # exposed socks5 address @@ -88,32 +85,8 @@ def loadTest(method: str, aid: int, stream: dict) -> dict: def load(): - stream = { - 'caption': 'TCP stream (with tls)', - 'info': { - 'type': 'tcp', - 'obfs': None, - 'secure': { - 'sni': settings['host'], - 'alpn': None, - 'verify': True, - }, - }, - 'server': { - 'network': 'tcp', - 'tcpSettings': {}, - 'security': 'tls', - 'tlsSettings': { - 'alpn': ['h2', 'http/1.1'], - 'certificates': [{ - 'certificateFile': settings['cert'], - 'keyFile': settings['key'], - }] - } - } - } - - # for method, aid in itertools.product(vmessMethods, [0, 64]): - # yield loadTest(method, aid, stream) - for stream in V2ray.loadStream(): - yield loadTest('auto', 0, stream) + streams = V2ray.loadStream() # load v2ray-core stream list + for method, aid in itertools.product(vmessMethods, [0, 64]): # test every methods (and whether enable aead) + yield loadTest(method, aid, streams[0]) + for stream in streams[1:]: # skip first stream that has benn checked + yield loadTest('auto', 0, stream) # aead with auto security diff --git a/test.py b/test.py index d8b6b5f..b46d6cd 100755 --- a/test.py +++ b/test.py @@ -99,5 +99,5 @@ vmess = VMess.load() logging.critical('test start') # runTest(ss, 64) # runTest(ssr, 64) -runTest(vmess, 1) +runTest(vmess, 64) logging.critical('test complete')