TURN module (rfc5766)

Permission

A single TURN permission entry associating a peer IP with a 5-minute expiry timer.

Permission

#include <icy/turn/permission.h>

A single TURN permission entry associating a peer IP with a 5-minute expiry timer. Per RFC 5766 section 8, permissions last exactly 300 seconds and must be refreshed via a new CreatePermission request before they expire.

Public Attributes

ReturnNameDescription
std::stringipIPv4 address string of the permitted peer.
KeykeyBinary IP key for allocation hot-path comparisons.
TimeouttimeoutCountdown timer; expires after PERMISSION_LIFETIME milliseconds.

ip

std::string ip

IPv4 address string of the permitted peer.


key

Key key

Binary IP key for allocation hot-path comparisons.


timeout

Timeout timeout

Countdown timer; expires after PERMISSION_LIFETIME milliseconds.

Public Methods

ReturnNameDescription
Permission inlineConstructs a permission for ip and immediately starts the expiry timer.
Permission inlineConstructs a permission from a binary socket address.
voidrefresh inlineResets the expiry timer, extending the permission lifetime by another 300 seconds.
booloperator== const inlineEquality comparison against an IP string.
boolmatches const inlineBinary IP comparison used on the TURN relay hot path.

Permission

inline

inline Permission(const std::string & ip)

Constructs a permission for ip and immediately starts the expiry timer.

Parameters

  • ip IPv4 address string of the permitted peer.

Permission

inline

inline Permission(const net::Address & address)

Constructs a permission from a binary socket address.

Parameters

  • address Peer IP address; port is ignored.

refresh

inline

inline void refresh()

Resets the expiry timer, extending the permission lifetime by another 300 seconds.


operator==

const inline

inline bool operator==(std::string_view r) const

Equality comparison against an IP string.

Parameters

  • r IPv4 address string to compare against.

Returns

true if this permission's IP matches r.


matches

const inline

inline bool matches(const net::Address & address) const

Binary IP comparison used on the TURN relay hot path.