---
title: llarp/layers/flow/flow_addr.hpp

---

# llarp/layers/flow/flow_addr.hpp



## Namespaces

| Name           |
| -------------- |
| **[llarp](Namespaces/namespacellarp.md)** <br>[crypto.hpp] |
| **[llarp::layers](Namespaces/namespacellarp_1_1layers.md)**  |
| **[llarp::layers::flow](Namespaces/namespacellarp_1_1layers_1_1flow.md)**  |
| **[std](Namespaces/namespacestd.md)** <br>STL namespace.  |

## Classes

|                | Name           |
| -------------- | -------------- |
| class | **[llarp::layers::flow::FlowAddr](Classes/classllarp_1_1layers_1_1flow_1_1FlowAddr.md)** <br>a long form .snode or .loki address  |
| struct | **[std::hash< llarp::layers::flow::FlowAddr >](Classes/structstd_1_1hash_3_01llarp_1_1layers_1_1flow_1_1FlowAddr_01_4.md)**  |




## Source code

```cpp
#pragma once

#include <fmt/core.h>
#include <llarp/util/aligned.hpp>
#include <string>
#include <string_view>
#include <llarp/endpoint_base.hpp>
#include <type_traits>

namespace llarp::layers::flow
{

  class FlowAddr : public AlignedBuffer<32>
  {
   public:
    enum class Kind : uint8_t
    {
      snapp,
      snode,
    };

    FlowAddr() = default;

    explicit FlowAddr(std::string str);

    explicit FlowAddr(EndpointBase::AddressVariant_t arg);

    std::string
    ToString() const;

    bool
    operator==(const FlowAddr& other) const;

    Kind
    kind() const;

   private:
    static Kind
    get_kind(std::string_view str);

    Kind _kind;
  };

}  // namespace llarp::layers::flow

namespace llarp
{
  template <>
  inline constexpr bool IsToStringFormattable<llarp::layers::flow::FlowAddr> = true;

}

namespace std
{
  template <>
  struct hash<llarp::layers::flow::FlowAddr>
  {
    size_t
    operator()(const llarp::layers::flow::FlowAddr& addr) const
    {
      return std::hash<llarp::AlignedBuffer<32>>{}(addr)
          ^ (std::hash<uint8_t>{}(static_cast<uint8_t>(addr.kind())) << 3);
    }
  };
}  // namespace std
```


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

Updated on 2023-03-06 at 20:36:34 +0000
