pybitmessage.network.tcp module

TCP protocol handler

maximumAgeOfNodesThatIAdvertiseToOthers = 10800[source]

Equals three hours

maximumTimeOffsetWrongCount = 3[source]

Connections with wrong time offset

class TCPConnection(address=None, sock=None)[source]

Bases: network.bmproto.BMProto, network.tls.TLSDispatcher

Todo

Look to understand and/or fix the non-parent-init-called

antiIntersectionDelay(initial=False)

This is a defense against the so called intersection attacks.

It is called when you notice peer is requesting non-existing objects, or right after the connection is established. It will estimate how long an object will take to propagate across the network, and skip processing “getdata” requests until then. This means an attacker only has one shot per IP to perform the attack.

checkTimeOffsetNotification()

Check if we have connected to too many nodes which have too high time offset from us

state_connection_fully_established()

State after the bitmessage protocol handshake is completed (version/verack exchange, and if both side support TLS, the TLS handshake as well).

set_connection_fully_established()

Initiate inventory synchronisation.

sendAddr()

Send a partial list of known addresses to peer.

sendBigInv()

Send hashes of all inventory objects, chunked as the protocol has a per-command limit.

handle_connect()

Callback for TCP connection being established.

handle_read()

Callback for reading from a socket

handle_write()

Callback for writing to a socket

handle_close()

Callback for connection being closed.

class Socks5BMConnection(address)[source]

Bases: network.socks5.Socks5Connection, pybitmessage.network.tcp.TCPConnection

SOCKS5 wrapper for TCP connections

state_proxy_handshake_done()

State when SOCKS5 connection succeeds, we need to send a Bitmessage handshake to peer.

class Socks4aBMConnection(address)[source]

Bases: network.socks4a.Socks4aConnection, pybitmessage.network.tcp.TCPConnection

SOCKS4a wrapper for TCP connections

state_proxy_handshake_done()

State when SOCKS4a connection succeeds, we need to send a Bitmessage handshake to peer.

bootstrap(connection_class)[source]

Make bootstrapper class for connection type (connection_class)

class TCPServer(host='127.0.0.1', port=8444)[source]

Bases: network.advanceddispatcher.AdvancedDispatcher

TCP connection server for Bitmessage protocol

is_bound()

Is the socket bound?

handle_accept()

Incoming connection callback