[][src]Module tox_core::net_crypto

Net crypto module allows to send data between two friends and provides encryption, ordered delivery, and perfect forward secrecy.

It can use both UDP and TCP (over relays) transport protocols to send data and can switch between them without the peers needing to disconnect and reconnect. For example two Tox friends might first connect over TCP and a few seconds later switch to UDP when a direct UDP connection becomes possible. Direct UDP is preferred over TCP because it is direct and isn't limited by possibly congested TCP relays.

Modules

errors

Module for errors of NetCrypto.

Structs

ConnectionAddr

UDP address of a connection with the time when last UDP packet was received

CryptoConnection

Secure connection to send data between two friends that provides encryption, ordered delivery, and perfect forward secrecy.

NetCrypto

Struct that manages crypto connections to friends and handles net crypto packets from both UDP and TCP connections.

NetCryptoNewArgs

Arguments for creating new NetCrypto.

RecvPacket

Received but not handled data packet that is stored in PacketsArray

SentPacket

Sent but not confirmed data packet that is stored in PacketsArray

StatusPacketWithTime

Packet that should be sent to the peer every second together with info how many times it was sent and when it was sent last time

Enums

ConnectionStatus

Status of crypto connection.

StatusPacket

Packet that should be sent every second. Depending on ConnectionStatus it can be CookieRequest or CryptoHandshake

Constants

CONGESTION_EVENT_TIMEOUT

Timeout for increasing speed after congestion event.

CONGESTION_LAST_SENT_ARRAY_SIZE

How many numbers of sent lossless packets should be recorded for congestion control. It should be bigger than CONGESTION_QUEUE_ARRAY_SIZE due to rtt.

CONGESTION_QUEUE_ARRAY_SIZE

How many last sizes of send_array should be recorded for congestion control.

CRYPTO_MIN_QUEUE_LENGTH

Minimum packets in the send queue to reduce send rate.

CRYPTO_PACKET_MIN_RATE

Minimum packets rate per second.

CRYPTO_SEND_PACKET_INTERVAL

Interval between sending cookie request/handshake packets.

CRYPTO_SEND_PACKET_INTERVAL_MS

Interval in ms between sending cookie request/handshake packets.

DEFAULT_RTT

Default RTT (round trip time)

MAX_NUM_SENDPACKET_TRIES

The maximum number of times we try to send the cookie request and handshake before giving up

PACKET_COUNTER_AVERAGE_INTERVAL

The dT for the average packet receiving rate calculations.

PACKET_COUNTER_AVERAGE_INTERVAL_MS

The dT for the average packet receiving rate calculations (in ms).

REQUEST_PACKETS_COMPARE_CONSTANT

Ratio of recv queue size / recv packet rate (in seconds) times the number of ms between request packets to send at that ratio.

SEND_QUEUE_CLEARANCE_TIME

If the send queue grows so that it will take more than 2 seconds to send all its packet we will reduce send rate.

TCP_RTT

RTT (round trip time) for TCP connections

UDP_DIRECT_TIMEOUT

If we don't receive UDP packets for this amount of time the direct UDP connection is considered dead