mirror of
https://github.com/RubyMetric/chsrc
synced 2026-02-28 10:21:09 +08:00
Accurate and rough measure for mirror site
This commit is contained in:
@@ -154,6 +154,7 @@ ProgStatus =
|
||||
#define chsrc_debug(str) xy_warn(App_Name "(DEBUG)",str)
|
||||
#define chsrc_verbose(str) xy_info(App_Name "(VERBOSE)",str)
|
||||
|
||||
#define faint(str) xy_str_to_faint(str)
|
||||
#define red(str) xy_str_to_red(str)
|
||||
#define blue(str) xy_str_to_blue(str)
|
||||
#define green(str) xy_str_to_green(str)
|
||||
@@ -637,11 +638,11 @@ measure_speed_for_every_source (Source_t sources[], int size, double speed_recor
|
||||
Source_t src = sources[i];
|
||||
|
||||
SourceProvider_t *provider = src.provider;
|
||||
SpeedMeasureInfo_t smi = provider->smi;
|
||||
ProviderSpeedMeasureInfo_t psmi = provider->psmi;
|
||||
|
||||
bool skip = smi.skip;
|
||||
bool skip = psmi.skip;
|
||||
|
||||
const char *url = smi.url;
|
||||
const char *url = psmi.url;
|
||||
|
||||
if (!skip && NULL==url)
|
||||
// 这种情况应当被视为bug,但是我们目前还是软处理
|
||||
@@ -664,8 +665,8 @@ measure_speed_for_every_source (Source_t sources[], int size, double speed_recor
|
||||
speed = -1024*1024*1024;
|
||||
if (!src.url)
|
||||
{
|
||||
smi.skip_reason_CN = "上游默认源URL未知,请帮助补充";
|
||||
smi.skip_reason_EN = "The default upstream source URL is unknown, please help to add";
|
||||
psmi.skip_reason_CN = "上游默认源URL未知,请帮助补充";
|
||||
psmi.skip_reason_EN = "The default upstream source URL is unknown, please help to add";
|
||||
}
|
||||
}
|
||||
else if (xy_streql ("user", provider->code))
|
||||
@@ -682,7 +683,7 @@ measure_speed_for_every_source (Source_t sources[], int size, double speed_recor
|
||||
speed_records[i] = speed;
|
||||
|
||||
const char *msg = ENGLISH ? provider->abbr : provider->name;
|
||||
const char *skip_reason = ENGLISH ? smi.skip_reason_EN : smi.skip_reason_CN;
|
||||
const char *skip_reason = ENGLISH ? psmi.skip_reason_EN : psmi.skip_reason_CN;
|
||||
if (NULL==skip_reason)
|
||||
{
|
||||
skip_reason = ENGLISH ? "SKIP for no reason" : "无理由跳过";
|
||||
@@ -694,13 +695,17 @@ measure_speed_for_every_source (Source_t sources[], int size, double speed_recor
|
||||
{
|
||||
const char *msg = ENGLISH ? provider->abbr : provider->name;
|
||||
|
||||
bool is_accurate = provider->psmi.accurate;
|
||||
char *accurate_msg = CHINESE ? (is_accurate ? "[精准测速]" : faint("[模糊测速]"))
|
||||
: (is_accurate ? "[accurate]" : faint("[rough]"));
|
||||
|
||||
if (xy_streql ("upstream", provider->code))
|
||||
{
|
||||
measure_msgs[i] = xy_strjoin (5, " ^ ", msg, " (", src.url, ") ... ");
|
||||
measure_msgs[i] = xy_strjoin (7, " ^ ", msg, " (", src.url, ") ", accurate_msg, " ... ");
|
||||
}
|
||||
else
|
||||
{
|
||||
measure_msgs[i] = xy_strjoin (3, " - ", msg, " ... ");
|
||||
measure_msgs[i] = xy_strjoin (5, " - ", msg, " ", accurate_msg, " ... ");
|
||||
}
|
||||
|
||||
print (measure_msgs[i]);
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
* | Mikachu2333 <mikachu.23333@zohomail.com>
|
||||
* |
|
||||
* Created On : <2023-08-29>
|
||||
* Last Modified : <2025-06-20>
|
||||
* Last Modified : <2025-07-11>
|
||||
*
|
||||
* 通用镜像站
|
||||
* ------------------------------------------------------------*/
|
||||
@@ -29,13 +29,13 @@
|
||||
MirrorSite_t MirrorZ =
|
||||
{
|
||||
"mirrorz", "MirrorZ", "MirrorZ 校园网镜像站", "https://mirrors.cernet.edu.cn/",
|
||||
{SKIP, "功能特殊无法测速,跳过", "SKIP because of its special function"}
|
||||
{SKIP, "功能特殊无法测速,跳过", "SKIP because of its special function", NULL, ROUGH}
|
||||
},
|
||||
|
||||
Tuna =
|
||||
{
|
||||
"tuna", "TUNA", "清华大学开源软件镜像站", "https://mirrors.tuna.tsinghua.edu.cn/",
|
||||
{NotSkip, NA, NA, "https://mirrors.tuna.tsinghua.edu.cn/speedtest/1000mb.bin"}
|
||||
{NotSkip, NA, NA, "https://mirrors.tuna.tsinghua.edu.cn/speedtest/1000mb.bin", ROUGH}
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -46,67 +46,67 @@ Tuna =
|
||||
Sjtug_Zhiyuan =
|
||||
{
|
||||
"sjtu-zy", "SJTUG-zhiyuan", "上海交通大学致远镜像站", "https://mirrors.sjtug.sjtu.edu.cn/",
|
||||
{NotSkip, NA, NA, "https://mirrors.sjtug.sjtu.edu.cn/ctan" Big_File_ctan}
|
||||
{NotSkip, NA, NA, "https://mirrors.sjtug.sjtu.edu.cn/ctan" Big_File_ctan, ROUGH}
|
||||
},
|
||||
|
||||
Sjtug_Siyuan =
|
||||
{
|
||||
"sjtu-sy", "SJTUG-siyuan", "上海交通大学思源镜像站", "https://mirror.sjtu.edu.cn/",
|
||||
{NotSkip, NA, NA, "https://mirror.sjtu.edu.cn/ctan" Big_File_ctan}
|
||||
{NotSkip, NA, NA, "https://mirror.sjtu.edu.cn/ctan" Big_File_ctan, ROUGH}
|
||||
},
|
||||
|
||||
Zju =
|
||||
{
|
||||
"zju", "ZJU", "浙江大学开源软件镜像站", "https://mirrors.zju.edu.cn/",
|
||||
{NotSkip, NA, NA, "https://mirrors.zju.edu.cn/ubuntu-releases" Big_File_ubuntu}
|
||||
{NotSkip, NA, NA, "https://mirrors.zju.edu.cn/ubuntu-releases" Big_File_ubuntu, ROUGH}
|
||||
},
|
||||
|
||||
Lzuoss =
|
||||
{
|
||||
"lzu", "LZUOSS", "兰州大学开源社区镜像站", "https://mirror.lzu.edu.cn/",
|
||||
{NotSkip, NA, NA, "https://mirror.lzu.edu.cn/CTAN" Big_File_ctan}
|
||||
{NotSkip, NA, NA, "https://mirror.lzu.edu.cn/CTAN" Big_File_ctan, ROUGH}
|
||||
},
|
||||
|
||||
Jlu =
|
||||
{
|
||||
"jlu", "JLU", "吉林大学开源镜像站", "https://mirrors.jlu.edu.cn/",
|
||||
{NotSkip, NA, NA, "https://mirrors.jlu.edu.cn/_static/speedtest.bin"}
|
||||
{NotSkip, NA, NA, "https://mirrors.jlu.edu.cn/_static/speedtest.bin", ROUGH}
|
||||
},
|
||||
|
||||
Bfsu =
|
||||
{
|
||||
"bfsu", "BFSU", "北京外国语大学开源软件镜像站", "https://mirrors.bfsu.edu.cn/",
|
||||
{NotSkip, NA, NA, "https://mirrors.bfsu.edu.cn/speedtest/1000mb.bin"}
|
||||
{NotSkip, NA, NA, "https://mirrors.bfsu.edu.cn/speedtest/1000mb.bin", ROUGH}
|
||||
},
|
||||
|
||||
Pku =
|
||||
{
|
||||
"pku", "PKU", "北京大学开源镜像站", "https://mirrors.pku.edu.cn/",
|
||||
{NotSkip, NA, NA, "https://mirrors.pku.edu.cn/ubuntu-releases" Big_File_ubuntu}
|
||||
{NotSkip, NA, NA, "https://mirrors.pku.edu.cn/ubuntu-releases" Big_File_ubuntu, ROUGH}
|
||||
},
|
||||
|
||||
Bjtu =
|
||||
{
|
||||
"bjtu", "BJTU", "北京交通大学自由与开源软件镜像站", "https://mirror.bjtu.edu.cn/",
|
||||
{NotSkip, NA, NA, "https://mirror.bjtu.edu.cn/archlinux" Big_File_archlinux}
|
||||
{NotSkip, NA, NA, "https://mirror.bjtu.edu.cn/archlinux" Big_File_archlinux, ROUGH}
|
||||
},
|
||||
|
||||
Sustech =
|
||||
{
|
||||
"sustech", "SUSTech", "南方科技大学开源软件镜像站", "https://mirrors.sustech.edu.cn/",
|
||||
{NotSkip, NA, NA, "https://mirrors.sustech.edu.cn/site/speedtest/1000mb.bin"}
|
||||
{NotSkip, NA, NA, "https://mirrors.sustech.edu.cn/site/speedtest/1000mb.bin", ROUGH}
|
||||
},
|
||||
|
||||
Ustc =
|
||||
{
|
||||
"ustc", "USTC", "中国科学技术大学开源镜像站", "https://mirrors.ustc.edu.cn/",
|
||||
{NotSkip, NA, NA, "https://mirrors.ustc.edu.cn/ubuntu-releases" Big_File_ubuntu}
|
||||
{NotSkip, NA, NA, "https://mirrors.ustc.edu.cn/ubuntu-releases" Big_File_ubuntu, ROUGH}
|
||||
},
|
||||
|
||||
Hust =
|
||||
{
|
||||
"hust", "HUST", "华中科技大学开源镜像站", "https://mirrors.hust.edu.cn/",
|
||||
{NotSkip, NA, NA, "https://mirrors.hust.edu.cn/ubuntu-releases" Big_File_ubuntu}
|
||||
{NotSkip, NA, NA, "https://mirrors.hust.edu.cn/ubuntu-releases" Big_File_ubuntu, ROUGH}
|
||||
},
|
||||
|
||||
// 速度暂时处于10位以后或者无测速报告,但是目前可用的源
|
||||
@@ -114,43 +114,43 @@ Hust =
|
||||
Iscas =
|
||||
{
|
||||
"iscas", "ISCAS", "中科院软件所智能软件研究中心开源镜像站", "https://mirror.iscas.ac.cn/",
|
||||
{NotSkip, NA, NA, "https://mirror.iscas.ac.cn/ubuntu-releases" Big_File_ubuntu}
|
||||
{NotSkip, NA, NA, "https://mirror.iscas.ac.cn/ubuntu-releases" Big_File_ubuntu, ROUGH}
|
||||
},
|
||||
|
||||
Scau =
|
||||
{
|
||||
"scau", "SCAU", "华南农业大学开源软件镜像站", "https://mirrors.scau.edu.cn/",
|
||||
{NotSkip, NA, NA, "https://mirrors.scau.edu.cn/ubuntu-releases" Big_File_ubuntu}
|
||||
{NotSkip, NA, NA, "https://mirrors.scau.edu.cn/ubuntu-releases" Big_File_ubuntu, ROUGH}
|
||||
},
|
||||
|
||||
NJTech =
|
||||
{
|
||||
"njtech", "NJTech", "南京工业大学开源软件镜像站", "https://mirrors.njtech.edu.cn/",
|
||||
{NotSkip, NA, NA, "https://mirrors.njtech.edu.cn/ubuntu-releases" Big_File_ubuntu}
|
||||
{NotSkip, NA, NA, "https://mirrors.njtech.edu.cn/ubuntu-releases" Big_File_ubuntu, ROUGH}
|
||||
},
|
||||
|
||||
Nyist =
|
||||
{
|
||||
"nyist", "NYIST", "南阳理工学院开源软件镜像站", "https://mirror.nyist.edu.cn/",
|
||||
{NotSkip, NA, NA, "https://mirror.nyist.edu.cn/ubuntu-releases" Big_File_ubuntu}
|
||||
{NotSkip, NA, NA, "https://mirror.nyist.edu.cn/ubuntu-releases" Big_File_ubuntu, ROUGH}
|
||||
},
|
||||
|
||||
Sdu =
|
||||
{
|
||||
"sdu", "SDU", "山东大学镜像站", "https://mirrors.sdu.edu.cn/",
|
||||
{NotSkip, NA, NA, "https://mirrors.sdu.edu.cn/ubuntu-releases" Big_File_ubuntu}
|
||||
{NotSkip, NA, NA, "https://mirrors.sdu.edu.cn/ubuntu-releases" Big_File_ubuntu, ROUGH}
|
||||
},
|
||||
|
||||
Cqupt =
|
||||
{
|
||||
"cqupt", "CQUPT", "重庆邮电大学开源镜像站", "https://mirrors.cqupt.edu.cn/",
|
||||
{NotSkip, NA, NA, "https://mirrors.cqupt.edu.cn/ubuntu-releases" Big_File_ubuntu}
|
||||
{NotSkip, NA, NA, "https://mirrors.cqupt.edu.cn/ubuntu-releases" Big_File_ubuntu, ROUGH}
|
||||
},
|
||||
|
||||
Nju =
|
||||
{
|
||||
"nju", "NJU", "南京大学开源镜像站", "https://mirrors.nju.edu.cn/",
|
||||
{NotSkip, NA, NA, "https://mirrors.nju.edu.cn/archlinux" Big_File_archlinux}
|
||||
{NotSkip, NA, NA, "https://mirrors.nju.edu.cn/archlinux" Big_File_archlinux, ROUGH}
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -159,7 +159,7 @@ Nju =
|
||||
Cqu =
|
||||
{
|
||||
"cqu", "CQU", "重庆大学开源软件镜像站", "https://mirrors.cqu.edu.cn/",
|
||||
{NotSkip, NA, NA, "https://mirrors.cqu.edu.cn/ubuntu-releases" Big_File_ubuntu}
|
||||
{NotSkip, NA, NA, "https://mirrors.cqu.edu.cn/ubuntu-releases" Big_File_ubuntu, ROUGH}
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -168,71 +168,71 @@ Cqu =
|
||||
MirrorSite_t Ali =
|
||||
{
|
||||
"ali", "Ali OPSX Public", "阿里巴巴开源镜像站(公网)", "https://developer.aliyun.com/mirror/",
|
||||
{NotSkip, NA, NA, "https://mirrors.aliyun.com/ubuntu/ls-lR.gz"} // 31MB左右
|
||||
{NotSkip, NA, NA, "https://mirrors.aliyun.com/ubuntu/ls-lR.gz", ROUGH} // 31MB左右
|
||||
},
|
||||
/*
|
||||
// https://mirrors.cloud.aliyuncs.com/
|
||||
Ali_ECS_VPC =
|
||||
{
|
||||
"ali-ECS-VPC", "Ali OPSX ECS VPC", "阿里巴巴开源镜像站(ECS VPC网络)", "https://developer.aliyun.com/mirror/",
|
||||
{NotSkip, NA, NA, "https://mirrors.cloud.aliyuncs.com/deepin-cd" Big_File_deepin}
|
||||
{NotSkip, NA, NA, "https://mirrors.cloud.aliyuncs.com/deepin-cd" Big_File_deepin, ROUGH}
|
||||
},
|
||||
|
||||
// https://mirrors.aliyuncs.com/
|
||||
Ali_ECS_classic =
|
||||
{
|
||||
"ali-ECS", "Ali OPSX ECS", "阿里巴巴开源镜像站(ECS 经典网络)", "https://developer.aliyun.com/mirror/",
|
||||
{NotSkip, NA, NA, "https://mirrors.aliyuncs.com/deepin-cd" Big_File_deepin}
|
||||
{NotSkip, NA, NA, "https://mirrors.aliyuncs.com/deepin-cd" Big_File_deepin, ROUGH}
|
||||
},
|
||||
*/
|
||||
|
||||
Tencent =
|
||||
{
|
||||
"tencent", "Tencent Public", "腾讯软件源(公网)", "https://mirrors.tencent.com/",
|
||||
{NotSkip, NA, NA, "https://mirrors.cloud.tencent.com/mariadb/mariadb-12.1.0/winx64-packages/mariadb-12.1.0-winx64-debugsymbols.zip"} // 110MB左右
|
||||
{NotSkip, NA, NA, "https://mirrors.cloud.tencent.com/mariadb/mariadb-12.1.0/winx64-packages/mariadb-12.1.0-winx64-debugsymbols.zip", ROUGH} // 110MB左右
|
||||
},
|
||||
/*
|
||||
Tencent_Intra =
|
||||
{
|
||||
"tencent-intra", "Tencent Intranet", "腾讯软件源(内网)", "https://mirrors.tencent.com/",
|
||||
{NotSkip, NA, NA, "https://mirrors.cloud.tencentyun.com/ubuntu-releases" Big_File_ubuntu}
|
||||
{NotSkip, NA, NA, "https://mirrors.cloud.tencentyun.com/ubuntu-releases" Big_File_ubuntu, ROUGH}
|
||||
},
|
||||
*/
|
||||
|
||||
Huawei =
|
||||
{
|
||||
"huawei", "Huawei Cloud", "华为开源镜像站", "https://mirrors.huaweicloud.com/",
|
||||
{NotSkip, NA, NA, "https://mirrors.huaweicloud.com/ubuntu-releases" Big_File_ubuntu}
|
||||
{NotSkip, NA, NA, "https://mirrors.huaweicloud.com/ubuntu-releases" Big_File_ubuntu, ROUGH}
|
||||
},
|
||||
|
||||
Volcengine =
|
||||
{
|
||||
"volc", "Volcengine", "火山引擎开源软件镜像站(公网)", "https://developer.volcengine.com/mirror/",
|
||||
{NotSkip, NA, NA, "https://mirrors.volces.com/ubuntu-releases" Big_File_ubuntu}
|
||||
{NotSkip, NA, NA, "https://mirrors.volces.com/ubuntu-releases" Big_File_ubuntu, ROUGH}
|
||||
},
|
||||
/*
|
||||
Volceengine_Intra =
|
||||
{
|
||||
"volc-intra", "Volcengine Intranet", "火山引擎开源软件镜像站(内网)",
|
||||
"https://developer.volcengine.com/mirror/",
|
||||
"https://mirrors.ivolces.com/ubuntu-releases" Big_File_ubuntu },
|
||||
"https://mirrors.ivolces.com/ubuntu-releases" Big_File_ubuntu, ROUGH},
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @note 2026-06-20 网易开源镜像站的速度始终过低,不建议再使用
|
||||
* @note 2025-06-20 网易开源镜像站的速度始终过低,不建议再使用
|
||||
*/
|
||||
Netease =
|
||||
{
|
||||
"netease", "Netease", "网易开源镜像站", "https://mirrors.163.com/",
|
||||
{NotSkip, NA, NA, "https://mirrors.163.com/deepin-cd" Big_File_deepin}
|
||||
{NotSkip, NA, NA, "https://mirrors.163.com/deepin-cd" Big_File_deepin, ROUGH}
|
||||
},
|
||||
|
||||
/**
|
||||
* @note 2026-06-20 搜狐开源镜像站的速度始终过低,不建议再使用
|
||||
* @note 2025-06-20 搜狐开源镜像站的速度始终过低,不建议再使用
|
||||
*/
|
||||
Sohu =
|
||||
{
|
||||
"sohu", "SOHU", "搜狐开源镜像站", "https://mirrors.sohu.com/",
|
||||
{NotSkip, NA, NA, "https://mirrors.sohu.com/deepin-cd" Big_File_deepin}
|
||||
{NotSkip, NA, NA, "https://mirrors.sohu.com/deepin-cd" Big_File_deepin, ROUGH}
|
||||
};
|
||||
|
||||
@@ -7,32 +7,36 @@
|
||||
* Contributors : Shengwei Chen <414685209@qq.com>
|
||||
* |
|
||||
* Created On : <2023-08-29>
|
||||
* Last Modified : <2024-12-18>
|
||||
* Last Modified : <2025-07-11>
|
||||
*
|
||||
* chsrc struct
|
||||
* ------------------------------------------------------------*/
|
||||
|
||||
typedef struct SpeedMeasureInfo_t
|
||||
typedef struct ProviderSpeedMeasureInfo_t
|
||||
{
|
||||
bool skip; /* 是否默认跳过 */
|
||||
char *skip_reason_CN; /* 跳过的原因(中文)*/
|
||||
char *skip_reason_EN; /* 跳过的原因(英文)*/
|
||||
char *url; /* 测速链接 */
|
||||
bool accurate; /* 是否为精准测速,上游源和专用镜像站为true,通用镜像站为false*/
|
||||
}
|
||||
SpeedMeasureInfo_t;
|
||||
ProviderSpeedMeasureInfo_t;
|
||||
|
||||
#define SKIP true
|
||||
#define NotSkip false
|
||||
#define ToFill NULL
|
||||
#define NA NULL
|
||||
|
||||
#define ACCURATE true
|
||||
#define ROUGH false
|
||||
|
||||
typedef struct SourceProvider_t
|
||||
{
|
||||
const char *code; /* 用于用户指定某一 Provider */
|
||||
const char *abbr; /* 需要使用 Provider 的英文名时,用这个代替,因为大部分 Provider 没有提供正式的英文名 */
|
||||
const char *name; /* Provider 中文名 */
|
||||
const char *site; /* Provider 首页 */
|
||||
SpeedMeasureInfo_t smi;
|
||||
ProviderSpeedMeasureInfo_t psmi;
|
||||
}
|
||||
SourceProvider_t;
|
||||
|
||||
@@ -43,16 +47,16 @@ SourceProvider_t UpstreamProvider =
|
||||
/* 引入新的上游默认源时,请使下面第一行的前三个字段保持不变,只添加第四个字段,可使用 def_upstream 宏 */
|
||||
"upstream", "Upstream", "上游默认源", NULL,
|
||||
/* 引入新的上游默认源时,请完全修改下面这个结构体,可使用 def_need_measure_info 宏 */
|
||||
{SKIP, "URL未知,邀您参与贡献!", "URL unknown, welcome to contribute!", NULL}
|
||||
{SKIP, "URL未知,邀您参与贡献!", "URL unknown, welcome to contribute!", NULL, ACCURATE}
|
||||
};
|
||||
|
||||
#define def_upstream "upstream", "Upstream", "上游默认源"
|
||||
#define def_need_measure_info {SKIP, "缺乏较大的测速对象,邀您参与贡献!", "Lack of large object URL, welcome to contribute!", NULL}
|
||||
#define def_need_measure_info {SKIP, "缺乏较大的测速对象,邀您参与贡献!", "Lack of large object URL, welcome to contribute!", NULL, ACCURATE}
|
||||
|
||||
SourceProvider_t UserDefinedProvider =
|
||||
{
|
||||
"user", "用户自定义", "用户自定义", NULL,
|
||||
{SKIP, "用户自定义源不测速", "SKIP for user-defined source", NULL}
|
||||
{SKIP, "用户自定义源不测速", "SKIP for user-defined source", NULL, ACCURATE}
|
||||
};
|
||||
|
||||
|
||||
@@ -62,7 +66,11 @@ typedef struct Source_t
|
||||
SourceProvider_t *provider;
|
||||
MirrorSite_t *mirror;
|
||||
};
|
||||
/* 用于换源的 URL */
|
||||
char *url;
|
||||
|
||||
/* 精准测速 URL*/
|
||||
char *accurate_speed_measure_url;
|
||||
}
|
||||
Source_t;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user