![]() |
vkmEngine 1.0.0
A C++ game engine · vkmengine.com
|
The token a server gives an address that asks to join, and takes back as proof that the address hears what is sent to it. More...
#include <join_cookie.h>
Public Member Functions | |
| void | rekey () |
| Draw a new key from the operating system. Every token given before is void. | |
| uint64_t | issue (const NetAddress &to, double now) const |
The token for to, as of now. | |
| bool | accepts (const NetAddress &from, uint64_t token, double now) const |
Whether token is one issue() gave from, this window or the last. | |
Static Public Attributes | |
| static constexpr double | WINDOW_SECONDS = 10.0 |
| How long one window lasts, in seconds; a token is good for one to two of them. | |
The token a server gives an address that asks to join, and takes back as proof that the address hears what is sent to it.
Stateless - a keyed hash of the address and the time window - so a forged Hello costs a hash and a reply no larger, and crowds out no real join. Accepted for its window and the next. The key comes from the operating system, so tokens cannot be predicted and a restart voids them.
| uint64_t Vkm::Engine::NetJoinCookie::issue | ( | const NetAddress & | to, |
| double | now ) const |
The token for to, as of now.
| to | The address that asked. |
| now | Seconds on a clock that only moves forward. |
| bool Vkm::Engine::NetJoinCookie::accepts | ( | const NetAddress & | from, |
| uint64_t | token, | ||
| double | now ) const |