---
title: llarp::RouterContact
summary: RouterContact. 

---

# llarp::RouterContact



[RouterContact](). 


`#include <router_contact.hpp>`

## Public Functions

|                | Name           |
| -------------- | -------------- |
| | **[RouterContact](Classes/structllarp_1_1RouterContact.md#function-routercontact)**() |
| util::StatusObject | **[ExtractStatus](Classes/structllarp_1_1RouterContact.md#function-extractstatus)**() const |
| nlohmann::json | **[ToJson](Classes/structllarp_1_1RouterContact.md#function-tojson)**() const |
| std::string | **[ToString](Classes/structllarp_1_1RouterContact.md#function-tostring)**() const |
| bool | **[BEncode](Classes/structllarp_1_1RouterContact.md#function-bencode)**([llarp_buffer_t](Classes/structllarp__buffer__t.md) * buf) const |
| bool | **[BEncodeSignedSection](Classes/structllarp_1_1RouterContact.md#function-bencodesignedsection)**([llarp_buffer_t](Classes/structllarp__buffer__t.md) * buf) const |
| std::string | **[ToTXTRecord](Classes/structllarp_1_1RouterContact.md#function-totxtrecord)**() const |
| bool | **[operator==](Classes/structllarp_1_1RouterContact.md#function-operator==)**(const [RouterContact](Classes/structllarp_1_1RouterContact.md) & other) const |
| bool | **[operator<](Classes/structllarp_1_1RouterContact.md#function-operator<)**(const [RouterContact](Classes/structllarp_1_1RouterContact.md) & other) const |
| bool | **[operator!=](Classes/structllarp_1_1RouterContact.md#function-operator!=)**(const [RouterContact](Classes/structllarp_1_1RouterContact.md) & other) const |
| void | **[Clear](Classes/structllarp_1_1RouterContact.md#function-clear)**() |
| bool | **[IsExit](Classes/structllarp_1_1RouterContact.md#function-isexit)**() const |
| bool | **[BDecode](Classes/structllarp_1_1RouterContact.md#function-bdecode)**([llarp_buffer_t](Classes/structllarp__buffer__t.md) * buf) |
| bool | **[DecodeKey](Classes/structllarp_1_1RouterContact.md#function-decodekey)**(const [llarp_buffer_t](Classes/structllarp__buffer__t.md) & k, [llarp_buffer_t](Classes/structllarp__buffer__t.md) * buf) |
| bool | **[HasNick](Classes/structllarp_1_1RouterContact.md#function-hasnick)**() const |
| std::string | **[Nick](Classes/structllarp_1_1RouterContact.md#function-nick)**() const |
| bool | **[IsPublicRouter](Classes/structllarp_1_1RouterContact.md#function-ispublicrouter)**() const |
| void | **[SetNick](Classes/structllarp_1_1RouterContact.md#function-setnick)**(std::string_view nick) |
| bool | **[Verify](Classes/structllarp_1_1RouterContact.md#function-verify)**(llarp_time_t now, bool allowExpired =true) const |
| bool | **[Sign](Classes/structllarp_1_1RouterContact.md#function-sign)**(const [llarp::SecretKey](Classes/structllarp_1_1SecretKey.md) & secret) |
| bool | **[ExpiresSoon](Classes/structllarp_1_1RouterContact.md#function-expiressoon)**(llarp_time_t now, llarp_time_t dlt =1min) const<br>does this RC expire soon? default delta is 1 minute  |
| bool | **[IsExpired](Classes/structllarp_1_1RouterContact.md#function-isexpired)**(llarp_time_t now) const<br>returns true if this RC is expired and should be removed  |
| llarp_time_t | **[TimeUntilExpires](Classes/structllarp_1_1RouterContact.md#function-timeuntilexpires)**(llarp_time_t now) const<br>returns time in ms until we expire or 0 if we have expired  |
| llarp_time_t | **[Age](Classes/structllarp_1_1RouterContact.md#function-age)**(llarp_time_t now) const<br>get the age of this RC in ms  |
| bool | **[OtherIsNewer](Classes/structllarp_1_1RouterContact.md#function-otherisnewer)**(const [RouterContact](Classes/structllarp_1_1RouterContact.md) & other) const |
| bool | **[Read](Classes/structllarp_1_1RouterContact.md#function-read)**(const fs::path & fname) |
| bool | **[Write](Classes/structllarp_1_1RouterContact.md#function-write)**(const fs::path & fname) const |
| bool | **[VerifySignature](Classes/structllarp_1_1RouterContact.md#function-verifysignature)**() const |
| bool | **[FromOurNetwork](Classes/structllarp_1_1RouterContact.md#function-fromournetwork)**() const<br>return true if the netid in this rc is for the network id we are using  |

## Public Attributes

|                | Name           |
| -------------- | -------------- |
| bool | **[BlockBogons](Classes/structllarp_1_1RouterContact.md#variable-blockbogons)** <br>for unit tests  |
| llarp_time_t | **[Lifetime](Classes/structllarp_1_1RouterContact.md#variable-lifetime)**  |
| llarp_time_t | **[UpdateInterval](Classes/structllarp_1_1RouterContact.md#variable-updateinterval)**  |
| llarp_time_t | **[StaleInsertionAge](Classes/structllarp_1_1RouterContact.md#variable-staleinsertionage)**  |
| const bool | **[serializeExit](Classes/structllarp_1_1RouterContact.md#variable-serializeexit)** <br>should we serialize the exit info?  |
| std::vector< [AddressInfo](Classes/structllarp_1_1AddressInfo.md) > | **[addrs](Classes/structllarp_1_1RouterContact.md#variable-addrs)**  |
| [NetID](Classes/structllarp_1_1NetID.md) | **[netID](Classes/structllarp_1_1RouterContact.md#variable-netid)**  |
| [llarp::PubKey](Classes/structllarp_1_1PubKey.md) | **[enckey](Classes/structllarp_1_1RouterContact.md#variable-enckey)**  |
| [llarp::PubKey](Classes/structllarp_1_1PubKey.md) | **[pubkey](Classes/structllarp_1_1RouterContact.md#variable-pubkey)**  |
| [llarp::Signature](Classes/structllarp_1_1Signature.md) | **[signature](Classes/structllarp_1_1RouterContact.md#variable-signature)**  |
| [llarp::AlignedBuffer](Classes/structllarp_1_1AlignedBuffer.md)<(32) > | **[nickname](Classes/structllarp_1_1RouterContact.md#variable-nickname)** <br>node nickname, yw kee  |
| llarp_time_t | **[last_updated](Classes/structllarp_1_1RouterContact.md#variable-last-updated)**  |
| uint64_t | **[version](Classes/structllarp_1_1RouterContact.md#variable-version)**  |
| std::optional< [RouterVersion](Classes/structllarp_1_1RouterVersion.md) > | **[routerVersion](Classes/structllarp_1_1RouterContact.md#variable-routerversion)**  |
| std::string | **[signed_bt_dict](Classes/structllarp_1_1RouterContact.md#variable-signed-bt-dict)**  |
| std::vector< [dns::SRVData](Classes/structllarp_1_1dns_1_1SRVData.md) > | **[srvRecords](Classes/structllarp_1_1RouterContact.md#variable-srvrecords)**  |

## Public Functions Documentation

### function RouterContact

```cpp
inline RouterContact()
```


### function ExtractStatus

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


### function ToJson

```cpp
inline nlohmann::json ToJson() const
```


### function ToString

```cpp
std::string ToString() const
```


### function BEncode

```cpp
bool BEncode(
    llarp_buffer_t * buf
) const
```


### function BEncodeSignedSection

```cpp
bool BEncodeSignedSection(
    llarp_buffer_t * buf
) const
```


### function ToTXTRecord

```cpp
std::string ToTXTRecord() const
```


### function operator==

```cpp
inline bool operator==(
    const RouterContact & other
) const
```


### function operator<

```cpp
inline bool operator<(
    const RouterContact & other
) const
```


### function operator!=

```cpp
inline bool operator!=(
    const RouterContact & other
) const
```


### function Clear

```cpp
void Clear()
```


### function IsExit

```cpp
inline bool IsExit() const
```


### function BDecode

```cpp
bool BDecode(
    llarp_buffer_t * buf
)
```


### function DecodeKey

```cpp
bool DecodeKey(
    const llarp_buffer_t & k,
    llarp_buffer_t * buf
)
```


### function HasNick

```cpp
bool HasNick() const
```


### function Nick

```cpp
std::string Nick() const
```


### function IsPublicRouter

```cpp
bool IsPublicRouter() const
```


### function SetNick

```cpp
void SetNick(
    std::string_view nick
)
```


### function Verify

```cpp
bool Verify(
    llarp_time_t now,
    bool allowExpired =true
) const
```


### function Sign

```cpp
bool Sign(
    const llarp::SecretKey & secret
)
```


### function ExpiresSoon

```cpp
bool ExpiresSoon(
    llarp_time_t now,
    llarp_time_t dlt =1min
) const
```

does this RC expire soon? default delta is 1 minute 

### function IsExpired

```cpp
bool IsExpired(
    llarp_time_t now
) const
```

returns true if this RC is expired and should be removed 

### function TimeUntilExpires

```cpp
llarp_time_t TimeUntilExpires(
    llarp_time_t now
) const
```

returns time in ms until we expire or 0 if we have expired 

### function Age

```cpp
llarp_time_t Age(
    llarp_time_t now
) const
```

get the age of this RC in ms 

### function OtherIsNewer

```cpp
inline bool OtherIsNewer(
    const RouterContact & other
) const
```


### function Read

```cpp
bool Read(
    const fs::path & fname
)
```


### function Write

```cpp
bool Write(
    const fs::path & fname
) const
```


### function VerifySignature

```cpp
bool VerifySignature() const
```


### function FromOurNetwork

```cpp
bool FromOurNetwork() const
```

return true if the netid in this rc is for the network id we are using 

## Public Attributes Documentation

### variable BlockBogons

```cpp
static bool BlockBogons;
```

for unit tests 

### variable Lifetime

```cpp
static llarp_time_t Lifetime;
```


### variable UpdateInterval

```cpp
static llarp_time_t UpdateInterval;
```


### variable StaleInsertionAge

```cpp
static llarp_time_t StaleInsertionAge;
```


### variable serializeExit

```cpp
static const bool serializeExit = true;
```

should we serialize the exit info? 

### variable addrs

```cpp
std::vector< AddressInfo > addrs;
```


### variable netID

```cpp
NetID netID;
```


### variable enckey

```cpp
llarp::PubKey enckey;
```


### variable pubkey

```cpp
llarp::PubKey pubkey;
```


### variable signature

```cpp
llarp::Signature signature;
```


### variable nickname

```cpp
llarp::AlignedBuffer<(32) > nickname;
```

node nickname, yw kee 

### variable last_updated

```cpp
llarp_time_t last_updated = 0s;
```


### variable version

```cpp
uint64_t version = llarp::constants::proto_version;
```


### variable routerVersion

```cpp
std::optional< RouterVersion > routerVersion;
```


### variable signed_bt_dict

```cpp
std::string signed_bt_dict;
```


### variable srvRecords

```cpp
std::vector< dns::SRVData > srvRecords;
```


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

Updated on 2022-09-10 at 18:17:13 +0000