加速神器——Xget

本文介绍加速神器——Xget。

加速神器——Xget 🚀

简介

Ultra-high-performance, secure, all-in-one acceleration engine for developer resources

官网xuc.xi-xu.me

面向开发者资源的超高性能、安全、一体化加速引擎,其性能显著优于传统解决方案,为代码存储库、模型和数据集中心、软件包注册表、容器注册表、AI 推理提供商等提供统一、高效的加速。

技术深度解析文章已发布:《深入剖析 Xget:一个高性能、多协议、高安全性的开发者资源加速引擎》

🎯 快速使用

预部署实例(不保证可靠性):xget.xi-xu.me

URL 转换器:xuc.xi-xu.me - 一键转换任意支持平台的 URL 为 Xget 的加速格式!

🌟 核心优势 - 为什么选择 Xget?

⚡ 极速性能 - 突破传统加速器瓶颈

  • ⚡ 毫秒级响应:Cloudflare 全球 330+ 边缘节点,平均响应时间 < 50ms
  • 🌐 HTTP/3 极速协议:启用最新 HTTP/3 协议,连接延迟降低 40%,传输速度提升 30%
  • 📦 智能多重压缩:gzip、deflate、brotli 三重压缩算法,传输效率提升 60%
  • 🔗 零延迟预连接:连接预热和保持活跃,消除握手开销,实现秒级响应
  • ⚡ 并行分片下载:完整支持 HTTP Range 请求,多线程下载速度倍增
  • 🎯 智能路由优化:自动选择最优传输路径,避开网络拥堵节点

🌐 多平台深度集成

  • 一站式多平台支持:统一支持各种开发场景中的主流平台
  • 智能识别与转换:自动识别平台前缀并转换为目标平台的正确 URL 结构
  • 一致的加速体验:无论文件类型或来源,均可享受统一且稳定的极速下载体验

🔒 企业级安全保障

  • 多层安全标头
    • Strict-Transport-Security:强制 HTTPS 传输,预防中间人攻击
    • X-Frame-Options: DENY:防止点击劫持攻击
    • X-XSS-Protection:内置 XSS 防护机制
    • Content-Security-Policy:严格的内容安全策略
    • Referrer-Policy:控制引用信息泄露
  • 请求验证机制
    • HTTP 方法白名单:常规请求限制为 GET/HEAD,Git 操作动态允许 POST
    • 路径长度限制:防止超长 URL 攻击(最大 2048 字符)
    • 输入清理:防止路径遍历和注入攻击
  • 超时保护:30 秒请求超时,防止资源耗尽和恶意请求

🚀 现代架构与可靠性

  • 智能重试机制
    • 最大 3 次重试,线性延迟策略(1000ms × 重试次数)
    • 自动错误恢复,提高下载成功率
    • 超时检测和中断处理
  • 高效缓存策略
    • 1800 秒(30 分钟)默认缓存时长,显著减少源站压力
    • Git 操作跳过缓存,确保实时性
    • 基于 Cloudflare Cache API 的边缘缓存
  • 性能监控系统
    • 内置 PerformanceMonitor 类,实时追踪请求各阶段耗时
    • 通过 X-Performance-Metrics 响应头提供详细性能数据
    • 支持缓存命中率统计和优化建议

