# `txtorcon.socks` Module

## SOCKS5 Errors

### SocksError

class txtorcon.socks.SocksError(message='', code=None)

### GeneralServerFailureError

class txtorcon.socks.GeneralServerFailureError(message='', code=None)

### ConnectionNotAllowedError

class txtorcon.socks.ConnectionNotAllowedError(message='', code=None)

### NetworkUnreachableError

class txtorcon.socks.NetworkUnreachableError(message='', code=None)

### HostUnreachableError

class txtorcon.socks.HostUnreachableError(message='', code=None)

### ConnectionRefusedError

class txtorcon.socks.ConnectionRefusedError(message='', code=None)

### TtlExpiredError

class txtorcon.socks.TtlExpiredError(message='', code=None)

### CommandNotSupportedError

class txtorcon.socks.CommandNotSupportedError(message='', code=None)

### AddressTypeNotSupportedError

class txtorcon.socks.AddressTypeNotSupportedError(message='', code=None)

Note

The following sections present low-level APIs. If you are able to work with `txtorcon.Tor`’s corresponding high-level APIs, you should do so.

## resolve

txtorcon.socks.resolve(tor_endpoint, hostname)

  This is easier to use via `txtorcon.Tor.dns_resolve()`

  Parameters:

    - tor_endpoint – the Tor SOCKS endpoint to use.

    - hostname – the hostname to look up.

## resolve_ptr

txtorcon.socks.resolve_ptr(tor_endpoint, ip)

  This is easier to use via `txtorcon.Tor.dns_resolve_ptr()`

  Parameters:

    - tor_endpoint – the Tor SOCKS endpoint to use.

    - ip – the IP address to look up.

## TorSocksEndpoint

class txtorcon.socks.TorSocksEndpoint(socks_endpoint, host, port, tls=False)

  Represents an endpoint which will talk to a Tor SOCKS port.

  These should usually not be instantiated directly, instead use `txtorcon.TorConfig.socks_endpoint()`.