Giter VIP home page Giter VIP logo

crates-io-proxy's Introduction

Caching HTTP proxy server for crates.io downloads

Introduction

The proxy server listens to HTTP GET requests at /api/v1/crates/{crate}/{version}/download, forwards them to https://crates.io/ and caches the downloaded crates as .crate files on the local filesystem. Subsequent download API hits are serviced using the locally cached crate files.

To use the proxy server, clone and rehost the crates.io index repository from GitHub and change "dl" parameter in config.json file in the repository root to point to the proxy server instead:

{
    "dl": "https://crates-io-proxy.example.com/api/v1/crates",
    "api": "https://crates.io"
}

Cargo can be told to use the package index mirror by using the source replacement feature. Add the following lines to your .cargo/config:

[source.crates-io]
registry = "https://crates-io-mirror.example.com/crates-io-index.git"

Configuration

The proxy server can be configured by either command line options or environment variables.

Run crates-io-proxy --help to get the following help page:

Usage:
    crates-io-proxy [options]

Options:
    -v, --verbose              print more debug info
    -h, --help                 print help and exit
    -V, --version              print version and exit
    -L, --listen ADDRESS:PORT  address and port to listen at (0.0.0.0:3080)
    -U, --upstream-url URL     upstream crates.io URL (https://crates.io/)
    -C, --cache-dir DIR        proxy cache directory (/var/cache/crates-io-proxy)

Environment:
    CRATES_IO_URL              same as --upstream-url option
    CRATES_IO_PROXY_CACHE_DIR  same as --cache-dir option

crates-io-proxy's People

Contributors

lukeb2e avatar ravenexp avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.