1
#include "source/extensions/matching/network/application_protocol/config.h"
2

            
3
#include "envoy/http/filter.h"
4
#include "envoy/registry/registry.h"
5

            
6
#include "absl/strings/str_cat.h"
7

            
8
namespace Envoy {
9
namespace Network {
10
namespace Matching {
11

            
12
33
Matcher::DataInputGetResult ApplicationProtocolInput::get(const MatchingData& data) const {
13
33
  const auto& protocols = data.socket().requestedApplicationProtocols();
14
33
  if (!protocols.empty()) {
15
28
    return Matcher::DataInputGetResult::CreateString(
16
28
        absl::StrCat("'", absl::StrJoin(protocols, "','"), "'"));
17
28
  }
18
5
  return Matcher::DataInputGetResult::NoData();
19
33
}
20

            
21
REGISTER_FACTORY(ApplicationProtocolInputFactory, Matcher::DataInputFactory<MatchingData>);
22

            
23
} // namespace Matching
24
} // namespace Network
25
} // namespace Envoy