STUN (Session Traversal Utilities for NAT) Protocol Implementation. More...
#include "socket.h"#include <array>#include <vector>#include <string>#include <optional>#include <cstdint>#include <memory>#include <chrono>#include <random>Go to the source code of this file.
Classes | |
| struct | librats::StunMappedAddress |
| STUN mapped address (result of binding request) More... | |
| struct | librats::StunError |
| STUN error information. More... | |
| struct | librats::StunAttribute |
| STUN attribute base class. More... | |
| struct | librats::StunMessage |
| STUN message structure. More... | |
| struct | librats::StunClientConfig |
| STUN client configuration. More... | |
| struct | librats::StunResult |
| STUN transaction result. More... | |
| class | librats::StunClient |
| STUN Client for NAT traversal. More... | |
Namespaces | |
| namespace | librats |
Functions | |
| uint32_t | librats::stun_crc32 (const uint8_t *data, size_t length) |
| Compute CRC32 for STUN FINGERPRINT attribute Uses CRC-32 as defined in RFC 5389 (ISO 3309) | |
| std::array< uint8_t, 20 > | librats::stun_hmac_sha1 (const std::vector< uint8_t > &key, const std::vector< uint8_t > &data) |
| Compute HMAC-SHA1 for MESSAGE-INTEGRITY attribute. | |
| std::vector< uint8_t > | librats::stun_compute_long_term_key (const std::string &username, const std::string &realm, const std::string &password) |
| Compute long-term credential key: MD5(username:realm:password) | |
| StunMappedAddress | librats::stun_xor_address (const StunMappedAddress &addr, const std::array< uint8_t, STUN_TRANSACTION_ID_SIZE > &transaction_id) |
| XOR an address with the magic cookie and transaction ID Used for XOR-MAPPED-ADDRESS encoding/decoding. | |
| std::vector< std::pair< std::string, uint16_t > > | librats::get_public_stun_servers () |
| Get a list of well-known public STUN servers. | |
Variables | |
| constexpr uint32_t | librats::STUN_MAGIC_COOKIE = 0x2112A442 |
| STUN Magic Cookie (fixed value per RFC 5389) | |
| constexpr size_t | librats::STUN_HEADER_SIZE = 20 |
| STUN header size in bytes. | |
| constexpr size_t | librats::STUN_TRANSACTION_ID_SIZE = 12 |
| STUN transaction ID size in bytes. | |
| constexpr uint16_t | librats::STUN_DEFAULT_PORT = 3478 |
| Default STUN port. | |
| constexpr uint16_t | librats::STUNS_DEFAULT_PORT = 5349 |
| STUN over TLS default port. | |
| constexpr size_t | librats::STUN_MAX_MESSAGE_SIZE = 1500 |
| Maximum STUN message size (RFC 5389 recommends path MTU, typically ~1500) | |
| constexpr int | librats::STUN_DEFAULT_RTO_MS = 500 |
| Default retransmission timeout (ms) | |
| constexpr int | librats::STUN_MAX_RETRANSMISSIONS = 7 |
| Maximum retransmissions. | |
STUN (Session Traversal Utilities for NAT) Protocol Implementation.
Implements RFC 5389 - STUN protocol for NAT traversal. Provides functionality to discover public IP address and port mappings.
Definition in file stun.h.