lokinet/llarp/constants/path.hpp

44 lines
1.6 KiB
C++
Raw Normal View History

#pragma once
2019-06-17 23:19:39 +00:00
2020-02-25 20:52:59 +00:00
#include <chrono>
2019-06-17 23:19:39 +00:00
#include <cstddef>
#include <llarp/util/types.hpp>
#include <llarp/util/time.hpp>
2019-06-17 23:19:39 +00:00
namespace llarp
{
namespace path
{
/// maximum path length
constexpr std::size_t max_len = 8;
/// default path length
constexpr std::size_t default_len = 4;
/// pad messages to the nearest this many bytes
constexpr std::size_t pad_size = 128;
/// default path lifetime in ms
constexpr std::chrono::milliseconds default_lifetime = 20min;
2020-02-25 20:52:59 +00:00
/// minimum into lifetime we will advertise
constexpr std::chrono::milliseconds min_intro_lifetime = default_lifetime / 2;
/// number of slices of path lifetime to spread intros out via
constexpr auto intro_spread_slices = 4;
2020-02-25 20:52:59 +00:00
/// spacing frequency at which we try to build paths for introductions
constexpr std::chrono::milliseconds intro_path_spread = default_lifetime / intro_spread_slices;
/// Minimum paths to keep around for intros; mainly used at startup (the
/// spread, above, should be able to maintain more than this number of paths
/// normally once things are going).
constexpr std::size_t min_intro_paths = 4;
2019-06-17 23:19:39 +00:00
/// after this many ms a path build times out
constexpr auto build_timeout = 10s;
2019-06-17 23:19:39 +00:00
/// measure latency every this interval ms
constexpr auto latency_interval = 20s;
2019-06-17 23:19:39 +00:00
/// if a path is inactive for this amount of time it's dead
constexpr auto alive_timeout = latency_interval * 1.5;
/// how big transit hop traffic queues are
constexpr std::size_t transit_hop_queue_size = 256;
2019-06-17 23:19:39 +00:00
} // namespace path
} // namespace llarp