---
title: llarp/consensus/edge_selector.hpp

---

# llarp/consensus/edge_selector.hpp



## Namespaces

| Name           |
| -------------- |
| **[llarp](Namespaces/namespacellarp.md)** <br>[crypto.hpp] |
| **[llarp::consensus](Namespaces/namespacellarp_1_1consensus.md)**  |

## Classes

|                | Name           |
| -------------- | -------------- |
| class | **[llarp::consensus::EdgeSelector](Classes/classllarp_1_1consensus_1_1EdgeSelector.md)** <br>when we want to connect to and edge when we are a client, an instance of [EdgeSelector]() acts as a stateless selection algorith for router contacts for each attempt at connecting out we make.  |




## Source code

```cpp
#pragma once

#include <optional>
#include <unordered_set>
#include <llarp/router_id.hpp>

namespace llarp
{
  struct AbstractRouter;
  struct RouterContact;
}  // namespace llarp

namespace llarp::consensus
{
  class EdgeSelector
  {
    AbstractRouter& _router;

   public:
    explicit EdgeSelector(AbstractRouter& router);

    std::optional<RouterContact>
    select_path_edge(const std::unordered_set<RouterID>& connected_now = {}) const;

    std::optional<RouterContact>
    select_bootstrap(const std::unordered_set<RouterID>& connected_now = {}) const;
  };
}  // namespace llarp::consensus
```


-------------------------------

Updated on 2023-05-11 at 14:13:06 +0000
