2023-09-15 12:44:50 +08:00
|
|
|
|
/** ------------------------------------------------------------
|
2024-06-11 20:18:02 +08:00
|
|
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
* -------------------------------------------------------------
|
2024-10-29 02:06:01 +08:00
|
|
|
|
* File Authors : Aoran Zeng <ccmywish@qq.com>
|
|
|
|
|
* | Heng Guo <2085471348@qq.com>
|
2024-06-21 01:47:28 +08:00
|
|
|
|
* Contributors : Shengwei Chen <414685209@qq.com>
|
|
|
|
|
* |
|
2024-09-26 19:51:55 +08:00
|
|
|
|
* Created On : <2023-08-29>
|
2024-11-04 18:57:08 +08:00
|
|
|
|
* Last Modified : <2024-11-04>
|
2023-09-15 12:44:50 +08:00
|
|
|
|
*
|
2024-10-04 02:13:07 +08:00
|
|
|
|
* 通用镜像站与换源信息
|
2023-09-15 12:44:50 +08:00
|
|
|
|
* ------------------------------------------------------------*/
|
|
|
|
|
|
2024-08-16 20:54:37 +08:00
|
|
|
|
typedef struct MirrorSite_t {
|
2024-05-25 00:59:20 +08:00
|
|
|
|
const char *code; // 用于用户指定镜像站
|
2024-08-23 14:24:31 +08:00
|
|
|
|
const char *abbr; // 需要使用镜像站的英文名时,用这个代替,因为大部分镜像站没有提供正式的英文名
|
|
|
|
|
const char *name; // 镜像站中文名
|
2024-05-25 00:59:20 +08:00
|
|
|
|
const char *site;
|
2024-09-29 12:04:33 +08:00
|
|
|
|
const char *bigfile_url; // 用于对该镜像站测速
|
2024-06-05 14:42:31 +08:00
|
|
|
|
} MirrorSite;
|
2023-09-15 12:44:50 +08:00
|
|
|
|
|
2024-09-29 12:53:10 +08:00
|
|
|
|
#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_archlinux "/iso/latest/archlinux-x86_64.iso" // 800 MB
|
|
|
|
|
#define Big_File_deepin "/20.9/deepin-desktop-community-20.9-amd64.iso" // 4 GB
|
2023-09-15 12:44:50 +08:00
|
|
|
|
|
|
|
|
|
|
2023-09-27 15:13:59 +08:00
|
|
|
|
/**
|
|
|
|
|
* 教育网镜像
|
|
|
|
|
*
|
2024-09-29 12:53:10 +08:00
|
|
|
|
* @sync https://github.com/RubyMetric/chsrc/wiki
|
|
|
|
|
*
|
|
|
|
|
* Wiki中的排序是根据 https://github.com/mirrorz-org/oh-my-mirrorz 挑选速度前10位
|
2023-09-27 15:13:59 +08:00
|
|
|
|
*/
|
2024-06-05 14:42:31 +08:00
|
|
|
|
MirrorSite
|
2024-08-23 14:24:31 +08:00
|
|
|
|
MirrorZ = {"mirrorz", "MirrorZ", "MirrorZ 校园网镜像站", "https://mirrors.cernet.edu.cn/", NULL},
|
2023-09-15 12:44:50 +08:00
|
|
|
|
|
2024-08-09 02:52:42 +08:00
|
|
|
|
Tuna = {"tuna", "TUNA", "清华大学开源软件镜像站", "https://mirrors.tuna.tsinghua.edu.cn/",
|
|
|
|
|
"https://mirrors.tuna.tsinghua.edu.cn/speedtest/1000mb.bin"},
|
2023-09-15 12:44:50 +08:00
|
|
|
|
|
2024-08-09 02:52:42 +08:00
|
|
|
|
Sjtug_Zhiyuan = {"sjtu", "SJTUG-zhiyuan", "上海交通大学致远镜像站", "https://mirrors.sjtug.sjtu.edu.cn/",
|
|
|
|
|
"https://mirrors.sjtug.sjtu.edu.cn/ctan" Big_File_ctan},
|
2023-09-15 12:44:50 +08:00
|
|
|
|
|
2024-08-09 02:52:42 +08:00
|
|
|
|
Zju = {"zju", "ZJU", "浙江大学开源软件镜像站", "https://mirrors.zju.edu.cn/",
|
2024-09-29 12:53:10 +08:00
|
|
|
|
"https://mirrors.zju.edu.cn/ubuntu-releases" Big_File_ubuntu},
|
2023-09-15 12:44:50 +08:00
|
|
|
|
|
2024-08-09 02:52:42 +08:00
|
|
|
|
Lzuoss = {"lzu", "LZUOSS", "兰州大学开源社区镜像站", "https://mirror.lzu.edu.cn/",
|
|
|
|
|
"https://mirror.lzu.edu.cn/CTAN" Big_File_ctan},
|
2023-09-15 12:44:50 +08:00
|
|
|
|
|
2024-08-09 02:52:42 +08:00
|
|
|
|
Jlu = {"jlu", "JLU", "吉林大学开源镜像站", "https://mirrors.jlu.edu.cn/",
|
|
|
|
|
"https://mirrors.jlu.edu.cn/_static/speedtest.bin"},
|
2023-09-15 12:44:50 +08:00
|
|
|
|
|
2024-08-09 02:52:42 +08:00
|
|
|
|
Bfsu = {"bfsu", "BFSU", "北京外国语大学开源软件镜像站","https://mirrors.bfsu.edu.cn/",
|
|
|
|
|
"https://mirrors.bfsu.edu.cn/speedtest/1000mb.bin"},
|
2023-09-15 12:44:50 +08:00
|
|
|
|
|
2024-08-09 02:52:42 +08:00
|
|
|
|
Pku = {"pku", "PKU", "北京大学开源镜像站", "https://mirrors.pku.edu.cn/",
|
2024-09-29 12:53:10 +08:00
|
|
|
|
"https://mirrors.pku.edu.cn/ubuntu-releases" Big_File_ubuntu},
|
2023-09-15 12:44:50 +08:00
|
|
|
|
|
2024-08-09 02:52:42 +08:00
|
|
|
|
Bjtu = {"bjtu", "BJTU", "北京交通大学自由与开源软件镜像站", "https://mirror.bjtu.edu.cn/",
|
|
|
|
|
"https://mirror.bjtu.edu.cn/archlinux" Big_File_archlinux},
|
2023-09-15 12:44:50 +08:00
|
|
|
|
|
2024-08-09 02:52:42 +08:00
|
|
|
|
Sustech = {"sustech", "SUSTech", "南方科技大学开源软件镜像站", "https://mirrors.sustech.edu.cn/",
|
|
|
|
|
"https://mirrors.sustech.edu.cn/site/speedtest/1000mb.bin"},
|
2023-09-15 12:44:50 +08:00
|
|
|
|
|
2024-08-09 02:52:42 +08:00
|
|
|
|
Ustc = {"ustc", "USTC", "中国科学技术大学开源镜像站", "https://mirrors.ustc.edu.cn/",
|
2024-09-29 12:53:10 +08:00
|
|
|
|
"https://mirrors.ustc.edu.cn/ubuntu-releases" Big_File_ubuntu},
|
2023-09-15 12:44:50 +08:00
|
|
|
|
|
2024-08-09 02:52:42 +08:00
|
|
|
|
Hust = {"hust", "HUST", "华中科技大学开源镜像站", "https://mirrors.hust.edu.cn/",
|
2024-09-29 12:53:10 +08:00
|
|
|
|
"https://mirrors.hust.edu.cn/ubuntu-releases" Big_File_ubuntu},
|
2024-05-24 21:40:17 +08:00
|
|
|
|
|
2023-09-15 12:44:50 +08:00
|
|
|
|
// 速度暂时处于10位以后,但是目前可用的源
|
2024-10-02 20:17:06 +08:00
|
|
|
|
Iscas = {"iscas", "ISCAS", "中科院软件所智能软件研究中心开源镜像站", "https://mirror.iscas.ac.cn/",
|
|
|
|
|
"https://mirror.iscas.ac.cn/ubuntu-releases" Big_File_ubuntu},
|
|
|
|
|
|
|
|
|
|
Scau = {"scau", "SCAU", "华南农业大学开源软件镜像站", "https://mirrors.scau.edu.cn/",
|
|
|
|
|
"https://mirrors.scau.edu.cn/ubuntu-releases" Big_File_ubuntu},
|
|
|
|
|
|
2024-08-09 02:52:42 +08:00
|
|
|
|
Nju = {"nju", "NJU", "南京大学开源镜像站", "https://mirrors.nju.edu.cn/",
|
|
|
|
|
"https://mirrors.nju.edu.cn/archlinux" Big_File_archlinux};
|
2023-09-15 12:44:50 +08:00
|
|
|
|
|
2024-08-09 02:52:42 +08:00
|
|
|
|
/**
|
2024-10-29 02:06:01 +08:00
|
|
|
|
* @note [ccmywish:2023-09-05] 我只使用了不到5次,重庆大学镜像站就把我的ip封杀了,对用户来说封杀策略过严,暂时不可靠,暂时不用
|
2024-08-09 02:52:42 +08:00
|
|
|
|
*/
|
|
|
|
|
// Cqu = {"cqu", "CQU", "重庆大学开源软件镜像站", "https://mirrors.cqu.edu.cn/",
|
|
|
|
|
// "https://mirrors.cqu.edu.cn/speedtest/1000mb.bin"};
|
2023-09-15 12:44:50 +08:00
|
|
|
|
|
|
|
|
|
|
2023-09-27 15:04:36 +08:00
|
|
|
|
|
|
|
|
|
/**
|
2023-09-27 15:13:59 +08:00
|
|
|
|
* 商业公司提供的源
|
2023-09-27 15:04:36 +08:00
|
|
|
|
*/
|
2024-06-05 14:42:31 +08:00
|
|
|
|
MirrorSite
|
2024-09-14 02:54:29 +08:00
|
|
|
|
Ali = {
|
|
|
|
|
"ali", "Ali OPSX Public", "阿里巴巴开源镜像站(公网)",
|
|
|
|
|
"https://developer.aliyun.com/mirror/",
|
|
|
|
|
"https://mirrors.aliyun.com/deepin-cd" Big_File_deepin},
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
// https://mirrors.cloud.aliyuncs.com/
|
|
|
|
|
Ali_ECS_VPC = {
|
|
|
|
|
"ali-ECS-VPC", "Ali OPSX ECS VPC", "阿里巴巴开源镜像站(ECS VPC网络)",
|
|
|
|
|
"https://developer.aliyun.com/mirror/",
|
|
|
|
|
"https://mirrors.cloud.aliyuncs.com/deepin-cd" Big_File_deepin},
|
|
|
|
|
|
|
|
|
|
// https://mirrors.aliyuncs.com/
|
|
|
|
|
Ali_ECS_classic = {
|
|
|
|
|
"ali-ECS", "Ali OPSX ECS", "阿里巴巴开源镜像站(ECS 经典网络)",
|
|
|
|
|
"https://developer.aliyun.com/mirror/",
|
|
|
|
|
"https://mirrors.aliyuncs.com/deepin-cd" Big_File_deepin},
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
Tencent = {
|
|
|
|
|
"tencent", "Tencent Public", "腾讯软件源(公网)", "https://mirrors.tencent.com/",
|
2024-09-29 12:53:10 +08:00
|
|
|
|
"https://mirrors.cloud.tencent.com/ubuntu-releases" Big_File_ubuntu},
|
2024-09-14 02:54:29 +08:00
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
Tencent_Intra = {
|
|
|
|
|
"tencent-intra", "Tencent Intranet", "腾讯软件源(内网)", "https://mirrors.tencent.com/",
|
2024-09-29 12:53:10 +08:00
|
|
|
|
"https://mirrors.cloud.tencentyun.com/ubuntu-releases" Big_File_ubuntu},
|
2024-09-14 02:54:29 +08:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
Huawei = {"huawei", "Huawei Cloud", "华为开源镜像站", "https://mirrors.huaweicloud.com/",
|
2024-09-29 12:53:10 +08:00
|
|
|
|
"https://mirrors.huaweicloud.com/ubuntu-releases" Big_File_ubuntu },
|
2024-09-14 02:54:29 +08:00
|
|
|
|
|
|
|
|
|
Volcengine = {
|
|
|
|
|
"volc", "Volcengine", "火山引擎开源软件镜像站(公网)",
|
|
|
|
|
"https://developer.volcengine.com/mirror/",
|
2024-09-29 12:53:10 +08:00
|
|
|
|
"https://mirrors.volces.com/ubuntu-releases" Big_File_ubuntu },
|
2024-09-14 02:54:29 +08:00
|
|
|
|
/*
|
|
|
|
|
Volceengine_Intra = {
|
|
|
|
|
"volc-intra", "Volcengine Intranet", "火山引擎开源软件镜像站(内网)",
|
|
|
|
|
"https://developer.volcengine.com/mirror/",
|
2024-09-29 12:53:10 +08:00
|
|
|
|
"https://mirrors.ivolces.com/ubuntu-releases" Big_File_ubuntu },
|
2024-09-14 02:54:29 +08:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
Netease = {
|
|
|
|
|
"netease", "Netease", "网易开源镜像站",
|
|
|
|
|
"https://mirrors.163.com/",
|
|
|
|
|
"https://mirrors.163.com/deepin-cd" Big_File_deepin},
|
|
|
|
|
|
|
|
|
|
Sohu = {
|
|
|
|
|
"sohu", "SOHU", "搜狐开源镜像站",
|
|
|
|
|
"https://mirrors.sohu.com/",
|
|
|
|
|
"https://mirrors.sohu.com/deepin-cd" Big_File_deepin};
|
2024-07-24 18:31:58 +08:00
|
|
|
|
|
2023-09-29 20:33:19 +08:00
|
|
|
|
|
2024-06-05 14:42:31 +08:00
|
|
|
|
MirrorSite
|
2024-09-14 02:54:29 +08:00
|
|
|
|
Upstream = {"upstream", "Upstream", "上游默认源", NULL, NULL};
|
2024-06-13 23:27:59 +08:00
|
|
|
|
MirrorSite
|
2024-09-14 02:54:29 +08:00
|
|
|
|
UserDefine = {"user", "用户自定义", "用户自定义", NULL, NULL};
|
2024-06-13 23:27:59 +08:00
|
|
|
|
|
2023-09-15 12:44:50 +08:00
|
|
|
|
|
2024-08-16 20:54:37 +08:00
|
|
|
|
typedef struct SourceInfo_t {
|
2024-06-05 14:42:31 +08:00
|
|
|
|
const MirrorSite *mirror;
|
2024-05-25 00:59:20 +08:00
|
|
|
|
const char *url;
|
2023-10-05 09:28:34 +08:00
|
|
|
|
} SourceInfo;
|
2023-09-15 12:44:50 +08:00
|
|
|
|
|
2024-08-16 20:54:37 +08:00
|
|
|
|
#define def_sources_n(t) const size_t t##_sources_n = xy_arylen(t##_sources)
|
2023-09-15 12:44:50 +08:00
|
|
|
|
|
2024-10-04 02:13:07 +08:00
|
|
|
|
enum Capability {
|
2024-08-22 22:41:52 +08:00
|
|
|
|
CanNot,
|
2024-10-04 02:13:07 +08:00
|
|
|
|
FullyCan,
|
|
|
|
|
PartiallyCan
|
2024-08-17 06:46:06 +08:00
|
|
|
|
};
|
2023-09-15 12:44:50 +08:00
|
|
|
|
|
2024-08-16 20:54:37 +08:00
|
|
|
|
/* Target Feature Info */
|
|
|
|
|
typedef struct FeatInfo_t {
|
|
|
|
|
bool can_get;
|
|
|
|
|
bool can_reset; // 有的reset不是暂时没有实现,而是现在的实现根本就无法重置
|
|
|
|
|
|
|
|
|
|
bool can_english;
|
2024-08-17 06:46:06 +08:00
|
|
|
|
|
2024-08-16 20:54:37 +08:00
|
|
|
|
bool can_user_define; // 用户自定义换源URL
|
|
|
|
|
|
2024-10-04 02:13:07 +08:00
|
|
|
|
enum Capability cap_locally;
|
2024-08-17 06:46:06 +08:00
|
|
|
|
char *locally;
|
|
|
|
|
|
2024-08-16 20:54:37 +08:00
|
|
|
|
char *note;
|
|
|
|
|
} FeatInfo;
|
|
|
|
|
|
|
|
|
|
/* Target Info */
|
|
|
|
|
typedef struct TargetInfo_t {
|
|
|
|
|
void (*getfn) (char *option);
|
|
|
|
|
void (*setfn) (char *option);
|
|
|
|
|
void (*resetfn) (char *option);
|
|
|
|
|
|
|
|
|
|
FeatInfo (*featfn) (char *option);
|
|
|
|
|
|
|
|
|
|
SourceInfo *sources;
|
|
|
|
|
size_t sources_n;
|
|
|
|
|
} TargetInfo;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define def_target_inner_s(t) NULL, t##_setsrc, NULL, NULL
|
2024-11-04 18:57:08 +08:00
|
|
|
|
#define def_target_inner_sr(t) NULL, t##_setsrc, t##_resetsrc, NULL
|
2024-10-09 15:29:48 +08:00
|
|
|
|
#define def_target_inner_sf(t) NULL, t##_setsrc, NULL, t##_feat
|
2024-11-04 18:57:08 +08:00
|
|
|
|
#define def_target_inner_srf(t) NULL, t##_setsrc, t##_resetsrc, t##_feat
|
|
|
|
|
#define def_target_inner_gs(t) t##_getsrc, t##_setsrc, NULL, NULL
|
2024-08-16 20:54:37 +08:00
|
|
|
|
#define def_target_inner_gsr(t) t##_getsrc, t##_setsrc, t##_resetsrc, NULL
|
|
|
|
|
#define def_target_inner_gsf(t) t##_getsrc, t##_setsrc, NULL, t##_feat
|
|
|
|
|
#define def_target_inner_gsrf(t) t##_getsrc, t##_setsrc, t##_resetsrc, t##_feat
|
|
|
|
|
|
|
|
|
|
#define def_target_sourcesn(t) t##_sources, t##_sources_n
|
|
|
|
|
|
|
|
|
|
// 大部分target还不支持reset,所以暂时先默认设置为NULL来过渡
|
|
|
|
|
#define def_target(t) TargetInfo t##_target = {def_target_inner_gs(t),def_target_sourcesn(t)}
|
2024-11-04 18:57:08 +08:00
|
|
|
|
#define def_target_s(t) TargetInfo t##_target = {def_target_inner_s(t),def_target_sourcesn(t)}
|
|
|
|
|
#define def_target_sr(t) TargetInfo t##_target = {def_target_inner_sr(t),def_target_sourcesn(t)}
|
2024-10-09 15:29:48 +08:00
|
|
|
|
#define def_target_sf(t) TargetInfo t##_target = {def_target_inner_sf(t),def_target_sourcesn(t)}
|
2024-11-04 18:57:08 +08:00
|
|
|
|
#define def_target_srf(t) TargetInfo t##_target = {def_target_inner_srf(t),def_target_sourcesn(t)}
|
|
|
|
|
#define def_target_gs(t) TargetInfo t##_target = {def_target_inner_gs(t),def_target_sourcesn(t)}
|
2024-08-16 20:54:37 +08:00
|
|
|
|
#define def_target_gsr(t) TargetInfo t##_target = {def_target_inner_gsr(t),def_target_sourcesn(t)}
|
2024-08-17 05:30:28 +08:00
|
|
|
|
#define def_target_gsf(t) TargetInfo t##_target = {def_target_inner_gsf(t),def_target_sourcesn(t)}
|
2024-08-16 20:54:37 +08:00
|
|
|
|
#define def_target_gsrf(t) TargetInfo t##_target = {def_target_inner_gsrf(t),def_target_sourcesn(t)}
|