35 lines
829 B
C++
35 lines
829 B
C++
#pragma once
|
|
|
|
#include <chrono>
|
|
#include <cstdint>
|
|
#include <random>
|
|
#include <openssl/types.h>
|
|
|
|
#include "behavior/tasks/types.hpp"
|
|
|
|
|
|
/**
|
|
* Contains common information about a certain peer.
|
|
* All the information contained here are "public": they can be communicated to anybody else safely.
|
|
*/
|
|
class Peer {
|
|
public:
|
|
Peer();
|
|
explicit Peer(const std::array<std::uint8_t, 2048>& cryptoRsaPublicKey);
|
|
|
|
std::uint32_t id;
|
|
|
|
bool serverEnabled;
|
|
drp::task::TaskType status;
|
|
std::uint8_t channel;
|
|
|
|
std::chrono::high_resolution_clock::duration latencyAverage {};
|
|
|
|
std::array<std::uint8_t, 2048> cryptoRsaPublicKey {};
|
|
|
|
private:
|
|
// random
|
|
static std::random_device randomDevice;
|
|
static std::mt19937 randomGenerator;
|
|
static std::uniform_int_distribution<std::uint32_t> randomDistribution;
|
|
};
|