Config v2ray 或 xray Vless 配置测试仪

问题描述 投票:0回答:1

如何在 python 中检查配置 vless 是否正常工作以及在 vless 连接后检查连接互联网是否已连接 我尝试这个代码:

我写的代码很简洁,我的目标是先连接wls文件,然后检查互联网访问是否建立。

import base64
import json
import subprocess
import speedtest
from subprocess import check_output
import os
import time
def start_v2ray(file_name: str):
    
      file_path = os.path.abspath(os.path.join('config',file_name))
      process = subprocess.Popen(f'Xray/xray.exe run -config="{file_name}"', stdout=subprocess.PIPE,
                                       stderr=subprocess.PIPE)
      
      time.sleep(1.5)

      was_success = process.poll() is None and process.returncode is None
      print(f"xray.exe executed success: {was_success}")
      if was_success:
          ....test ping after that,but not working
          process.kill()
          return True
      else:
          return None





config_path = 'vless.json' 
if start_v2ray(config_path):
    print("Connected to VLESS server.")
else:
    print("Failed to connect to VLESS server.")
python x-ray v2ray
1个回答
0
投票

我真的需要这样一个项目,谢谢 但有一个问题

xray.exe执行成功:False 无法连接到 VLESS 服务器。

我使用 v2rayN 文件中的 xray.exe 但不起作用

© www.soinside.com 2019 - 2024. All rights reserved.