🎯 Git 协议完全兼容

  • 智能协议检测
    • 自动识别 Git 特定端点(/info/refs/git-upload-pack/git-receive-pack
    • 检测 Git 客户端 User-Agent 模式
    • 支持 service=git-upload-pack 等查询参数
  • 完整操作支持
    • git clone:完整存储库克隆,支持浅克隆和分支指定
    • git push:代码推送和分支管理
    • git pull/fetch:增量更新和远程同步
    • git submodule:子模块递归克隆
  • 协议优化
    • 保持 Git 专用请求头和认证信息
    • 智能 User-Agent 处理(默认 git/2.34.1
    • 支持 Git LFS 大文件传输

📱 生态系统集成

  • 专用浏览器扩展Xget Now 提供无缝体验
    • 自动 URL 重定向,无需手动修改 URL
    • 支持自定义 Xget 实例域名
    • 多平台偏好设置和黑白名单管理
    • 本地处理,确保隐私安全
  • 下载工具兼容:完美支持 wget、cURL、aria2、IDM 等主流下载工具
  • CI/CD 集成:可直接在 GitHub Actions、GitLab CI 等环境中使用

📖 URL 转换规则

使用预部署实例 xget.xi-xu.me 或你自己部署的实例,只需简单替换域名并添加平台前缀:

转换格式

平台平台前缀原始 URL 格式加速 URL 格式
GitHubghhttps://github.com/...https://xget.xi-xu.me/gh/...
GitHub Gistgisthttps://gist.github.com/...https://xget.xi-xu.me/gist/...
GitLabglhttps://gitlab.com/...https://xget.xi-xu.me/gl/...
Giteagiteahttps://gitea.com/...https://xget.xi-xu.me/gitea/...
Codebergcodeberghttps://codeberg.org/...https://xget.xi-xu.me/codeberg/...
SourceForgesfhttps://sourceforge.net/...https://xget.xi-xu.me/sf/...
AOSPaosphttps://android.googlesource.com/...https://xget.xi-xu.me/aosp/...
Hugging Facehfhttps://huggingface.co/...https://xget.xi-xu.me/hf/...
Civitaicivitaihttps://civitai.com/...https://xget.xi-xu.me/civitai/...
npmnpmhttps://registry.npmjs.org/...https://xget.xi-xu.me/npm/...
PyPIpypihttps://pypi.org/...https://xget.xi-xu.me/pypi/...
condacondahttps://repo.anaconda.com/...https://conda.anaconda.org/...https://xget.xi-xu.me/conda/...https://xget.xi-xu.me/conda/community/...
Mavenmavenhttps://repo1.maven.org/...https://xget.xi-xu.me/maven/...
Apacheapachehttps://downloads.apache.org/...https://xget.xi-xu.me/apache/...
Gradlegradlehttps://plugins.gradle.org/...https://xget.xi-xu.me/gradle/...
Homebrewhomebrewhttps://github.com/Homebrew/...https://xget.xi-xu.me/homebrew/...
RubyGemsrubygemshttps://rubygems.org/...https://xget.xi-xu.me/rubygems/...
CRANcranhttps://cran.r-project.org/...https://xget.xi-xu.me/cran/...
CPANcpanhttps://www.cpan.org/...https://xget.xi-xu.me/cpan/...
CTANctanhttps://tug.ctan.org/...https://xget.xi-xu.me/ctan/...
Go 模块golanghttps://proxy.golang.org/...https://xget.xi-xu.me/golang/...
NuGetnugethttps://api.nuget.org/...https://xget.xi-xu.me/nuget/...
Rust Cratescrateshttps://crates.io/...https://xget.xi-xu.me/crates/...
Packagistpackagisthttps://repo.packagist.org/...https://xget.xi-xu.me/packagist/...
Debiandebianhttps://deb.debian.org/...https://xget.xi-xu.me/debian/...
Ubuntuubuntuhttps://archive.ubuntu.com/...https://xget.xi-xu.me/ubuntu/...
Fedorafedorahttps://dl.fedoraproject.org/...https://xget.xi-xu.me/fedora/...
Rocky Linuxrockyhttps://download.rockylinux.org/...https://xget.xi-xu.me/rocky/...
openSUSEopensusehttps://download.opensuse.org/...https://xget.xi-xu.me/opensuse/...
Arch Linuxarchhttps://geo.mirror.pkgbuild.com/...https://xget.xi-xu.me/arch/...
arXivarxivhttps://arxiv.org/...https://xget.xi-xu.me/arxiv/...
F-Droidfdroidhttps://f-droid.org/...https://xget.xi-xu.me/fdroid/...
Jenkins 插件jenkinshttps://updates.jenkins.io/...https://xget.xi-xu.me/jenkins/...
容器注册表cr容器注册表容器注册表
AI 推理提供商ipAI 推理提供商AI 推理提供商

各平台转换示例

GitHub

1
2
3
4
5
# 原始 URL
https://github.com/microsoft/vscode/archive/refs/heads/main.zip

# 转换后(添加 gh 前缀)
https://xget.xi-xu.me/gh/microsoft/vscode/archive/refs/heads/main.zip

GitHub Gist

1
2
3
4
5
# 原始 URL
https://gist.github.com/xixu-me/e2ea9db6b1f143892495f796fef18631/raw/3b8807172ee492d0da3a7e370b0fb88fc97b53e6/Free-ChatGPT-Paid-Plan.md

# 转换后(添加 gist 前缀)
https://xget.xi-xu.me/gist/xixu-me/e2ea9db6b1f143892495f796fef18631/raw/3b8807172ee492d0da3a7e370b0fb88fc97b53e6/Free-ChatGPT-Paid-Plan.md

GitLab

1
2
3
4
5
# 原始 URL
https://gitlab.com/gitlab-org/gitlab/-/archive/master/gitlab-master.zip

# 转换后(添加 gl 前缀)
https://xget.xi-xu.me/gl/gitlab-org/gitlab/-/archive/master/gitlab-master.zip

Gitea

1
2
3
4
5
# 原始 URL
https://gitea.com/gitea/gitea/archive/master.zip

# 转换后(添加 gitea 前缀)
https://xget.xi-xu.me/gitea/gitea/gitea/archive/master.zip

Codeberg

1
2
3
4
5
# 原始 URL
https://codeberg.org/forgejo/forgejo/archive/forgejo.zip

# 转换后(添加 codeberg 前缀)
https://xget.xi-xu.me/codeberg/forgejo/forgejo/archive/forgejo.zip

SourceForge

1
2
3
4
5
# 原始 URL
https://sourceforge.net/projects/sevenzip/files/7-Zip/23.01/7z2301-x64.exe/download

# 转换后(添加 sf 前缀)
https://xget.xi-xu.me/sf/projects/sevenzip/files/7-Zip/23.01/7z2301-x64.exe/download

AOSP (Android 开源项目)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# AOSP 项目原始 URL
https://android.googlesource.com/platform/frameworks/base

# 转换后(添加 aosp 前缀)
https://xget.xi-xu.me/aosp/platform/frameworks/base

# AOSP 设备树原始 URL
https://android.googlesource.com/device/google/pixel

# 转换后(添加 aosp 前缀)
https://xget.xi-xu.me/aosp/device/google/pixel

Hugging Face

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# 模型文件原始 URL
https://huggingface.co/microsoft/DialoGPT-medium/resolve/main/pytorch_model.bin

# 转换后(添加 hf 前缀)
https://xget.xi-xu.me/hf/microsoft/DialoGPT-medium/resolve/main/pytorch_model.bin

# 数据集文件原始 URL
https://huggingface.co/datasets/rajpurkar/squad/resolve/main/plain_text/train-00000-of-00001.parquet

# 转换后(添加 hf 前缀)
https://xget.xi-xu.me/hf/datasets/rajpurkar/squad/resolve/main/plain_text/train-00000-of-00001.parquet

Civitai

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
# AI 模型下载原始 URL
https://civitai.com/api/download/models/128713

# 转换后(添加 civitai 前缀)
https://xget.xi-xu.me/civitai/api/download/models/128713

# 模型 API 原始 URL
https://civitai.com/api/v1/models/7240

# 转换后(添加 civitai 前缀)
https://xget.xi-xu.me/civitai/api/v1/models/7240

# 模型版本 API 原始 URL
https://civitai.com/api/v1/model-versions/128713

# 转换后(添加 civitai 前缀)
https://xget.xi-xu.me/civitai/api/v1/model-versions/128713

npm

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# 包文件原始 URL
https://registry.npmjs.org/react/-/react-18.2.0.tgz

# 转换后(添加 npm 前缀)
https://xget.xi-xu.me/npm/react/-/react-18.2.0.tgz

# 包元数据原始 URL
https://registry.npmjs.org/lodash

# 转换后(添加 npm 前缀)
https://xget.xi-xu.me/npm/lodash

PyPI

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Python 包文件原始 URL
https://pypi.org/packages/source/r/requests/requests-2.31.0.tar.gz

# 转换后(添加 pypi 前缀)
https://xget.xi-xu.me/pypi/packages/source/r/requests/requests-2.31.0.tar.gz

# Wheel 文件原始 URL
https://pypi.org/packages/py3/r/requests/requests-2.31.0-py3-none-any.whl

# 转换后(添加 pypi 前缀)
https://xget.xi-xu.me/pypi/packages/py3/r/requests/requests-2.31.0-py3-none-any.whl

conda

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# 默认频道包文件原始 URL
https://repo.anaconda.com/pkgs/main/linux-64/numpy-1.24.3-py311h08b1b3b_1.conda

# 转换后(添加 conda 前缀)
https://xget.xi-xu.me/conda/pkgs/main/linux-64/numpy-1.24.3-py311h08b1b3b_1.conda

# 社区频道元数据原始 URL
https://conda.anaconda.org/conda-forge/linux-64/repodata.json

# 转换后(添加 conda/community 前缀)
https://xget.xi-xu.me/conda/community/conda-forge/linux-64/repodata.json

Maven

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Maven 中央存储库 JAR 文件原始 URL
https://repo1.maven.org/maven2/org/springframework/spring-core/5.3.21/spring-core-5.3.21.jar

# 转换后(添加 maven 前缀)
https://xget.xi-xu.me/maven/maven2/org/springframework/spring-core/5.3.21/spring-core-5.3.21.jar

# Maven 元数据原始 URL
https://repo1.maven.org/maven2/org/apache/commons/commons-lang3/maven-metadata.xml

# 转换后(添加 maven 前缀)
https://xget.xi-xu.me/maven/maven2/org/apache/commons/commons-lang3/maven-metadata.xml

Apache 软件下载

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
# Apache 软件下载原始 URL
https://downloads.apache.org/kafka/3.6.1/kafka_2.13-3.6.1.tgz

# 转换后(添加 apache 前缀)
https://xget.xi-xu.me/apache/kafka/3.6.1/kafka_2.13-3.6.1.tgz

# Apache Maven 下载原始 URL
https://downloads.apache.org/maven/maven-3/3.9.5/binaries/apache-maven-3.9.5-bin.tar.gz

# 转换后(添加 apache 前缀)
https://xget.xi-xu.me/apache/maven/maven-3/3.9.5/binaries/apache-maven-3.9.5-bin.tar.gz

# Apache Spark 下载原始 URL
https://downloads.apache.org/spark/spark-3.5.0/spark-3.5.0-bin-hadoop3.tgz

# 转换后(添加 apache 前缀)
https://xget.xi-xu.me/apache/spark/spark-3.5.0/spark-3.5.0-bin-hadoop3.tgz

Gradle

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Gradle 插件门户 JAR 文件原始 URL
https://plugins.gradle.org/m2/org/gradle/gradle-hello-world-plugin/0.2/gradle-hello-world-plugin-0.2.jar

# 转换后(添加 gradle 前缀)
https://xget.xi-xu.me/gradle/m2/org/gradle/gradle-hello-world-plugin/0.2/gradle-hello-world-plugin-0.2.jar

# Gradle 插件元数据原始 URL
https://plugins.gradle.org/m2/com/github/ben-manes/gradle-versions-plugin/0.51.0/gradle-versions-plugin-0.51.0.module

# 转换后(添加 gradle 前缀)
https://xget.xi-xu.me/gradle/m2/com/github/ben-manes/gradle-versions-plugin/0.51.0/gradle-versions-plugin-0.51.0.module

Homebrew

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
# Homebrew 公式存储库原始 URL
https://github.com/Homebrew/homebrew-core/raw/HEAD/Formula/g/git.rb

# 转换后(添加 homebrew 前缀)
https://xget.xi-xu.me/homebrew/homebrew-core/raw/HEAD/Formula/g/git.rb

# Homebrew API 原始 URL
https://formulae.brew.sh/api/formula/git.json

# 转换后(添加 homebrew/api 前缀)
https://xget.xi-xu.me/homebrew/api/formula/git.json

# Homebrew Bottles 原始 URL
https://ghcr.io/v2/homebrew/core/git/manifests/2.39.0

# 转换后(添加 homebrew/bottles 前缀)
https://xget.xi-xu.me/homebrew/bottles/v2/homebrew/core/git/manifests/2.39.0

RubyGems

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# RubyGems 包文件原始 URL
https://rubygems.org/gems/rails-7.0.4.gem

# 转换后(添加 rubygems 前缀)
https://xget.xi-xu.me/rubygems/gems/rails-7.0.4.gem

# RubyGems API 原始 URL
https://rubygems.org/api/v1/gems/nokogiri.json

# 转换后(添加 rubygems 前缀)
https://xget.xi-xu.me/rubygems/api/v1/gems/nokogiri.json

CRAN

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# CRAN 包文件原始 URL
https://cran.r-project.org/src/contrib/ggplot2_3.5.2.tar.gz

# 转换后(添加 cran 前缀)
https://xget.xi-xu.me/cran/src/contrib/ggplot2_3.5.2.tar.gz

# CRAN 包元数据原始 URL
https://cran.r-project.org/web/packages/dplyr/DESCRIPTION

# 转换后(添加 cran 前缀)
https://xget.xi-xu.me/cran/web/packages/dplyr/DESCRIPTION

CPAN (Perl 包管理)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# CPAN 模块原始 URL
https://www.cpan.org/modules/by-module/DBI/DBI-1.643.tar.gz

# 转换后(添加 cpan 前缀)
https://xget.xi-xu.me/cpan/modules/by-module/DBI/DBI-1.643.tar.gz

# CPAN 作者包原始 URL
https://www.cpan.org/authors/id/T/TI/TIMB/DBI-1.643.tar.gz

# 转换后(添加 cpan 前缀)
https://xget.xi-xu.me/cpan/authors/id/T/TI/TIMB/DBI-1.643.tar.gz

CTAN (TeX/LaTeX 包管理)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# CTAN 包文件原始 URL
https://tug.ctan.org/tex-archive/macros/latex/contrib/beamer.zip

# 转换后(添加 ctan 前缀)
https://xget.xi-xu.me/ctan/tex-archive/macros/latex/contrib/beamer.zip

# CTAN 字体文件原始 URL
https://tug.ctan.org/tex-archive/fonts/cm/pk/ljfour/public/cm/dpi600/cmr10.pk

# 转换后(添加 ctan 前缀)
https://xget.xi-xu.me/ctan/tex-archive/fonts/cm/pk/ljfour/public/cm/dpi600/cmr10.pk

Go 模块

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Go 模块代理原始 URL
https://proxy.golang.org/github.com/gin-gonic/gin/@v/v1.9.1.zip

# 转换后(添加 golang 前缀)
https://xget.xi-xu.me/golang/github.com/gin-gonic/gin/@v/v1.9.1.zip

# Go 模块信息原始 URL
https://proxy.golang.org/github.com/gorilla/mux/@v/list

# 转换后(添加 golang 前缀)
https://xget.xi-xu.me/golang/github.com/gorilla/mux/@v/list

NuGet

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# NuGet 包下载原始 URL
https://api.nuget.org/v3-flatcontainer/newtonsoft.json/13.0.3/newtonsoft.json.13.0.3.nupkg

# 转换后(添加 nuget 前缀)
https://xget.xi-xu.me/nuget/v3-flatcontainer/newtonsoft.json/13.0.3/newtonsoft.json.13.0.3.nupkg

# NuGet 包元数据原始 URL
https://api.nuget.org/v3/registration5-semver1/microsoft.aspnetcore.app/index.json

# 转换后(添加 nuget 前缀)
https://xget.xi-xu.me/nuget/v3/registration5-semver1/microsoft.aspnetcore.app/index.json

Rust Crates

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
# Crate 下载原始 URL
https://crates.io/api/v1/crates/serde/1.0.0/download

# 转换后(添加 crates 前缀)
https://xget.xi-xu.me/crates/serde/1.0.0/download

# Crate 元数据原始 URL
https://crates.io/api/v1/crates/serde

# 转换后(添加 crates 前缀)
https://xget.xi-xu.me/crates/serde

# Crate 搜索原始 URL
https://crates.io/api/v1/crates?q=serde

# 转换后(添加 crates 前缀)
https://xget.xi-xu.me/crates/?q=serde

Packagist

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Packagist 包元数据原始 URL
https://repo.packagist.org/p2/symfony/console.json

# 转换后(添加 packagist 前缀)
https://xget.xi-xu.me/packagist/p2/symfony/console.json

# Packagist 包列表原始 URL
https://repo.packagist.org/packages/list.json

# 转换后(添加 packagist 前缀)
https://xget.xi-xu.me/packagist/packages/list.json

Linux 发行版

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# Debian 包原始 URL
https://deb.debian.org/debian/pool/main/c/curl/curl_7.88.1-10+deb12u4_amd64.deb

# 转换后(添加 debian 前缀)
https://xget.xi-xu.me/debian/debian/pool/main/c/curl/curl_7.88.1-10+deb12u4_amd64.deb

# Ubuntu 包原始 URL
https://archive.ubuntu.com/ubuntu/pool/main/g/git/git_2.34.1-1ubuntu1.9_amd64.deb

# 转换后(添加 ubuntu 前缀)
https://xget.xi-xu.me/ubuntu/ubuntu/pool/main/g/git/git_2.34.1-1ubuntu1.9_amd64.deb

# Fedora 包原始 URL
https://dl.fedoraproject.org/pub/fedora/linux/releases/39/Everything/x86_64/os/Packages/n/nginx-1.24.0-1.fc39.x86_64.rpm

# 转换后(添加 fedora 前缀)
https://xget.xi-xu.me/fedora/pub/fedora/linux/releases/39/Everything/x86_64/os/Packages/n/nginx-1.24.0-1.fc39.x86_64.rpm

# Rocky Linux 包原始 URL
https://download.rockylinux.org/pub/rocky/9/BaseOS/x86_64/os/Packages/b/bash-5.1.8-6.el9.x86_64.rpm

# 转换后(添加 rocky 前缀)
https://xget.xi-xu.me/rocky/pub/rocky/9/BaseOS/x86_64/os/Packages/b/bash-5.1.8-6.el9.x86_64.rpm

# openSUSE 包原始 URL
https://download.opensuse.org/distribution/leap/15.5/repo/oss/x86_64/vim-9.0.1572-150500.20.8.1.x86_64.rpm

# 转换后(添加 opensuse 前缀)
https://xget.xi-xu.me/opensuse/distribution/leap/15.5/repo/oss/x86_64/vim-9.0.1572-150500.20.8.1.x86_64.rpm

# Arch Linux 包原始 URL
https://geo.mirror.pkgbuild.com/core/os/x86_64/linux-6.6.10.arch1-1-x86_64.pkg.tar.zst

# 转换后(添加 arch 前缀)
https://xget.xi-xu.me/arch/core/os/x86_64/linux-6.6.10.arch1-1-x86_64.pkg.tar.zst

arXiv

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# arXiv 论文 PDF 原始 URL
https://arxiv.org/pdf/2301.07041.pdf

# 转换后(添加 arxiv 前缀)
https://xget.xi-xu.me/arxiv/pdf/2301.07041.pdf

# arXiv 论文源码原始 URL
https://arxiv.org/e-print/2301.07041

# 转换后(添加 arxiv 前缀)
https://xget.xi-xu.me/arxiv/e-print/2301.07041

F-Droid

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# F-Droid 应用 APK 原始 URL
https://f-droid.org/repo/org.fdroid.fdroid_1016050.apk

# 转换后(添加 fdroid 前缀)
https://xget.xi-xu.me/fdroid/repo/org.fdroid.fdroid_1016050.apk

# F-Droid 应用元数据原始 URL
https://f-droid.org/api/v1/packages/org.fdroid.fdroid

# 转换后(添加 fdroid 前缀)
https://xget.xi-xu.me/fdroid/api/v1/packages/org.fdroid.fdroid

Jenkins 插件

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Jenkins 更新中心原始 URL
https://updates.jenkins.io/update-center.json

# 转换后(添加 jenkins 前缀)
https://xget.xi-xu.me/jenkins/update-center.json

# Jenkins 插件下载原始 URL
https://updates.jenkins.io/download/plugins/maven-plugin/3.27/maven-plugin.hpi

# 转换后(添加 jenkins 前缀)
https://xget.xi-xu.me/jenkins/download/plugins/maven-plugin/3.27/maven-plugin.hpi

容器注册表

Xget 支持多个容器注册表,使用 cr/[容器注册表前缀] 格式:

容器注册表容器注册表前缀原始 URL 格式加速 URL 格式
Docker Hubdockerhttps://registry-1.docker.io/...https://xget.xi-xu.me/cr/docker/...
Quay.ioquayhttps://quay.io/...https://xget.xi-xu.me/cr/quay/...
谷歌容器注册表gcrhttps://gcr.io/...https://xget.xi-xu.me/cr/gcr/...
微软容器注册表mcrhttps://mcr.microsoft.com/...https://xget.xi-xu.me/cr/mcr/...
亚马逊公共弹性容器注册表ecrhttps://public.ecr.aws/...https://xget.xi-xu.me/cr/ecr/...
GitHub 容器注册表ghcrhttps://ghcr.io/...https://xget.xi-xu.me/cr/ghcr/...
GitLab 容器注册表gitlabhttps://registry.gitlab.com/...https://xget.xi-xu.me/cr/gitlab/...
红帽注册表redhathttps://registry.redhat.io/...https://xget.xi-xu.me/cr/redhat/...
甲骨文容器注册表oraclehttps://container-registry.oracle.com/...https://xget.xi-xu.me/cr/oracle/...
Cloudsmithcloudsmithhttps://docker.cloudsmith.io/...https://xget.xi-xu.me/cr/cloudsmith/...
DigitalOcean 注册表digitaloceanhttps://registry.digitalocean.com/...https://xget.xi-xu.me/cr/digitalocean/...
VMware 注册表vmwarehttps://projects.registry.vmware.com/...https://xget.xi-xu.me/cr/vmware/...
Kubernetes 注册表k8shttps://registry.k8s.io/...https://xget.xi-xu.me/cr/k8s/...
Heroku 注册表herokuhttps://registry.heroku.com/...https://xget.xi-xu.me/cr/heroku/...
SUSE 注册表susehttps://registry.suse.com/...https://xget.xi-xu.me/cr/suse/...
openSUSE 注册表opensusehttps://registry.opensuse.org/...https://xget.xi-xu.me/cr/opensuse/...
Gitpod 注册表gitpodhttps://registry.gitpod.io/...https://xget.xi-xu.me/cr/gitpod/...
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# Docker Hub 原始 URL(官方镜像)
https://registry-1.docker.io/v2/library/nginx/manifests/latest

# 转换后(添加 cr/docker 前缀)
https://xget.xi-xu.me/cr/docker/v2/nginx/manifests/latest

# Docker Hub 原始 URL(用户镜像)
https://registry-1.docker.io/v2/nginxinc/nginx-unprivileged/manifests/latest

# 转换后(添加 cr/docker 前缀)
https://xget.xi-xu.me/cr/docker/v2/nginxinc/nginx-unprivileged/manifests/latest

# GitHub 容器注册表原始 URL
https://ghcr.io/v2/nginxinc/nginx-unprivileged/manifests/latest

# 转换后(添加 cr/ghcr 前缀)
https://xget.xi-xu.me/cr/ghcr/v2/nginxinc/nginx-unprivileged/manifests/latest

# 谷歌容器注册表原始 URL
https://gcr.io/v2/distroless/base/manifests/latest

# 转换后(添加 cr/gcr 前缀)
https://xget.xi-xu.me/cr/gcr/v2/distroless/base/manifests/latest

应用场景见容器镜像加速

AI 推理提供商

Xget 支持众多主流 AI 推理提供商的 API 加速,使用 ip/[AI 推理提供商前缀] 格式:

AI 推理提供商AI 推理提供商前缀原始 URL 格式加速 URL 格式
OpenAIopenaihttps://api.openai.com/...https://xget.xi-xu.me/ip/openai/...
Anthropicanthropichttps://api.anthropic.com/...https://xget.xi-xu.me/ip/anthropic/...
Geminigeminihttps://generativelanguage.googleapis.com/...https://xget.xi-xu.me/ip/gemini/...
Vertex AIvertexaihttps://aiplatform.googleapis.com/...https://xget.xi-xu.me/ip/vertexai/...
Coherecoherehttps://api.cohere.ai/...https://xget.xi-xu.me/ip/cohere/...
Mistral AImistralaihttps://api.mistral.ai/...https://xget.xi-xu.me/ip/mistralai/...
xAIxaihttps://api.x.ai/...https://xget.xi-xu.me/ip/xai/...
GitHub 模型githubmodelshttps://models.github.ai/...https://xget.xi-xu.me/ip/githubmodels/...
NVIDIA APInvidiaapihttps://integrate.api.nvidia.com/...https://xget.xi-xu.me/ip/nvidiaapi/...
Perplexityperplexityhttps://api.perplexity.ai/...https://xget.xi-xu.me/ip/perplexity/...
Groqgroqhttps://api.groq.com/...https://xget.xi-xu.me/ip/groq/...
Cerebrascerebrashttps://api.cerebras.ai/...https://xget.xi-xu.me/ip/cerebras/...
SambaNovasambanovahttps://api.sambanova.ai/...https://xget.xi-xu.me/ip/sambanova/...
Siraysirayhttps://api.siray.ai/...https://xget.xi-xu.me/ip/siray/...
HF Inferencehuggingfacehttps://router.huggingface.co/...https://xget.xi-xu.me/ip/huggingface/...
Togethertogetherhttps://api.together.xyz/...https://xget.xi-xu.me/ip/together/...
Replicatereplicatehttps://api.replicate.com/...https://xget.xi-xu.me/ip/replicate/...
Fireworksfireworkshttps://api.fireworks.ai/...https://xget.xi-xu.me/ip/fireworks/...
Nebiusnebiushttps://api.studio.nebius.ai/...https://xget.xi-xu.me/ip/nebius/...
Jinajinahttps://api.jina.ai/...https://xget.xi-xu.me/ip/jina/...
Voyage AIvoyageaihttps://api.voyageai.com/...https://xget.xi-xu.me/ip/voyageai/...
Fal AIfalaihttps://fal.run/...https://xget.xi-xu.me/ip/falai/...
Novitanovitahttps://api.novita.ai/...https://xget.xi-xu.me/ip/novita/...
Burncloudburncloudhttps://ai.burncloud.com/...https://xget.xi-xu.me/ip/burncloud/...
OpenRouteropenrouterhttps://openrouter.ai/...https://xget.xi-xu.me/ip/openrouter/...
Poepoehttps://api.poe.com/...https://xget.xi-xu.me/ip/poe/...
Featherless AIfeatherlessaihttps://api.featherless.ai/...https://xget.xi-xu.me/ip/featherlessai/...
Hyperbolichyperbolichttps://api.hyperbolic.xyz/...https://xget.xi-xu.me/ip/hyperbolic/...
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# OpenAI API 原始 URL
https://api.openai.com/v1/chat/completions

# 转换后(添加 ip/openai 前缀)
https://xget.xi-xu.me/ip/openai/v1/chat/completions

# Claude API 原始 URL
https://api.anthropic.com/v1/messages

# 转换后(添加 ip/anthropic 前缀)
https://xget.xi-xu.me/ip/anthropic/v1/messages

# Gemini API 原始 URL
https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent

# 转换后(添加 ip/gemini 前缀)
https://xget.xi-xu.me/ip/gemini/v1beta/models/gemini-2.5-flash:generateContent

# HF Inference API 原始 URL
https://router.huggingface.co/hf-inference/models/openai/whisper-large-v3

# 转换后(添加 ip/huggingface 前缀)
https://xget.xi-xu.me/ip/huggingface/hf-inference/models/openai/whisper-large-v3

应用场景见 AI 推理 API 加速

🎯 应用场景

Git 操作与配置

Git 操作

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# 克隆存储库
git clone https://xget.xi-xu.me/gh/microsoft/vscode.git

# 克隆指定分支
git clone -b main https://xget.xi-xu.me/gh/facebook/react.git

# 浅克隆(仅最新提交)
git clone --depth 1 https://xget.xi-xu.me/gh/torvalds/linux.git

# 克隆 GitLab 存储库
git clone https://xget.xi-xu.me/gl/gitlab-org/gitlab.git

# 克隆 Gitea 存储库
git clone https://xget.xi-xu.me/gitea/gitea/gitea.git

# 克隆 Codeberg 存储库
git clone https://xget.xi-xu.me/codeberg/forgejo/forgejo.git

# 克隆 SourceForge 存储库
git clone https://xget.xi-xu.me/sf/projects/mingw-w64/code.git

# 克隆 AOSP 存储库
git clone https://xget.xi-xu.me/aosp/platform/frameworks/base.git

# 添加远程存储库
git remote add upstream https://xget.xi-xu.me/gh/[所有者]/[存储库].git

# 拉取更新
git pull https://xget.xi-xu.me/gh/microsoft/vscode.git main

# 子模块递归克隆
git clone --recursive https://xget.xi-xu.me/gh/[用户名]/[带子模块的存储库].git

Git 全局加速配置

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# 为特定域名配置 Git 使用 Xget
git config --global url."https://xget.xi-xu.me/gh/".insteadOf "https://github.com/"
git config --global url."https://xget.xi-xu.me/gl/".insteadOf "https://gitlab.com/"
git config --global url."https://xget.xi-xu.me/gitea/".insteadOf "https://gitea.com/"
git config --global url."https://xget.xi-xu.me/codeberg/".insteadOf "https://codeberg.org/"
git config --global url."https://xget.xi-xu.me/sf/".insteadOf "https://sourceforge.net/"
git config --global url."https://xget.xi-xu.me/aosp/".insteadOf "https://android.googlesource.com/"

# 验证配置
git config --global --get-regexp url

# 现在所有相关平台的 git clone 都会自动使用 Xget
git clone https://github.com/microsoft/vscode.git  # 自动转换为 Xget URL
git clone https://gitlab.com/gitlab-org/gitlab.git  # 自动转换为 Xget URL
git clone https://codeberg.org/forgejo/forgejo.git  # 自动转换为 Xget URL
git clone https://android.googlesource.com/platform/frameworks/base.git  # 自动转换为 Xget URL

主流下载工具集成

wget 下载

1
2
3
4
5
6
7
8
# 下载单个文件
wget https://xget.xi-xu.me/gh/microsoft/vscode/archive/refs/heads/main.zip

# 断点续传
wget -c https://xget.xi-xu.me/hf/microsoft/DialoGPT-large/resolve/main/pytorch_model.bin

# 批量下载
wget -i urls.txt  # urls.txt 包含多个 Xget URL

cURL 下载

1
2
3
4
5
6
7
8
# 基本下载
curl -L -O https://xget.xi-xu.me/gh/golang/go/archive/refs/tags/go1.22.0.tar.gz

# 显示进度条
curl -L --progress-bar -o model.bin https://xget.xi-xu.me/hf/openai/whisper-large-v3/resolve/main/pytorch_model.bin

# 设置用户代理
curl -L -H "User-Agent: MyApp/1.0" https://xget.xi-xu.me/gl/gitlab-org/gitlab-runner/-/archive/main/gitlab-runner-main.zip

aria2 多线程下载

1
2
3
4
5
6
7
8
# 多线程下载大文件
aria2c -x 16 -s 16 https://xget.xi-xu.me/hf/microsoft/DialoGPT-large/resolve/main/pytorch_model.bin

# 断点续传
aria2c -c https://xget.xi-xu.me/gh/microsoft/vscode/archive/refs/heads/main.zip

# 批量下载配置文件
aria2c -i download-list.txt  # 包含多个 Xget URL 的文件

Hugging Face 镜像

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import os
from transformers import AutoTokenizer, AutoModelForCausalLM

# 设置环境变量,让 transformers 库自动使用 Xget 镜像
os.environ['HF_ENDPOINT'] = 'https://xget.xi-xu.me/hf'

# 定义模型名称
model_name = 'microsoft/DialoGPT-medium'

print(f"正在从镜像下载模型: {model_name}")

# 使用 AutoModelForCausalLM 来加载对话生成模型
# 由于上面设置了环境变量,这里无需添加任何额外参数
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name)

print("模型和分词器加载成功!")

# 你现在可以使用 tokenizer 和 model 了
# 例如:
# new_user_input_ids = tokenizer.encode("Hello, how are you?", return_tensors='pt')
# chat_history_ids = model.generate(new_user_input_ids, max_length=1000, pad_token_id=tokenizer.eos_token_id)
# print(tokenizer.decode(chat_history_ids[:, new_user_input_ids.shape[-1]:][0], skip_special_tokens=True))

Civitai AI 模型平台

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import requests

# 设置 API 基础 URL 使用 Xget
base_url = "https://xget.xi-xu.me/civitai"

# 获取模型信息
def get_model_info(model_id):
    """获取 Civitai 模型信息"""
    url = f"{base_url}/api/v1/models/{model_id}"
    response = requests.get(url)
    return response.json()

# 下载模型
def download_model(model_version_id, output_path):
    """下载 Civitai 模型文件"""
    download_url = f"{base_url}/api/download/models/{model_version_id}"

    print(f"正在下载模型版本 {model_version_id}...")

    response = requests.get(download_url, stream=True)
    response.raise_for_status()

    with open(output_path, 'wb') as f:
        for chunk in response.iter_content(chunk_size=8192):
            f.write(chunk)

    print(f"模型已下载到: {output_path}")

# 使用示例
model_id = 7240  # 示例模型 ID
model_info = get_model_info(model_id)
print(f"模型名称: {model_info['name']}")

# 下载第一个模型版本
if model_info['modelVersions']:
    version_id = model_info['modelVersions'][0]['id']
    download_model(version_id, f"model_{version_id}.safetensors")

npm 包管理加速

配置 npm 使用 Xget 镜像

1
2
3
4
5
6
7
8
# 临时使用 Xget 镜像
npm install --registry https://xget.xi-xu.me/npm/

# 全局配置 npm 镜像
npm config set registry https://xget.xi-xu.me/npm/

# 验证配置
npm config get registry

在项目中使用

1
2
3
4
5
6
7
8
9
# 在 .npmrc 文件中配置项目级镜像
echo "registry=https://xget.xi-xu.me/npm/" > .npmrc

# 安装依赖
npm install

# 或者使用 yarn
yarn config set registry https://xget.xi-xu.me/npm/
yarn install

Python 包管理加速

配置 pip 使用 Xget 镜像

1
2
3
4
5
6
7
8
9
# 临时使用 Xget 镜像
pip install requests -i https://xget.xi-xu.me/pypi/simple/

# 全局配置 pip 镜像
pip config set global.index-url https://xget.xi-xu.me/pypi/simple/
pip config set global.trusted-host xget.xi-xu.me

# 验证配置
pip config list

在项目中使用

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
# 创建 pip.conf 文件(Linux/macOS)
mkdir -p ~/.pip
cat > ~/.pip/pip.conf << EOF
[global]
index-url = https://xget.xi-xu.me/pypi/simple/
trusted-host = xget.xi-xu.me
EOF

# 或在项目根目录创建 pip.conf
cat > pip.conf << EOF
[global]
index-url = https://xget.xi-xu.me/pypi/simple/
trusted-host = xget.xi-xu.me
EOF

# 使用配置文件安装
pip install -r requirements.txt --config-file pip.conf

在 requirements.txt 中指定镜像

1
2
3
4
5
6
7
8
# requirements.txt
--index-url https://xget.xi-xu.me/pypi/simple/
--trusted-host xget.xi-xu.me

requests>=2.25.0
numpy>=1.21.0
pandas>=1.3.0
matplotlib>=3.4.0

conda 包管理加速

配置 conda 使用 Xget 镜像

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
# 配置默认频道镜像
conda config --add default_channels https://xget.xi-xu.me/conda/pkgs/msys2
conda config --add default_channels https://xget.xi-xu.me/conda/pkgs/r
conda config --add default_channels https://xget.xi-xu.me/conda/pkgs/main

# 配置所有社区频道镜像(推荐)
conda config --set channel_alias https://xget.xi-xu.me/conda/community

# 或配置特定社区频道
conda config --add channels https://xget.xi-xu.me/conda/community/conda-forge
conda config --add channels https://xget.xi-xu.me/conda/community/bioconda

# 设置频道优先级
conda config --set channel_priority strict

# 验证配置
conda config --show

在 .condarc 中配置

.condarc 文件可以放在用户主目录(~/.condarc)或项目根目录下:

1
2
3
4
5
6
7
default_channels:
  - https://xget.xi-xu.me/conda/pkgs/main
  - https://xget.xi-xu.me/conda/pkgs/r
  - https://xget.xi-xu.me/conda/pkgs/msys2
channel_alias: https://xget.xi-xu.me/conda/community
channel_priority: strict
show_channel_urls: true

使用环境文件

环境文件中可以直接指定完整的镜像 URL:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# environment.yml
name: myproject
channels:
  - https://xget.xi-xu.me/conda/pkgs/main
  - https://xget.xi-xu.me/conda/pkgs/r
  - https://xget.xi-xu.me/conda/community/bioconda
  - https://xget.xi-xu.me/conda/community/conda-forge
dependencies:
  - python=3.11
  - numpy>=1.24.0
  - pandas>=2.0.0
  - matplotlib>=3.7.0
  - scipy>=1.10.0
  - pip
  - pip:
    - requests>=2.28.0
1
2
3
4
5
# 使用环境文件创建环境
conda env create -f environment.yml

# 更新环境
conda env update -f environment.yml

Maven 包管理加速

配置 Maven 使用 Xget 镜像

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
<!-- 在 ~/.m2/settings.xml 中配置 Maven 镜像 -->
<settings>
  <mirrors>
    <mirror>
      <id>xget-maven-central</id>
      <mirrorOf>central</mirrorOf>
      <name>Xget Maven Central Mirror</name>
      <url>https://xget.xi-xu.me/maven/maven2</url>
    </mirror>
  </mirrors>
</settings>

在项目中使用

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
<!-- 在 pom.xml 中配置项目级镜像 -->
<project>
  <repositories>
    <repository>
      <id>xget-maven-central</id>
      <name>Xget Maven Central</name>
      <url>https://xget.xi-xu.me/maven/maven2</url>
    </repository>
  </repositories>

  <pluginRepositories>
    <pluginRepository>
      <id>xget-maven-central</id>
      <name>Xget Maven Central</name>
      <url>https://xget.xi-xu.me/maven/maven2</url>
    </pluginRepository>
  </pluginRepositories>
</project>
1
2
3
4
5
6
# 使用命令行指定镜像
mvn clean install -Dmaven.repo.remote=https://xget.xi-xu.me/maven/maven2

# 下载特定依赖
mvn dependency:get -Dartifact=org.springframework:spring-core:5.3.21 \
  -DremoteRepositories=https://xget.xi-xu.me/maven/maven2

Apache 软件下载加速

使用 Xget 下载 Apache 软件

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# 下载 Apache Kafka
wget https://xget.xi-xu.me/apache/kafka/3.6.1/kafka_2.13-3.6.1.tgz

# 下载 Apache Maven
curl -L -O https://xget.xi-xu.me/apache/maven/maven-3/3.9.5/binaries/apache-maven-3.9.5-bin.tar.gz

# 下载 Apache Spark
aria2c https://xget.xi-xu.me/apache/spark/spark-3.5.0/spark-3.5.0-bin-hadoop3.tgz

# 下载 Apache Hadoop
wget https://xget.xi-xu.me/apache/hadoop/common/hadoop-3.3.6/hadoop-3.3.6.tar.gz

# 下载 Apache Flink
curl -L -O https://xget.xi-xu.me/apache/flink/flink-1.18.1/flink-1.18.1-bin-scala_2.12.tgz

常用 Apache 软件下载

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# 大数据相关
wget https://xget.xi-xu.me/apache/hive/hive-3.1.3/apache-hive-3.1.3-bin.tar.gz
wget https://xget.xi-xu.me/apache/hbase/2.5.7/hbase-2.5.7-bin.tar.gz
wget https://xget.xi-xu.me/apache/zookeeper/zookeeper-3.8.4/apache-zookeeper-3.8.4-bin.tar.gz

# Web 服务器
wget https://xget.xi-xu.me/apache/httpd/httpd-2.4.59.tar.gz
wget https://xget.xi-xu.me/apache/tomcat/tomcat-10/v10.1.19/bin/apache-tomcat-10.1.19.tar.gz

# 开发工具
wget https://xget.xi-xu.me/apache/ant/1.10.14/apache-ant-1.10.14-bin.tar.gz
wget https://xget.xi-xu.me/apache/netbeans/netbeans/20/netbeans-20-bin.zip

Gradle 包管理加速

配置 Gradle 使用 Xget 镜像

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
// 在 build.gradle 中配置 Gradle 镜像
repositories {
    maven {
        url 'https://xget.xi-xu.me/maven/maven2'
    }
    gradlePluginPortal {
        url 'https://xget.xi-xu.me/gradle/m2'
    }
}

// 配置插件存储库
pluginManagement {
    repositories {
        maven {
            url 'https://xget.xi-xu.me/gradle/m2'
        }
        gradlePluginPortal()
    }
}

全局配置

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
// 在 ~/.gradle/init.gradle 中配置全局镜像
allprojects {
    repositories {
        maven {
            url 'https://xget.xi-xu.me/maven/maven2'
        }
    }
}

settingsEvaluated { settings ->
    settings.pluginManagement {
        repositories {
            maven {
                url 'https://xget.xi-xu.me/gradle/m2'
            }
            gradlePluginPortal()
        }
    }
}
1
2
3
4
5
# 使用命令行指定镜像
gradle build -Dmaven.repo.remote=https://xget.xi-xu.me/maven/maven2

# 刷新依赖
gradle build --refresh-dependencies

Homebrew 包管理加速

配置 Homebrew 使用 Xget 镜像

1
2
3
4
5
6
7
8
# 设置 Homebrew 环境变量使用 Xget 镜像
export HOMEBREW_BREW_GIT_REMOTE="https://xget.xi-xu.me/homebrew/brew.git"
export HOMEBREW_CORE_GIT_REMOTE="https://xget.xi-xu.me/homebrew/homebrew-core.git"
export HOMEBREW_API_DOMAIN="https://xget.xi-xu.me/homebrew/api"
export HOMEBREW_BOTTLE_DOMAIN="https://xget.xi-xu.me/homebrew/bottles"

# 更新 Homebrew
brew update

长期配置

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# 为 bash 用户添加到 ~/.bash_profile
echo 'export HOMEBREW_BREW_GIT_REMOTE="https://xget.xi-xu.me/homebrew/brew.git"' >> ~/.bash_profile
echo 'export HOMEBREW_CORE_GIT_REMOTE="https://xget.xi-xu.me/homebrew/homebrew-core.git"' >> ~/.bash_profile
echo 'export HOMEBREW_API_DOMAIN="https://xget.xi-xu.me/homebrew/api"' >> ~/.bash_profile
echo 'export HOMEBREW_BOTTLE_DOMAIN="https://xget.xi-xu.me/homebrew/bottles"' >> ~/.bash_profile

# 为 zsh 用户添加到 ~/.zprofile
echo 'export HOMEBREW_BREW_GIT_REMOTE="https://xget.xi-xu.me/homebrew/brew.git"' >> ~/.zprofile
echo 'export HOMEBREW_CORE_GIT_REMOTE="https://xget.xi-xu.me/homebrew/homebrew-core.git"' >> ~/.zprofile
echo 'export HOMEBREW_API_DOMAIN="https://xget.xi-xu.me/homebrew/api"' >> ~/.zprofile
echo 'export HOMEBREW_BOTTLE_DOMAIN="https://xget.xi-xu.me/homebrew/bottles"' >> ~/.zprofile

在项目中使用

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# 安装软件包
brew install git

# 搜索软件包
brew search python

# 更新软件包
brew upgrade

# 查看已安装软件包
brew list

验证镜像配置

1
2
3
4
5
6
# 检查 Homebrew 配置
brew config

# 查看环境变量
echo $HOMEBREW_API_DOMAIN
echo $HOMEBREW_BOTTLE_DOMAIN

Ruby 包管理加速

配置 RubyGems 使用 Xget 镜像

1
2
3
4
5
6
7
8
9
# 临时使用 Xget 镜像
gem install rails --source https://xget.xi-xu.me/rubygems/

# 全局配置 RubyGems 镜像
gem sources --add https://xget.xi-xu.me/rubygems/
gem sources --remove https://rubygems.org/

# 验证配置
gem sources -l

在项目中使用

1
2
3
4
5
6
# 在 Gemfile 中配置项目级镜像
source 'https://xget.xi-xu.me/rubygems/'

gem 'rails', '~> 7.0.0'
gem 'pg', '~> 1.1'
gem 'puma', '~> 5.0'
1
2
3
# 使用 bundle 安装
bundle config mirror.https://rubygems.org https://xget.xi-xu.me/rubygems/
bundle install

R 包管理加速

配置 R 使用 Xget CRAN 镜像

1
2
3
4
5
6
7
8
# 在 R 中临时使用 Xget CRAN 镜像
install.packages("ggplot2", repos = "https://xget.xi-xu.me/cran/")

# 全局配置 CRAN 镜像
options(repos = c(CRAN = "https://xget.xi-xu.me/cran/"))

# 验证配置
getOption("repos")

在 .Rprofile 中配置

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# 在用户主目录的 .Rprofile 文件中配置全局镜像
options(repos = c(
  CRAN = "https://xget.xi-xu.me/cran/",
  BioCsoft = "https://bioconductor.org/packages/release/bioc",
  BioCann = "https://bioconductor.org/packages/release/data/annotation",
  BioCexp = "https://bioconductor.org/packages/release/data/experiment"
))

# 设置下载方法
options(download.file.method = "libcurl")

在项目中使用

1
2
3
4
5
6
7
8
9
# 在项目的 renv.lock 或脚本中指定镜像
renv::init()
renv::settings$repos.override(c(CRAN = "https://xget.xi-xu.me/cran/"))

# 安装包
install.packages(c("dplyr", "ggplot2", "tidyr"))

# 或使用 pak 包管理器
pak::pkg_install("tidyverse", repos = "https://xget.xi-xu.me/cran/")
1
2
3
4
5
6
7
8
9
# 在命令行中使用 R 脚本安装包
Rscript -e "options(repos = c(CRAN = 'https://xget.xi-xu.me/cran/')); install.packages('ggplot2')"

# 批量安装包
Rscript -e "
options(repos = c(CRAN = 'https://xget.xi-xu.me/cran/'))
packages <- c('dplyr', 'ggplot2', 'tidyr', 'readr')
install.packages(packages)
"

Perl 包管理加速

配置 CPAN 使用 Xget 镜像

1
2
3
4
5
6
7
# 配置 CPAN 使用 Xget 镜像
cpan o conf urllist push https://xget.xi-xu.me/cpan/
cpan o conf commit

# 或者直接编辑配置文件 ~/.cpan/CPAN/MyConfig.pm
# 添加:
# 'urllist' => [q[https://xget.xi-xu.me/cpan/]],

使用 cpanm 安装模块

1
2
3
4
5
6
7
8
9
# 安装 cpanm(如果没有)
curl -L https://cpanmin.us | perl - --sudo App::cpanminus

# 使用 Xget 镜像安装模块
cpanm --mirror https://xget.xi-xu.me/cpan/ DBI
cpanm --mirror https://xget.xi-xu.me/cpan/ Mojolicious

# 从 Makefile.PL 安装依赖
cpanm --mirror https://xget.xi-xu.me/cpan/ --installdeps .

在项目中使用

1
2
3
4
5
6
7
# 在 cpanfile 中列出依赖
requires 'DBI';
requires 'Mojolicious';
requires 'JSON';

# 然后使用 Xget 镜像安装
cpanm --mirror https://xget.xi-xu.me/cpan/ --installdeps .

TeX/LaTeX 包管理加速

配置 TeX Live 使用 Xget CTAN 镜像

1
2
3
4
5
6
7
8
9
# 配置 tlmgr 使用 Xget CTAN 镜像
tlmgr option repository https://xget.xi-xu.me/ctan/systems/texlive/tlnet

# 更新包数据库
tlmgr update --self --all

# 安装包
tlmgr install beamer
tlmgr install tikz

配置 MiKTeX 使用 Xget 镜像

1
2
3
4
5
6
7
8
9
# Windows MiKTeX 配置
mpm --set-repository=https://xget.xi-xu.me/ctan/systems/win32/miktex

# 更新包数据库
mpm --update-db

# 安装包
mpm --install=beamer
mpm --install=pgf

在项目中使用

1
2
3
4
5
6
7
# LaTeX 文档编译时自动安装缺失包
pdflatex --shell-escape document.tex

# 或手动安装特定包
tlmgr install caption
tlmgr install subcaption
tlmgr install algorithm2e

Go 模块加速

配置 Go 使用 Xget 代理

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# 配置 Go 模块代理
export GOPROXY=https://xget.xi-xu.me/golang,direct
export GOSUMDB=off

# 或者永久配置
go env -w GOPROXY=https://xget.xi-xu.me/golang,direct
go env -w GOSUMDB=off

# 验证配置
go env GOPROXY

在项目中使用

1
2
3
4
5
6
7
8
# 下载依赖
go mod download

# 更新依赖
go get -u ./...

# 清理模块缓存
go clean -modcache

NuGet 包管理加速

配置 NuGet 使用 Xget 镜像

1
2
3
4
5
6
7
8
# 添加 Xget 包源
dotnet nuget add source https://xget.xi-xu.me/nuget/v3/index.json -n xget

# 列出包源
dotnet nuget list source

# 在项目中使用
dotnet restore --source https://xget.xi-xu.me/nuget/v3/index.json

在 NuGet.Config 中配置

1
2
3
4
5
6
7
<!-- NuGet.Config -->
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="xget" value="https://xget.xi-xu.me/nuget/v3/index.json" />
  </packageSources>
</configuration>

Rust 包管理加速

配置 Cargo 使用 Xget 镜像

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# 配置 Cargo 使用 Xget 镜像(在 ~/.cargo/config.toml 中)
mkdir -p ~/.cargo
cat >> ~/.cargo/config.toml << EOF
[source.crates-io]
replace-with = "xget"

[source.xget]
registry = "https://xget.xi-xu.me/crates/"
EOF

# 验证配置
cargo search serde

在项目中使用

1
2
3
4
5
# 在 Cargo.toml 中可以正常使用依赖
[dependencies]
serde = "1.0"
tokio = "1.0"
reqwest = "0.11"
1
2
3
4
5
6
7
8
# 构建项目时会自动使用 Xget
cargo build

# 更新依赖
cargo update

# 添加新依赖
cargo add clap

PHP 包管理加速

配置 Composer 使用 Xget 镜像

1
2
3
4
5
6
7
8
# 全局配置 Composer 镜像
composer config -g repo.packagist composer https://xget.xi-xu.me/packagist/

# 项目级配置
composer config repo.packagist composer https://xget.xi-xu.me/packagist/

# 验证配置
composer config -l

在 composer.json 中配置

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
{
  "repositories": [
    {
      "type": "composer",
      "url": "https://xget.xi-xu.me/packagist/"
    }
  ],
  "require": {
    "symfony/console": "^6.0",
    "guzzlehttp/guzzle": "^7.0"
  }
}

Linux 发行版加速

Debian/Ubuntu APT 配置

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# 备份原始源列表
sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup

# 配置 Debian 镜像
echo "deb https://xget.xi-xu.me/debian/debian bookworm main" | sudo tee /etc/apt/sources.list
echo "deb https://xget.xi-xu.me/debian/debian-security bookworm-security main" | sudo tee -a /etc/apt/sources.list

# 配置 Ubuntu 镜像
echo "deb https://xget.xi-xu.me/ubuntu/ubuntu jammy main restricted universe multiverse" | sudo tee /etc/apt/sources.list
echo "deb https://xget.xi-xu.me/ubuntu/ubuntu jammy-updates main restricted universe multiverse" | sudo tee -a /etc/apt/sources.list

# 更新包列表
sudo apt update

Fedora DNF 配置

1
2
3
4
5
6
# 配置 Fedora 镜像
sudo sed -i 's|^metalink=|#metalink=|g' /etc/yum.repos.d/fedora*.repo
sudo sed -i 's|^#baseurl=http://download.example/pub/fedora/linux|baseurl=https://xget.xi-xu.me/fedora/pub/fedora/linux|g' /etc/yum.repos.d/fedora*.repo

# 更新包缓存
sudo dnf makecache

Rocky Linux DNF 配置

1
2
3
4
5
6
# 配置 Rocky Linux 镜像
sudo sed -i 's|^mirrorlist=|#mirrorlist=|g' /etc/yum.repos.d/rocky*.repo
sudo sed -i 's|^#baseurl=http://dl.rockylinux.org|baseurl=https://xget.xi-xu.me/rocky|g' /etc/yum.repos.d/rocky*.repo

# 更新包缓存
sudo dnf makecache

openSUSE Zypper 配置

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# 配置 openSUSE Leap 镜像
sudo zypper mr -d repo-oss
sudo zypper ar -f https://xget.xi-xu.me/opensuse/distribution/leap/15.5/repo/oss/ repo-oss-xget

# 配置 openSUSE Tumbleweed 镜像
sudo zypper mr -d repo-oss
sudo zypper ar -f https://xget.xi-xu.me/opensuse/tumbleweed/repo/oss/ repo-oss-xget

# 刷新软件源
sudo zypper refresh

# 验证配置
sudo zypper lr -u

Arch Linux Pacman 配置

1
2
3
4
5
6
7
8
# 备份原始镜像列表
sudo cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.backup

# 配置 Arch Linux 镜像
echo 'Server = https://xget.xi-xu.me/arch/$repo/os/$arch' | sudo tee /etc/pacman.d/mirrorlist

# 更新包数据库
sudo pacman -Sy

学术资源加速

arXiv 论文下载

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# 下载 arXiv 论文 PDF
wget https://xget.xi-xu.me/arxiv/pdf/2301.07041.pdf

# 下载论文源码
curl -L -O https://xget.xi-xu.me/arxiv/e-print/2301.07041

# 批量下载多篇论文
for id in 2301.07041 2302.13971 2303.08774; do
  wget https://xget.xi-xu.me/arxiv/pdf/${id}.pdf
done

在学术工具中使用

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# 在 Python 中使用 arXiv 加速下载
import requests

def download_arxiv_paper(arxiv_id, output_path):
    url = f"https://xget.xi-xu.me/arxiv/pdf/{arxiv_id}.pdf"
    response = requests.get(url)

    if response.status_code == 200:
        with open(output_path, 'wb') as f:
            f.write(response.content)
        print(f"Downloaded {arxiv_id} to {output_path}")
    else:
        print(f"Failed to download {arxiv_id}")

# 下载论文
download_arxiv_paper("2301.07041", "attention_is_all_you_need.pdf")

F-Droid 存储库镜像

配置 F-Droid 客户端使用 Xget 镜像

  1. 在 F-Droid 应用中进入设置存储库
  2. 点击 + 后输入存储库 URL:https://xget.xi-xu.me/fdroid/repo
  3. 点击添加后再点击添加镜像

支持的 F-Droid 服务

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# F-Droid 应用 APK 下载
https://xget.xi-xu.me/fdroid/repo/[包名]_[版本号].apk

# F-Droid 存储库索引
https://xget.xi-xu.me/fdroid/repo/index-v1.jar

# F-Droid 应用图标
https://xget.xi-xu.me/fdroid/repo/icons-640/[包名].[版本号].png

# F-Droid API 接口
https://xget.xi-xu.me/fdroid/api/v1/packages/[包名]

使用示例

1
2
3
4
5
6
7
8
# 直接下载 F-Droid 客户端 APK
wget https://xget.xi-xu.me/fdroid/repo/org.fdroid.fdroid_1016050.apk

# 下载其他开源应用
curl -L -O https://xget.xi-xu.me/fdroid/repo/org.mozilla.fennec_fdroid_1014000.apk

# 获取应用信息
curl https://xget.xi-xu.me/fdroid/api/v1/packages/org.fdroid.fdroid

批量应用管理

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# 创建应用下载脚本
cat > download_fdroid_apps.sh << 'EOF'
#!/bin/bash

# 定义要下载的应用列表
apps=(
    "org.fdroid.fdroid_1016050.apk"
    "org.mozilla.fennec_fdroid_1014000.apk"
    "com.termux_1180.apk"
    "org.videolan.vlc_13050399.apk"
)

# 创建下载目录
mkdir -p fdroid_apps

# 批量下载应用
for app in "${apps[@]}"; do
    echo "正在下载: $app"
    wget -P fdroid_apps "https://xget.xi-xu.me/fdroid/repo/$app"
done

echo "所有应用下载完成!"
EOF

chmod +x download_fdroid_apps.sh
./download_fdroid_apps.sh

开发者集成

对于 Android 开发者,可以在构建脚本中集成 F-Droid 镜像:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
// 在 build.gradle 中配置 F-Droid 依赖检查
task checkFDroidAvailability {
    doLast {
        def fdroidUrl = "https://xget.xi-xu.me/fdroid/api/v1/packages/${project.name}"
        try {
            def connection = new URL(fdroidUrl).openConnection()
            connection.requestMethod = 'GET'
            def responseCode = connection.responseCode
            if (responseCode == 200) {
                println "应用在 F-Droid 上可用: $fdroidUrl"
            }
        } catch (Exception e) {
            println "检查 F-Droid 可用性时出错: ${e.message}"
        }
    }
}

Jenkins 插件下载

使用 Xget 加速 Jenkins 插件下载和更新

支持 Jenkins 更新中心和插件下载,兼容清华镜像等国内镜像源的配置方式。

Jenkins 更新中心配置

方法一:在 Jenkins Web 界面配置
  1. 登录 Jenkins 管理界面

  2. 进入 Manage JenkinsPluginsAdvanced

  3. Update Site 部分,将 URL 更改为 https://xget.xi-xu.me/jenkins/update-center.json

  4. 点击 Submit 保存配置

方法二:修改配置文件
1
2
3
4
5
6
7
8
9
# 在 Jenkins 服务器上修改更新中心配置文件
# 默认位置:$JENKINS_HOME/hudson.model.UpdateCenter.xml
sudo nano /var/lib/jenkins/hudson.model.UpdateCenter.xml

# 将 URL 改为:
# <url>https://xget.xi-xu.me/jenkins/update-center.json</url>

# 重启 Jenkins 服务
sudo systemctl restart jenkins

支持的 Jenkins 服务

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Jenkins 更新中心 JSON
https://xget.xi-xu.me/jenkins/update-center.json

# Jenkins 更新中心(实际 JSON 格式)
https://xget.xi-xu.me/jenkins/update-center.actual.json

# Jenkins 插件下载
https://xget.xi-xu.me/jenkins/download/plugins/[插件名]/[版本]/[插件名].hpi

# 实验性插件更新中心
https://xget.xi-xu.me/jenkins/experimental/update-center.json

使用示例

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# 下载 Maven 插件
wget https://xget.xi-xu.me/jenkins/download/plugins/maven-plugin/3.27/maven-plugin.hpi

# 下载 Git 插件
curl -L -O https://xget.xi-xu.me/jenkins/download/plugins/git/5.2.1/git.hpi

# 获取更新中心信息
curl https://xget.xi-xu.me/jenkins/update-center.json

# 批量下载常用插件
cat > download_jenkins_plugins.sh << 'EOF'
#!/bin/bash

# 定义要下载的插件列表
plugins=(
    "git:5.2.1"
    "maven-plugin:3.27"
    "workflow-aggregator:596.v8c21c963d92d"
    "blueocean:1.27.8"
    "docker-workflow:563.vd5d2e5c4007f"
)

# 创建插件下载目录
mkdir -p jenkins_plugins

# 批量下载插件
for plugin in "${plugins[@]}"; do
    name=$(echo $plugin | cut -d: -f1)
    version=$(echo $plugin | cut -d: -f2)
    echo "正在下载插件: $name v$version"
    wget -P jenkins_plugins "https://xget.xi-xu.me/jenkins/download/plugins/$name/$version/$name.hpi"
done

echo "所有插件下载完成!"
EOF

chmod +x download_jenkins_plugins.sh
./download_jenkins_plugins.sh

离线 Jenkins 部署

对于无网络环境的 Jenkins 部署:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# 1. 下载 Jenkins 核心文件
wget https://xget.xi-xu.me/jenkins/war/jenkins.war

# 2. 创建插件打包脚本
cat > prepare_jenkins_offline.sh << 'EOF'
#!/bin/bash

# 创建离线部署目录结构
mkdir -p jenkins_offline/{plugins,update_center}

# 下载更新中心配置
curl -o jenkins_offline/update_center/update-center.json \
    https://xget.xi-xu.me/jenkins/update-center.json

# 必备插件列表
essential_plugins=(
    "ant:475.vf34069fef73c"
    "build-timeout:1.31"
    "credentials:1319.v7eb_51b_3a_c97b_"
    "git:5.2.1"
    "github:1.38.0"
    "gradle:2.8.2"
    "ldap:682.v7b_544c9d1512"
    "mailer:463.vedf8358e006b_"
    "matrix-auth:3.2.2"
    "maven-plugin:3.27"
    "pam-auth:1.10"
    "pipeline-stage-view:2.34"
    "ssh-slaves:2.973.v0fa_8c0dea_f9f"
    "timestamper:1.26"
    "workflow-aggregator:596.v8c21c963d92d"
    "ws-cleanup:0.45"
)

# 下载所有必备插件
for plugin in "${essential_plugins[@]}"; do
    name=$(echo $plugin | cut -d: -f1)
    version=$(echo $plugin | cut -d: -f2)
    echo "下载 $name:$version"
    wget -P jenkins_offline/plugins \
        "https://xget.xi-xu.me/jenkins/download/plugins/$name/$version/$name.hpi"
done

# 创建部署说明
cat > jenkins_offline/deploy_instructions.md << 'DEPLOY'
# Jenkins 离线部署说明

1. 将 jenkins.war 复制到目标服务器
2. 启动 Jenkins:java -jar jenkins.war
3. 将 plugins/ 目录中的 .hpi 文件复制到 $JENKINS_HOME/plugins/
4. 重启 Jenkins
DEPLOY

echo "离线部署包准备完成!"
EOF

chmod +x prepare_jenkins_offline.sh
./prepare_jenkins_offline.sh

在项目中使用

Jenkinsfile 中的插件检查
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
pipeline {
    agent any

    stages {
        stage('Check Plugin Availability') {
            steps {
                script {
                    // 检查 Maven 插件可用性
                    def pluginUrl = "https://xget.xi-xu.me/jenkins/download/plugins/maven-plugin/3.27/maven-plugin.hpi"

                    try {
                        def response = httpRequest url: pluginUrl, httpMode: 'HEAD'
                        if (response.status == 200) {
                            echo "Maven 插件可用: ${pluginUrl}"
                        }
                    } catch (Exception e) {
                        error "Maven 插件不可用: ${e.message}"
                    }
                }
            }
        }

        stage('Build') {
            steps {
                // 你的构建步骤
                echo "使用加速后的插件进行构建..."
            }
        }
    }
}

容器镜像加速

直接拉取镜像

1
2
3
4
5
6
7
8
# 拉取 GitHub 容器注册表镜像
docker pull xget.xi-xu.me/cr/ghcr/nginxinc/nginx-unprivileged:latest

# 拉取谷歌容器注册表镜像
docker pull xget.xi-xu.me/cr/gcr/distroless/base:latest

# 拉取微软容器注册表镜像
docker pull xget.xi-xu.me/cr/mcr/dotnet/runtime:8.0

Kubernetes 部署配置

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# deployment.yaml - 使用 Xget 的镜像
apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
spec:
  replicas: 3
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: xget.xi-xu.me/cr/ghcr/nginxinc/nginx-unprivileged:latest
        ports:
        - containerPort: 80
      - name: redis
        image: xget.xi-xu.me/cr/ghcr/bitnami/redis:alpine
        ports:
        - containerPort: 6379

Docker Compose 配置

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# docker-compose.yml - 使用 Xget 加速镜像
version: '3.8'
services:
  web:
    image: xget.xi-xu.me/cr/ghcr/nginxinc/nginx-unprivileged:latest
    ports:
      - "80:80"
    volumes:
      - ./html:/usr/share/nginx/html

  database:
    image: xget.xi-xu.me/cr/mcr/mssql/server:2022-latest
    environment:
      ACCEPT_EULA: Y
      SA_PASSWORD: "MyStrongPassword123!"
    volumes:
      - mssql_data:/var/opt/mssql

  cache:
    image: xget.xi-xu.me/cr/ghcr/bitnami/redis:alpine
    ports:
      - "6379:6379"

volumes:
  mssql_data:

Dockerfile 优化

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
# 在 Dockerfile 中使用 Xget 加速基础镜像
FROM xget.xi-xu.me/cr/ghcr/nodejs/node:18-alpine AS builder

WORKDIR /app
COPY package*.json ./
RUN npm install

COPY . .
RUN npm run build

# 生产阶段
FROM xget.xi-xu.me/cr/ghcr/nginxinc/nginx-unprivileged:latest
COPY --from=builder /app/dist /usr/share/nginx/html

# 使用微软容器注册表的 .NET 镜像
FROM xget.xi-xu.me/cr/mcr/dotnet/aspnet:8.0 AS runtime
WORKDIR /app
COPY --from=builder /app/publish .
ENTRYPOINT ["dotnet", "MyApp.dll"]

CI/CD 集成

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
# GitHub Actions - 使用 Xget 加速容器构建
name: Build and Deploy
on: [push]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Build with accelerated base images
        run: |
          # 构建时使用 Xget 的基础镜像
          docker build -t myapp:latest \
            --build-arg BASE_IMAGE=xget.xi-xu.me/cr/ghcr/nodejs/node:18-alpine .

      - name: Test with accelerated images
        run: |
          # 使用加速镜像进行测试
          docker run --rm \
            xget.xi-xu.me/cr/mcr/dotnet/runtime:8.0 \
            dotnet --version

Podman 配置

1
2
3
4
5
6
7
8
9
# 配置 Podman 使用 Xget 镜像加速
# 编辑 /etc/containers/registries.conf
[[registry]]
prefix = "ghcr.io"
location = "xget.xi-xu.me/cr/ghcr"

# 或者直接拉取
podman pull xget.xi-xu.me/cr/ghcr/alpine/alpine:latest
podman pull xget.xi-xu.me/cr/ghcr/nginxinc/nginx-unprivileged:latest

containerd 配置

1
2
3
4
5
6
7
# 配置 containerd 使用 Xget
# 编辑 /etc/containerd/config.toml
[plugins."io.containerd.grpc.v1.cri".registry.mirrors]
  [plugins."io.containerd.grpc.v1.cri".registry.mirrors."ghcr.io"]
    endpoint = ["https://xget.xi-xu.me/cr/ghcr"]
  [plugins."io.containerd.grpc.v1.cri".registry.mirrors."gcr.io"]
    endpoint = ["https://xget.xi-xu.me/cr/gcr"]
1
2
# 重启 containerd
sudo systemctl restart containerd

AI 推理 API 加速

OpenAI API

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
from openai import OpenAI

client = OpenAI(
    api_key="your-api-key",
    base_url="https://xget.xi-xu.me/ip/openai/v1",  # 使用 Xget
)

response = client.responses.create(
    model="gpt-5.1",
    input="Hello, GPT!",
)

print(response.output_text)

Claude API

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
from anthropic import Anthropic

client = Anthropic(
    api_key="your-api-key",
    base_url="https://xget.xi-xu.me/ip/anthropic",  # 使用 Xget
)

message = client.messages.create(
    model="claude-sonnet-4-5",
    max_tokens=256,
    messages=[
        {
            "role": "user",
            "content": "Hello, Claude!",
        }
    ],
)

print(message.content[0].text)

Gemini API

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
from google import genai
from google.genai import types

client = genai.Client(
    api_key="your-api-key",
    http_options=types.HttpOptions(base_url="https://xget.xi-xu.me/ip/gemini"),  # 使用 Xget
)

response = client.models.generate_content(
    model="gemini-3-pro-preview",
    contents="Hello, Gemini!",
)

print(response.text)

多提供商统一接口

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
from openai import OpenAI

providers = [
    ("Cohere",  "your-cohere-api-key",  "/cohere/compatibility/v1", "command-a-03-2025"),
    ("Mistral", "your-mistral-api-key", "/mistralai/v1",            "mistral-medium-latest"),
    ("xAI",     "your-xai-api-key",     "/xai/v1",                  "grok-4"),
]

for name, key, path, model in providers:
    client = OpenAI(api_key=key, base_url="https://xget.xi-xu.me/ip" + path)  # 使用 Xget
    response = client.chat.completions.create(
        model=model,
        messages=[{"role": "user", "content": f"Hello, who are you?"}],
    )
    print(name, "=>", response.choices[0].message.content)

JavaScript/Node.js 中使用

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// OpenAI API 加速
import OpenAI from "openai";

const openaiClient = new OpenAI({
  apiKey: "your-openai-api-key",
  baseURL: "https://xget.xi-xu.me/ip/openai/v1",  // 使用 Xget
});

async function chatWithGPT() {
  const response = await openaiClient.responses.create({
    model: "gpt-5.1",
    input: "Hello, GPT!",
  });

  console.log(response.output_text);
}

// Claude API 加速
import Anthropic from "@anthropic-ai/sdk";

const anthropicClient = new Anthropic({
  apiKey: "your-claude-api-key",
  baseURL: "https://xget.xi-xu.me/ip/anthropic",  // 使用 Xget
});

async function chatWithClaude() {
  const message = await anthropicClient.messages.create({
    model: "claude-sonnet-4-5",
    max_tokens: 256,
    messages: [
      {
        role: "user",
        content: "Hello, Claude!",
      },
    ],
  });

  console.log(message.content[0].text);
}

// Gemini API 加速
import { GoogleGenAI } from "@google/genai";

const geminiClient = new GoogleGenAI({
  apiKey: "your-gemini-api-key",
});

async function chatWithGemini() {
  const response = await geminiClient.models.generateContent({
    model: "gemini-3-pro-preview",
    contents: "Hello, Gemini!",
    config: {
      httpOptions: {
        baseUrl: "https://xget.xi-xu.me/ip/gemini",  // 使用 Xget
      },
    },
  });

  console.log(response.text);
}

环境变量配置

1
2
3
4
5
6
7
# 在 .env 文件中配置
OPENAI_BASE_URL=https://xget.xi-xu.me/ip/openai
ANTHROPIC_BASE_URL=https://xget.xi-xu.me/ip/anthropic
GEMINI_BASE_URL=https://xget.xi-xu.me/ip/gemini
COHERE_BASE_URL=https://xget.xi-xu.me/ip/cohere
MISTRAL_AI_BASE_URL=https://xget.xi-xu.me/ip/mistralai
GROQ_BASE_URL=https://xget.xi-xu.me/ip/groq

然后在代码中使用:

1
2
3
4
5
6
7
8
import os
from openai import OpenAI

# 从环境变量读取配置
client = OpenAI(
    api_key=os.getenv("OPENAI_API_KEY"),
    base_url=os.getenv("OPENAI_BASE_URL")  # 自动使用 Xget
)

🚀 部署

部署到 Cloudflare Workers

  1. fork 本存储库Fork xixu-me/Xget

  2. 获取 Cloudflare 凭证

  3. 配置 GitHub Secrets

    • 进入你的 GitHub 存储库 → Settings → Secrets and variables → Actions
    • 添加以下 secrets:
      • CLOUDFLARE_API_TOKEN:你的 API 令牌
      • CLOUDFLARE_ACCOUNT_ID:你的 Account ID
  4. 触发部署

    • 推送代码到 main 分支会自动触发部署
    • 仅修改文档文件(.md)、LICENSE.gitignore 等不会触发部署
    • 也可以在 GitHub Actions 页面手动触发部署
  5. 绑定自定义域名(可选):在 Cloudflare Workers 控制台中绑定你的自定义域名

部署到 Cloudflare Pages

  1. fork 本存储库Fork xixu-me/Xget

  2. 获取 Cloudflare 凭证

  3. 配置 GitHub Secrets

    • 进入你的 GitHub 存储库 → Settings → Secrets and variables → Actions
    • 添加以下 secrets:
      • CLOUDFLARE_API_TOKEN:你的 API 令牌
      • CLOUDFLARE_ACCOUNT_ID:你的 Account ID
  4. 触发部署

    • 存储库会自动将 Workers 代码转换为 Pages 兼容格式并同步到 pages 分支
    • 推送代码到 main 分支会自动触发同步和部署工作流
    • 仅修改文档文件(.md)、LICENSE.gitignore 等不会触发部署
    • 也可以在 GitHub Actions 页面手动触发部署
  5. 绑定自定义域名(可选):在 Cloudflare Pages 控制台中绑定你的自定义域名

注意pages 分支是从 main 分支自动生成的。请勿手动编辑 pages 分支,因为它会被同步工作流覆盖。

部署到 EdgeOne Pages

  1. fork 本存储库Fork xixu-me/Xget

  2. 获取 EdgeOne Pages API Token

  3. 配置 GitHub Secrets

    • 进入你的 GitHub 存储库 → Settings → Secrets and variables → Actions
    • 添加以下 secret:
      • EDGEONE_API_TOKEN:你的 API Token
  4. 触发部署

    • 存储库会自动将 Workers 代码转换为 Pages 兼容格式并同步到 pages 分支
    • 推送代码到 main 分支会自动触发同步和部署工作流
    • 仅修改文档文件(.md)、LICENSE.gitignore 等不会触发部署
    • 也可以在 GitHub Actions 页面手动触发部署
  5. 绑定自定义域名(可选):在 EdgeOne Pages 控制台中绑定你的自定义域名

注意pages 分支是从 main 分支自动生成的。请勿手动编辑 pages 分支,因为它会被同步工作流覆盖。

部署到 Vercel

  1. fork 本存储库Fork xixu-me/Xget

  2. 获取 Vercel 凭证

    • 访问 Vercel Account Settings 创建并记录 Access Token
    • 访问 Team Settings 记录 Team ID
    • 新建项目后访问项目的 Settings 记录 Project ID
  3. 配置 GitHub Secrets

    • 进入你的 GitHub 存储库 → Settings → Secrets and variables → Actions
    • 添加以下 secrets:
      • VERCEL_TOKEN:你的 Access Token
      • VERCEL_ORG_ID:你的 Team ID
      • VERCEL_PROJECT_ID:你的 Project ID
  4. 触发部署

    • 存储库会自动将 Workers 代码转换为 Functions 兼容格式并同步到 functions 分支
    • 推送代码到 main 分支会自动触发同步和部署工作流
    • 仅修改文档文件(.md)、LICENSE.gitignore 等不会触发部署
    • 也可以在 GitHub Actions 页面手动触发部署
  5. 绑定自定义域名(可选):在 Vercel 控制台中绑定你的自定义域名

注意functions 分支是从 main 分支自动生成的。请勿手动编辑 functions 分支,因为它会被同步工作流覆盖。

部署到 Netlify

  1. fork 本存储库Fork xixu-me/Xget

  2. 获取 Netlify 凭证

    • 访问 Netlify User Settings 创建并记录 personal access token
    • 新建项目后访问 Project configuration 记录 Project ID
  3. 配置 GitHub Secrets

    • 进入你的 GitHub 存储库 → Settings → Secrets and variables → Actions
    • 添加以下 secrets:
      • NETLIFY_AUTH_TOKEN:你的 personal access token
      • NETLIFY_SITE_ID:你的 Project ID
  4. 触发部署

    • 存储库会自动将 Workers 代码转换为 Functions 兼容格式并同步到 functions 分支
    • 推送代码到 main 分支会自动触发同步和部署工作流
    • 仅修改文档文件(.md)、LICENSE.gitignore 等不会触发部署
    • 也可以在 GitHub Actions 页面手动触发部署
  5. 绑定自定义域名(可选):在 Netlify 控制台中绑定你的自定义域名

注意functions 分支是从 main 分支自动生成的。请勿手动编辑 functions 分支,因为它会被同步工作流覆盖。

部署到 Deno Deploy

  1. fork 本存储库Fork xixu-me/Xget

  2. 切换默认分支

    • 进入你的 GitHub 存储库 → Settings → General → Default branch
    • 将默认分支从 main 切换到 functions
  3. 部署到 Deno Deploy

  4. 绑定自定义域名(可选):在 Deno Deploy 控制台中绑定你的自定义域名

注意functions 分支是从 main 分支自动生成的。请勿手动编辑 functions 分支,因为它会被同步工作流覆盖。

自托管部署

如果你希望在自己的服务器上运行 Xget,可以使用 Docker 或 Podman 部署:

使用预构建镜像

从 GitHub Container Registry 拉取并运行预构建的镜像:

使用 Docker:

1
2
3
4
5
6
7
8
# 拉取最新镜像
docker pull ghcr.io/xixu-me/xget:latest

# 运行容器
docker run -d \
  --name xget \
  -p 8080:8080 \
  ghcr.io/xixu-me/xget:latest

使用 Podman:

1
2
3
4
5
6
7
8
# 拉取最新镜像
podman pull ghcr.io/xixu-me/xget:latest

# 运行容器
podman run -d \
  --name xget \
  -p 8080:8080 \
  ghcr.io/xixu-me/xget:latest

本地构建

从源码构建容器镜像:

使用 Docker:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# 克隆存储库
git clone https://github.com/xixu-me/Xget.git
cd Xget

# 构建镜像
docker build -t xget:local .

# 运行容器
docker run -d \
  --name xget \
  -p 8080:8080 \
  xget:local

使用 Podman:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# 克隆存储库
git clone https://github.com/xixu-me/Xget.git
cd Xget

# 构建镜像
podman build -t xget:local .

# 运行容器
podman run -d \
  --name xget \
  -p 8080:8080 \
  xget:local

使用 Docker Compose / Podman Compose

创建 docker-compose.yml 文件:

1
2
3
4
5
6
7
8
9
version: '3.8'

services:
  xget:
    image: ghcr.io/xixu-me/xget:latest
    container_name: xget
    ports:
      - "8080:8080"
    restart: unless-stopped

使用 Docker Compose:

1
docker compose up -d

使用 Podman Compose:

1
podman compose up -d

部署完成后,Xget 将在 8080 端口运行。

如果你希望在 DigitalOcean 上部署和运行 Xget,可以参考文档《Deploying and Optimizing Xget on DigitalOcean》。通过下方推荐链接注册账户,可获得 200 美元代金券积分,可用于创建 Droplet、Kubernetes、App Platform 等资源:

注意:自托管部署不包括全球边缘网络加速,性能取决于你的服务器配置和网络环境。

🔧 配置

配置参数

你可以通过修改 src/config/index.js 来自定义配置:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
export const CONFIG = {
  TIMEOUT_SECONDS: 30,       // 请求超时时间(秒)
  MAX_RETRIES: 3,            // 最大重试次数
  RETRY_DELAY_MS: 1000,      // 重试延迟时间(毫秒)
  CACHE_DURATION: 1800,      // 缓存持续时间(1800秒 = 30分钟)
  SECURITY: {
    ALLOWED_METHODS: ["GET", "HEAD"],  // 允许的 HTTP 方法(Git 操作会动态允许 POST)
    ALLOWED_ORIGINS: ["*"],            // 允许的 CORS 源
    MAX_PATH_LENGTH: 2048,             // 最大路径长度(字符)
  },
};

性能调优建议

  • 缓存优化:根据使用模式调整 CACHE_DURATION,频繁更新的存储库可适当降低
  • 超时设置:网络条件较差时可适当增加 TIMEOUT_SECONDS
  • 重试策略:高延迟环境下可增加 MAX_RETRIESRETRY_DELAY_MS

添加新平台

要添加对新平台的支持,编辑 src/config/platforms.js

1
2
3
4
5
6
7
8
9
export const PLATFORMS = {
  // 现有平台...

  // 新平台示例
  custom: {
    base: "https://example.com",
    transform: (path) => path.replace(/^\/custom\//, "/"),
  },
};

🚧 开发

  1. 存储库设置

    1
    2
    3
    4
    
    git clone https://github.com/xixu-me/Xget.git
    cd Xget
    npm install
    npx wrangler login  # 首次使用
    
  2. 本地开发

    1
    2
    3
    4
    5
    6
    
    npm run dev              # 启动开发服务器 (http://localhost:8787)
    npm run test:run         # 运行完整测试套件
    npm run test:coverage    # 生成测试覆盖率报告
    npm run lint             # 代码检查
    npm run format           # 代码格式化
    npm run deploy           # 部署到生产
    

🧪 测试

存储库包含完整的测试套件,确保代码质量和功能正确性。

完整测试

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# 安装测试依赖
npm install

# 运行所有测试
npm run test:run

# 生成覆盖率报告
npm run test:coverage

# 监视模式
npm run test:watch

测试覆盖

  • 单元测试: 核心功能、平台配置、性能监控
  • 集成测试: 端到端流程、平台集成、Git 协议
  • 安全测试: 输入验证、安全头、权限控制
  • 性能测试: 响应时间、内存使用、并发处理

🔍 故障排除

常见问题

Q: 下载速度没有明显提升? A: 检查源文件是否已经在 CDN 边缘节点缓存,首次访问可能较慢,后续访问会显著提升。

Q: Git 操作失败? A: 确认使用了正确的 URL 格式,且 Git 客户端版本支持 HTTPS 代理。

Q: 部署后无法访问? A: 检查 Cloudflare Workers 域名是否正确绑定,确认 wrangler.toml 配置正确。

Q: 出现 400 错误? A: 检查 URL 路径格式,确认平台前缀正确使用。

性能监控

在响应头中返回性能指标:

  • X-Performance-Metrics: 包含请求各阶段的耗时统计
  • X-Cache-Status: 显示缓存命中状态

日志调试

在开发环境中,你可以通过 Cloudflare Workers 控制台查看详细日志:

1
npx wrangler dev --log-level debug

⚠️ 免责声明

  • 合法合规使用:本存储库旨在为代码存储库、软件包注册表、AI 推理 API、容器镜像、模型、数据集及更多合法开发者资源提供统一加速服务。使用者应严格遵守所在司法辖区法律法规及相关平台服务条款,任何非法用途的法律责任由使用者自行承担
  • 非关联性与独立责任:本存储库与各第三方平台不存在任何隶属、代理或合作关系。任何基于本存储库的 fork、二次开发、再分发或衍生版本均由其维护者独立承担全部责任;作者、维护者及贡献者不对衍生存储库的任何行为或后果承担法律或连带责任
  • 无担保与免责条款:在适用法律允许的最大范围内,本存储库按“现状(AS IS)”提供,不提供任何明示或暗示担保(包括但不限于适销性、特定用途适用性、非侵权等)。对因使用本存储库而造成的任何直接或间接损失(包括但不限于数据丢失、业务中断、利润损失等),作者、维护者及贡献者不承担任何责任
  • 风险自担原则:使用者应自行评估使用风险,确保其使用行为合法合规,不侵犯第三方权益,不得将本存储库用于任何违法、侵权、恶意或不当用途
  • 第三方平台合规:使用者应遵守相关平台的服务条款、API 使用政策、速率限制及版权要求,避免对源平台造成过载或干扰。各平台对其内容、服务及政策拥有最终解释权
  • 知识产权保护:通过本存储库获取的内容受相应版权法保护。使用者应遵守相关许可协议、版权声明及使用条款,不得从事任何侵犯知识产权的行为
  • 安全防护建议:虽然本存储库采用无日志架构,不存储用户请求数据,但基于互联网传输的固有风险,建议使用者对下载内容进行安全扫描,尤其对可执行文件、脚本等保持谨慎
  • 开源性质声明:本存储库为开源项目,作者与贡献者不承担提供技术支持、错误修复或持续维护的义务。外部贡献的合并不代表对特定用途或效果的承诺与背书
  • 名称使用规范:严禁任何可能暗示作者或贡献者提供商业合作、技术支持、担保或背书的表述。涉及存储库名称或作者标识的使用应遵循相关法律法规及通用规范
  • 免责声明更新:本免责声明可能随存储库发展或法律环境变化进行更新修订。使用者继续使用、复制、分发或修改本存储库即视为接受最新版本的免责声明
comments powered by Disqus
使用 Hugo 构建
主题 StackJimmy 设计