---
title: llarp::consensus::EdgeSelector
summary: 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. 

---

# llarp::consensus::EdgeSelector



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. 


`#include <edge_selector.hpp>`

## Public Functions

|                | Name           |
| -------------- | -------------- |
| | **[EdgeSelector](Classes/classllarp_1_1consensus_1_1EdgeSelector.md#function-edgeselector)**([AbstractRouter](Classes/structllarp_1_1AbstractRouter.md) & router) |
| std::optional< [RouterContact](Classes/structllarp_1_1RouterContact.md) > | **[select_path_edge](Classes/classllarp_1_1consensus_1_1EdgeSelector.md#function-select-path-edge)**(const std::unordered_set< [RouterID](Classes/structllarp_1_1RouterID.md) > & connected_now ={}) const<br>select a candidate for connecting out to the network when we need more connections to do a path build.  |
| std::optional< [RouterContact](Classes/structllarp_1_1RouterContact.md) > | **[select_bootstrap](Classes/classllarp_1_1consensus_1_1EdgeSelector.md#function-select-bootstrap)**(const std::unordered_set< [RouterID](Classes/structllarp_1_1RouterID.md) > & connected_now ={}) const<br>get a router contact of a bootstrap snode to bootstrap with if we are in need of bootstrapping more peers.  |

## Public Functions Documentation

### function EdgeSelector

```cpp
explicit EdgeSelector(
    AbstractRouter & router
)
```


### function select_path_edge

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

select a candidate for connecting out to the network when we need more connections to do a path build. 

pass in an unordered set of the snode pubkeys we are currently connected to. 


### function select_bootstrap

```cpp
std::optional< RouterContact > select_bootstrap(
    const std::unordered_set< RouterID > & connected_now ={}
) const
```

get a router contact of a bootstrap snode to bootstrap with if we are in need of bootstrapping more peers. 

pass in an unodereed set of bootstrap router pubkeys we are currently connected to. 


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

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