mirror-sources.md 3.7 KB

软件镜像源对照表

本文档记录了各软件在不同镜像设置下的版本列表获取源和下载源。

总览

软件 镜像选项 选项值 版本列表获取源 下载源
Node.js 华为云镜像 huaweicloud mirrors.huaweicloud.com mirrors.huaweicloud.com
Node.js 官方 official nodejs.org nodejs.org
VS Code Azure 中国 CDN azure-china update.code.visualstudio.com vscode.cdn.azure.cn
VS Code 官方 official update.code.visualstudio.com code.visualstudio.com
Git 华为云镜像 huaweicloud mirrors.huaweicloud.com mirrors.huaweicloud.com
Git GitHub 官方 github api.github.com github.com

详细说明

Node.js

镜像选项 选项值 版本列表 API 下载 URL 模板
华为云镜像(国内推荐) huaweicloud https://mirrors.huaweicloud.com/nodejs/index.json https://mirrors.huaweicloud.com/nodejs/{version}/node-{version}-x64.msi
Node.js 官方 official https://nodejs.org/dist/index.json https://nodejs.org/dist/{version}/node-{version}-x64.msi

说明

  • 版本列表和下载源完全对应镜像设置
  • 华为云镜像同步自 Node.js 官方,提供 JSON 格式的版本列表

VS Code

镜像选项 选项值 版本列表 API 下载 URL
Azure 中国 CDN(国内推荐) azure-china https://update.code.visualstudio.com/api/releases/stable https://vscode.cdn.azure.cn/stable/{commit_hash}/VSCodeSetup-x64-{version}.exe
VS Code 官方 official https://update.code.visualstudio.com/api/releases/stable https://code.visualstudio.com/sha/download?build=stable&os=win32-x64

说明

  • 版本列表 API 只有一个源(微软官方 update.code.visualstudio.com),因为 Azure 中国 CDN 没有提供版本列表 API
  • 两个下载源都是微软的服务:
    • update.code.visualstudio.com - 微软官方更新 API 服务
    • code.visualstudio.com - 微软官方下载站
    • vscode.cdn.azure.cn - 微软 Azure 中国 CDN
  • Azure 中国 CDN 下载需要先从官方 API 获取 commit_hash 和 version,然后拼接下载 URL

Git

镜像选项 选项值 版本列表获取方式 下载 URL 模板
华为云镜像(国内推荐) huaweicloud 解析 https://mirrors.huaweicloud.com/git-for-windows/ 页面 HTML https://mirrors.huaweicloud.com/git-for-windows/v{version}.windows.1/Git-{version}-64-bit.exe
GitHub 官方(需代理) github https://api.github.com/repos/git-for-windows/git/releases 从 GitHub Releases API 获取 browser_download_url

说明

  • 华为云镜像没有提供 JSON 格式的版本列表,需要解析 HTML 目录页面提取版本号
  • GitHub 官方使用 GitHub Releases API 获取版本列表和下载链接
  • 如果版本列表获取失败,会使用预设的备用版本列表

缓存机制

前端按 软件类型:镜像源 格式缓存版本列表数据,例如:

  • nodejs:huaweicloud
  • nodejs:official
  • vscode:azure-china
  • git:github

缓存特性:

  • 内存缓存,应用关闭后清除
  • 切换镜像时,如果目标镜像已有缓存,直接使用缓存数据
  • 可通过 forceRefresh 参数强制刷新

默认配置

软件 默认镜像
Node.js 华为云镜像 (huaweicloud)
VS Code Azure 中国 CDN (azure-china)
Git 华为云镜像 (huaweicloud)

默认配置针对国内用户优化,选择访问速度较快的镜像源。