Skip to content

pysocks is ignoring the relay host provided by the socks proxy #172

Open
@mvanholsteijn

Description

@mvanholsteijn

We have 3 socks proxies behind a load balancer for HA purposes. It works fine for TCP proxy requests, but fails for UDP proxy request. The socks proxy returns the correct IP address and port for the UDP proxy port, but PySocks overrides the hostname with the hostname of the loadbalancer.

PySocks/socks.py

Lines 355 to 358 in 91dcdf0

# The relay is most likely on the same host as the SOCKS proxy,
# but some proxies return a private IP address (10.x.y.z)
host, _ = proxy
_, port = relay

The comment suggests this is intentional, but the SOCKS5 proxy is allowed to return a different IP address to bind to, so the fix in the client code hides a misconfiguration in the SOCKS proxy.

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