1
#pragma once
2

            
3
#include <cstdint>
4
#include <string>
5
#include <vector>
6

            
7
#include "envoy/network/address.h"
8

            
9
#include "absl/types/optional.h"
10

            
11
namespace Envoy {
12
namespace Network {
13

            
14
struct ProxyProtocolTLV {
15
  const uint8_t type;
16
  const std::vector<unsigned char> value;
17
};
18

            
19
using ProxyProtocolTLVVector = std::vector<ProxyProtocolTLV>;
20

            
21
struct ProxyProtocolData {
22
  const Network::Address::InstanceConstSharedPtr src_addr_;
23
  const Network::Address::InstanceConstSharedPtr dst_addr_;
24
  const ProxyProtocolTLVVector tlv_vector_{};
25
15
  std::string asStringForHash() const {
26
15
    return std::string(src_addr_ ? src_addr_->asString() : "null") +
27
15
           (dst_addr_ ? dst_addr_->asString() : "null");
28
15
  }
29
};
30

            
31
enum class ProxyProtocolVersion { NotFound = 1, V1 = 2, V2 = 3 };
32

            
33
struct ProxyProtocolDataWithVersion : public ProxyProtocolData {
34
  const absl::optional<ProxyProtocolVersion> version_;
35
};
36
} // namespace Network
37
} // namespace Envoy