Skip to content

Cannot connect to v6 address via SOCKS5 proxy on linux #637

@casept

Description

@casept

I'm trying to connect to localhost's IPv6 address (::1) via a SOCKS5 proxy using reqwest. The code below works perfectly fine on Windows, but fails on Linux with

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error(Hyper(Error(Connect, Custom { kind: Other, error: "failed to lookup address information: Name or service not known" })), "http://[::1]:8080/")', src/libcore/result.rs:999:5

.

The code in question:

use reqwest;

fn main() {
    let proxy_uri = "socks5://127.0.0.1:1080";
    let proxy = reqwest::Proxy::all(proxy_uri).expect("Failed to convert proxy address");
    let client = reqwest::ClientBuilder::new().proxy(proxy).build().unwrap();

    let dest_url = format!("http://[::1]:{}", 8080);
    let mut resp = client.get(&dest_url).send().unwrap();
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions