修改API为 chef_set_rest_smURL_

This commit is contained in:
Aoran Zeng
2026-01-21 18:12:38 +08:00
parent d766a6f398
commit 0180558cb7
16 changed files with 28 additions and 27 deletions

View File

@@ -59,11 +59,15 @@ def_sources_end()
// //
// 调整/设置上述某一个镜像站的所提供源的 "精准测速链接" // 调整/设置上述某一个镜像站的所提供源的 "精准测速链接"
chef_set_smURL (this, &UpstreamProvider, "新的测速链接") chef_set_smURL (this, &UpstreamProvider, "新的测速链接");
// 把所有上述源的 "测速链接" 设置为 "换源链接" + postfix // 设置上述某一个镜像站的所提供源的 "精准测速链接" 设置为 "换源链接" + postfix
chef_set_all_smURL_with_postfix (this, "/dir/BigFile.tar.gz"); chef_set_smURL_with_postfix (this, &UpstreamProvider, "/dir/BigFile.tar.gz");
// 基于 "换源链接" 做更自定义的操作 // 基于 "换源链接" 做更自定义的操作
chef_set_all_smURL_with_func (this, func, data); chef_set_smURL_with_func (this, &UpstreamProvider, func, data);
// 把所有上述源中还未设置 "精准测速链接" 的源进行设置
chef_set_rest_smURL_with_postfix (this, "/dir/BigFile.tar.gz");
chef_set_rest_smURL_with_func (this, func, data);
// 调整某一个镜像站(Provider)的 "测速链接" // 调整某一个镜像站(Provider)的 "测速链接"
chef_set_provider_smURL (&Tencent, "https://mirrors.cloud.tencent.com/npm/BigFile.tar.gz"); chef_set_provider_smURL (&Tencent, "https://mirrors.cloud.tencent.com/npm/BigFile.tar.gz");

View File

@@ -209,10 +209,10 @@ chef_set_smURL (Target_t *target, SourceProvider_t *provider, char *url)
/** /**
* @brief 提供一个函数,这个函数基于 "换源链接" 和用户提供的数据来构造和填充精准测速链接 * @brief 针对每一个剩下的还未设置专用测速链接的源,对其 "换源链接" 使用函数 `func` 来生成专用测速链接
*/ */
void void
chef_set_all_smURL_with_func ( chef_set_rest_smURL_with_func (
Target_t *target, Target_t *target,
char *(*func)(const char *url, const char *user_data), char *(*func)(const char *url, const char *user_data),
char *user_data) char *user_data)
@@ -239,12 +239,12 @@ chef_set_all_smURL_with_func (
/** /**
* @brief "换源链接" 增加一个后缀来构造和填充专用测速链接 * @brief 针对每一个剩下的还未设置专用测速链接的源,对其 "换源链接" 增加一个后缀来生成专用测速链接
*/ */
void void
chef_set_all_smURL_with_postfix (Target_t *target, char *postfix) chef_set_rest_smURL_with_postfix (Target_t *target, char *postfix)
{ {
chef_set_all_smURL_with_func (target, xy_2strcat, postfix); chef_set_rest_smURL_with_func (target, xy_2strcat, postfix);
} }

View File

@@ -180,10 +180,7 @@ Target_t;
* {&某镜像站2, "换源URL", NULL }, // 若精准测速链接为空,则为模糊测速,默认使用该镜像站的整体测速链接 * {&某镜像站2, "换源URL", NULL }, // 若精准测速链接为空,则为模糊测速,默认使用该镜像站的整体测速链接
* def_sources_end() * def_sources_end()
* *
* 若是出于代码美观考虑,上述第三列可以写 FeedByPrelude然后下面调用函数来填充: * 出于代码美观考虑,上述第三列可以写 FeedByPrelude然后下面使用文档 ./doc/11-如何设置换源链接与测速链接.md 中的函数来填充
* chef_set_smURL()
* chef_set_all_smURL_with_postfix()
* chef_set_all_smURL_with_func()
*/ */
#define def_sources_begin() Source_t sources[] = { #define def_sources_begin() Source_t sources[] = {
#define def_sources_end() }; \ #define def_sources_end() }; \

View File

@@ -29,7 +29,7 @@ pl_dart_flutter_prelude (void)
{&Nju, "https://mirror.nju.edu.cn/flutter", FeedByPrelude} {&Nju, "https://mirror.nju.edu.cn/flutter", FeedByPrelude}
def_sources_end() def_sources_end()
chef_set_all_smURL_with_postfix (this, "/flutter_infra_release/releases/stable/linux/flutter_linux_v1.0.0-stable.tar.xz"); chef_set_rest_smURL_with_postfix (this, "/flutter_infra_release/releases/stable/linux/flutter_linux_v1.0.0-stable.tar.xz");
} }

View File

@@ -29,7 +29,7 @@ pl_dart_prelude (void)
{&Nju, "https://mirror.nju.edu.cn/dart-pub", FeedByPrelude} {&Nju, "https://mirror.nju.edu.cn/dart-pub", FeedByPrelude}
def_sources_end() def_sources_end()
chef_set_all_smURL_with_postfix (this, "/packages/flutter_vision/versions/1.1.4.tar.gz"); chef_set_rest_smURL_with_postfix (this, "/packages/flutter_vision/versions/1.1.4.tar.gz");
} }

View File

@@ -36,7 +36,7 @@ pl_java_prelude ()
def_sources_end() def_sources_end()
// 220MB // 220MB
chef_set_all_smURL_with_postfix (this, "com/tencentcloudapi/tencentcloud-sdk-java/3.1.1033/tencentcloud-sdk-java-3.1.1033-javadoc.jar"); chef_set_rest_smURL_with_postfix (this, "com/tencentcloudapi/tencentcloud-sdk-java/3.1.1033/tencentcloud-sdk-java-3.1.1033-javadoc.jar");
} }

View File

@@ -39,7 +39,7 @@ pl_js_group_prelude (void)
def_sources_end() def_sources_end()
// 29MB 大小 // 29MB 大小
chef_set_all_smURL_with_postfix (this, "/@tensorflow/tfjs/-/tfjs-4.22.0.tgz"); chef_set_rest_smURL_with_postfix (this, "/@tensorflow/tfjs/-/tfjs-4.22.0.tgz");
} }
@@ -73,5 +73,5 @@ pl_js_nodejs_binary_prelude (void)
{&Tencent, "https://mirrors.cloud.tencent.com/nodejs-release/", FeedByPrelude} {&Tencent, "https://mirrors.cloud.tencent.com/nodejs-release/", FeedByPrelude}
def_sources_end() def_sources_end()
chef_set_all_smURL_with_postfix (this, "/v23.4.0/node-v23.4.0-linux-x64.tar.xz"); chef_set_rest_smURL_with_postfix (this, "/v23.4.0/node-v23.4.0-linux-x64.tar.xz");
} }

View File

@@ -39,7 +39,7 @@ pl_perl_prelude ()
{&Ali, "https://mirrors.aliyun.com/CPAN/", FeedByPrelude} {&Ali, "https://mirrors.aliyun.com/CPAN/", FeedByPrelude}
def_sources_end() def_sources_end()
chef_set_all_smURL_with_postfix (this, "authors/id/D/DB/DBAURAIN/Bio-MUST-Apps-FortyTwo-0.213470.tar.gz"); chef_set_rest_smURL_with_postfix (this, "authors/id/D/DB/DBAURAIN/Bio-MUST-Apps-FortyTwo-0.213470.tar.gz");
} }

View File

@@ -70,7 +70,7 @@ pl_python_group_prelude (void)
// {&Netease, "https://mirrors.163.com/.help/pypi.html", NULL} // {&Netease, "https://mirrors.163.com/.help/pypi.html", NULL}
def_sources_end() def_sources_end()
chef_set_all_smURL_with_func (this, pl_python_speed_url_constructor, NULL); chef_set_rest_smURL_with_func (this, pl_python_speed_url_constructor, NULL);
} }
void void

View File

