kafka.net.socks5

class kafka.net.socks5.Socks5Proxy(proxy_url=None)[source]

Socks5 proxy

Manages connection through socks5 proxy with support for username/password authentication.

SCHEMES = ('socks5', 'socks5h')
connect_ex(sock, addr)[source]

Runs a state machine through connection to authentication to proxy connection request.

The somewhat strange setup is to facilitate non-intrusive use from BrokerConnection state machine.

This function is called with a socket in non-blocking mode. Both send and receive calls can return in EWOULDBLOCK/EAGAIN which we specifically avoid handling here. These are handled in main BrokerConnection connection loop, which then would retry calls to this function.

dns_lookup(host, port, proxy=False)[source]
socket(family=AddressFamily.AF_UNSPEC, sock_type=SocketKind.SOCK_STREAM, proto=6)[source]

Open and record a socket.

Returns the actual underlying socket object to ensure e.g. selects and ssl wrapping works as expected.