Go / Rust / Java / .NET

其他主流语言的依赖下载。

Go

Go 默认使用 proxy.golang.org,读取环境变量:

bash
export HTTPS_PROXY=http://127.0.0.1:7898
go env -w GOPROXY=https://proxy.golang.org,direct
go mod download

私有仓库请设置 GOPRIVATE,避免它们经过公共模块代理。

Rust(cargo、rustup)

~/.cargo/config.toml:

toml
[http]
proxy = "http://127.0.0.1:7898"

rustup 读取环境变量:

bash
export HTTPS_PROXY=http://127.0.0.1:7898
rustup update

Java · Maven

~/.m2/settings.xml:

xml
<settings>
  <proxies>
    <proxy>
      <id>coderboost</id>
      <active>true</active>
      <protocol>http</protocol>
      <host>127.0.0.1</host>
      <port>7898</port>
      <nonProxyHosts>localhost|127.0.0.1</nonProxyHosts>
    </proxy>
  </proxies>
</settings>

Java · Gradle

~/.gradle/gradle.properties:

properties
systemProp.http.proxyHost=127.0.0.1
systemProp.http.proxyPort=7898
systemProp.https.proxyHost=127.0.0.1
systemProp.https.proxyPort=7898
systemProp.http.nonProxyHosts=localhost|127.0.0.1

.NET(NuGet)

bash
dotnet nuget config set http_proxy http://127.0.0.1:7898

或设置 HTTPS_PROXY 环境变量。

Ruby / PHP / Dart

  • RubyGems、Bundler:读取 https_proxy;或 gem install --http-proxy http://127.0.0.1:7898 <gem>。
  • Composer:读取 HTTPS_PROXY / HTTP_PROXY。
  • Dart / Flutter:读取 HTTPS_PROXY。