mirror of
https://github.com/RubyMetric/chsrc
synced 2025-06-08 19:54:13 +08:00
parent
9e6ff663f9
commit
bba1df37f8
215
include/source.h
215
include/source.h
@ -6,18 +6,30 @@
|
|||||||
* Contributors : Shengwei Chen <414685209@qq.com>
|
* Contributors : Shengwei Chen <414685209@qq.com>
|
||||||
* |
|
* |
|
||||||
* Created On : <2023-08-29>
|
* Created On : <2023-08-29>
|
||||||
* Last Modified : <2024-11-08>
|
* Last Modified : <2024-11-21>
|
||||||
*
|
*
|
||||||
* 通用镜像站与换源信息
|
* 通用镜像站与换源信息
|
||||||
* ------------------------------------------------------------*/
|
* ------------------------------------------------------------*/
|
||||||
|
|
||||||
typedef struct MirrorSite_t {
|
typedef struct SpeedMeasureInfo_t
|
||||||
const char *code; // 用于用户指定镜像站
|
{
|
||||||
const char *abbr; // 需要使用镜像站的英文名时,用这个代替,因为大部分镜像站没有提供正式的英文名
|
bool skip; /* 是否默认跳过 */
|
||||||
const char *name; // 镜像站中文名
|
const char *skip_reason_CN; /* 跳过的原因(中文)*/
|
||||||
const char *site;
|
const char *skip_reason_EN; /* 跳过的原因(英文)*/
|
||||||
const char *bigfile_url; // 用于对该镜像站测速
|
const char *url; /* 测速链接 */
|
||||||
} MirrorSite;
|
}
|
||||||
|
SpeedMeasureInfo;
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct MirrorSite_t
|
||||||
|
{
|
||||||
|
const char *code; /* 用于用户指定镜像站 */
|
||||||
|
const char *abbr; /* 需要使用镜像站的英文名时,用这个代替,因为大部分镜像站没有提供正式的英文名 */
|
||||||
|
const char *name; /* 镜像站中文名 */
|
||||||
|
const char *site; /* 镜像站首页 */
|
||||||
|
SpeedMeasureInfo smi;
|
||||||
|
}
|
||||||
|
MirrorSite;
|
||||||
|
|
||||||
#define Big_File_ubuntu "/24.04/ubuntu-24.04.1-desktop-amd64.iso" // 5.8 GB
|
#define Big_File_ubuntu "/24.04/ubuntu-24.04.1-desktop-amd64.iso" // 5.8 GB
|
||||||
#define Big_File_ctan "/systems/texlive/Images/texlive.iso" // 4.8 GB
|
#define Big_File_ctan "/systems/texlive/Images/texlive.iso" // 4.8 GB
|
||||||
@ -33,56 +45,91 @@ typedef struct MirrorSite_t {
|
|||||||
* Wiki中的排序是根据 https://github.com/mirrorz-org/oh-my-mirrorz 挑选速度前10位
|
* Wiki中的排序是根据 https://github.com/mirrorz-org/oh-my-mirrorz 挑选速度前10位
|
||||||
*/
|
*/
|
||||||
MirrorSite
|
MirrorSite
|
||||||
MirrorZ = {"mirrorz", "MirrorZ", "MirrorZ 校园网镜像站", "https://mirrors.cernet.edu.cn/", NULL},
|
MirrorZ = {
|
||||||
|
"mirrorz", "MirrorZ", "MirrorZ 校园网镜像站", "https://mirrors.cernet.edu.cn/",
|
||||||
|
{true, "功能特殊无法测速,跳过", "SKIP because of its special function"}
|
||||||
|
},
|
||||||
|
|
||||||
Tuna = {"tuna", "TUNA", "清华大学开源软件镜像站", "https://mirrors.tuna.tsinghua.edu.cn/",
|
Tuna = {
|
||||||
"https://mirrors.tuna.tsinghua.edu.cn/speedtest/1000mb.bin"},
|
"tuna", "TUNA", "清华大学开源软件镜像站", "https://mirrors.tuna.tsinghua.edu.cn/",
|
||||||
|
{false, NULL, NULL, "https://mirrors.tuna.tsinghua.edu.cn/speedtest/1000mb.bin"}
|
||||||
|
},
|
||||||
|
|
||||||
Sjtug_Zhiyuan = {"sjtu", "SJTUG-zhiyuan", "上海交通大学致远镜像站", "https://mirrors.sjtug.sjtu.edu.cn/",
|
Sjtug_Zhiyuan = {
|
||||||
"https://mirrors.sjtug.sjtu.edu.cn/ctan" Big_File_ctan},
|
"sjtu", "SJTUG-zhiyuan", "上海交通大学致远镜像站", "https://mirrors.sjtug.sjtu.edu.cn/",
|
||||||
|
{false, NULL, NULL, "https://mirrors.sjtug.sjtu.edu.cn/ctan" Big_File_ctan}
|
||||||
|
},
|
||||||
|
|
||||||
Zju = {"zju", "ZJU", "浙江大学开源软件镜像站", "https://mirrors.zju.edu.cn/",
|
Zju = {
|
||||||
"https://mirrors.zju.edu.cn/ubuntu-releases" Big_File_ubuntu},
|
"zju", "ZJU", "浙江大学开源软件镜像站", "https://mirrors.zju.edu.cn/",
|
||||||
|
{false, NULL, NULL, "https://mirrors.zju.edu.cn/ubuntu-releases" Big_File_ubuntu}
|
||||||
|
},
|
||||||
|
|
||||||
Lzuoss = {"lzu", "LZUOSS", "兰州大学开源社区镜像站", "https://mirror.lzu.edu.cn/",
|
Lzuoss = {
|
||||||
"https://mirror.lzu.edu.cn/CTAN" Big_File_ctan},
|
"lzu", "LZUOSS", "兰州大学开源社区镜像站", "https://mirror.lzu.edu.cn/",
|
||||||
|
{false, NULL, NULL, "https://mirror.lzu.edu.cn/CTAN" Big_File_ctan}
|
||||||
|
},
|
||||||
|
|
||||||
Jlu = {"jlu", "JLU", "吉林大学开源镜像站", "https://mirrors.jlu.edu.cn/",
|
Jlu = {
|
||||||
"https://mirrors.jlu.edu.cn/_static/speedtest.bin"},
|
"jlu", "JLU", "吉林大学开源镜像站", "https://mirrors.jlu.edu.cn/",
|
||||||
|
{false, NULL, NULL, "https://mirrors.jlu.edu.cn/_static/speedtest.bin"}
|
||||||
|
},
|
||||||
|
|
||||||
Bfsu = {"bfsu", "BFSU", "北京外国语大学开源软件镜像站","https://mirrors.bfsu.edu.cn/",
|
Bfsu = {
|
||||||
"https://mirrors.bfsu.edu.cn/speedtest/1000mb.bin"},
|
"bfsu", "BFSU", "北京外国语大学开源软件镜像站", "https://mirrors.bfsu.edu.cn/",
|
||||||
|
{false, NULL, NULL, "https://mirrors.bfsu.edu.cn/speedtest/1000mb.bin"}
|
||||||
|
},
|
||||||
|
|
||||||
Pku = {"pku", "PKU", "北京大学开源镜像站", "https://mirrors.pku.edu.cn/",
|
Pku = {
|
||||||
"https://mirrors.pku.edu.cn/ubuntu-releases" Big_File_ubuntu},
|
"pku", "PKU", "北京大学开源镜像站", "https://mirrors.pku.edu.cn/",
|
||||||
|
{false, NULL, NULL, "https://mirrors.pku.edu.cn/ubuntu-releases" Big_File_ubuntu}
|
||||||
|
},
|
||||||
|
|
||||||
Bjtu = {"bjtu", "BJTU", "北京交通大学自由与开源软件镜像站", "https://mirror.bjtu.edu.cn/",
|
Bjtu = {
|
||||||
"https://mirror.bjtu.edu.cn/archlinux" Big_File_archlinux},
|
"bjtu", "BJTU", "北京交通大学自由与开源软件镜像站", "https://mirror.bjtu.edu.cn/",
|
||||||
|
{false, NULL, NULL, "https://mirror.bjtu.edu.cn/archlinux" Big_File_archlinux}
|
||||||
|
},
|
||||||
|
|
||||||
Sustech = {"sustech", "SUSTech", "南方科技大学开源软件镜像站", "https://mirrors.sustech.edu.cn/",
|
Sustech = {
|
||||||
"https://mirrors.sustech.edu.cn/site/speedtest/1000mb.bin"},
|
"sustech", "SUSTech", "南方科技大学开源软件镜像站", "https://mirrors.sustech.edu.cn/",
|
||||||
|
{false, NULL, NULL, "https://mirrors.sustech.edu.cn/site/speedtest/1000mb.bin"}
|
||||||
|
},
|
||||||
|
|
||||||
Ustc = {"ustc", "USTC", "中国科学技术大学开源镜像站", "https://mirrors.ustc.edu.cn/",
|
Ustc = {
|
||||||
"https://mirrors.ustc.edu.cn/ubuntu-releases" Big_File_ubuntu},
|
"ustc", "USTC", "中国科学技术大学开源镜像站", "https://mirrors.ustc.edu.cn/",
|
||||||
|
{false, NULL, NULL, "https://mirrors.ustc.edu.cn/ubuntu-releases" Big_File_ubuntu}
|
||||||
|
},
|
||||||
|
|
||||||
Hust = {"hust", "HUST", "华中科技大学开源镜像站", "https://mirrors.hust.edu.cn/",
|
Hust = {
|
||||||
"https://mirrors.hust.edu.cn/ubuntu-releases" Big_File_ubuntu},
|
"hust", "HUST", "华中科技大学开源镜像站", "https://mirrors.hust.edu.cn/",
|
||||||
|
{false, NULL, NULL, "https://mirrors.hust.edu.cn/ubuntu-releases" Big_File_ubuntu}
|
||||||
|
},
|
||||||
|
|
||||||
// 速度暂时处于10位以后,但是目前可用的源
|
// 速度暂时处于10位以后,但是目前可用的源
|
||||||
Iscas = {"iscas", "ISCAS", "中科院软件所智能软件研究中心开源镜像站", "https://mirror.iscas.ac.cn/",
|
Iscas = {
|
||||||
"https://mirror.iscas.ac.cn/ubuntu-releases" Big_File_ubuntu},
|
"iscas", "ISCAS", "中科院软件所智能软件研究中心开源镜像站", "https://mirror.iscas.ac.cn/",
|
||||||
|
{false, NULL, NULL, "https://mirror.iscas.ac.cn/ubuntu-releases" Big_File_ubuntu}
|
||||||
|
},
|
||||||
|
|
||||||
Scau = {"scau", "SCAU", "华南农业大学开源软件镜像站", "https://mirrors.scau.edu.cn/",
|
Scau = {
|
||||||
"https://mirrors.scau.edu.cn/ubuntu-releases" Big_File_ubuntu},
|
"scau", "SCAU", "华南农业大学开源软件镜像站", "https://mirrors.scau.edu.cn/",
|
||||||
|
{false, NULL, NULL, "https://mirrors.scau.edu.cn/ubuntu-releases" Big_File_ubuntu}
|
||||||
|
},
|
||||||
|
|
||||||
Nju = {"nju", "NJU", "南京大学开源镜像站", "https://mirrors.nju.edu.cn/",
|
Nju = {
|
||||||
"https://mirrors.nju.edu.cn/archlinux" Big_File_archlinux};
|
"nju", "NJU", "南京大学开源镜像站", "https://mirrors.nju.edu.cn/",
|
||||||
|
{false, NULL, NULL, "https://mirrors.nju.edu.cn/archlinux" Big_File_archlinux}
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @note [ccmywish:2023-09-05] 我只使用了不到5次,重庆大学镜像站就把我的ip封杀了,对用户来说封杀策略过严,暂时不可靠,暂时不用
|
* @note 2023-09-05 只使用了不到5次,重庆大学镜像站就把我的ip封杀了,对用户来说封杀策略过严,暂时不可靠,暂时不用
|
||||||
|
*
|
||||||
|
* Cqu = {
|
||||||
|
* "cqu", "CQU", "重庆大学开源软件镜像站", "https://mirrors.cqu.edu.cn/",
|
||||||
|
* {false, NULL, NULL, "https://mirrors.cqu.edu.cn/speedtest/1000mb.bin"}
|
||||||
|
* };
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
// Cqu = {"cqu", "CQU", "重庆大学开源软件镜像站", "https://mirrors.cqu.edu.cn/",
|
|
||||||
// "https://mirrors.cqu.edu.cn/speedtest/1000mb.bin"};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -91,41 +138,43 @@ Nju = {"nju", "NJU", "南京大学开源镜像站",
|
|||||||
*/
|
*/
|
||||||
MirrorSite
|
MirrorSite
|
||||||
Ali = {
|
Ali = {
|
||||||
"ali", "Ali OPSX Public", "阿里巴巴开源镜像站(公网)",
|
"ali", "Ali OPSX Public", "阿里巴巴开源镜像站(公网)", "https://developer.aliyun.com/mirror/",
|
||||||
"https://developer.aliyun.com/mirror/",
|
{false, NULL, NULL, "https://mirrors.aliyun.com/deepin-cd" Big_File_deepin}
|
||||||
"https://mirrors.aliyun.com/deepin-cd" Big_File_deepin},
|
},
|
||||||
|
|
||||||
/*
|
/*
|
||||||
// https://mirrors.cloud.aliyuncs.com/
|
// https://mirrors.cloud.aliyuncs.com/
|
||||||
Ali_ECS_VPC = {
|
Ali_ECS_VPC = {
|
||||||
"ali-ECS-VPC", "Ali OPSX ECS VPC", "阿里巴巴开源镜像站(ECS VPC网络)",
|
"ali-ECS-VPC", "Ali OPSX ECS VPC", "阿里巴巴开源镜像站(ECS VPC网络)", "https://developer.aliyun.com/mirror/",
|
||||||
"https://developer.aliyun.com/mirror/",
|
{false, NULL, NULL, "https://mirrors.cloud.aliyuncs.com/deepin-cd" Big_File_deepin}
|
||||||
"https://mirrors.cloud.aliyuncs.com/deepin-cd" Big_File_deepin},
|
},
|
||||||
|
|
||||||
// https://mirrors.aliyuncs.com/
|
// https://mirrors.aliyuncs.com/
|
||||||
Ali_ECS_classic = {
|
Ali_ECS_classic = {
|
||||||
"ali-ECS", "Ali OPSX ECS", "阿里巴巴开源镜像站(ECS 经典网络)",
|
"ali-ECS", "Ali OPSX ECS", "阿里巴巴开源镜像站(ECS 经典网络)", "https://developer.aliyun.com/mirror/",
|
||||||
"https://developer.aliyun.com/mirror/",
|
{false, NULL, NULL, "https://mirrors.aliyuncs.com/deepin-cd" Big_File_deepin}
|
||||||
"https://mirrors.aliyuncs.com/deepin-cd" Big_File_deepin},
|
},
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Tencent = {
|
Tencent = {
|
||||||
"tencent", "Tencent Public", "腾讯软件源(公网)", "https://mirrors.tencent.com/",
|
"tencent", "Tencent Public", "腾讯软件源(公网)", "https://mirrors.tencent.com/",
|
||||||
"https://mirrors.cloud.tencent.com/ubuntu-releases" Big_File_ubuntu},
|
{false, NULL, NULL, "https://mirrors.cloud.tencent.com/ubuntu-releases" Big_File_ubuntu}
|
||||||
|
},
|
||||||
/*
|
/*
|
||||||
Tencent_Intra = {
|
Tencent_Intra = {
|
||||||
"tencent-intra", "Tencent Intranet", "腾讯软件源(内网)", "https://mirrors.tencent.com/",
|
"tencent-intra", "Tencent Intranet", "腾讯软件源(内网)", "https://mirrors.tencent.com/",
|
||||||
"https://mirrors.cloud.tencentyun.com/ubuntu-releases" Big_File_ubuntu},
|
{false, NULL, NULL, "https://mirrors.cloud.tencentyun.com/ubuntu-releases" Big_File_ubuntu}
|
||||||
|
},
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Huawei = {"huawei", "Huawei Cloud", "华为开源镜像站", "https://mirrors.huaweicloud.com/",
|
Huawei = {
|
||||||
"https://mirrors.huaweicloud.com/ubuntu-releases" Big_File_ubuntu },
|
"huawei", "Huawei Cloud", "华为开源镜像站", "https://mirrors.huaweicloud.com/",
|
||||||
|
{false, NULL, NULL, "https://mirrors.huaweicloud.com/ubuntu-releases" Big_File_ubuntu}
|
||||||
|
},
|
||||||
|
|
||||||
Volcengine = {
|
Volcengine = {
|
||||||
"volc", "Volcengine", "火山引擎开源软件镜像站(公网)",
|
"volc", "Volcengine", "火山引擎开源软件镜像站(公网)", "https://developer.volcengine.com/mirror/",
|
||||||
"https://developer.volcengine.com/mirror/",
|
{false, NULL, NULL, "https://mirrors.volces.com/ubuntu-releases" Big_File_ubuntu}
|
||||||
"https://mirrors.volces.com/ubuntu-releases" Big_File_ubuntu },
|
},
|
||||||
/*
|
/*
|
||||||
Volceengine_Intra = {
|
Volceengine_Intra = {
|
||||||
"volc-intra", "Volcengine Intranet", "火山引擎开源软件镜像站(内网)",
|
"volc-intra", "Volcengine Intranet", "火山引擎开源软件镜像站(内网)",
|
||||||
@ -134,52 +183,67 @@ Volceengine_Intra = {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
Netease = {
|
Netease = {
|
||||||
"netease", "Netease", "网易开源镜像站",
|
"netease", "Netease", "网易开源镜像站", "https://mirrors.163.com/",
|
||||||
"https://mirrors.163.com/",
|
{false, NULL, NULL, "https://mirrors.163.com/deepin-cd" Big_File_deepin}
|
||||||
"https://mirrors.163.com/deepin-cd" Big_File_deepin},
|
},
|
||||||
|
|
||||||
Sohu = {
|
Sohu = {
|
||||||
"sohu", "SOHU", "搜狐开源镜像站",
|
"sohu", "SOHU", "搜狐开源镜像站", "https://mirrors.sohu.com/",
|
||||||
"https://mirrors.sohu.com/",
|
{false, NULL, NULL, "https://mirrors.sohu.com/deepin-cd" Big_File_deepin}
|
||||||
"https://mirrors.sohu.com/deepin-cd" Big_File_deepin};
|
};
|
||||||
|
|
||||||
|
|
||||||
MirrorSite
|
MirrorSite
|
||||||
Upstream = {"upstream", "Upstream", "上游默认源", NULL, NULL};
|
Upstream = {
|
||||||
|
"upstream", "Upstream", "上游默认源", NULL,
|
||||||
|
{true, "上游默认源不测速", "SKIP for upstream source", NULL}
|
||||||
|
};
|
||||||
|
|
||||||
MirrorSite
|
MirrorSite
|
||||||
UserDefine = {"user", "用户自定义", "用户自定义", NULL, NULL};
|
UserDefine = {
|
||||||
|
"user", "用户自定义", "用户自定义", NULL,
|
||||||
|
{true, "用户自定义源不测速", "SKIP for user-defined source", NULL}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
typedef struct SourceInfo_t {
|
typedef struct SourceInfo_t
|
||||||
|
{
|
||||||
const MirrorSite *mirror;
|
const MirrorSite *mirror;
|
||||||
const char *url;
|
const char *url;
|
||||||
} SourceInfo;
|
}
|
||||||
|
SourceInfo;
|
||||||
|
|
||||||
#define def_sources_n(t) const size_t t##_sources_n = xy_arylen(t##_sources)
|
#define def_sources_n(t) const size_t t##_sources_n = xy_arylen(t##_sources)
|
||||||
|
|
||||||
enum Capability {
|
enum Capability
|
||||||
|
{
|
||||||
CanNot,
|
CanNot,
|
||||||
FullyCan,
|
FullyCan,
|
||||||
PartiallyCan
|
PartiallyCan
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/* Target Feature Info */
|
/* Target Feature Info */
|
||||||
typedef struct FeatInfo_t {
|
typedef struct FeatInfo_t
|
||||||
|
{
|
||||||
bool can_get;
|
bool can_get;
|
||||||
bool can_reset; // 有的reset不是暂时没有实现,而是现在的实现根本就无法重置
|
bool can_reset; /* 有的reset不是暂时没有实现,而是现在的实现根本就无法重置 */
|
||||||
|
|
||||||
bool can_english;
|
bool can_english;
|
||||||
|
|
||||||
bool can_user_define; // 用户自定义换源URL
|
bool can_user_define; /* 用户自定义换源URL */
|
||||||
|
|
||||||
enum Capability cap_locally;
|
enum Capability cap_locally;
|
||||||
char *cap_locally_explain;
|
char *cap_locally_explain;
|
||||||
|
|
||||||
char *note;
|
char *note;
|
||||||
} FeatInfo;
|
}
|
||||||
|
FeatInfo;
|
||||||
|
|
||||||
|
|
||||||
/* Target Info */
|
/* Target Info */
|
||||||
typedef struct TargetInfo_t {
|
typedef struct TargetInfo_t
|
||||||
|
{
|
||||||
void (*getfn) (char *option);
|
void (*getfn) (char *option);
|
||||||
void (*setfn) (char *option);
|
void (*setfn) (char *option);
|
||||||
void (*resetfn) (char *option);
|
void (*resetfn) (char *option);
|
||||||
@ -188,7 +252,8 @@ typedef struct TargetInfo_t {
|
|||||||
|
|
||||||
SourceInfo *sources;
|
SourceInfo *sources;
|
||||||
size_t sources_n;
|
size_t sources_n;
|
||||||
} TargetInfo;
|
}
|
||||||
|
TargetInfo;
|
||||||
|
|
||||||
|
|
||||||
#define def_target_inner_s(t) NULL, t##_setsrc, NULL, NULL
|
#define def_target_inner_s(t) NULL, t##_setsrc, NULL, NULL
|
||||||
|
@ -383,6 +383,8 @@ query_mirror_exist (SourceInfo *sources, size_t size, char *target, char *input)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 该函数来自 oh-my-mirrorz.py,由 @ccmywish 翻译为C语言,但功劳和版权属于原作者
|
* 该函数来自 oh-my-mirrorz.py,由 @ccmywish 翻译为C语言,但功劳和版权属于原作者
|
||||||
|
*
|
||||||
|
* @param speed 单位为Byte/s
|
||||||
*/
|
*/
|
||||||
char *
|
char *
|
||||||
to_human_readable_speed (double speed)
|
to_human_readable_speed (double speed)
|
||||||
@ -490,7 +492,7 @@ measure_speed_for_url (void *url)
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return 返回速度speed
|
* @return 返回速度speed,单位为 Byte/s
|
||||||
*/
|
*/
|
||||||
double
|
double
|
||||||
parse_and_say_curl_result (char *curl_buf)
|
parse_and_say_curl_result (char *curl_buf)
|
||||||
@ -538,12 +540,12 @@ get_max_ele_idx_in_dbl_ary (double *array, int size)
|
|||||||
/**
|
/**
|
||||||
* @param sources 所有待测源
|
* @param sources 所有待测源
|
||||||
* @param size 待测源的数量
|
* @param size 待测源的数量
|
||||||
* @param[out] speed_records 速度值记录
|
* @param[out] speed_records 速度值记录,单位为Byte/s
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
measure_speed_for_every_source (SourceInfo sources[], int size, double speed_records[])
|
measure_speed_for_every_source (SourceInfo sources[], int size, double speed_records[])
|
||||||
{
|
{
|
||||||
bool get_measured[size]; /* 是否测速了 */
|
bool get_measured[size]; /* 是否真正执行了测速 */
|
||||||
int get_measured_n = 0; /* 测速了几个 */
|
int get_measured_n = 0; /* 测速了几个 */
|
||||||
char *measure_msgs[size];
|
char *measure_msgs[size];
|
||||||
|
|
||||||
@ -552,35 +554,63 @@ measure_speed_for_every_source (SourceInfo sources[], int size, double speed_rec
|
|||||||
for (int i=0; i<size; i++)
|
for (int i=0; i<size; i++)
|
||||||
{
|
{
|
||||||
SourceInfo src = sources[i];
|
SourceInfo src = sources[i];
|
||||||
const char *url = src.mirror->bigfile_url;
|
|
||||||
if (NULL==url)
|
const SpeedMeasureInfo smi = src.mirror->smi;
|
||||||
|
|
||||||
|
bool skip = smi.skip;
|
||||||
|
|
||||||
|
const char *url = smi.url;
|
||||||
|
|
||||||
|
if (!skip && NULL==url)
|
||||||
|
// 这种情况应当被视为bug,但是我们目前还是软处理
|
||||||
|
{
|
||||||
|
char *msg1 = CliOpt_InEnglish ? "Maintainers don't offer " : "维护者未提供 ";
|
||||||
|
char *msg2 = CliOpt_InEnglish ? " mirror site's speed measure link, so skip it" : " 镜像站测速链接,跳过该站点";
|
||||||
|
chsrc_warn (xy_strjoin (3, msg1, src.mirror->code, msg2));
|
||||||
|
speed = 0;
|
||||||
|
|
||||||
|
speed_records[i] = speed;
|
||||||
|
get_measured[i] = false;
|
||||||
|
measure_msgs[i] = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (skip)
|
||||||
{
|
{
|
||||||
if (xy_streql ("upstream", src.mirror->code))
|
if (xy_streql ("upstream", src.mirror->code))
|
||||||
{
|
{
|
||||||
// 上游源不测速,但不置0,因为要避免这种情况: 可能其他镜像站测速都为0,最后反而选择了该 upstream
|
// 上游源不测速,但不置0,因为要避免这种情况: 可能其他镜像站测速都为0,最后反而选择了该 upstream
|
||||||
speed = -999;
|
speed = -1024*1024*1024;
|
||||||
|
}
|
||||||
|
else if (xy_streql ("user", src.mirror->code))
|
||||||
|
{
|
||||||
|
// 代码不会执行至此
|
||||||
|
speed = 1024*1024*1024;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char *msg1 = CliOpt_InEnglish ? "Dev team doesn't offer " : "开发者未提供 ";
|
// 什么情况?
|
||||||
char *msg2 = CliOpt_InEnglish ? " mirror site's speed measure link, so skip it" : " 镜像站测速链接,跳过该站点";
|
speed = -1;
|
||||||
chsrc_warn (xy_strjoin (3, msg1, src.mirror->code, msg2));
|
|
||||||
speed = 0;
|
|
||||||
}
|
}
|
||||||
speed_records[i] = speed;
|
|
||||||
get_measured[i] = false;
|
get_measured[i] = false;
|
||||||
measure_msgs[i] = NULL;
|
speed_records[i] = speed;
|
||||||
|
|
||||||
|
const char *msg = CliOpt_InEnglish ? src.mirror->abbr : src.mirror->name;
|
||||||
|
const char *skip_reason = CliOpt_InEnglish ? smi.skip_reason_EN : smi.skip_reason_CN;
|
||||||
|
if (NULL==skip_reason)
|
||||||
|
{
|
||||||
|
skip_reason = CliOpt_InEnglish ? "SKIP for no reason" : "无理由跳过";
|
||||||
|
}
|
||||||
|
measure_msgs[i] = xy_strjoin (4, " x ", msg, " ", yellow(skip_reason));
|
||||||
|
printf ("%s\n", measure_msgs[i]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const char *msg = CliOpt_InEnglish ? src.mirror->abbr : src.mirror->name;
|
const char *msg = CliOpt_InEnglish ? src.mirror->abbr : src.mirror->name;
|
||||||
measure_msgs[i] = xy_strjoin (3, " - ", msg, " ... ");
|
measure_msgs[i] = xy_strjoin (3, " - ", msg, " ... ");
|
||||||
printf ("%s", measure_msgs[i]);
|
printf ("%s", measure_msgs[i]);
|
||||||
|
|
||||||
fflush (stdout);
|
fflush (stdout);
|
||||||
|
|
||||||
char *url_ = xy_strdup (url);
|
char *url_ = xy_strdup (url);
|
||||||
|
|
||||||
char *curl_result = measure_speed_for_url (url_);
|
char *curl_result = measure_speed_for_url (url_);
|
||||||
double speed = parse_and_say_curl_result (curl_result);
|
double speed = parse_and_say_curl_result (curl_result);
|
||||||
speed_records[i] = speed;
|
speed_records[i] = speed;
|
||||||
|
@ -10,11 +10,15 @@
|
|||||||
* ------------------------------------------------------------*/
|
* ------------------------------------------------------------*/
|
||||||
|
|
||||||
static MirrorSite
|
static MirrorSite
|
||||||
GoProxyCN = {"goproxy.cn", "Goproxy.cn", "Goproxy.cn (七牛云)", "https://goproxy.cn/",
|
GoProxyCN = {
|
||||||
"https://goproxy.cn/github.com/aws/aws-sdk-go/@v/v1.45.2.zip"}, // 30 MB
|
"goproxy.cn", "Goproxy.cn", "Goproxy.cn (七牛云)", "https://goproxy.cn/",
|
||||||
|
{false, NULL, NULL, "https://goproxy.cn/github.com/aws/aws-sdk-go/@v/v1.45.2.zip"} // 30 MB
|
||||||
|
},
|
||||||
|
|
||||||
GoProxyIO = {"goproxy.io", "GOPROXY.IO", "GOPROXY.IO", "https://goproxy.io/",
|
GoProxyIO = {
|
||||||
"https://goproxy.io/github.com/aws/aws-sdk-go/@v/v1.45.2.zip"}; // 30 MB
|
"goproxy.io", "GOPROXY.IO", "GOPROXY.IO", "https://goproxy.io/",
|
||||||
|
{false, NULL, NULL, "https://goproxy.io/github.com/aws/aws-sdk-go/@v/v1.45.2.zip"} // 30 MB
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -9,9 +9,11 @@
|
|||||||
* ------------------------------------------------------------*/
|
* ------------------------------------------------------------*/
|
||||||
|
|
||||||
static MirrorSite
|
static MirrorSite
|
||||||
NpmMirror = {"npmmirror", "npmmirror", "npmmirror (阿里云赞助)", "https://npmmirror.com/",
|
NpmMirror = {
|
||||||
// 注意,这个是跳转后的地址,不确定未来会不会改变
|
"npmmirror", "npmmirror", "npmmirror (阿里云赞助)", "https://npmmirror.com/",
|
||||||
"https://cdn.npmmirror.com/packages/%40tensorflow/tfjs/4.10.0/tfjs-4.10.0.tgz"}; // 29MB
|
// 注意,下面这个是跳转后的地址,不确定未来会不会改变
|
||||||
|
{false, NULL, NULL, "https://cdn.npmmirror.com/packages/%40tensorflow/tfjs/4.10.0/tfjs-4.10.0.tgz"} // 29MB
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -4,12 +4,14 @@
|
|||||||
* File Authors : Aoran Zeng <ccmywish@qq.com>
|
* File Authors : Aoran Zeng <ccmywish@qq.com>
|
||||||
* Contributors : Nil Null <nil@null.org>
|
* Contributors : Nil Null <nil@null.org>
|
||||||
* Created On : <2023-08-29>
|
* Created On : <2023-08-29>
|
||||||
* Last Modified : <2024-11-08>
|
* Last Modified : <2024-11-21>
|
||||||
* ------------------------------------------------------------*/
|
* ------------------------------------------------------------*/
|
||||||
|
|
||||||
static MirrorSite
|
static MirrorSite
|
||||||
RubyChina = {"rubychina", "RubyChina", "Ruby China 社区", "https://gems.ruby-china.com/",
|
RubyChina = {
|
||||||
"https://gems.ruby-china.com/rubygems/gems/nokogiri-1.15.0-java.gem"}; // 9.9 MB
|
"rubychina", "RubyChina", "Ruby China 社区", "https://gems.ruby-china.com/",
|
||||||
|
{false, NULL, NULL, "https://gems.ruby-china.com/rubygems/gems/nokogiri-1.15.0-java.gem"} // 9.9 MB
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @update 2024-09-04
|
* @update 2024-09-04
|
||||||
|
@ -10,15 +10,22 @@
|
|||||||
* ------------------------------------------------------------*/
|
* ------------------------------------------------------------*/
|
||||||
|
|
||||||
static MirrorSite
|
static MirrorSite
|
||||||
|
DaoCloud = {
|
||||||
|
"daocloud", "DaoCloud","上海道客网络科技有限公司", "https://www.daocloud.io/",
|
||||||
// 没有找到 DaoCloud 合适的下载链接,先随便给一个,以规避 chsrc 自动测速时所有 dockerhub 镜像站都没有测速链接带来的 bug
|
// 没有找到 DaoCloud 合适的下载链接,先随便给一个,以规避 chsrc 自动测速时所有 dockerhub 镜像站都没有测速链接带来的 bug
|
||||||
DaoCloud = {"daocloud", "DaoCloud","上海道客网络科技有限公司", "https://www.daocloud.io/",
|
{false, NULL, NULL, "https://qiniu-download-public.daocloud.io/DaoCloud_Enterprise/dce5/offline-community-v0.18.0-amd64.tar"}
|
||||||
"https://qiniu-download-public.daocloud.io/DaoCloud_Enterprise/dce5/offline-community-v0.18.0-amd64.tar"},
|
},
|
||||||
|
|
||||||
Fit2Cloud = {"fit2cloud", "FIT2CLOUD", "杭州飞致云信息科技有限公司", "https://www.fit2cloud.com/", NULL},
|
Fit2Cloud = {
|
||||||
|
"fit2cloud", "FIT2CLOUD", "杭州飞致云信息科技有限公司", "https://www.fit2cloud.com/",
|
||||||
|
{true, NULL, NULL, NULL}
|
||||||
|
},
|
||||||
|
|
||||||
Huecker = {"huecker", "(Russia) Huecker", "俄罗斯 Huecker.io", "https://huecker.io/",
|
Huecker = {
|
||||||
|
"huecker", "(Russia) Huecker", "俄罗斯 Huecker.io", "https://huecker.io/",
|
||||||
// 同 DaoCloud,没有合适的下载链接,先随便给一个,以避免 bug
|
// 同 DaoCloud,没有合适的下载链接,先随便给一个,以避免 bug
|
||||||
"https://huecker.io/en/use.html"};
|
{false, NULL, NULL, "https://huecker.io/en/use.html"}
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @update 2024-07-24
|
* @update 2024-07-24
|
||||||
|
Loading…
x
Reference in New Issue
Block a user