Skip to content

cargo can't fetch crates when the SOCKS5 server is in an IPv4-only network #15390

Open
@Lanius-collaris

Description

@Lanius-collaris

Problem

cargo can't fetch crates when the SOCKS5 server is in an IPv4-only network. ( index.crates.io is dual-stack )

~/hello $ export https_proxy=socks5://192.168.1.1:1080
~/hello $ cargo add libc
    Updating crates.io index
error: download of config.json failed

Caused by:
  failed to download from `https://index.crates.io/config.json`

Caused by:
  [97] proxy handshake error (cannot complete SOCKS5 connection to index.crates.io. (3))

Reply field = 3 means "network unreachable".
https://www.rfc-editor.org/rfc/rfc1928#section-6

Steps

  1. delete the IPv6 default route on a SOCKS5 server
    ip route del ::/0
  2. tell cargo to fetch something via this SOCKS5 server

Possible Solution(s)

retry with other IP addresses anyway or use "socks5h://"

Notes

No response

Version

cargo 1.85.1 (d73d2caf9 2024-12-31)
release: 1.85.1
commit-hash: d73d2caf9e41a39daf2a8d6ce60ec80bf354d2a7
commit-date: 2024-12-31
host: x86_64-unknown-linux-musl
libgit2: 1.8.1 (sys:0.19.0 vendored)
libcurl: 8.9.0-DEV (sys:0.4.74+curl-8.9.0 vendored ssl:OpenSSL/1.1.1w)
ssl: OpenSSL 1.1.1w  11 Sep 2023

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-networkingArea: networking issues, curl, etc.C-bugCategory: bugS-needs-infoStatus: Needs more info, such as a reproduction or more background for a feature request.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions