pybitmessage.network.socks5 module

SOCKS5 proxy module

exception Socks5AuthError(code=-1)[source]

Bases: pybitmessage.network.proxy.ProxyError

Rised when the socks5 protocol encounters an authentication error

errorCodes = ('Succeeded', 'Authentication is required', 'All offered authentication methods were rejected', 'Unknown username or invalid password', 'Unknown error')
exception Socks5Error(code=-1)[source]

Bases: pybitmessage.network.proxy.ProxyError

Rised when socks5 protocol encounters an error

errorCodes = ('Succeeded', 'General SOCKS server failure', 'Connection not allowed by ruleset', 'Network unreachable', 'Host unreachable', 'Connection refused', 'TTL expired', 'Command not supported', 'Address type not supported', 'Unknown error')
class Socks5(address=None)[source]

Bases: pybitmessage.network.proxy.Proxy

A socks5 proxy base class

state_init()

Protocol initialization (before connection is established)

state_auth_1()

Perform authentication if peer is requesting it.

state_auth_needed()

Handle response to authentication attempt

state_pre_connect()

Handle feedback from socks5 while it is connecting on our behalf.

state_proxy_addr_1()

Handle IPv4 address returned for peer

state_proxy_addr_2_1()

Handle other addresses than IPv4 returned for peer (e.g. IPv6, onion, …). This is part 1 which retrieves the length of the data.

state_proxy_addr_2_2()

Handle other addresses than IPv4 returned for peer (e.g. IPv6, onion, …). This is part 2 which retrieves the data.

state_proxy_port()

Handle peer’s port being returned.

proxy_sock_name()

Handle return value when using SOCKS5 for DNS resolving instead of connecting.

class Socks5Connection(address=None)[source]

Bases: pybitmessage.network.socks5.Socks5

Child socks5 class used for making outbound connections.

state_auth_done()

Request connection to be made

state_pre_connect()

Tell socks5 to initiate a connection

class Socks5Resolver(host)[source]

Bases: pybitmessage.network.socks5.Socks5

DNS resolver class using socks5

state_auth_done()

Perform resolving

resolved()

Resolving is done, process the return value. To use this within PyBitmessage, a callback needs to be implemented which hasn’t been done yet.