From 9b461bf271b97019f02f0b0a7316aad7a30318f8 Mon Sep 17 00:00:00 2001 From: Xi Xu Date: Sun, 31 Aug 2025 21:52:46 +0800 Subject: [PATCH] Remove English README and translation workflow Deleted the auto-translation GitHub Actions workflow and the generated README.en.md file. Updated README.md, likely to remove references to the English version and translation automation. --- .github/workflows/translate-readme.yml | 186 -- README.en.md | 2298 ------------------------ README.md | 2 - 3 files changed, 2486 deletions(-) delete mode 100644 .github/workflows/translate-readme.yml delete mode 100644 README.en.md diff --git a/.github/workflows/translate-readme.yml b/.github/workflows/translate-readme.yml deleted file mode 100644 index 97d6d81..0000000 --- a/.github/workflows/translate-readme.yml +++ /dev/null @@ -1,186 +0,0 @@ -name: Translate README - -on: - push: - branches: [main] - paths: - - "README.md" - pull_request: - branches: [main] - paths: - - "README.md" - workflow_dispatch: - -jobs: - translate-readme: - runs-on: ubuntu-latest - permissions: - contents: write - pull-requests: write - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - token: ${{ secrets.GITHUB_TOKEN }} - fetch-depth: 0 - - - name: Setup Node.js for chunked translation - uses: actions/setup-node@v4 - with: - node-version: "20" - - - name: Install dependencies - run: | - npm install deepl-node - - - name: Split and translate README in chunks - run: | - # 创建分块翻译脚本 - cat > translate_chunks.js << 'EOF' - const fs = require('fs'); - const { Translator } = require('deepl-node'); - - const translator = new Translator(process.env.DEEPL_API_KEY); - - async function translateFile() { - try { - const content = fs.readFileSync('README.md', 'utf8'); - - // 智能分块:按段落和标题分割,避免破坏结构 - const sections = content.split(/(?=^#{1,6}\s)/m); - const chunks = []; - let currentChunk = ''; - const maxChunkSize = 3800; // 字符数限制,留有安全边际 - - for (const section of sections) { - if ((currentChunk + section).length > maxChunkSize && currentChunk) { - chunks.push(currentChunk.trim()); - currentChunk = section; - } else { - currentChunk += section; - } - } - - if (currentChunk.trim()) { - chunks.push(currentChunk.trim()); - } - - console.log(`📄 文件大小: ${content.length} 字符`); - console.log(`📦 分为 ${chunks.length} 块进行翻译`); - - const translatedChunks = []; - - for (let i = 0; i < chunks.length; i++) { - const chunkSize = chunks[i].length; - console.log(`🔄 翻译第 ${i + 1}/${chunks.length} 块 (${chunkSize} 字符)...`); - - try { - const result = await translator.translateText( - chunks[i], - 'zh', - 'en-US', - { - preserveFormatting: true, - tagHandling: 'html' - } - ); - translatedChunks.push(result.text); - console.log(`✅ 第 ${i + 1} 块翻译完成`); - - // 添加延迟避免API限制 - if (i < chunks.length - 1) { - await new Promise(resolve => setTimeout(resolve, 2000)); - } - } catch (error) { - console.error(`❌ 翻译第 ${i + 1} 块时出错:`, error.message); - // 如果翻译失败,保留原文并添加错误标记 - translatedChunks.push(`\n${chunks[i]}`); - } - } - - const translatedContent = translatedChunks.join('\n\n'); - fs.writeFileSync('README.en.md', translatedContent); - console.log('🎉 翻译完成!'); - - // 检查翻译质量 - const originalLines = content.split('\n').length; - const translatedLines = translatedContent.split('\n').length; - console.log(`📊 原文行数: ${originalLines}, 译文行数: ${translatedLines}`); - - } catch (error) { - console.error('❌ 翻译过程中发生错误:', error); - process.exit(1); - } - } - - translateFile(); - EOF - - # 运行翻译脚本 - node translate_chunks.js - env: - DEEPL_API_KEY: ${{ secrets.DEEPL_API_KEY }} - - - name: Update language link and add translation notice - run: | - if [ -f "README.en.md" ]; then - # 创建临时文件 - temp_file=$(mktemp) - - # 读取翻译后的文件内容 - content=$(cat README.en.md) - - # 替换语言链接:将 [English](README.en.md) 改为 [汉语](README.md) - content=$(echo "$content" | sed 's/\*\*\[English\](README\.en\.md)\*\*/\*\*\[汉语\](README\.md)\*\*/g') - - # 在第三行(语言链接后)插入翻译说明 - echo "$content" | awk ' - NR==1 {print $0} - NR==2 {print $0; print ""} - NR==3 { - print $0 - print "" - print "> **📝 翻译说明**" - print ">" - print "> 本文档由 [DeepL](https://www.deepl.com/) 自动翻译生成,如有疏漏或错误,请以 [中文原文](README.md) 为准。" - print ">" - print "> This document is automatically translated by [DeepL](https://www.deepl.com/). For any omissions or errors, please refer to the [original Chinese text](README.md)." - print "" - next - } - NR>3 {print $0} - ' > "$temp_file" - - # 替换原文件 - mv "$temp_file" README.en.md - fi - - - name: Commit and push changes - run: | - git config --local user.email "action@github.com" - git config --local user.name "GitHub Action" - - if [ -f "README.en.md" ]; then - git add README.en.md - if git diff --staged --quiet; then - echo "No changes to commit" - else - # 计算文件统计信息 - original_lines=$(wc -l < README.md) - translated_lines=$(wc -l < README.en.md) - - git commit -m "🌐 Auto-translate README.md to English using DeepL (Chunked) - - 📄 Processed large README.md in chunks for optimal translation quality - 📊 Original: ${original_lines} lines → Translated: ${translated_lines} lines - ✨ Features: - - Generated README.en.md from README.md - - Updated language links - - Added translation disclaimer - - Intelligent chunk processing to maintain structure - - Co-authored-by: DeepL " - git push - fi - fi diff --git a/README.en.md b/README.en.md deleted file mode 100644 index c1390a6..0000000 --- a/README.en.md +++ /dev/null @@ -1,2298 +0,0 @@ -# Xget - -**[汉语](README.md)** - -[![Chromium Extension](https://img.shields.io/badge/Chromium%20Extension-4285F4?logo=googlechrome&logoColor=white)](#-ecosystem-integration) -[![Firefox Extension](https://img.shields.io/badge/Firefox%20Extension-582ACB?logo=Firefox&logoColor=white)](#-ecosystem-integration) -[![Cloudflare Workers](https://img.shields.io/badge/Cloudflare%20Workers-F38020?&logo=cloudflare&logoColor=white)](#cloudflare-workers-highly-recommended) -[![Vercel](https://img.shields.io/badge/Vercel-000000?logo=vercel&logoColor=white)](#vercel) -[![Docker](https://img.shields.io/badge/Docker-2496ED?&logo=docker&logoColor=white)](#docker) - -[![GitHub](https://img.shields.io/badge/GitHub-181717?&logo=github&logoColor=white)](#github) -[![GitLab](https://img.shields.io/badge/GitLab-FC6D26?&logo=gitlab&logoColor=white)](#gitlab) -[![Gitea](https://img.shields.io/badge/Gitea-609926?&logo=gitea&logoColor=white)](#gitea) -[![Codeberg](https://img.shields.io/badge/Codeberg-2185D0?&logo=codeberg&logoColor=white)](#codeberg) -[![SourceForge](https://img.shields.io/badge/SourceForge-FF6600?&logo=sourceforge&logoColor=white)](#sourceforge) -[![AOSP](https://img.shields.io/badge/AOSP-3DDC84?&logo=android&logoColor=white)](#aosp-android-open-source-project) -[![Hugging Face](https://img.shields.io/badge/Hugging%20Face-FFD21E?&logo=huggingface&logoColor=white)](#hugging-face-mirror) -[![Civitai](https://img.shields.io/badge/Civitai-0066CC)](#civitai-ai-model-platform) -[![npm](https://img.shields.io/badge/npm-CB3837?logo=npm&logoColor=white)](#npm-package-acceleration) -[![PyPI](https://img.shields.io/badge/PyPI-3775A9?logo=pypi&logoColor=white)](#python-package-acceleration) -[![conda](https://img.shields.io/badge/conda-44A833?logo=anaconda&logoColor=white)](#conda-package-acceleration) -[![Maven](https://img.shields.io/badge/Maven-C71A36?logo=apachemaven&logoColor=white)](#maven-package-acceleration) -[![Apache](https://img.shields.io/badge/Apache-D22128?logo=apache&logoColor=white)](#apache-software-downloads) -[![Gradle](https://img.shields.io/badge/Gradle-02303A?logo=gradle&logoColor=white)](#gradle-package-acceleration) -[![Homebrew](https://img.shields.io/badge/Homebrew-FBB040?logo=homebrew&logoColor=black)](#homebrew-package-acceleration) -[![RubyGems](https://img.shields.io/badge/RubyGems-CC342D?logo=rubygems&logoColor=white)](#ruby-package-acceleration) -[![CRAN](https://img.shields.io/badge/CRAN-276DC3?logo=r&logoColor=white)](#r-package-acceleration) -[![CPAN](https://img.shields.io/badge/CPAN-39457E?logo=perl&logoColor=white)](#perl-package-acceleration) -[![CTAN](https://img.shields.io/badge/CTAN-008080?logo=latex&logoColor=white)](#texlatex-package-acceleration) -[![Go](https://img.shields.io/badge/Go-00ADD8?logo=go&logoColor=white)](#go-module-acceleration) -[![NuGet](https://img.shields.io/badge/NuGet-004880?logo=nuget&logoColor=white)](#nuget-package-acceleration) -[![Rust](https://img.shields.io/badge/Rust-000000?logo=rust&logoColor=white)](#rust-package-acceleration) -[![Packagist](https://img.shields.io/badge/Packagist-F28D1A?logo=packagist&logoColor=white)](#php-package-acceleration) -[![Debian](https://img.shields.io/badge/Debian-A81D33?logo=debian&logoColor=white)](#debianubuntu-apt-configuration) -[![Ubuntu](https://img.shields.io/badge/Ubuntu-E95420?logo=ubuntu&logoColor=white)](#debianubuntu-apt-configuration) -[![Fedora](https://img.shields.io/badge/Fedora-294172?logo=fedora&logoColor=white)](#fedora-dnf-configuration) -[![Rocky Linux](https://img.shields.io/badge/Rocky%20Linux-10B981?logo=rockylinux&logoColor=white)](#rocky-linux-dnf-configuration) -[![openSUSE](https://img.shields.io/badge/openSUSE-73BA25?logo=opensuse&logoColor=white)](#opensuse-zypper-configuration) -[![Arch Linux](https://img.shields.io/badge/Arch%20Linux-1793D1?logo=archlinux&logoColor=white)](#arch-linux-pacman-configuration) -[![arXiv](https://img.shields.io/badge/arXiv-B31B1B?logo=arxiv&logoColor=white)](#arxiv-paper-downloads) -[![F-Droid](https://img.shields.io/badge/F--Droid-1976D2?logo=f-droid&logoColor=white)](#f-droid-repository-mirror) -[![AI Inference Providers](https://img.shields.io/badge/AI%20Inference%20Providers-412991?logo=openai&logoColor=white)](#ai-inference-providers) -[![Container Registries](https://img.shields.io/badge/Container%20Registries-%23007EC6.svg?logo=docker&logoColor=white)](#container-registries) - -Ultra-high performance, secure, all-in-one open-source resource acceleration engine. Significantly outperforms traditional accelerators, providing unified and efficient acceleration across multiple platforms including code repositories, package managers, AI inference APIs, container images, models, and datasets. - -## 💡 Repository Vision - -The vision of this repository is to accelerate access to open-source resources on platforms that comply with relevant laws and regulations within mainland China, providing developers with a stable and legal acceleration service. We are committed to: - -- **🌍 Eliminate Geographic Restrictions**: Help developers in mainland China quickly access overseas open-source resources -- **⚖️ Legal Compliance**: Strictly comply with relevant laws and regulations, only accelerating legal public resources -- **🚀 Improve Efficiency**: Significantly enhance developers' work efficiency and development experience -- **🆓 Benefit Open Source**: Contribute to the open-source community and promote technological exchange and development - -## 🎯 Quick Start - -**Public Instance: `xget.xi-xu.me`** - Ready to use, no deployment required! - -**URL Converter: [`xuc.xi-xu.me`](https://xuc.xi-xu.me)** - One-click conversion of any supported platform URL to Xget acceleration format! - -> **⚡ Experience lightning-fast downloads instantly**: No registration, no configuration needed - just start using it to feel the blazing download speeds! - -## 🌟 Core Advantages - Why Choose Xget? - -### ⚡ Extreme Performance - Breaking Traditional Accelerator Bottlenecks - -- **⚡ Millisecond Response**: Cloudflare's global 330+ edge nodes with average response time < 50ms -- **🌐 HTTP/3 Ultra-Fast Protocol**: Latest HTTP/3 protocol reduces connection latency by 40% and boosts transfer speed by 30% -- **📦 Smart Multi-Layer Compression**: Triple compression with gzip, deflate, and brotli algorithms improves transfer efficiency by 60% -- **🔗 Zero-Latency Pre-connection**: Connection warming and keep-alive eliminates handshake overhead for instant response -- **⚡ Parallel Chunked Downloads**: Full HTTP Range request support enables multi-threaded downloads with multiplied speeds -- **🎯 Intelligent Route Optimization**: Automatically selects optimal transfer paths, avoiding network congestion nodes - -### 🌐 Deep Multi-Platform Integration - -- **Unified Multi-Platform Support**: Single solution for code repositories, package managers, AI inference providers, container registries, and model/dataset hosting platforms -- **Smart Recognition & Transformation**: Automatically identifies platform prefixes and converts to correct target platform URL structures -- **Consistent Acceleration Experience**: Enjoy unified and stable ultra-fast download service regardless of file type or source - -### 🔒 Enterprise-Grade Security - -- **Multi-Layer Security Headers**: - - `Strict-Transport-Security`: Enforces HTTPS transport, prevents man-in-the-middle attacks - - `X-Frame-Options: DENY`: Prevents clickjacking attacks - - `X-XSS-Protection`: Built-in XSS protection mechanism - - `Content-Security-Policy`: Strict content security policy - - `Referrer-Policy`: Controls referrer information leakage -- **Request Validation Mechanism**: - - HTTP method whitelist: Regular requests limited to GET/HEAD, Git operations dynamically allow POST - - Path length limits: Prevents oversized URL attacks (max 2048 characters) - - Input sanitization: Prevents path traversal and injection attacks -- **Timeout Protection**: 30-second request timeout prevents resource exhaustion and malicious requests - -### 🚀 Modern Architecture & Reliability - -- **Smart Retry Mechanism**: - - Maximum 3 retries with linear delay strategy (1000ms × retry count) - - Automatic error recovery improves download success rate - - Timeout detection and interruption handling -- **Efficient Caching Strategy**: - - 1800 seconds (30 minutes) default cache duration significantly reduces origin server pressure - - Git operations bypass cache ensuring real-time updates - - Edge caching based on Cloudflare Cache API -- **Performance Monitoring System**: - - Built-in `PerformanceMonitor` class tracks request stage timing in real-time - - Detailed performance data via `X-Performance-Metrics` response header - - Cache hit rate statistics and optimization recommendations - -### 🎯 Full Git Protocol Compatibility - -- **Smart Protocol Detection**: - - Automatically recognizes Git-specific endpoints (`/info/refs`, `/git-upload-pack`, `/git-receive-pack`) - - Detects Git client User-Agent patterns - - Supports query parameters like `service=git-upload-pack` -- **Complete Operation Support**: - - `git clone`: Full repository cloning with shallow clone and branch specification support - - `git push`: Code pushing and branch management - - `git pull/fetch`: Incremental updates and remote synchronization - - `git submodule`: Recursive submodule cloning -- **Protocol Optimization**: - - Preserves Git-specific request headers and authentication information - - Smart User-Agent handling (defaults to `git/2.34.1`) - - Supports Git LFS large file transfers - -### 📱 Ecosystem Integration - -- **Dedicated Browser Extensions**: [Xget Now](https://github.com/xixu-me/Xget-Now) provides seamless experience - - Automatic URL redirection without manual URL modification - - Custom Xget instance domain support - - Multi-platform preference settings and blacklist/whitelist management - - Local processing ensures privacy and security -- **Download Tool Compatibility**: Perfect support for wget, cURL, aria2, IDM, and other mainstream download tools -- **CI/CD Integration**: Direct usage in GitHub Actions, GitLab CI, and other environments - -## 📖 URL Transformation Rules - -Using the public instance **`xget.xi-xu.me`** or your own deployed instance, simply replace the domain and add platform prefixes: - -### Transformation Format - -| Platform | Platform Prefix | Original URL Format | Accelerated URL Format | -|----------|----------------|-------------------|----------------------| -| GitHub | `gh` | `https://github.com/...` | `https://xget.xi-xu.me/gh/...` | -| 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/...` and `https://conda.anaconda.org/...` | `https://xget.xi-xu.me/conda/...` and `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 Modules | `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/...` | -| AI Inference Providers | `ip` | See [AI Inference Providers](#ai-inference-providers) | See [AI Inference Providers](#ai-inference-providers) | -| Container Registries | `cr` | See [Container Registries](#container-registries) | See [Container Registries](#container-registries) | - -### Platform Transformation Examples - -#### GitHub - -```url -# Original URL -https://github.com/microsoft/vscode/archive/refs/heads/main.zip - -# Transformed (add gh prefix) -https://xget.xi-xu.me/gh/microsoft/vscode/archive/refs/heads/main.zip -``` - -#### GitLab - -```url -# Original URL -https://gitlab.com/gitlab-org/gitlab/-/archive/master/gitlab-master.zip - -# Transformed (add gl prefix) -https://xget.xi-xu.me/gl/gitlab-org/gitlab/-/archive/master/gitlab-master.zip -``` - -#### Gitea - -```url -# Original URL -https://gitea.com/gitea/gitea/archive/master.zip - -# Transformed (add gitea prefix) -https://xget.xi-xu.me/gitea/gitea/gitea/archive/master.zip -``` - -#### Codeberg - -```url -# Original URL -https://codeberg.org/forgejo/forgejo/archive/forgejo.zip - -# Transformed (add codeberg prefix) -https://xget.xi-xu.me/codeberg/forgejo/forgejo/archive/forgejo.zip -``` - -#### SourceForge - -```url -# Original URL -https://sourceforge.net/projects/sevenzip/files/7-Zip/23.01/7z2301-x64.exe/download - -# Transformed (add sf prefix) -https://xget.xi-xu.me/sf/projects/sevenzip/files/7-Zip/23.01/7z2301-x64.exe/download -``` - -#### AOSP (Android Open Source Project) - -```url -# AOSP project original URL -https://android.googlesource.com/platform/frameworks/base - -# Transformed (add aosp prefix) -https://xget.xi-xu.me/aosp/platform/frameworks/base - -# AOSP device tree original URL -https://android.googlesource.com/device/google/pixel - -# Transformed (add aosp prefix) -https://xget.xi-xu.me/aosp/device/google/pixel -``` - -#### Hugging Face - -```url -# Model file original URL -https://huggingface.co/microsoft/DialoGPT-medium/resolve/main/pytorch_model.bin - -# Transformed (add hf prefix) -https://xget.xi-xu.me/hf/microsoft/DialoGPT-medium/resolve/main/pytorch_model.bin - -# Dataset file original URL -https://huggingface.co/datasets/rajpurkar/squad/resolve/main/plain_text/train-00000-of-00001.parquet - -# Transformed (add hf prefix) -https://xget.xi-xu.me/hf/datasets/rajpurkar/squad/resolve/main/plain_text/train-00000-of-00001.parquet -``` - -#### Civitai - -```url -# AI model download original URL -https://civitai.com/api/download/models/128713 - -# Transformed (add civitai prefix) -https://xget.xi-xu.me/civitai/api/download/models/128713 - -# Model API original URL -https://civitai.com/api/v1/models/7240 - -# Transformed (add civitai prefix) -https://xget.xi-xu.me/civitai/api/v1/models/7240 - -# Model version API original URL -https://civitai.com/api/v1/model-versions/128713 - -# Transformed (add civitai prefix) -https://xget.xi-xu.me/civitai/api/v1/model-versions/128713 -``` - -#### npm - -```url -# Package file original URL -https://registry.npmjs.org/react/-/react-18.2.0.tgz - -# Transformed (add npm prefix) -https://xget.xi-xu.me/npm/react/-/react-18.2.0.tgz - -# Package metadata original URL -https://registry.npmjs.org/lodash - -# Transformed (add npm prefix) -https://xget.xi-xu.me/npm/lodash -``` - -#### PyPI - -```url -# Python package file original URL -https://pypi.org/packages/source/r/requests/requests-2.31.0.tar.gz - -# Transformed (add pypi prefix) -https://xget.xi-xu.me/pypi/packages/source/r/requests/requests-2.31.0.tar.gz - -# Wheel file original URL -https://pypi.org/packages/py3/r/requests/requests-2.31.0-py3-none-any.whl - -# Transformed (add pypi prefix) -https://xget.xi-xu.me/pypi/packages/py3/r/requests/requests-2.31.0-py3-none-any.whl -``` - -#### conda - -```url -# Default channel package file original URL -https://repo.anaconda.com/pkgs/main/linux-64/numpy-1.24.3-py311h08b1b3b_1.conda - -# Transformed (add conda prefix) -https://xget.xi-xu.me/conda/pkgs/main/linux-64/numpy-1.24.3-py311h08b1b3b_1.conda - -# Community channel metadata original URL -https://conda.anaconda.org/conda-forge/linux-64/repodata.json - -# Transformed (add conda/community prefix) -https://xget.xi-xu.me/conda/community/conda-forge/linux-64/repodata.json -``` - -#### Maven - -```url -# Maven Central repository JAR file original URL -https://repo1.maven.org/maven2/org/springframework/spring-core/5.3.21/spring-core-5.3.21.jar - -# Transformed (add maven prefix) -https://xget.xi-xu.me/maven/maven2/org/springframework/spring-core/5.3.21/spring-core-5.3.21.jar - -# Maven metadata original URL -https://repo1.maven.org/maven2/org/apache/commons/commons-lang3/maven-metadata.xml - -# Transformed (add maven prefix) -https://xget.xi-xu.me/maven/maven2/org/apache/commons/commons-lang3/maven-metadata.xml -``` - -#### Apache Software Downloads - -```url -# Apache software download original URL -https://downloads.apache.org/kafka/3.6.1/kafka_2.13-3.6.1.tgz - -# Transformed (add apache prefix) -https://xget.xi-xu.me/apache/kafka/3.6.1/kafka_2.13-3.6.1.tgz - -# Apache Maven download original URL -https://downloads.apache.org/maven/maven-3/3.9.5/binaries/apache-maven-3.9.5-bin.tar.gz - -# Transformed (add apache prefix) -https://xget.xi-xu.me/apache/maven/maven-3/3.9.5/binaries/apache-maven-3.9.5-bin.tar.gz - -# Apache Spark download original URL -https://downloads.apache.org/spark/spark-3.5.0/spark-3.5.0-bin-hadoop3.tgz - -# Transformed (add apache prefix) -https://xget.xi-xu.me/apache/spark/spark-3.5.0/spark-3.5.0-bin-hadoop3.tgz -``` - -#### AI Inference Providers - -Xget supports numerous mainstream AI inference providers with API acceleration using the `ip/[AI Provider Prefix]` format: - -| AI Inference Provider | AI Provider Prefix | Original URL Format | Accelerated URL Format | -|----------------------|-------------------|-------------------|----------------------| -| 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 Models | `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/...` | -| 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/...` | - -```url -# OpenAI API original URL -https://api.openai.com/v1/chat/completions - -# Transformed (add ip/openai prefix) -https://xget.xi-xu.me/ip/openai/v1/chat/completions - -# Anthropic API original URL -https://api.anthropic.com/v1/messages - -# Transformed (add ip/anthropic prefix) -https://xget.xi-xu.me/ip/anthropic/v1/messages - -# Gemini API original URL -https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent - -# Transformed (add ip/gemini prefix) -https://xget.xi-xu.me/ip/gemini/v1beta/models/gemini-2.5-flash:generateContent - -# HF Inference API original URL -https://router.huggingface.co/hf-inference/models/openai/whisper-large-v3 - -# Transformed (add ip/huggingface prefix) -https://xget.xi-xu.me/ip/huggingface/hf-inference/models/openai/whisper-large-v3 -``` - -Use cases are detailed in [AI Inference API Acceleration](#ai-inference-api-acceleration). - -#### Container Registries - -Xget supports multiple container registries using the `cr/[Container Registry Prefix]` format: - -| Container Registry | Registry Prefix | Original URL Format | Accelerated URL Format | -|-------------------|----------------|-------------------|----------------------| -| Quay.io | `quay` | `https://quay.io/...` | `https://xget.xi-xu.me/cr/quay/...` | -| Google Container Registry | `gcr` | `https://gcr.io/...` | `https://xget.xi-xu.me/cr/gcr/...` | -| Microsoft Container Registry | `mcr` | `https://mcr.microsoft.com/...` | `https://xget.xi-xu.me/cr/mcr/...` | -| Amazon Public ECR | `ecr` | `https://public.ecr.aws/...` | `https://xget.xi-xu.me/cr/ecr/...` | -| GitHub Container Registry | `ghcr` | `https://ghcr.io/...` | `https://xget.xi-xu.me/cr/ghcr/...` | -| GitLab Container Registry | `gitlab` | `https://registry.gitlab.com/...` | `https://xget.xi-xu.me/cr/gitlab/...` | -| Red Hat Registry | `redhat` | `https://registry.redhat.io/...` | `https://xget.xi-xu.me/cr/redhat/...` | -| Oracle Container Registry | `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 Registry | `digitalocean` | `https://registry.digitalocean.com/...` | `https://xget.xi-xu.me/cr/digitalocean/...` | -| VMware Registry | `vmware` | `https://projects.registry.vmware.com/...` | `https://xget.xi-xu.me/cr/vmware/...` | -| Kubernetes Registry | `k8s` | `https://registry.k8s.io/...` | `https://xget.xi-xu.me/cr/k8s/...` | -| Heroku Registry | `heroku` | `https://registry.heroku.com/...` | `https://xget.xi-xu.me/cr/heroku/...` | -| SUSE Registry | `suse` | `https://registry.suse.com/...` | `https://xget.xi-xu.me/cr/suse/...` | -| openSUSE Registry | `opensuse` | `https://registry.opensuse.org/...` | `https://xget.xi-xu.me/cr/opensuse/...` | -| Gitpod Registry | `gitpod` | `https://registry.gitpod.io/...` | `https://xget.xi-xu.me/cr/gitpod/...` | - -```url -# GitHub Container Registry original URL -https://ghcr.io/v2/nginxinc/nginx-unprivileged/manifests/latest - -# Transformed (add cr/ghcr prefix) -https://xget.xi-xu.me/cr/ghcr/v2/nginxinc/nginx-unprivileged/manifests/latest - -# Google Container Registry original URL -https://gcr.io/v2/distroless/base/manifests/latest - -# Transformed (add cr/gcr prefix) -https://xget.xi-xu.me/cr/gcr/v2/distroless/base/manifests/latest -``` - -Use cases are detailed in [Container Image Acceleration](#container-image-acceleration). - -## 🎯 Use Cases - -### Git Operations & Configuration - -Xget is fully compatible with Git protocol, supporting all standard Git operations with global acceleration configuration: - -#### Git Operations - -```bash -# Clone repository -git clone https://xget.xi-xu.me/gh/microsoft/vscode.git - -# Clone specific branch -git clone -b main https://xget.xi-xu.me/gh/facebook/react.git - -# Shallow clone (latest commit only) -git clone --depth 1 https://xget.xi-xu.me/gh/torvalds/linux.git - -# Clone GitLab repository -git clone https://xget.xi-xu.me/gl/gitlab-org/gitlab.git - -# Clone Gitea repository -git clone https://xget.xi-xu.me/gitea/gitea/gitea.git - -# Clone Codeberg repository -git clone https://xget.xi-xu.me/codeberg/forgejo/forgejo.git - -# Clone SourceForge repository -git clone https://xget.xi-xu.me/sf/projects/mingw-w64/code.git - -# Clone AOSP repository -git clone https://xget.xi-xu.me/aosp/platform/frameworks/base.git - -# Add remote repository -git remote add upstream https://xget.xi-xu.me/gh/[owner]/[repository].git - -# Pull updates -git pull https://xget.xi-xu.me/gh/microsoft/vscode.git main - -# Recursive submodule clone -git clone --recursive https://xget.xi-xu.me/gh/[username]/[repository-with-submodules].git -``` - -#### Git Global Acceleration Configuration - -```bash -# Configure Git to use Xget for specific domains -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/" - -# Verify configuration -git config --global --get-regexp url - -# Now all git clone operations for relevant platforms will automatically use Xget acceleration -git clone https://github.com/microsoft/vscode.git # Automatically converted to Xget URL -git clone https://gitlab.com/gitlab-org/gitlab.git # Automatically converted to Xget URL -git clone https://codeberg.org/forgejo/forgejo.git # Automatically converted to Xget URL -git clone https://android.googlesource.com/platform/frameworks/base.git # Automatically converted to Xget URL -``` - -### Mainstream Download Tool Integration - -#### wget Downloads - -```bash -# Download single file -wget https://xget.xi-xu.me/gh/microsoft/vscode/archive/refs/heads/main.zip - -# Resume download -wget -c https://xget.xi-xu.me/hf/microsoft/DialoGPT-large/resolve/main/pytorch_model.bin - -# Batch download -wget -i urls.txt # urls.txt contains multiple Xget URLs -``` - -#### cURL Downloads - -```bash -# Basic download -curl -L -O https://xget.xi-xu.me/gh/golang/go/archive/refs/tags/go1.22.0.tar.gz - -# Show progress bar -curl -L --progress-bar -o model.bin https://xget.xi-xu.me/hf/openai/whisper-large-v3/resolve/main/pytorch_model.bin - -# Set user agent -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 Multi-threaded Downloads - -```bash -# Multi-threaded download for large files -aria2c -x 16 -s 16 https://xget.xi-xu.me/hf/microsoft/DialoGPT-large/resolve/main/pytorch_model.bin - -# Resume download -aria2c -c https://xget.xi-xu.me/gh/microsoft/vscode/archive/refs/heads/main.zip - -# Batch download with config file -aria2c -i download-list.txt # File containing multiple Xget URLs -``` - -### Hugging Face Mirror - -```python -import os -from transformers import AutoTokenizer, AutoModelForCausalLM - -# Set environment variable to make transformers library automatically use Xget mirror -os.environ['HF_ENDPOINT'] = 'https://xget.xi-xu.me/hf' - -# Define model name -model_name = 'microsoft/DialoGPT-medium' - -print(f"Downloading model from mirror: {model_name}") - -# Use AutoModelForCausalLM to load dialogue generation model -# No additional parameters needed due to environment variable setting above -tokenizer = AutoTokenizer.from_pretrained(model_name) -model = AutoModelForCausalLM.from_pretrained(model_name) - -print("Model and tokenizer loaded successfully!") - -# You can now use the tokenizer and model -# For example: -# 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 Model Platform - -```python -import requests - -# Set API base URL to use Xget acceleration -base_url = "https://xget.xi-xu.me/civitai" - -# Get model information -def get_model_info(model_id): - """Retrieve Civitai model information""" - url = f"{base_url}/api/v1/models/{model_id}" - response = requests.get(url) - return response.json() - -# Download model -def download_model(model_version_id, output_path): - """Download Civitai model file""" - download_url = f"{base_url}/api/download/models/{model_version_id}" - - print(f"Downloading model version {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"Model downloaded to: {output_path}") - -# Usage example -model_id = 7240 # Example model ID -model_info = get_model_info(model_id) -print(f"Model name: {model_info['name']}") - -# Download the first model version -if model_info['modelVersions']: - version_id = model_info['modelVersions'][0]['id'] - download_model(version_id, f"model_{version_id}.safetensors") -``` - -### npm Package Acceleration - -#### Configure npm to use Xget mirror - -```bash -# Temporarily use Xget mirror -npm install --registry https://xget.xi-xu.me/npm/ - -# Globally configure npm mirror -npm config set registry https://xget.xi-xu.me/npm/ - -# Verify configuration -npm config get registry -``` - -#### Project-level usage - -```bash -# Configure project-level mirror in .npmrc file -echo "registry=https://xget.xi-xu.me/npm/" > .npmrc - -# Install dependencies -npm install - -# Or use yarn -yarn config set registry https://xget.xi-xu.me/npm/ -yarn install -``` - -### Python Package Acceleration - -#### Configure pip to use Xget mirror - -```bash -# Temporarily use Xget mirror -pip install requests -i https://xget.xi-xu.me/pypi/simple/ - -# Globally configure pip mirror -pip config set global.index-url https://xget.xi-xu.me/pypi/simple/ -pip config set global.trusted-host xget.xi-xu.me - -# Verify configuration -pip config list -``` - -#### Project-level usage - -```bash -# Create pip.conf file (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 - -# Or create pip.conf in project root directory -cat > pip.conf << EOF -[global] -index-url = https://xget.xi-xu.me/pypi/simple/ -trusted-host = xget.xi-xu.me -EOF - -# Install using config file -pip install -r requirements.txt --config-file pip.conf -``` - -#### Specify mirror in requirements.txt - -```txt -# 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 Package Acceleration - -#### Configure conda to use Xget mirror - -```bash -# Configure default channel mirrors -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 - -# Configure all community channel mirrors (recommended) -conda config --set channel_alias https://xget.xi-xu.me/conda/community - -# Or configure specific community channels -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 - -# Set channel priority -conda config --set channel_priority strict - -# Verify configuration -conda config --show -``` - -#### Configure in .condarc - -The .condarc file can be placed in the user home directory (`~/.condarc`) or project root: - -```yaml -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 -``` - -#### Using environment files - -Environment files can directly specify complete mirror URLs: - -```yaml -# 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 -``` - -```bash -# Create environment using environment file -conda env create -f environment.yml - -# Update environment -conda env update -f environment.yml -``` - -### Maven Package Acceleration - -#### Configure Maven to use Xget mirror - -```xml - - - - - xget-maven-central - central - Xget Maven Central Mirror - https://xget.xi-xu.me/maven/maven2 - - - -``` - -#### Project-level usage - -```xml - - - - - xget-maven-central - Xget Maven Central - https://xget.xi-xu.me/maven/maven2 - - - - - - xget-maven-central - Xget Maven Central - https://xget.xi-xu.me/maven/maven2 - - - -``` - -```bash -# Use command line to specify mirror -mvn clean install -Dmaven.repo.remote=https://xget.xi-xu.me/maven/maven2 - -# Download specific dependency -mvn dependency:get -Dartifact=org.springframework:spring-core:5.3.21 \ - -DremoteRepositories=https://xget.xi-xu.me/maven/maven2 -``` - -### Apache Software Downloads - -#### Download Apache software using Xget - -```bash -# Download Apache Kafka -wget https://xget.xi-xu.me/apache/kafka/3.6.1/kafka_2.13-3.6.1.tgz - -# Download 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 - -# Download Apache Spark -aria2c https://xget.xi-xu.me/apache/spark/spark-3.5.0/spark-3.5.0-bin-hadoop3.tgz - -# Download Apache Hadoop -wget https://xget.xi-xu.me/apache/hadoop/common/hadoop-3.3.6/hadoop-3.3.6.tar.gz - -# Download 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 -``` - -#### Common Apache software downloads - -```bash -# Big data related -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 servers -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 - -# Development tools -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 Package Acceleration - -#### Configure Gradle to use Xget mirror - -```gradle -// Configure Gradle mirror in build.gradle -repositories { - maven { - url 'https://xget.xi-xu.me/maven/maven2' - } - gradlePluginPortal { - url 'https://xget.xi-xu.me/gradle/m2' - } -} - -// Configure plugin repositories -pluginManagement { - repositories { - maven { - url 'https://xget.xi-xu.me/gradle/m2' - } - gradlePluginPortal() - } -} -``` - -#### Global configuration - -```gradle -// Configure global mirror in ~/.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() - } - } -} -``` - -```bash -# Use command line to specify mirror -gradle build -Dmaven.repo.remote=https://xget.xi-xu.me/maven/maven2 - -# Refresh dependencies -gradle build --refresh-dependencies -``` - -### Homebrew Package Acceleration - -#### Configure Homebrew to use Xget mirror - -```bash -# Set Homebrew environment variables to use Xget mirror -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" - -# Update Homebrew -brew update -``` - -#### Permanent configuration - -```bash -# Add to ~/.bash_profile for bash users -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 - -# Add to ~/.zprofile for zsh users -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 -``` - -#### Project usage - -```bash -# Install packages -brew install git - -# Search packages -brew search python - -# Update packages -brew upgrade - -# List installed packages -brew list -``` - -#### Verify mirror configuration - -```bash -# Check Homebrew configuration -brew config - -# View environment variables -echo $HOMEBREW_API_DOMAIN -echo $HOMEBREW_BOTTLE_DOMAIN -``` - -### Ruby Package Acceleration - -#### Configure RubyGems to use Xget mirror - -```bash -# Temporarily use Xget mirror -gem install rails --source https://xget.xi-xu.me/rubygems/ - -# Globally configure RubyGems mirror -gem sources --add https://xget.xi-xu.me/rubygems/ -gem sources --remove https://rubygems.org/ - -# Verify configuration -gem sources -l -``` - -#### Project usage - -```ruby -# Configure project-level mirror in Gemfile -source 'https://xget.xi-xu.me/rubygems/' - -gem 'rails', '~> 7.0.0' -gem 'pg', '~> 1.1' -gem 'puma', '~> 5.0' -``` - -```bash -# Use bundle to install -bundle config mirror.https://rubygems.org https://xget.xi-xu.me/rubygems/ -bundle install -``` - -### R Package Acceleration - -#### Configure R to use Xget CRAN mirror - -```r -# Temporarily use Xget CRAN mirror in R -install.packages("ggplot2", repos = "https://xget.xi-xu.me/cran/") - -# Globally configure CRAN mirror -options(repos = c(CRAN = "https://xget.xi-xu.me/cran/")) - -# Verify configuration -getOption("repos") -``` - -#### Configure in .Rprofile - -```r -# Configure global mirror in user home directory .Rprofile file -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" -)) - -# Set download method -options(download.file.method = "libcurl") -``` - -#### Project usage - -```r -# Specify mirror in project's renv.lock or scripts -renv::init() -renv::settings$repos.override(c(CRAN = "https://xget.xi-xu.me/cran/")) - -# Install packages -install.packages(c("dplyr", "ggplot2", "tidyr")) - -# Or use pak package manager -pak::pkg_install("tidyverse", repos = "https://xget.xi-xu.me/cran/") -``` - -```bash -# Use R script to install packages from command line -Rscript -e "options(repos = c(CRAN = 'https://xget.xi-xu.me/cran/')); install.packages('ggplot2')" - -# Batch install packages -Rscript -e " -options(repos = c(CRAN = 'https://xget.xi-xu.me/cran/')) -packages <- c('dplyr', 'ggplot2', 'tidyr', 'readr') -install.packages(packages) -" -``` - -### Perl Package Acceleration - -#### Configure CPAN to use Xget mirror - -```bash -# Configure CPAN to use Xget mirror -cpan o conf urllist push https://xget.xi-xu.me/cpan/ -cpan o conf commit - -# Or directly edit config file ~/.cpan/CPAN/MyConfig.pm -# Add: -# 'urllist' => [q[https://xget.xi-xu.me/cpan/]], -``` - -#### Use cpanm to install modules - -```bash -# Install cpanm (if not available) -curl -L https://cpanmin.us | perl - --sudo App::cpanminus - -# Install modules using Xget mirror -cpanm --mirror https://xget.xi-xu.me/cpan/ DBI -cpanm --mirror https://xget.xi-xu.me/cpan/ Mojolicious - -# Install dependencies from Makefile.PL -cpanm --mirror https://xget.xi-xu.me/cpan/ --installdeps . -``` - -#### Project usage - -```perl -# List dependencies in cpanfile -requires 'DBI'; -requires 'Mojolicious'; -requires 'JSON'; - -# Then install using Xget mirror -cpanm --mirror https://xget.xi-xu.me/cpan/ --installdeps . -``` - -### TeX/LaTeX Package Acceleration - -#### Configure TeX Live to use Xget CTAN mirror - -```bash -# Configure tlmgr to use Xget CTAN mirror -tlmgr option repository https://xget.xi-xu.me/ctan/systems/texlive/tlnet - -# Update package database -tlmgr update --self --all - -# Install packages -tlmgr install beamer -tlmgr install tikz -``` - -#### Configure MiKTeX to use Xget mirror - -```bash -# Windows MiKTeX configuration -mpm --set-repository=https://xget.xi-xu.me/ctan/systems/win32/miktex - -# Update package database -mpm --update-db - -# Install packages -mpm --install=beamer -mpm --install=pgf -``` - -#### Project usage - -```bash -# LaTeX document compilation with automatic missing package installation -pdflatex --shell-escape document.tex - -# Or manually install specific packages -tlmgr install caption -tlmgr install subcaption -tlmgr install algorithm2e -``` - -### Go Module Acceleration - -#### Configure Go to use Xget proxy - -```bash -# Configure Go module proxy -export GOPROXY=https://xget.xi-xu.me/golang,direct -export GOSUMDB=off - -# Or configure permanently -go env -w GOPROXY=https://xget.xi-xu.me/golang,direct -go env -w GOSUMDB=off - -# Verify configuration -go env GOPROXY -``` - -#### Project usage - -```bash -# Download dependencies -go mod download - -# Update dependencies -go get -u ./... - -# Clean module cache -go clean -modcache -``` - -### NuGet Package Acceleration - -#### Configure NuGet to use Xget mirror - -```bash -# Add Xget package source -dotnet nuget add source https://xget.xi-xu.me/nuget/v3/index.json -n xget - -# List package sources -dotnet nuget list source - -# Use in project -dotnet restore --source https://xget.xi-xu.me/nuget/v3/index.json -``` - -#### Configure in NuGet.Config - -```xml - - - - - - - -``` - -### Rust Package Acceleration - -#### Configure Cargo to use Xget mirror - -```bash -# Configure Cargo to use Xget mirror (in ~/.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 - -# Verify configuration -cargo search serde -``` - -#### Project usage - -```toml -# Normal dependency usage in Cargo.toml -[dependencies] -serde = "1.0" -tokio = "1.0" -reqwest = "0.11" -``` - -```bash -# Build project will automatically use Xget acceleration -cargo build - -# Update dependencies -cargo update - -# Add new dependencies -cargo add clap -``` - -### PHP Package Acceleration - -#### Configure Composer to use Xget mirror - -```bash -# Globally configure Composer mirror -composer config -g repo.packagist composer https://xget.xi-xu.me/packagist/ - -# Project-level configuration -composer config repo.packagist composer https://xget.xi-xu.me/packagist/ - -# Verify configuration -composer config -l -``` - -#### Configure in composer.json - -```json -{ - "repositories": [ - { - "type": "composer", - "url": "https://xget.xi-xu.me/packagist/" - } - ], - "require": { - "symfony/console": "^6.0", - "guzzlehttp/guzzle": "^7.0" - } -} -``` - -### Linux Distribution Acceleration - -#### Debian/Ubuntu APT Configuration - -```bash -# Backup original sources list -sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup - -# Configure Debian mirror -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 - -# Configure Ubuntu mirror -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 - -# Update package lists -sudo apt update -``` - -#### Fedora DNF Configuration - -```bash -# Configure Fedora mirror -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 - -# Update package cache -sudo dnf makecache -``` - -#### Rocky Linux DNF Configuration - -```bash -# Configure Rocky Linux mirror -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 - -# Update package cache -sudo dnf makecache -``` - -#### openSUSE Zypper Configuration - -```bash -# Configure openSUSE Leap mirror -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 - -# Configure openSUSE Tumbleweed mirror -sudo zypper mr -d repo-oss -sudo zypper ar -f https://xget.xi-xu.me/opensuse/tumbleweed/repo/oss/ repo-oss-xget - -# Refresh repositories -sudo zypper refresh - -# Verify configuration -sudo zypper lr -u -``` - -#### Arch Linux Pacman Configuration - -```bash -# Backup original mirror list -sudo cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.backup - -# Configure Arch Linux mirror -echo 'Server = https://xget.xi-xu.me/arch/$repo/os/$arch' | sudo tee /etc/pacman.d/mirrorlist - -# Update package database -sudo pacman -Sy -``` - -### Academic Resource Acceleration - -#### arXiv Paper Downloads - -```bash -# Download arXiv paper PDF -wget https://xget.xi-xu.me/arxiv/pdf/2301.07041.pdf - -# Download paper source code -curl -L -O https://xget.xi-xu.me/arxiv/e-print/2301.07041 - -# Batch download multiple papers -for id in 2301.07041 2302.13971 2303.08774; do - wget https://xget.xi-xu.me/arxiv/pdf/${id}.pdf -done -``` - -#### Usage in academic tools - -```python -# Use arXiv acceleration in Python -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 paper -download_arxiv_paper("2301.07041", "attention_is_all_you_need.pdf") -``` - -### F-Droid Repository Mirror - -F-Droid is the largest open-source app store on the Android platform. Xget provides high-speed mirror services for F-Droid repositories, significantly improving app download and update speeds. - -#### Configure F-Droid client to use Xget mirror - -1. In the F-Droid app, go to **Settings** → **Repositories** -2. Click **+** and enter repository URL: `https://xget.xi-xu.me/fdroid/repo` -3. Click **Add** then click **Add Mirror** - -#### Supported F-Droid services - -```url -# F-Droid app APK downloads -https://xget.xi-xu.me/fdroid/repo/[package-name]_[version-code].apk - -# F-Droid repository index -https://xget.xi-xu.me/fdroid/repo/index-v1.jar - -# F-Droid app icons -https://xget.xi-xu.me/fdroid/repo/icons-640/[package-name].[version-code].png - -# F-Droid API endpoints -https://xget.xi-xu.me/fdroid/api/v1/packages/[package-name] -``` - -#### Usage examples - -```bash -# Directly download F-Droid client APK -wget https://xget.xi-xu.me/fdroid/repo/org.fdroid.fdroid_1016050.apk - -# Download other open-source apps -curl -L -O https://xget.xi-xu.me/fdroid/repo/org.mozilla.fennec_fdroid_1014000.apk - -# Get app information -curl https://xget.xi-xu.me/fdroid/api/v1/packages/org.fdroid.fdroid -``` - -#### Batch app management - -```bash -# Create app download script -cat > download_fdroid_apps.sh << 'EOF' -#!/bin/bash - -# Define app list to download -apps=( - "org.fdroid.fdroid_1016050.apk" - "org.mozilla.fennec_fdroid_1014000.apk" - "com.termux_1180.apk" - "org.videolan.vlc_13050399.apk" -) - -# Create download directory -mkdir -p fdroid_apps - -# Batch download apps -for app in "${apps[@]}"; do - echo "Downloading: $app" - wget -P fdroid_apps "https://xget.xi-xu.me/fdroid/repo/$app" -done - -echo "All apps downloaded!" -EOF - -chmod +x download_fdroid_apps.sh -./download_fdroid_apps.sh -``` - -#### Developer integration - -For Android developers, F-Droid mirror can be integrated into build scripts: - -```gradle -// Configure F-Droid dependency checking in build.gradle -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 "App available on F-Droid: $fdroidUrl" - } - } catch (Exception e) { - println "Error checking F-Droid availability: ${e.message}" - } - } -} -``` - -### AI Inference API Acceleration - -Xget provides acceleration services for numerous AI inference APIs, significantly improving API response speed and reliability through intelligent routing optimization. - -#### OpenAI API - -```python -import openai - -# Use Xget-accelerated OpenAI API -client = openai.OpenAI( - api_key="your-api-key", - base_url="https://xget.xi-xu.me/ip/openai/v1" # Use Xget acceleration -) - -# Chat completion -response = client.chat.completions.create( - model="gpt-4", - messages=[ - {"role": "user", "content": "Hello, how are you?"} - ] -) - -print(response.choices[0].message.content) -``` - -#### Anthropic API - -```python -import anthropic - -# Use Xget-accelerated Anthropic API -client = anthropic.Anthropic( - api_key="your-api-key", - base_url="https://xget.xi-xu.me/ip/anthropic" # Use Xget acceleration -) - -# Create message -message = client.messages.create( - model="claude-3-sonnet-20240229", - max_tokens=1000, - messages=[ - {"role": "user", "content": "Hello, Claude!"} - ] -) - -print(message.content) -``` - -#### Gemini API - -```python -import google.generativeai as genai - -# Configure API key -genai.configure(api_key="your-api-key") - -# Use custom transport to configure Xget acceleration -import requests - -class XgetTransport: - def __init__(self, base_url): - self.base_url = base_url - - def request(self, method, url, **kwargs): - # Forward requests to Xget acceleration service - accelerated_url = url.replace("https://generativelanguage.googleapis.com", - "https://xget.xi-xu.me/ip/gemini") - return requests.request(method, accelerated_url, **kwargs) - -# Create model instance -model = genai.GenerativeModel('gemini-pro') - -# Generate content -response = model.generate_content("Write a brief introduction about artificial intelligence") -print(response.text) -``` - -#### Multi-provider unified interface - -```python -import requests -import json - -def call_ai_api(provider, endpoint, data, api_key): - """ - Unified AI API calling function supporting multiple providers - """ - headers = { - "Authorization": f"Bearer {api_key}", - "Content-Type": "application/json" - } - - # Use Xget acceleration URL - url = f"https://xget.xi-xu.me/ip/{provider}/{endpoint}" - - response = requests.post(url, headers=headers, json=data) - return response.json() - -# Usage examples -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 - } - } -} - -# Loop through different providers -for provider, config in providers.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}") - except Exception as e: - print(f"Error calling {provider}: {e}") -``` - -#### JavaScript/Node.js usage - -```javascript -// OpenAI API acceleration -import OpenAI from 'openai'; - -const openai = new OpenAI({ - apiKey: 'your-api-key', - baseURL: 'https://xget.xi-xu.me/ip/openai', // Use Xget acceleration -}); - -async function chatWithGPT() { - const completion = await openai.chat.completions.create({ - messages: [{ role: 'user', content: 'Hello!' }], - model: 'gpt-4', - }); - - console.log(completion.choices[0].message.content); -} - -// Anthropic API acceleration -import Anthropic from '@anthropic-ai/sdk'; - -const anthropic = new Anthropic({ - apiKey: 'your-api-key', - baseURL: 'https://xget.xi-xu.me/ip/anthropic', // Use Xget acceleration -}); - -async function chatWithClaude() { - const message = await anthropic.messages.create({ - model: 'claude-3-sonnet-20240229', - max_tokens: 1000, - messages: [{ role: 'user', content: 'Hello!' }], - }); - - console.log(message.content); -} -``` - -#### Environment variable configuration - -```bash -# Configure in .env file -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 -``` - -Then use in code: - -```python -import os -from openai import OpenAI - -# Read configuration from environment variables -client = OpenAI( - api_key=os.getenv("OPENAI_API_KEY"), - base_url=os.getenv("OPENAI_BASE_URL") # Automatically use Xget acceleration -) -``` - -### Container Image Acceleration - -Xget provides comprehensive acceleration support for container image pulling, compatible with Docker, Podman, containerd, and other container runtimes. - -#### Docker Configuration - -```bash -# Configure Docker to use Xget image acceleration -# Edit /etc/docker/daemon.json (Linux) or ~/.docker/daemon.json (macOS/Windows) -{ - "registry-mirrors": [ - "https://xget.xi-xu.me/cr/ghcr" - ] -} - -# Restart Docker service -sudo systemctl restart docker # Linux -# Or restart service in Docker Desktop - -# Verify configuration -docker info | grep -A 10 "Registry Mirrors" -``` - -#### Direct image pulling - -```bash -# Pull GitHub Container Registry images -docker pull xget.xi-xu.me/cr/ghcr/nginxinc/nginx-unprivileged:latest - -# Pull Google Container Registry images -docker pull xget.xi-xu.me/cr/gcr/distroless/base:latest - -# Pull Microsoft Container Registry images -docker pull xget.xi-xu.me/cr/mcr/dotnet/runtime:8.0 -``` - -#### Kubernetes deployment configuration - -```yaml -# deployment.yaml - Use Xget-accelerated images -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 configuration - -```yaml -# docker-compose.yml - Use Xget-accelerated images -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 optimization - -```dockerfile -# Use Xget-accelerated base images in Dockerfile -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 - -# Production stage -FROM xget.xi-xu.me/cr/ghcr/nginxinc/nginx-unprivileged:latest -COPY --from=builder /app/dist /usr/share/nginx/html - -# Use Microsoft Container Registry .NET images -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 integration - -```yaml -# GitHub Actions - Use Xget acceleration for container builds -name: Build and Deploy -on: [push] - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: Build with accelerated base images - run: | - # Build using Xget-accelerated base images - 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: | - # Test using accelerated images - docker run --rm \ - xget.xi-xu.me/cr/mcr/dotnet/runtime:8.0 \ - dotnet --version -``` - -#### Podman configuration - -```bash -# Configure Podman to use Xget image acceleration -# Edit /etc/containers/registries.conf -[[registry]] -prefix = "ghcr.io" -location = "xget.xi-xu.me/cr/ghcr" - -# Or pull directly -podman pull xget.xi-xu.me/cr/ghcr/alpine/alpine:latest -podman pull xget.xi-xu.me/cr/ghcr/nginxinc/nginx-unprivileged:latest -``` - -#### containerd configuration - -```toml -# Configure containerd to use Xget acceleration -# Edit /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"] -``` - -```bash -# Restart containerd -sudo systemctl restart containerd -``` - -### CI/CD Environment Integration - -#### GitHub Actions - -```yaml -name: Download Dependencies -on: [push] - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Download model files - run: | - # Use Xget acceleration to download large model files - wget https://xget.xi-xu.me/hf/microsoft/DialoGPT-medium/resolve/main/pytorch_model.bin - - - name: Clone dependency repo - run: | - # Use Xget acceleration for Git cloning - git clone https://xget.xi-xu.me/gh/[owner]/[repository].git - - - name: Download release assets - run: | - # Batch download release files - curl -L -O https://xget.xi-xu.me/gh/[owner]/[repository]/releases/download/v1.0.0/[filename].tar.gz - curl -L -O https://xget.xi-xu.me/gh/[owner]/[repository]/releases/download/v1.0.0/[filename].zip -``` - -#### GitLab CI - -```yaml -stages: - - download - - build - -download_dependencies: - stage: download - script: - # Use Xget acceleration for downloads - - wget https://xget.xi-xu.me/gl/gitlab-org/gitlab-runner/-/archive/main/gitlab-runner-main.zip - - git clone https://xget.xi-xu.me/gh/[owner]/[dependency-repository].git - # Download Hugging Face datasets - - curl -L -O https://xget.xi-xu.me/hf/datasets/wikitext/resolve/main/wikitext-103-v1/wiki.train.tokens - artifacts: - paths: - - "*.zip" - - "*.json" - - dependency/ -``` - -#### Docker build optimization - -```dockerfile -FROM ubuntu:22.04 - -# Use Xget acceleration for downloads in Docker builds -RUN apt-get update && apt-get install -y wget curl git - -# Download large files -RUN wget https://xget.xi-xu.me/gh/microsoft/vscode/archive/refs/heads/main.zip - -# Clone source code -RUN git clone https://xget.xi-xu.me/gh/[owner]/[source-repository].git /app - -# Download model files -RUN curl -L -O /models/model.bin https://xget.xi-xu.me/hf/microsoft/DialoGPT-medium/resolve/main/pytorch_model.bin - -# Configure and install conda packages -RUN echo "default_channels:" > ~/.condarc && \ - echo " - https://xget.xi-xu.me/conda/pkgs/main" >> ~/.condarc && \ - echo " - https://xget.xi-xu.me/conda/pkgs/r" >> ~/.condarc && \ - echo " - https://xget.xi-xu.me/conda/pkgs/msys2" >> ~/.condarc && \ - echo "channel_alias: https://xget.xi-xu.me/conda/community" >> ~/.condarc && \ - echo "channel_priority: strict" >> ~/.condarc && \ - conda install -y numpy pandas matplotlib - -WORKDIR /app -``` - -## 🚀 Deployment Options - -### Cloudflare Workers (Highly recommended) - -[![Deploy to Cloudflare Workers](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/xixu-me/Xget) - -**Strongly recommend using Cloudflare Workers for deployment**, which offers the following advantages: - -- **💰 Cost-effective**: Free in most cases, except for domain registration fees -- **🚀 Best Performance**: Global edge nodes for fastest response times -- **🔧 Simple Maintenance**: No server management required, automatic scaling and updates - -After deployment, your Xget service will be available at `your-worker-name.your-subdomain.workers.dev`. - -### Other Deployment Options - -Other deployment methods are provided to meet diverse user needs: - -#### Vercel - -[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https://github.com/xixu-me/Xget) - -After deployment, your Xget service will be available at `your-project-name.vercel.app`. - -#### Docker - -##### Using Pre-built Images - -```bash -# Pull the latest image -docker pull ghcr.io/xixu-me/xget:latest - -# Run the container -docker run -d \ - --name xget \ - -p 3000:3000 \ - --restart unless-stopped \ - ghcr.io/xixu-me/xget:latest -``` - -##### Building Locally - -```bash -# Clone the repository -git clone https://github.com/xixu-me/Xget.git -cd Xget - -# Build the image -docker build -t xget . - -# Run the container -docker run -d \ - --name xget \ - -p 3000:3000 \ - --restart unless-stopped \ - xget -``` - -##### Docker Compose - -Create a `docker-compose.yml` file: - -```yaml -version: '3.8' - -services: - xget: - image: ghcr.io/xixu-me/xget:latest - container_name: xget - ports: - - "3000:3000" - restart: unless-stopped - environment: - - NODE_ENV=production - - PORT=3000 - healthcheck: - test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3000/api/health"] - interval: 30s - timeout: 10s - retries: 3 - start_period: 40s -``` - -Then run: - -```bash -docker-compose up -d -``` - -##### Kubernetes Deployment - -Create a `k8s-deployment.yaml`: - -```yaml -apiVersion: apps/v1 -kind: Deployment -metadata: - name: xget - labels: - app: xget -spec: - replicas: 3 - selector: - matchLabels: - app: xget - template: - metadata: - labels: - app: xget - spec: - containers: - - name: xget - image: ghcr.io/xixu-me/xget:latest - ports: - - containerPort: 3000 - env: - - name: NODE_ENV - value: "production" - - name: PORT - value: "3000" - livenessProbe: - httpGet: - path: /api/health - port: 3000 - initialDelaySeconds: 30 - periodSeconds: 10 - readinessProbe: - httpGet: - path: /api/health - port: 3000 - initialDelaySeconds: 5 - periodSeconds: 5 - resources: - requests: - memory: "128Mi" - cpu: "100m" - limits: - memory: "256Mi" - cpu: "500m" ---- -apiVersion: v1 -kind: Service -metadata: - name: xget-service -spec: - selector: - app: xget - ports: - - protocol: TCP - port: 80 - targetPort: 3000 - type: LoadBalancer -``` - -Deploy to Kubernetes: - -```bash -kubectl apply -f k8s-deployment.yaml -``` - -After deployment, your Xget service will be available at `http://localhost:3000`. You can check the service status through the `/api/health` endpoint. - -## 🔧 Configuration - -### Configuration Parameters - -You can customize configuration by modifying `src/config/index.js`: - -```javascript -export const CONFIG = { - TIMEOUT_SECONDS: 30, // Request timeout (seconds) - MAX_RETRIES: 3, // Maximum retry attempts - RETRY_DELAY_MS: 1000, // Retry delay (milliseconds) - CACHE_DURATION: 1800, // Cache duration (1800 seconds = 30 minutes) - SECURITY: { - ALLOWED_METHODS: ["GET", "HEAD"], // Allowed HTTP methods (Git operations dynamically allow POST) - ALLOWED_ORIGINS: ["*"], // Allowed CORS origins - MAX_PATH_LENGTH: 2048, // Maximum path length (characters) - }, -}; -``` - -### Performance Tuning Recommendations - -- **Cache Optimization**: Adjust `CACHE_DURATION` based on usage patterns; frequently updated repositories can use lower values -- **Timeout Settings**: Increase `TIMEOUT_SECONDS` for poor network conditions -- **Retry Strategy**: Increase `MAX_RETRIES` and `RETRY_DELAY_MS` for high-latency environments - -### Adding New Platforms - -To add support for new platforms, edit `src/config/platforms.js`: - -```javascript -export const PLATFORMS = { - // Existing platforms... - - // New platform example - custom: { - base: "https://example.com", - transform: (path) => path.replace(/^\/custom\//, "/"), - }, -}; -``` - -## 🚧 Development - -1. **Repository Setup** - - ```bash - git clone https://github.com/xixu-me/Xget.git - cd Xget - npm install - npx wrangler login # First time use - ``` - -2. **Local Development** - - ```bash - npm run dev # Start development server (http://localhost:8787) - npm run test:run # Run complete test suite - npm run test:coverage # Generate test coverage report - npm run lint # Code linting - npm run format # Code formatting - npm run deploy # Deploy to production - ``` - -## 🧪 Testing - -The repository includes a comprehensive test suite ensuring code quality and functionality. - -### Complete Testing - -```bash -# Install test dependencies -npm install - -# Run all tests -npm run test:run - -# Generate coverage report -npm run test:coverage - -# Watch mode -npm run test:watch -``` - -### Test Coverage - -- **Unit Tests**: Core functionality, platform configuration, performance monitoring -- **Integration Tests**: End-to-end workflows, platform integration, Git protocol -- **Security Tests**: Input validation, security headers, permission control -- **Performance Tests**: Response time, memory usage, concurrent processing - -## 🔍 Troubleshooting - -### Common Issues - -**Q: Download speed not significantly improved?** -A: Check if source files are already cached on CDN edge nodes. First access may be slower, subsequent access will be significantly faster. - -**Q: Git operations failing?** -A: Confirm correct URL format usage and that Git client version supports HTTPS proxy. - -**Q: Cannot access after deployment?** -A: Check if Cloudflare Workers domain is correctly bound and confirm `wrangler.toml` configuration is correct. - -**Q: Getting 400 errors?** -A: Check URL path format and confirm platform prefix is used correctly. - -### Performance Monitoring - -The service returns performance metrics in response headers: - -- `X-Performance-Metrics`: Contains timing statistics for request stages -- `X-Cache-Status`: Shows cache hit status - -### Debug Logging - -In development environment, you can view detailed logs through Cloudflare Workers console: - -```bash -npx wrangler dev --log-level debug -``` - -## ⚠️ Disclaimer - -- **Legal and Compliant Use**: This repository is solely for accelerating legal public resource access, including but not limited to file downloads, Git operations, AI inference API calls, container image pulls, package manager access, etc. Users must strictly comply with all relevant platform terms of service, usage agreements, and local laws and regulations. Any illegal, infringing, or malicious use is strictly prohibited. Any use beyond the scope of legal public resources shall be the user's own legal responsibility -- **Service Availability Statement**: The public instance `xget.xi-xu.me` is provided as a free open-source service without Service Level Agreement (SLA) guarantees. While we strive to maintain service stability, we do not promise 100% availability. Production environments or critical business operations should deploy dedicated instances -- **Data Privacy Protection**: Xget employs a no-logging architecture and does not store, record, or analyze user request data. However, users should still handle sensitive information carefully and avoid transmitting confidential content over public networks -- **Liability Limitation**: Repository maintainers and contributors assume no legal responsibility for any direct losses, indirect losses, data loss, business interruption, or other consequences that may arise from using this service -- **Third-party Platform Respect**: Please strictly adhere to the terms of service, API usage limits, and rate controls of GitHub, GitLab, Gitea, Codeberg, SourceForge, Hugging Face, various package management platforms and container registries, etc. Avoid causing excessive load on source platforms -- **Intellectual Property Protection**: Users should ensure that downloaded content does not infringe on any third-party intellectual property rights. For copyrighted content obtained through this service, please comply with the corresponding license agreements and terms of use -- **Security Risk Warning**: Although Xget implements multiple security measures, internet transmission carries inherent risks. Users are advised to perform security scans on downloaded files, especially executable files and scripts - -## 🤝 Contributing - -We welcome all forms of contributions! Please check the [Contributing Guide](CONTRIBUTING.md) to learn how to participate in repository development. - -1. **Report Issues**: Use [issue templates](https://github.com/xixu-me/Xget/issues/new/choose) to report bugs or request features -2. **Submit Code**: Fork the repository, create feature branches, submit pull requests -3. **Improve Documentation**: Fix errors, add examples, improve explanations -4. **Testing Feedback**: Test in different environments and provide feedback - -## 🌟 Star History - - - - - - Star History Chart - - - -## 📞 Contact - -- **Author**: [Xi Xu](https://xi-xu.me) -- **Email**: [Contact Email](mailto:i@xi-xu.me) -- **Sponsor**: [Sponsor URL](https://xi-xu.me/#sponsorships) - -## 📝 License - -This repository is licensed under the GPL-3.0 License - see the [LICENSE](LICENSE) file for details. - ---- - -
- -**If this repository helps you, please consider giving it a ⭐ star!** - -Made with ❤️ by [Xi Xu](https://xi-xu.me) - -
diff --git a/README.md b/README.md index 76f18f2..28f164d 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,5 @@ # Xget -**[English](README.en.md)** - [![Chromium 扩展](https://img.shields.io/badge/Chromium%20扩展-4285F4?logo=googlechrome&logoColor=white)](#-生态系统集成) [![Firefox 扩展](https://img.shields.io/badge/Firefox%20扩展-582ACB?logo=Firefox&logoColor=white)](#-生态系统集成) [![Cloudflare Workers](https://img.shields.io/badge/Cloudflare%20Workers-F38020?&logo=cloudflare&logoColor=white)](#cloudflare-workers强烈推荐)