面向开发者资源的超高性能、安全、一体化加速引擎,其性能显著优于传统解决方案,为代码存储库、模型和数据集中心、软件包注册表、容器注册表、AI 推理提供商等提供统一、高效的加速。
技术深度解析文章已发布:《深入剖析 Xget:一个高性能、多协议、高安全性的开发者资源加速引擎》。
本存储库的初衷是为了加速在中国大陆境内访问不违反相关法律法规的平台上的开发者资源,从而为广大开发者提供一个稳定、合法的加速体验。我们致力于:
- 🌍 消除地理限制:帮助中国大陆开发者快速访问海外开发者资源
- ⚖️ 合规合法:严格遵守相关法律法规,仅加速合法资源
- 🚀 提升效率:显著提高开发者的工作效率和开发体验
- 🆓 普惠开源:为开源社区贡献力量,促进技术交流与发展
预部署实例(不保证可靠性):xget.xi-xu.me
URL 转换器:xuc.xi-xu.me - 一键转换任意支持平台的 URL 为 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 特定端点(
/info/refs、/git-upload-pack、/git-receive-pack) - 检测 Git 客户端 User-Agent 模式
- 支持
service=git-upload-pack等查询参数
- 自动识别 Git 特定端点(
- 完整操作支持:
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 等环境中使用
使用预部署实例 xget.xi-xu.me 或你自己部署的实例,只需简单替换域名并添加平台前缀:
| 平台 | 平台前缀 | 原始 URL 格式 | 加速 URL 格式 |
|---|---|---|---|
| GitHub | gh | https://github.com/... | https://xget.xi-xu.me/gh/... |
| GitHub Gist | gist | https://gist.github.com/... | https://xget.xi-xu.me/gist/... |
| GitLab | gl | https://gitlab.com/... | https://xget.xi-xu.me/gl/... |
| Gitea | gitea | https://gitea.com/... | https://xget.xi-xu.me/gitea/... |
| Codeberg | codeberg | https://codeberg.org/... | https://xget.xi-xu.me/codeberg/... |
| SourceForge | sf | https://sourceforge.net/... | https://xget.xi-xu.me/sf/... |
| AOSP | aosp | https://android.googlesource.com/... | https://xget.xi-xu.me/aosp/... |
| Hugging Face | hf | https://huggingface.co/... | https://xget.xi-xu.me/hf/... |
| Civitai | civitai | https://civitai.com/... | https://xget.xi-xu.me/civitai/... |
| npm | npm | https://registry.npmjs.org/... | https://xget.xi-xu.me/npm/... |
| PyPI | pypi | https://pypi.org/... | https://xget.xi-xu.me/pypi/... |
| conda | conda | https://repo.anaconda.com/... 和 https://conda.anaconda.org/... | https://xget.xi-xu.me/conda/... 和 https://xget.xi-xu.me/conda/community/... |
| Maven | maven | https://repo1.maven.org/... | https://xget.xi-xu.me/maven/... |
| Apache | apache | https://downloads.apache.org/... | https://xget.xi-xu.me/apache/... |
| Gradle | gradle | https://plugins.gradle.org/... | https://xget.xi-xu.me/gradle/... |
| Homebrew | homebrew | https://github.com/Homebrew/... | https://xget.xi-xu.me/homebrew/... |
| RubyGems | rubygems | https://rubygems.org/... | https://xget.xi-xu.me/rubygems/... |
| CRAN | cran | https://cran.r-project.org/... | https://xget.xi-xu.me/cran/... |
| CPAN | cpan | https://www.cpan.org/... | https://xget.xi-xu.me/cpan/... |
| CTAN | ctan | https://tug.ctan.org/... | https://xget.xi-xu.me/ctan/... |
| Go 模块 | golang | https://proxy.golang.org/... | https://xget.xi-xu.me/golang/... |
| NuGet | nuget | https://api.nuget.org/... | https://xget.xi-xu.me/nuget/... |
| Rust Crates | crates | https://crates.io/... | https://xget.xi-xu.me/crates/... |
| Packagist | packagist | https://repo.packagist.org/... | https://xget.xi-xu.me/packagist/... |
| Debian | debian | https://deb.debian.org/... | https://xget.xi-xu.me/debian/... |
| Ubuntu | ubuntu | https://archive.ubuntu.com/... | https://xget.xi-xu.me/ubuntu/... |
| Fedora | fedora | https://dl.fedoraproject.org/... | https://xget.xi-xu.me/fedora/... |
| Rocky Linux | rocky | https://download.rockylinux.org/... | https://xget.xi-xu.me/rocky/... |
| openSUSE | opensuse | https://download.opensuse.org/... | https://xget.xi-xu.me/opensuse/... |
| Arch Linux | arch | https://geo.mirror.pkgbuild.com/... | https://xget.xi-xu.me/arch/... |
| arXiv | arxiv | https://arxiv.org/... | https://xget.xi-xu.me/arxiv/... |
| F-Droid | fdroid | https://f-droid.org/... | https://xget.xi-xu.me/fdroid/... |
| Jenkins 插件 | jenkins | https://updates.jenkins.io/... | https://xget.xi-xu.me/jenkins/... |
| 容器注册表 | cr | 见容器注册表 | 见容器注册表 |
| AI 推理提供商 | ip | 见 AI 推理提供商 | 见 AI 推理提供商 |
# 原始 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# 原始 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# 原始 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# 原始 URL
https://gitea.com/gitea/gitea/archive/master.zip
# 转换后(添加 gitea 前缀)
https://xget.xi-xu.me/gitea/gitea/gitea/archive/master.zip# 原始 URL
https://codeberg.org/forgejo/forgejo/archive/forgejo.zip
# 转换后(添加 codeberg 前缀)
https://xget.xi-xu.me/codeberg/forgejo/forgejo/archive/forgejo.zip# 原始 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 项目原始 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# 模型文件原始 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# 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# 包文件原始 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# 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# 默认频道包文件原始 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 中央存储库 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 软件下载原始 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 插件门户 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 公式存储库原始 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 包文件原始 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 包文件原始 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 模块原始 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 包文件原始 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 模块代理原始 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 包下载原始 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# 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 包元数据原始 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# 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 论文 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 应用 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 更新中心原始 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.hpiXget 支持多个容器注册表,使用 cr/[容器注册表前缀] 格式:
| 容器注册表 | 容器注册表前缀 | 原始 URL 格式 | 加速 URL 格式 |
|---|---|---|---|
| Docker Hub | docker | https://registry-1.docker.io/... | https://xget.xi-xu.me/cr/docker/... |
| Quay.io | quay | https://quay.io/... | https://xget.xi-xu.me/cr/quay/... |
| 谷歌容器注册表 | gcr | https://gcr.io/... | https://xget.xi-xu.me/cr/gcr/... |
| 微软容器注册表 | mcr | https://mcr.microsoft.com/... | https://xget.xi-xu.me/cr/mcr/... |
| 亚马逊公共弹性容器注册表 | ecr | https://public.ecr.aws/... | https://xget.xi-xu.me/cr/ecr/... |
| GitHub 容器注册表 | ghcr | https://ghcr.io/... | https://xget.xi-xu.me/cr/ghcr/... |
| GitLab 容器注册表 | gitlab | https://registry.gitlab.com/... | https://xget.xi-xu.me/cr/gitlab/... |
| 红帽注册表 | redhat | https://registry.redhat.io/... | https://xget.xi-xu.me/cr/redhat/... |
| 甲骨文容器注册表 | oracle | https://container-registry.oracle.com/... | https://xget.xi-xu.me/cr/oracle/... |
| Cloudsmith | cloudsmith | https://docker.cloudsmith.io/... | https://xget.xi-xu.me/cr/cloudsmith/... |
| DigitalOcean 注册表 | digitalocean | https://registry.digitalocean.com/... | https://xget.xi-xu.me/cr/digitalocean/... |
| VMware 注册表 | vmware | https://projects.registry.vmware.com/... | https://xget.xi-xu.me/cr/vmware/... |
| Kubernetes 注册表 | k8s | https://registry.k8s.io/... | https://xget.xi-xu.me/cr/k8s/... |
| Heroku 注册表 | heroku | https://registry.heroku.com/... | https://xget.xi-xu.me/cr/heroku/... |
| SUSE 注册表 | suse | https://registry.suse.com/... | https://xget.xi-xu.me/cr/suse/... |
| openSUSE 注册表 | opensuse | https://registry.opensuse.org/... | https://xget.xi-xu.me/cr/opensuse/... |
| Gitpod 注册表 | gitpod | https://registry.gitpod.io/... | https://xget.xi-xu.me/cr/gitpod/... |
# 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应用场景见容器镜像加速。
Xget 支持众多主流 AI 推理提供商的 API 加速,使用 ip/[AI 推理提供商前缀] 格式:
| AI 推理提供商 | AI 推理提供商前缀 | 原始 URL 格式 | 加速 URL 格式 |
|---|---|---|---|
| OpenAI | openai | https://api.openai.com/... | https://xget.xi-xu.me/ip/openai/... |
| Anthropic | anthropic | https://api.anthropic.com/... | https://xget.xi-xu.me/ip/anthropic/... |
| Gemini | gemini | https://generativelanguage.googleapis.com/... | https://xget.xi-xu.me/ip/gemini/... |
| Vertex AI | vertexai | https://aiplatform.googleapis.com/... | https://xget.xi-xu.me/ip/vertexai/... |
| Cohere | cohere | https://api.cohere.ai/... | https://xget.xi-xu.me/ip/cohere/... |
| Mistral AI | mistralai | https://api.mistral.ai/... | https://xget.xi-xu.me/ip/mistralai/... |
| xAI | xai | https://api.x.ai/... | https://xget.xi-xu.me/ip/xai/... |
| GitHub 模型 | githubmodels | https://models.github.ai/... | https://xget.xi-xu.me/ip/githubmodels/... |
| NVIDIA API | nvidiaapi | https://integrate.api.nvidia.com/... | https://xget.xi-xu.me/ip/nvidiaapi/... |
| Perplexity | perplexity | https://api.perplexity.ai/... | https://xget.xi-xu.me/ip/perplexity/... |
| Groq | groq | https://api.groq.com/... | https://xget.xi-xu.me/ip/groq/... |
| Cerebras | cerebras | https://api.cerebras.ai/... | https://xget.xi-xu.me/ip/cerebras/... |
| SambaNova | sambanova | https://api.sambanova.ai/... | https://xget.xi-xu.me/ip/sambanova/... |
| Siray | siray | https://api.siray.ai/... | https://xget.xi-xu.me/ip/siray/... |
| HF Inference | huggingface | https://router.huggingface.co/... | https://xget.xi-xu.me/ip/huggingface/... |
| Together | together | https://api.together.xyz/... | https://xget.xi-xu.me/ip/together/... |
| Replicate | replicate | https://api.replicate.com/... | https://xget.xi-xu.me/ip/replicate/... |
| Fireworks | fireworks | https://api.fireworks.ai/... | https://xget.xi-xu.me/ip/fireworks/... |
| Nebius | nebius | https://api.studio.nebius.ai/... | https://xget.xi-xu.me/ip/nebius/... |
| Jina | jina | https://api.jina.ai/... | https://xget.xi-xu.me/ip/jina/... |
| Voyage AI | voyageai | https://api.voyageai.com/... | https://xget.xi-xu.me/ip/voyageai/... |
| Fal AI | falai | https://fal.run/... | https://xget.xi-xu.me/ip/falai/... |
| Novita | novita | https://api.novita.ai/... | https://xget.xi-xu.me/ip/novita/... |
| Burncloud | burncloud | https://ai.burncloud.com/... | https://xget.xi-xu.me/ip/burncloud/... |
| OpenRouter | openrouter | https://openrouter.ai/... | https://xget.xi-xu.me/ip/openrouter/... |
| Poe | poe | https://api.poe.com/... | https://xget.xi-xu.me/ip/poe/... |
| Featherless AI | featherlessai | https://api.featherless.ai/... | https://xget.xi-xu.me/ip/featherlessai/... |
| Hyperbolic | hyperbolic | https://api.hyperbolic.xyz/... | https://xget.xi-xu.me/ip/hyperbolic/... |
# OpenAI API 原始 URL
https://api.openai.com/v1/chat/completions
# 转换后(添加 ip/openai 前缀)
https://xget.xi-xu.me/ip/openai/v1/chat/completions
# Anthropic 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 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 使用 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 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 -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# 多线程下载大文件
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 的文件importosfromtransformersimportAutoTokenizer, 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))importrequests# 设置 API 基础 URL 使用 Xgetbase_url="https://xget.xi-xu.me/civitai"# 获取模型信息defget_model_info(model_id):
"""获取 Civitai 模型信息"""url=f"{base_url}/api/v1/models/{model_id}"response=requests.get(url)
returnresponse.json()
# 下载模型defdownload_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()
withopen(output_path, 'wb') asf:
forchunkinresponse.iter_content(chunk_size=8192):
f.write(chunk)
print(f"模型已下载到: {output_path}")
# 使用示例model_id=7240# 示例模型 IDmodel_info=get_model_info(model_id)
print(f"模型名称: {model_info['name']}")
# 下载第一个模型版本ifmodel_info['modelVersions']:
version_id=model_info['modelVersions'][0]['id']
download_model(version_id, f"model_{version_id}.safetensors")# 临时使用 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# 在 .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# 临时使用 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# 创建 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.meEOF# 或在项目根目录创建 pip.conf
cat > pip.conf <<EOF[global]index-url = https://xget.xi-xu.me/pypi/simple/trusted-host = xget.xi-xu.meEOF# 使用配置文件安装
pip install -r requirements.txt --config-file pip.conf# 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 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)或项目根目录下:
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/msys2channel_alias: https://xget.xi-xu.me/conda/communitychannel_priority: strictshow_channel_urls: true环境文件中可以直接指定完整的镜像 URL:
# environment.ymlname: myprojectchannels:
- 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-forgedependencies:
- 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# 使用环境文件创建环境
conda env create -f environment.yml
# 更新环境
conda env update -f environment.yml<!-- 在 ~/.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><!-- 在 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># 使用命令行指定镜像
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 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# 大数据相关
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// 在 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()
}
}// 在 ~/.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()
}
}
}# 使用命令行指定镜像
gradle build -Dmaven.repo.remote=https://xget.xi-xu.me/maven/maven2
# 刷新依赖
gradle build --refresh-dependencies# 设置 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# 为 bash 用户添加到 ~/.bash_profileecho'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 用户添加到 ~/.zprofileecho'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# 安装软件包
brew install git
# 搜索软件包
brew search python
# 更新软件包
brew upgrade
# 查看已安装软件包
brew list# 检查 Homebrew 配置
brew config
# 查看环境变量echo$HOMEBREW_API_DOMAINecho$HOMEBREW_BOTTLE_DOMAIN# 临时使用 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# 在 Gemfile 中配置项目级镜像source'https://xget.xi-xu.me/rubygems/'gem'rails','~> 7.0.0'gem'pg','~> 1.1'gem'puma','~> 5.0'# 使用 bundle 安装
bundle config mirror.https://rubygems.org https://xget.xi-xu.me/rubygems/
bundle install# 在 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 文件中配置全局镜像
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")# 在项目的 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/")# 在命令行中使用 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)"# 配置 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(如果没有)
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 .# 在 cpanfile 中列出依赖
requires 'DBI';
requires 'Mojolicious';
requires 'JSON';
# 然后使用 Xget 镜像安装
cpanm --mirror https://xget.xi-xu.me/cpan/ --installdeps .# 配置 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# Windows MiKTeX 配置
mpm --set-repository=https://xget.xi-xu.me/ctan/systems/win32/miktex
# 更新包数据库
mpm --update-db
# 安装包
mpm --install=beamer
mpm --install=pgf# LaTeX 文档编译时自动安装缺失包
pdflatex --shell-escape document.tex
# 或手动安装特定包
tlmgr install caption
tlmgr install subcaption
tlmgr install algorithm2e# 配置 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# 下载依赖
go mod download
# 更新依赖
go get -u ./...
# 清理模块缓存
go clean -modcache# 添加 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 -->
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<addkey="xget"value="https://xget.xi-xu.me/nuget/v3/index.json" />
</packageSources>
</configuration># 配置 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# 在 Cargo.toml 中可以正常使用依赖
[dependencies]
serde = "1.0"tokio = "1.0"reqwest = "0.11"# 构建项目时会自动使用 Xget
cargo build
# 更新依赖
cargo update
# 添加新依赖
cargo add clap# 全局配置 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{
"repositories": [
{
"type": "composer",
"url": "https://xget.xi-xu.me/packagist/"
}
],
"require": {
"symfony/console": "^6.0",
"guzzlehttp/guzzle": "^7.0"
}
}# 备份原始源列表
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 镜像
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 镜像
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 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# 备份原始镜像列表
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 论文 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
# 批量下载多篇论文foridin 2301.07041 2302.13971 2303.08774;do
wget https://xget.xi-xu.me/arxiv/pdf/${id}.pdf
done# 在 Python 中使用 arXiv 加速下载importrequestsdefdownload_arxiv_paper(arxiv_id, output_path):
url=f"https://xget.xi-xu.me/arxiv/pdf/{arxiv_id}.pdf"response=requests.get(url)
ifresponse.status_code==200:
withopen(output_path, 'wb') asf:
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 应用中进入设置 → 存储库
- 点击 + 后输入存储库 URL:
https://xget.xi-xu.me/fdroid/repo - 点击添加后再点击添加镜像
# 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/[包名]# 直接下载 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# 创建应用下载脚本
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"doneecho "所有应用下载完成!"EOF
chmod +x download_fdroid_apps.sh
./download_fdroid_apps.sh对于 Android 开发者,可以在构建脚本中集成 F-Droid 镜像:
// 在 build.gradle 中配置 F-Droid 依赖检查
task checkFDroidAvailability {
doLast {
def fdroidUrl ="https://xget.xi-xu.me/fdroid/api/v1/packages/${project.name}"try {
def connection =newURL(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 更新中心和插件下载,兼容清华镜像等国内镜像源的配置方式。
登录 Jenkins 管理界面
进入 Manage Jenkins → Plugins → Advanced
在 Update Site 部分,将 URL 更改为
https://xget.xi-xu.me/jenkins/update-center.json点击 Submit 保存配置
# 在 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 更新中心 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# 下载 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"doneecho "所有插件下载完成!"EOF
chmod +x download_jenkins_plugins.sh
./download_jenkins_plugins.sh对于无网络环境的 Jenkins 部署:
# 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.war3. 将 plugins/ 目录中的 .hpi 文件复制到 $JENKINS_HOME/plugins/4. 重启 JenkinsDEPLOYecho "离线部署包准备完成!"EOF
chmod +x prepare_jenkins_offline.sh
./prepare_jenkins_offline.shpipeline {
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 "使用加速后的插件进行构建..."
}
}
}
}# 配置 Docker 使用 Xget 镜像加速# 编辑 /etc/docker/daemon.json(Linux)或 ~/.docker/daemon.json(macOS/Windows)
{
"registry-mirrors": [
"https://xget.xi-xu.me/cr/ghcr"
]
}
# 重启 Docker 服务
sudo systemctl restart docker # Linux# 或在 Docker Desktop 中重启服务# 验证配置
docker info | grep -A 10 "Registry Mirrors"# 拉取 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# deployment.yaml - 使用 Xget 的镜像apiVersion: apps/v1kind: Deploymentmetadata:
name: nginx-deploymentspec:
replicas: 3selector:
matchLabels:
app: nginxtemplate:
metadata:
labels:
app: nginxspec:
containers:
- name: nginximage: xget.xi-xu.me/cr/ghcr/nginxinc/nginx-unprivileged:latestports:
- containerPort: 80
- name: redisimage: xget.xi-xu.me/cr/ghcr/bitnami/redis:alpineports:
- containerPort: 6379# docker-compose.yml - 使用 Xget 加速镜像version: '3.8'services:
web:
image: xget.xi-xu.me/cr/ghcr/nginxinc/nginx-unprivileged:latestports:
- "80:80"volumes:
- ./html:/usr/share/nginx/htmldatabase:
image: xget.xi-xu.me/cr/mcr/mssql/server:2022-latestenvironment:
ACCEPT_EULA: YSA_PASSWORD: "MyStrongPassword123!"volumes:
- mssql_data:/var/opt/mssqlcache:
image: xget.xi-xu.me/cr/ghcr/bitnami/redis:alpineports:
- "6379:6379"volumes:
mssql_data:# 在 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"]# GitHub Actions - 使用 Xget 加速容器构建name: Build and Deployon: [push]jobs:
build:
runs-on: ubuntu-lateststeps:
- uses: actions/checkout@v4
- name: Build with accelerated base imagesrun: | # 构建时使用 Xget 的基础镜像 docker build -t myapp:latest \ --build-arg BASE_IMAGE=xget.xi-xu.me/cr/ghcr/nodejs/node:18-alpine . - name: Test with accelerated imagesrun: | # 使用加速镜像进行测试 docker run --rm \ xget.xi-xu.me/cr/mcr/dotnet/runtime:8.0 \ dotnet --version# 配置 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 使用 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"]# 重启 containerd
sudo systemctl restart containerdimportopenai# 使用 Xget 的 OpenAI APIclient=openai.OpenAI(
api_key="your-api-key",
base_url="https://xget.xi-xu.me/ip/openai/v1"# 使用 Xget
)
# 聊天完成response=client.chat.completions.create(
model="gpt-4",
messages=[
{"role": "user", "content": "Hello, how are you?"}
]
)
print(response.choices[0].message.content)importanthropic# 使用 Xget 的 Anthropic APIclient=anthropic.Anthropic(
api_key="your-api-key",
base_url="https://xget.xi-xu.me/ip/anthropic"# 使用 Xget
)
# 创建消息message=client.messages.create(
model="claude-3-sonnet-20240229",
max_tokens=1000,
messages=[
{"role": "user", "content": "Hello, Claude!"}
]
)
print(message.content)importgoogle.generativeaiasgenai# 配置 API 密钥genai.configure(api_key="your-api-key")
# 使用自定义传输配置 XgetimportrequestsclassXgetTransport:
def__init__(self, base_url):
self.base_url=base_urldefrequest(self, method, url, **kwargs):
# 将请求转发到 Xgetaccelerated_url=url.replace("https://generativelanguage.googleapis.com",
"https://xget.xi-xu.me/ip/gemini")
returnrequests.request(method, accelerated_url, **kwargs)
# 创建模型实例model=genai.GenerativeModel('gemini-pro')
# 生成内容response=model.generate_content("写一个关于人工智能的简短介绍")
print(response.text)importrequestsimportjsondefcall_ai_api(provider, endpoint, data, api_key):
""" 统一的 AI API 调用函数,支持多个提供商 """headers= {
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json"
}
# 使用 Xget 的加速 URLurl=f"https://xget.xi-xu.me/ip/{provider}/{endpoint}"response=requests.post(url, headers=headers, json=data)
returnresponse.json()
# 使用示例providers= {
"openai": {
"endpoint": "v1/chat/completions",
"data": {
"model": "gpt-4",
"messages": [{"role": "user", "content": "Hello!"}]
}
},
"anthropic": {
"endpoint": "v1/messages",
"data": {
"model": "claude-3-sonnet-20240229",
"max_tokens": 1000,
"messages": [{"role": "user", "content": "Hello!"}]
}
},
"cohere": {
"endpoint": "v1/generate",
"data": {
"model": "command",
"prompt": "Hello!",
"max_tokens": 100
}
}
}
# 循环调用不同提供商forprovider, configinproviders.items():
try:
result=call_ai_api(
provider=provider,
endpoint=config["endpoint"],
data=config["data"],
api_key="your-api-key"
)
print(f"{provider.title()} response: {result}")
exceptExceptionase:
print(f"Error calling {provider}: {e}")// OpenAI API 加速importOpenAIfrom'openai';constopenai=newOpenAI({apiKey: 'your-api-key',baseURL: 'https://xget.xi-xu.me/ip/openai',// 使用 Xget});asyncfunctionchatWithGPT(){constcompletion=awaitopenai.chat.completions.create({messages: [{role: 'user',content: 'Hello!'}],model: 'gpt-4',});console.log(completion.choices[0].message.content);}// Anthropic API 加速importAnthropicfrom'@anthropic-ai/sdk';constanthropic=newAnthropic({apiKey: 'your-api-key',baseURL: 'https://xget.xi-xu.me/ip/anthropic',// 使用 Xget});asyncfunctionchatWithClaude(){constmessage=awaitanthropic.messages.create({model: 'claude-3-sonnet-20240229',max_tokens: 1000,messages: [{role: 'user',content: 'Hello!'}],});console.log(message.content);}# 在 .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然后在代码中使用:
importosfromopenaiimportOpenAI# 从环境变量读取配置client=OpenAI(
api_key=os.getenv("OPENAI_API_KEY"),
base_url=os.getenv("OPENAI_BASE_URL") # 自动使用 Xget
)fork 本存储库:Fork xixu-me/Xget
获取 Cloudflare 凭证:
- 访问帐户 API 令牌创建并记录 API 令牌,使用“编辑 Cloudflare Workers”模板
- 访问 Workers 和 Pages 记录 Account ID
配置 GitHub Secrets:
- 进入你的 GitHub 存储库 → Settings → Secrets and variables → Actions
- 添加以下 Secrets:
CLOUDFLARE_API_TOKEN:你的 API 令牌CLOUDFLARE_ACCOUNT_ID:你的 Account ID
触发部署:
- 推送代码到
main分支会自动触发部署 - 仅修改文档文件(
.md)、LICENSE、.gitignore等不会触发部署 - 也可以在 GitHub Actions 页面手动触发部署
- 推送代码到
绑定自定义域名(可选):在 Cloudflare Workers 控制台中绑定你的自定义域名
部署完成后,你的 Xget 服务将在以下地址可用:
- Worker 域名:
your-worker-name.your-subdomain.workers.dev - 自定义域名:
your-domain.com(如果已绑定)
你可以在 Cloudflare Workers 控制台中设置以下环境变量来自定义配置:
TIMEOUT_SECONDS:请求超时时间(默认:30)MAX_RETRIES:最大重试次数(默认:3)RETRY_DELAY_MS:重试延迟时间(默认:1000)CACHE_DURATION:缓存持续时间(默认:1800)ALLOWED_METHODS:允许的 HTTP 方法(默认:GET,HEAD)ALLOWED_ORIGINS:允许的 CORS 源(默认:*)MAX_PATH_LENGTH:最大路径长度(默认:2048)
如果你希望在自己的服务器上运行 Xget,可以使用 Docker 或 Podman 部署:
从 GitHub Container Registry 拉取并运行预构建的镜像:
使用 Docker:
# 拉取最新镜像
docker pull ghcr.io/xixu-me/xget:latest
# 运行容器
docker run -d \
--name xget \
-p 8080:8080 \
ghcr.io/xixu-me/xget:latest使用 Podman:
# 拉取最新镜像
podman pull ghcr.io/xixu-me/xget:latest
# 运行容器
podman run -d \
--name xget \
-p 8080:8080 \
ghcr.io/xixu-me/xget:latest从源码构建容器镜像:
使用 Docker:
# 克隆存储库
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:
# 克隆存储库
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.yml 文件:
version: '3.8'services:
xget:
image: ghcr.io/xixu-me/xget:latestcontainer_name: xgetports:
- "8080:8080"restart: unless-stopped使用 Docker Compose:
docker-compose up -d使用 Podman Compose:
podman-compose up -d
# 或者使用 podman compose (Podman 4.0+)
podman compose up -d部署完成后,Xget 将在 http://<server-ip>:8080 可用。
注意:自托管部署不包括 Cloudflare Workers 的全球边缘网络加速,性能取决于你的服务器配置和网络环境。
你可以通过修改 src/config/index.js 来自定义配置:
exportconstCONFIG={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_RETRIES和RETRY_DELAY_MS
要添加对新平台的支持,编辑 src/config/platforms.js:
exportconstPLATFORMS={// 现有平台...// 新平台示例custom: {base: "https://example.com",transform: (path)=>path.replace(/^\/custom\//,"/"),},};存储库设置
git clone https://github.com/xixu-me/Xget.git cd Xget npm install npx wrangler login # 首次使用
本地开发
npm run dev # 启动开发服务器 (http://localhost:8787) npm run test:run # 运行完整测试套件 npm run test:coverage # 生成测试覆盖率报告 npm run lint # 代码检查 npm run format # 代码格式化 npm run deploy # 部署到生产
存储库包含完整的测试套件,确保代码质量和功能正确性。
# 安装测试依赖
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 控制台查看详细日志:
npx wrangler dev --log-level debug- 合法合规使用:本存储库旨在为代码存储库、软件包注册表、AI 推理 API、容器镜像、模型、数据集及更多合法开发者资源提供统一加速服务。使用者应严格遵守所在司法辖区法律法规及相关平台服务条款,任何非法用途的法律责任由使用者自行承担
- 非关联性与独立责任:本存储库与各第三方平台不存在任何隶属、代理或合作关系。任何基于本存储库的 fork、二次开发、再分发或衍生版本均由其维护者独立承担全部责任;作者、维护者及贡献者不对衍生存储库的任何行为或后果承担法律或连带责任
- 无担保与免责条款:在适用法律允许的最大范围内,本存储库按“现状(AS IS)”提供,不提供任何明示或暗示担保(包括但不限于适销性、特定用途适用性、非侵权等)。对因使用本存储库而造成的任何直接或间接损失(包括但不限于数据丢失、业务中断、利润损失等),作者、维护者及贡献者不承担任何责任
- 风险自担原则:使用者应自行评估使用风险,确保其使用行为合法合规,不侵犯第三方权益,不得将本存储库用于任何违法、侵权、恶意或不当用途
- 第三方平台合规:使用者应遵守相关平台的服务条款、API 使用政策、速率限制及版权要求,避免对源平台造成过载或干扰。各平台对其内容、服务及政策拥有最终解释权
- 知识产权保护:通过本存储库获取的内容受相应版权法保护。使用者应遵守相关许可协议、版权声明及使用条款,不得从事任何侵犯知识产权的行为
- 安全防护建议:虽然本存储库采用无日志架构,不存储用户请求数据,但基于互联网传输的固有风险,建议使用者对下载内容进行安全扫描,尤其对可执行文件、脚本等保持谨慎
- 开源性质声明:本存储库为开源项目,作者与贡献者不承担提供技术支持、错误修复或持续维护的义务。外部贡献的合并不代表对特定用途或效果的承诺与背书
- 名称使用规范:严禁任何可能暗示作者或贡献者提供商业合作、技术支持、担保或背书的表述。涉及存储库名称或作者标识的使用应遵循相关法律法规及通用规范
- 免责声明更新:本免责声明可能随存储库发展或法律环境变化进行更新修订。使用者继续使用、复制、分发或修改本存储库即视为接受最新版本的免责声明
我们欢迎各种形式的贡献!请查看贡献指南了解如何参与存储库开发。
- 报告问题: 使用 issue 模板报告 bug 或提出功能请求
- 提交代码: fork 存储库,创建功能分支,提交 pull request
- 改进文档: 修正错误、添加示例、完善说明
- 测试反馈: 在不同环境下测试并提供反馈
版权所有 © Xi Xu。
本存储库采用 GPL-3.0 许可证 - 查看 LICENSE 文件了解详情。
如果这个存储库对您有帮助,请考虑给它一个 ⭐ star!
Made with ❤️ by Xi Xu