@@ -38,7 +38,7 @@ pl_rust_rustup_prelude (void)
def_sources_end() def_sources_end()
// 20MB大小 // 20MB大小
chef_set_all_smURL_with_postfix (this, "/dist/2025-06-26/cargo-1.88.0-x86_64-unknown-illumos.tar.gz"); chef_set_rest_smURL_with_postfix (this, "/dist/2025-06-26/cargo-1.88.0-x86_64-unknown-illumos.tar.gz");
} }

View File

@@ -42,7 +42,7 @@ os_debian_prelude ()
// {&Sohu, "https://mirrors.sohu.com/debian", FeedByPrelude} // {&Sohu, "https://mirrors.sohu.com/debian", FeedByPrelude}
def_sources_end() def_sources_end()
chef_set_all_smURL_with_postfix (this, "/dists/bookworm/main/Contents-all.gz"); chef_set_rest_smURL_with_postfix (this, "/dists/bookworm/main/Contents-all.gz");
} }

View File

@@ -43,7 +43,7 @@ os_ubuntu_prelude ()
// {&Sohu, "https://mirrors.sohu.com/ubuntu", FeedByPrelude} // {&Sohu, "https://mirrors.sohu.com/ubuntu", FeedByPrelude}
def_sources_end() def_sources_end()
chef_set_all_smURL_with_postfix (this, "/dists/noble/Contents-amd64.gz"); chef_set_rest_smURL_with_postfix (this, "/dists/noble/Contents-amd64.gz");
} }

View File

@@ -35,7 +35,7 @@ os_alpine_prelude ()
{&Huawei, "https://mirrors.huaweicloud.com/alpine", FeedByPrelude} {&Huawei, "https://mirrors.huaweicloud.com/alpine", FeedByPrelude}
def_sources_end() def_sources_end()
chef_set_all_smURL_with_postfix (this, "/latest-stable/releases/x86_64/alpine-standard-3.21.0-x86_64.iso"); chef_set_rest_smURL_with_postfix (this, "/latest-stable/releases/x86_64/alpine-standard-3.21.0-x86_64.iso");
} }

View File

@@ -30,7 +30,7 @@ os_voidlinux_prelude ()
{&Bfsu, "https://mirrors.bfsu.edu.cn/voidlinux", FeedByPrelude} {&Bfsu, "https://mirrors.bfsu.edu.cn/voidlinux", FeedByPrelude}
def_sources_end() def_sources_end()
chef_set_all_smURL_with_postfix (this, "/live/20240314/void-live-x86_64-musl-20240314-xfce.iso"); chef_set_rest_smURL_with_postfix (this, "/live/20240314/void-live-x86_64-musl-20240314-xfce.iso");
} }

View File

@@ -33,7 +33,7 @@ os_almalinux_prelude ()
def_sources_end() def_sources_end()
#define link "/9.6/isos/x86_64/AlmaLinux-9-latest-x86_64-minimal.iso" #define link "/9.6/isos/x86_64/AlmaLinux-9-latest-x86_64-minimal.iso"
chef_set_all_smURL_with_postfix (this, link); chef_set_rest_smURL_with_postfix (this, link);
chef_set_provider_smURL (&UpstreamProvider, "https://raw.repo.almalinux.org/almalinux" link); chef_set_provider_smURL (&UpstreamProvider, "https://raw.repo.almalinux.org/almalinux" link);
#undef link #undef link
} }

View File

@@ -38,7 +38,7 @@ os_openeuler_prelude ()
// {&Sohu, "https://mirrors.sohu.com/openeuler/", FeedByPrelude} // {&Sohu, "https://mirrors.sohu.com/openeuler/", FeedByPrelude}
def_sources_end() def_sources_end()
chef_set_all_smURL_with_postfix (this, "https://repo.openeuler.org/openEuler-24.03-LTS/ISO/x86_64/openEuler-24.03-LTS-netinst-x86_64-dvd.iso"); chef_set_rest_smURL_with_postfix (this, "https://repo.openeuler.org/openEuler-24.03-LTS/ISO/x86_64/openEuler-24.03-LTS-netinst-x86_64-dvd.iso");
} }