rust 更换国内源

服务介绍
由于国内拉取 crates.io 以及安装 Rust 会面临流量出境不稳定的问题,我们提供了一个国内镜像代理以帮助国内 Rust 生态发展,欢迎大家使用。
配置说明
步骤一:设置 Rustup 镜像, 修改配置 ~/.zshrc or ~/.bashrc (配置环境变量)

export RUSTUP_DIST_SERVER="https://rsproxy.cn"
export RUSTUP_UPDATE_ROOT="https://rsproxy.cn/rustup"

步骤二:设置 crates.io 镜像, 修改配置 ~/.cargo/config,已支持git协议和sparse协议,>=1.68 版本建议使用 sparse-index,速度更快。

[source.crates-io]
replace-with = 'rsproxy-sparse'
[source.rsproxy]
registry = "https://rsproxy.cn/crates.io-index"
[source.rsproxy-sparse]
registry = "sparse+https://rsproxy.cn/index/"
[registries.rsproxy]
index = "https://rsproxy.cn/crates.io-index"
[net]
git-fetch-with-cli = true

参考 https://rsproxy.cn/#getStarted

posted @ 2024-04-06 21:23  MasonLee  阅读(1112)  评论(0编辑  收藏  举报