Xget 各平台使用指南
概述
本文档详细介绍了如何在各个支持平台上使用 Xget 进行加速。包括代码托管、包管理、容器镜像、AI 模型等各种场景的具体使用方法。
代码托管平台
GitHub
基本使用
下载文件
1 2 3 4 5
| https://github.com/microsoft/vscode/archive/refs/heads/main.zip
wget https://xget.xi-xu.me/gh/microsoft/vscode/archive/refs/heads/main.zip
|
下载 Release
1 2
| wget https://xget.xi-xu.me/gh/nodejs/node/releases/download/v20.10.0/node-v20.10.0-x64.msi
|
Git 操作
Clone 仓库
1 2 3 4 5 6 7 8
| git clone https://xget.xi-xu.me/gh/microsoft/vscode.git
git clone --depth 1 https://xget.xi-xu.me/gh/microsoft/vscode.git
git clone -b main https://xget.xi-xu.me/gh/microsoft/vscode.git
|
Pull 和 Fetch
1 2 3 4 5
| git pull origin main
git fetch origin
|
Push 操作
1 2 3 4 5
| git push origin main
git push --all origin
|
Submodule 操作
1 2 3 4 5
| git clone --recursive https://xget.xi-xu.me/gh/microsoft/vscode.git
git submodule update --init --recursive
|
高级用法
Git LFS 支持
1 2 3 4
| GIT_LFS_SKIP_SMUDGE=1 git clone https://xget.xi-xu.me/gh/microsoft/vscode.git cd vscode git lfs pull
|
配置 Git 使用 Xget
1 2 3 4 5 6
| git config --global url."https://xget.xi-xu.me/gh/".insteadOf "https://github.com/"
cd your-repo git config url."https://xget.xi-xu.me/gh/".insteadOf "https://github.com/"
|
GitHub Gist
下载 Gist
1 2
| wget https://xget.xi-xu.me/gist/xixu-me/e2ea9db6b1f143892495f796fef18631/raw/3b8807172ee492d0da3a7e370b0fb88fc97b53e6/Free-ChatGPT-Paid-Plan.md
|
克隆 Gist
1 2
| git clone https://xget.xi-xu.me/gist/xixu-me/e2ea9db6b1f143892495f796fef18631.git
|
GitLab
下载文件
1 2
| wget https://xget.xi-xu.me/gl/gitlab-org/gitlab/-/archive/master/gitlab-master.zip
|
Git 操作
1 2 3 4 5
| git clone https://xget.xi-xu.me/gl/gitlab-org/gitlab.git
git pull origin main
|
Gitea
下载文件
1 2
| wget https://xget.xi-xu.me/gitea/gitea/gitea/archive/master.zip
|
Git 操作
1 2
| git clone https://xget.xi-xu.me/gitea/gitea/gitea.git
|
Codeberg
下载文件
1 2
| wget https://xget.xi-xu.me/codeberg/forgejo/forgejo/archive/forgejo.zip
|
Git 操作
1 2
| git clone https://xget.xi-xu.me/codeberg/forgejo/forgejo.git
|
SourceForge
下载文件
1 2
| wget https://xget.xi-xu.me/sf/projects/sevenzip/files/7-Zip/23.01/7z2301-x64.exe/download
|
使用 aria2c 多线程下载
1
| aria2c -x 16 -s 16 https://xget.xi-xu.me/sf/projects/sevenzip/files/7-Zip/23.01/7z2301-x64.exe/download
|
AOSP (Android 开源项目)
Git 操作
1 2 3 4 5
| git clone https://xget.xi-xu.me/aosp/platform/frameworks/base
git clone https://xget.xi-xu.me/aosp/device/google/pixel
|
使用 repo 工具
1 2 3 4 5 6 7 8
| export REPO_URL="https://xget.xi-xu.me/aosp/tools/repo"
repo init -u https://xget.xi-xu.me/aosp/platform/manifest
repo sync
|
AI/ML 平台
Hugging Face
下载模型文件
1 2 3 4 5
| wget https://xget.xi-xu.me/hf/microsoft/DialoGPT-medium/resolve/main/pytorch_model.bin
wget https://xget.xi-xu.me/hf/microsoft/DialoGPT-medium/resolve/main/config.json
|
下载完整模型
1 2 3 4 5 6 7 8
| pip install huggingface-hub
export HF_ENDPOINT="https://xget.xi-xu.me/hf"
huggingface-cli download microsoft/DialoGPT-medium
|
下载数据集
1 2 3 4 5 6 7 8 9 10 11
| wget https://xget.xi-xu.me/hf/datasets/rajpurkar/squad/resolve/main/plain_text/train-00000-of-00001.parquet
pip install datasets
export HF_ENDPOINT="https://xget.xi-xu.me/hf"
python -c "from datasets import load_dataset; ds = load_dataset('rajpurkar/squad')"
|
Python 代码示例
1 2 3 4 5 6 7 8
| from huggingface_hub import snapshot_download
import os os.environ['HF_ENDPOINT'] = 'https://xget.xi-xu.me/hf'
model_path = snapshot_download(repo_id="microsoft/DialoGPT-medium")
|
Civitai
下载模型
1 2
| wget https://xget.xi-xu.me/civitai/api/download/models/128713 -O model.safetensors
|
使用 API
1 2 3 4 5
| curl https://xget.xi-xu.me/civitai/api/v1/models/7240
curl https://xget.xi-xu.me/civitai/api/v1/model-versions/128713
|
Python 代码示例
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| import requests
base_url = "https://xget.xi-xu.me/civitai/api"
response = requests.get(f"{base_url}/v1/models/7240") model_info = response.json()
download_url = model_info['downloadUrl'] response = requests.get(download_url) with open('model.safetensors', 'wb') as f: f.write(response.content)
|
包管理平台
npm
配置 npm 使用 Xget
1 2 3 4 5
| npm config set registry https://xget.xi-xu.me/npm
npm config get registry
|
安装包
下载包文件
1 2
| wget https://xget.xi-xu.me/npm/react/-/react-18.2.0.tgz
|
使用 .npmrc
在项目根目录创建 .npmrc 文件:
1
| registry=https://xget.xi-xu.me/npm
|
PyPI
配置 pip 使用 Xget
1 2 3 4 5
| pip install --index-url https://xget.xi-xu.me/pypi requests
pip install --extra-index-url https://xget.xi-xu.me/pypi requests
|
使用 pip.conf
创建或编辑 ~/.pip/pip.conf:
1 2
| [global] index-url = https://xget.xi-xu.me/pypi
|
下载包文件
1 2 3 4 5
| wget https://xget.xi-xu.me/pypi/packages/source/r/requests/requests-2.31.0.tar.gz
wget https://xget.xi-xu.me/pypi/packages/py3/n/numpy/numpy-1.26.2-cp312-cp312-win_amd64.whl
|
使用 pip download
1 2 3 4 5
| pip download --index-url https://xget.xi-xu.me/pypi requests
pip download --index-url https://xget.xi-xu.me/pypi -d ./packages requests
|
conda
配置 conda 使用 Xget
1 2 3 4 5 6 7 8
| conda config --add channels https://xget.xi-xu.me/conda/pkgs/main
conda config --add channels https://xget.xi-xu.me/conda/community/conda-forge
conda config --show channels
|
安装包
1 2 3 4 5
| conda install python=3.11
conda install -c https://xget.xi-xu.me/conda/community/conda-forge pytorch
|
下载包文件
1 2
| wget https://xget.xi-xu.me/conda/pkgs/main/win-64/python-3.11.0-h955f1ad_0.conda
|
使用 .condarc
创建或编辑 ~/.condarc:
1 2 3 4
| channels: - https://xget.xi-xu.me/conda/pkgs/main - https://xget.xi-xu.me/conda/community/conda-forge - defaults
|
Maven
配置 Maven 使用 Xget
编辑 ~/.m2/settings.xml:
1 2 3 4 5 6 7 8 9 10
| <settings> <mirrors> <mirror> <id>xget-maven</id> <mirrorOf>central</mirrorOf> <name>Xget Maven Mirror</name> <url>https://xget.xi-xu.me/maven2</url> </mirror> </mirrors> </settings>
|
下载依赖
1 2 3 4 5
| mvn dependency:resolve
mvn dependency:sources
|
下载 JAR 文件
1 2
| wget https://xget.xi-xu.me/maven2/org/springframework/spring-core/6.1.1/spring-core-6.1.1.jar
|
Gradle
配置 Gradle 使用 Xget
编辑 build.gradle:
1 2 3 4
| repositories { maven { url 'https://xget.xi-xu.me/maven2' } mavenCentral() }
|
或编辑 settings.gradle:
1 2 3 4 5 6
| dependencyResolutionManagement { repositories { maven { url 'https://xget.xi-xu.me/maven2' } mavenCentral() } }
|
下载依赖
1 2 3 4 5
| ./gradlew dependencies
./gradlew downloadSources
|
下载插件
1 2
| wget https://xget.xi-xu.me/gradle/m2/com/github/ben-manes/gradle-caches-plugin/0.9.0/gradle-caches-plugin-0.9.0.pom
|
Homebrew
配置 Homebrew 使用 Xget
1 2 3 4 5 6
| export HOMEBREW_BREW_GIT_REMOTE="https://xget.xi-xu.me/homebrew/brew" export HOMEBREW_CORE_GIT_REMOTE="https://xget.xi-xu.me/homebrew/homebrew-core"
brew update
|
安装软件
1 2 3 4 5
| brew install python
brew install --cask visual-studio-code
|
RubyGems
配置 gem 使用 Xget
1 2 3 4 5 6
| gem sources --add https://xget.xi-xu.me/rubygems gem sources --remove https://rubygems.org/
gem sources -l
|
安装 gem
1 2 3 4 5
| gem install rails
gem install rails -v 7.1.2
|
下载 gem 文件
1 2
| wget https://xget.xi-xu.me/rubygems/gems/rails-7.1.2.gem
|
CRAN ®
配置 R 使用 Xget
在 R 中执行:
1 2 3 4 5
| options(repos = c(CRAN = "https://xget.xi-xu.me/cran"))
options()$repos
|
安装包
1 2 3 4 5
| install.packages("ggplot2")
install.packages("https://xget.xi-xu.me/cran/src/contrib/Archive/ggplot2/ggplot2_3.4.4.tar.gz")
|
下载包文件
1 2
| wget https://xget.xi-xu.me/cran/src/contrib/ggplot2_3.4.4.tar.gz
|
CPAN (Perl)
配置 CPAN 使用 Xget
1 2
| cpanm --mirror https://xget.xi-xu.me/cpan --mirror-only Module::Name
|
安装模块
1 2 3 4 5
| cpanm Plack
cpanm https://xget.xi-xu.me/cpan/authors/id/M/MI/MIYAGAWA/Plack-1.050.tar.gz
|
下载模块文件
1 2
| wget https://xget.xi-xu.me/cpan/authors/id/M/MI/MIYAGAWA/Plack-1.050.tar.gz
|
CTAN (TeX/LaTeX)
下载 TeX 包
1 2 3 4 5
| wget https://xget.xi-xu.me/ctan/tex-archive/macros/latex/contrib/beamer.zip
tlmgr option repository https://xget.xi-xu.me/ctan/tex-archive/tlcontrib
|
Go 模块
配置 Go 使用 Xget
1 2 3 4 5
| export GOPROXY=https://xget.xi-xu.me/golang
go env GOPROXY
|
下载模块
下载模块文件
1 2
| wget https://xget.xi-xu.me/golang/github.com/golang/go/@v/v1.21.5.zip
|
NuGet (.NET)
配置 NuGet 使用 Xget
编辑 NuGet.Config:
1 2 3 4 5
| <configuration> <packageSources> <add key="xget" value="https://xget.xi-xu.me/nuget" protocolVersion="3" /> </packageSources> </configuration>
|
安装包
1 2 3 4 5
| dotnet add package Newtonsoft.Json --source https://xget.xi-xu.me/nuget
nuget install Newtonsoft.Json -Source https://xget.xi-xu.me/nuget
|
下载包文件
1 2
| wget https://xget.xi-xu.me/nuget/v3-flatcontainer/newtonsoft.json/13.0.3/newtonsoft.json.13.0.3.nupkg
|
Rust Crates
配置 Cargo 使用 Xget
编辑 ~/.cargo/config.toml:
1 2 3 4 5 6 7 8
| [source.xget] registry = "https://xget.xi-xu.me/crates"
[registries.xget] index = "https://xget.xi-xu.me/crates"
[crates-io] replace-with = "xget"
|
安装 crate
1 2 3 4 5
| cargo install ripgrep
cargo add serde
|
下载 crate 文件
1 2
| wget https://xget.xi-xu.me/crates/api/v1/crates/serde/1.0.195/download
|
Packagist (PHP)
配置 Composer 使用 Xget
编辑 composer.json:
1 2 3 4 5 6 7 8
| { "repositories": [ { "type": "composer", "url": "https://xget.xi-xu.me/packagist" } ] }
|
或编辑 ~/.composer/config.json:
1 2 3 4 5 6 7 8
| { "repositories": { "packagist.org": { "type": "composer", "url": "https://xget.xi-xu.me/packagist" } } }
|
安装包
1 2 3 4 5
| composer require laravel/framework
composer update
|
系统包管理平台
Debian/Ubuntu
配置 apt 使用 Xget
编辑 /etc/apt/sources.list:
1
| deb https://xget.xi-xu.me/debian bookworm main contrib non-free
|
或编辑 /etc/apt/sources.list.d/xget.list:
1
| deb https://xget.xi-xu.me/ubuntu jammy main restricted universe multiverse
|
更新和安装
1 2 3 4 5 6 7 8
| sudo apt update
sudo apt install nginx
apt-get download nginx
|
Fedora
配置 dnf 使用 Xget
编辑 /etc/yum.repos.d/xget.repo:
1 2 3 4 5
| [xget] name=Xget Fedora Mirror baseurl=https://xget.xi-xu.me/fedora/linux/releases/$releasever/Everything/$basearch/os/ enabled=1 gpgcheck=0
|
更新和安装
1 2 3 4 5 6 7 8
| sudo dnf makecache
sudo dnf install nginx
sudo dnf download nginx
|
Rocky Linux
配置 dnf 使用 Xget
编辑 /etc/yum.repos.d/xget.repo:
1 2 3 4 5 6 7 8 9 10 11
| [xget-baseos] name=Xget Rocky Linux BaseOS baseurl=https://xget.xi-xu.me/rocky/$releasever/BaseOS/$basearch/os/ enabled=1 gpgcheck=0
[xget-appstream] name=Xget Rocky Linux AppStream baseurl=https://xget.xi-xu.me/rocky/$releasever/AppStream/$basearch/os/ enabled=1 gpgcheck=0
|
更新和安装
1 2 3 4 5
| sudo dnf makecache
sudo dnf install nginx
|
openSUSE
配置 zypper 使用 Xget
1 2 3 4 5
| sudo zypper ar -f https://xget.xi-xu.me/opensuse/tumbleweed/repo/oss xget-oss
sudo zypper refresh
|
更新和安装
1 2 3 4 5 6 7 8
| sudo zypper refresh
sudo zypper install nginx
sudo zypper download nginx
|
Arch Linux
配置 pacman 使用 Xget
编辑 /etc/pacman.conf:
1 2
| [xget] Server = https://xget.xi-xu.me/arch/$repo/os/$arch
|
更新和安装
1 2 3 4 5 6 7 8
| sudo pacman -Sy
sudo pacman -S nginx
sudo pacman -Sw nginx
|
其他平台
arXiv
下载论文
1 2 3 4 5
| wget https://xget.xi-xu.me/arxiv/pdf/2312.12345.pdf
wget https://xget.xi-xu.me/arxiv/e-print/2312.12345
|
F-Droid
下载应用
1 2 3 4 5
| wget https://xget.xi-xu.me/fdroid/repo/com.example.app_100.apk
|
Jenkins 插件
下载插件
1 2 3 4 5
| wget https://xget.xi-xu.me/jenkins/latest/git.hpi
|
Apache 软件下载
下载软件
1 2 3 4 5
| wget https://xget.xi-xu.me/apache/tomcat/tomcat-10/v10.1.15/bin/apache-tomcat-10.1.15.tar.gz
aria2c -x 16 -s 16 https://xget.xi-xu.me/apache/tomcat/tomcat-10/v10.1.15/bin/apache-tomcat-10.1.15.tar.gz
|
容器注册表
配置 Docker 使用 Xget
编辑 /etc/docker/daemon.json:
1 2 3 4 5
| { "registry-mirrors": [ "https://xget.xi-xu.me/cr/registry-1.docker.io" ] }
|
重启 Docker:
1
| sudo systemctl restart docker
|
拉取镜像
1 2 3 4 5 6 7 8
| docker pull nginx:latest
docker pull nginx:1.25
docker pull ghcr.io/user/image:tag
|
使用 Podman
1 2 3 4 5
| podman pull docker.io/nginx:latest
podman pull nginx:latest
|
AI 推理提供商
配置 OpenAI 使用 Xget
1 2 3 4 5 6 7 8
| curl https://xget.xi-xu.me/ip/api.openai.com/v1/chat/completions \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-4", "messages": [{"role": "user", "content": "Hello!"}] }'
|
Python 代码示例
1 2 3 4 5 6 7 8 9 10 11
| import openai
openai.api_base = "https://xget.xi-xu.me/ip/api.openai.com/v1" openai.api_key = "YOUR_API_KEY"
response = openai.ChatCompletion.create( model="gpt-4", messages=[{"role": "user", "content": "Hello!"}] )
|
配置 Anthropic 使用 Xget
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| import anthropic
client = anthropic.Anthropic( api_key="YOUR_API_KEY", base_url="https://xget.xi-xu.me/ip/api.anthropic.com" )
message = client.messages.create( model="claude-3-opus-20240229", max_tokens=1024, messages=[{"role": "user", "content": "Hello!"}] )
|
下载工具
wget
基本使用
1 2 3 4 5 6 7 8
| wget https://xget.xi-xu.me/gh/microsoft/vscode/archive/main.zip
wget -O vscode.zip https://xget.xi-xu.me/gh/microsoft/vscode/archive/main.zip
wget -c https://xget.xi-xu.me/gh/microsoft/vscode/archive/main.zip
|
cURL
基本使用
1 2 3 4 5 6 7 8
| curl -o vscode.zip https://xget.xi-xu.me/gh/microsoft/vscode/archive/main.zip
curl -# -o vscode.zip https://xget.xi-xu.me/gh/microsoft/vscode/archive/main.zip
curl -C - -o vscode.zip https://xget.xi-xu.me/gh/microsoft/vscode/archive/main.zip
|
aria2
多线程下载
1 2 3 4 5 6 7 8
| aria2c -x 16 -s 16 https://xget.xi-xu.me/gh/microsoft/vscode/archive/main.zip
aria2c -i urls.txt
aria2c -c https://xget.xi-xu.me/gh/microsoft/vscode/archive/main.zip
|
IDM (Internet Download Manager)
使用方法
- 复制加速 URL
- IDM 会自动捕获下载
- 或手动添加到 IDM
配置
- 在 IDM 设置中配置最大连接数
- 启用分段下载
- 配置下载速度限制
CI/CD 集成
GitHub Actions
配置示例
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
| name: Build and Test
on: [push, pull_request]
jobs: build: runs-on: ubuntu-latest
steps: - uses: actions/checkout@v4
- name: Setup Node.js uses: actions/setup-node@v4 with: node-version: '20' registry-url: 'https://xget.xi-xu.me/npm'
- name: Install dependencies run: npm ci
- name: Build run: npm run build
- name: Test run: npm test
|
GitLab CI
配置示例
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| image: node:20
variables: NPM_CONFIG_REGISTRY: "https://xget.xi-xu.me/npm"
before_script: - npm ci
stages: - build - test
build: stage: build script: - npm run build
test: stage: test script: - npm test
|
常见问题
Q1: 如何验证 Xget 是否正常工作?
A: 下载一个小文件并检查速度:
1
| time wget https://xget.xi-xu.me/gh/microsoft/vscode/archive/main.zip
|
Q2: 如何切换回原始源?
A: 恢复原始配置:
1 2 3 4 5 6 7 8
| npm config set registry https://registry.npmjs.org
pip install --index-url https://pypi.org requests
sudo sed -i 's/xget.xi-xu.me/deb.debian.org/g' /etc/apt/sources.list
|
Q3: Xget 支持哪些协议?
A: Xget 支持 HTTP/HTTPS、Git、Docker、AI 推理等多种协议。
Q4: 如何提高下载速度?
A: 使用多线程下载工具:
Q5: Xget 会缓存文件吗?
A: 是的,Xget 使用 Cloudflare Cache API 进行边缘缓存,默认缓存时长为 30 分钟。
总结
Xget 为 40+ 开发者常用平台提供了统一的加速服务。通过简单的 URL 转换或配置更改,即可享受极速下载体验。无论是代码托管、包管理、容器镜像还是 AI 模型,Xget 都能提供稳定、高效的加速服务。