---
title: llarp::exit::Context
summary: owner of all the exit endpoints 

---

# llarp::exit::Context



owner of all the exit endpoints 


`#include <context.hpp>`

## Public Types

|                | Name           |
| -------------- | -------------- |
| using std::unordered_map< [PubKey](Classes/structllarp_1_1PubKey.md), std::pair< uint64_t, uint64_t > > | **[TrafficStats](Classes/structllarp_1_1exit_1_1Context.md#using-trafficstats)** <br>calculate (pk, tx, rx) for all exit traffic  |

## Public Functions

|                | Name           |
| -------------- | -------------- |
| | **[Context](Classes/structllarp_1_1exit_1_1Context.md#function-context)**([AbstractRouter](Classes/structllarp_1_1AbstractRouter.md) * r) |
| | **[~Context](Classes/structllarp_1_1exit_1_1Context.md#function-~context)**() |
| void | **[Tick](Classes/structllarp_1_1exit_1_1Context.md#function-tick)**(llarp_time_t now) |
| void | **[ClearAllEndpoints](Classes/structllarp_1_1exit_1_1Context.md#function-clearallendpoints)**() |
| util::StatusObject | **[ExtractStatus](Classes/structllarp_1_1exit_1_1Context.md#function-extractstatus)**() const |
| void | **[Stop](Classes/structllarp_1_1exit_1_1Context.md#function-stop)**()<br>send close to all exit sessions and remove all sessions  |
| void | **[AddExitEndpoint](Classes/structllarp_1_1exit_1_1Context.md#function-addexitendpoint)**(const std::string & name, const [NetworkConfig](Classes/structllarp_1_1NetworkConfig.md) & networkConfig, const [DnsConfig](Classes/structllarp_1_1DnsConfig.md) & dnsConfig) |
| bool | **[ObtainNewExit](Classes/structllarp_1_1exit_1_1Context.md#function-obtainnewexit)**(const [PubKey](Classes/structllarp_1_1PubKey.md) & remote, const [PathID_t](Classes/structllarp_1_1PathID__t.md) & path, bool permitInternet) |
| [exit::Endpoint](Classes/structllarp_1_1exit_1_1Endpoint.md) * | **[FindEndpointForPath](Classes/structllarp_1_1exit_1_1Context.md#function-findendpointforpath)**(const [PathID_t](Classes/structllarp_1_1PathID__t.md) & path) const |
| void | **[CalculateExitTraffic](Classes/structllarp_1_1exit_1_1Context.md#function-calculateexittraffic)**([TrafficStats](Classes/structllarp_1_1exit_1_1Context.md#using-trafficstats) & stats) |
| std::shared_ptr< [handlers::ExitEndpoint](Classes/structllarp_1_1handlers_1_1ExitEndpoint.md) > | **[GetExitEndpoint](Classes/structllarp_1_1exit_1_1Context.md#function-getexitendpoint)**(std::string name) const |

## Public Types Documentation

### using TrafficStats

```cpp
using llarp::exit::Context::TrafficStats =  std::unordered_map<PubKey, std::pair<uint64_t, uint64_t> >;
```

calculate (pk, tx, rx) for all exit traffic 

## Public Functions Documentation

### function Context

```cpp
Context(
    AbstractRouter * r
)
```


### function ~Context

```cpp
~Context()
```


### function Tick

```cpp
void Tick(
    llarp_time_t now
)
```


### function ClearAllEndpoints

```cpp
void ClearAllEndpoints()
```


### function ExtractStatus

```cpp
util::StatusObject ExtractStatus() const
```


### function Stop

```cpp
void Stop()
```

send close to all exit sessions and remove all sessions 

### function AddExitEndpoint

```cpp
void AddExitEndpoint(
    const std::string & name,
    const NetworkConfig & networkConfig,
    const DnsConfig & dnsConfig
)
```


### function ObtainNewExit

```cpp
bool ObtainNewExit(
    const PubKey & remote,
    const PathID_t & path,
    bool permitInternet
)
```


### function FindEndpointForPath

```cpp
exit::Endpoint * FindEndpointForPath(
    const PathID_t & path
) const
```


### function CalculateExitTraffic

```cpp
void CalculateExitTraffic(
    TrafficStats & stats
)
```


### function GetExitEndpoint

```cpp
std::shared_ptr< handlers::ExitEndpoint > GetExitEndpoint(
    std::string name
) const
```


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

Updated on 2023-01-09 at 16:43:38 +0000