feat: 修改测试节点问题
Build Android APK / 编译 libcore.aar (push) Has been cancelled
Build Android APK / 编译 Android APK (release) (push) Has been cancelled
Build Android APK / 创建 GitHub Release (push) Has been cancelled
Build Multi-Platform / 编译 libcore (iOS/tvOS) (push) Has been cancelled
Build Multi-Platform / 编译 libcore (Android) (push) Has been cancelled
Build Multi-Platform / 编译 libcore (Windows) (push) Has been cancelled
Build Multi-Platform / 编译 libcore (macOS) (push) Has been cancelled
Build Multi-Platform / 编译 libcore (Linux) (push) Has been cancelled
Build Multi-Platform / 构建 Android APK (push) Has been cancelled
Build Multi-Platform / 构建 Windows (push) Has been cancelled
Build Multi-Platform / 构建 macOS (push) Has been cancelled
Build Multi-Platform / 构建 Linux (push) Has been cancelled
Build Multi-Platform / 构建 iOS (push) Has been cancelled
Build Multi-Platform / 创建 Release (push) Has been cancelled
Build Windows / build (push) Has been cancelled
Build Windows / 编译 libcore (Windows) (push) Has been cancelled

This commit is contained in:
2025-10-31 19:05:29 -07:00
parent 445b1e0352
commit b79ce2d15a
5 changed files with 95 additions and 74 deletions
@@ -38,59 +38,6 @@ class HINodeListController extends GetxController {
}
}
/// 根据国家选择最快的节点
void kr_selectFastestNodeByCountry(String country) {
KRLogUtil.kr_i('开始为国家 $country 选择最快节点', tag: 'HINodeListController');
// 通知kr_home当前选择的国家
homeController.setCurrentSelectedCountry(country);
// 查找国家分组
final countryGroup = kr_subscribeService.countryOutboundList
.firstWhereOrNull((group) => group.country == country);
if (countryGroup == null) {
KRLogUtil.kr_w('未找到国家分组: $country', tag: 'HINodeListController');
return;
}
if (countryGroup.outboundList.isEmpty) {
KRLogUtil.kr_w('国家 $country 的节点列表为空', tag: 'HINodeListController');
return;
}
// 查找延迟最小的有效节点
String? fastestNodeTag;
int minDelay = 65535;
int validNodeCount = 0;
for (var node in countryGroup.outboundList) {
final delay = node.urlTestDelay.value;
// 统计有效节点数量
if (delay < 65535 && delay > 0) {
validNodeCount++;
// 找到延迟更小的节点
if (delay < minDelay) {
minDelay = delay;
fastestNodeTag = node.tag;
}
}
}
KRLogUtil.kr_i('国家 $country 内有 $validNodeCount 个有效节点可供切换', tag: 'HINodeListController');
// 选择最快的节点,如果没有有效延迟则选择第一个
final selectedTag = fastestNodeTag ?? countryGroup.outboundList.first.tag;
KRLogUtil.kr_i('选择节点: $selectedTag (延迟: ${minDelay == 65535 ? "未知" : "${minDelay}ms"})',
tag: 'HINodeListController');
// 调用homeController的选择节点方法
homeController.kr_selectNode(selectedTag);
}
/// 获取当前国家内的有效节点标签列表
List<String> getValidNodesInCurrentCountry() {
final country = homeController.currentSelectedCountry.value;