Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【Feature】希望不同的代理组可以配置不同的测试URL及期望值 #467

Closed
wzdnzd opened this issue Dec 2, 2023 · 0 comments

Comments

@wzdnzd
Copy link
Contributor

wzdnzd commented Dec 2, 2023

1. 背景

在使用过程中,即使为类似 NetflixOpenAI 这样的服务单独设置了代理组并过滤出对应的节点,但由于节点的变动,有时候过滤出来的节点对于普通的测试 URL(如 https://www.gstatic.com/generate_204)是 Alive 的,可对于 openai.com 这样的网址却是不可用的。此时,在使用 URLTest 这样的代理组的时候,如果这样的节点延迟很低,依然会被选择作为代理节点,从而导致无法正常访问相应的服务。

2. 需求

一种可能的解决办法是 为不同的代理组设置不同的测试 URL,并将 HTTP Status Code 与 期望值做比较,只有与期望状态一致时,才认为该代理节点可用。目前内核侧已经具备该功能,需要 Dashboard 侧也提供支持。之前个人也基于 Yacd-Meta 实现了一下,但现在 [MetacubeXD](https://github.com/MetaCubeX/metacubexd) 才是一等公民,而且 Yacd 不如 MetacubeXD 美观。所以希望 MetacubeXD 也能够支持该功能,在此感谢。个人以前的实现如下:
capture

3. 方案

  • 接口 /providers/proxies 会返回用户配置文件里里的测试 URL 和期望值,对应字段是 testUrlexpectedStatus,Dashboard 每个 ProxyGroup 默认显示接口返回的值
  • 用户双击时可进入编辑状态,可分别检测用户输入的 URL 和 期望值(形如:200/204/400-500,格式与 SRC-PORT 一致)是否合法
  • 保存用户的配置
  • 发起延迟测试时,参数 url 为该组配置的 testURLexpected 为 配置的 expectedStatus因为带有/,可能需要进行 URL 编码
  • 获取组下面的节点延迟时,根据测试 URL 去 extra 里取,取不到则取 history 里的值,delay 值不存在或为 0 则表示节点不可用
@wzdnzd wzdnzd changed the title 希望不同的代理组可以配置不同的测试URL及期望值 【Feature】希望不同的代理组可以配置不同的测试URL及期望值 Dec 5, 2023
@wzdnzd wzdnzd closed this as completed Jan 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant