forked from envoyproxy/envoy-filter-example
-
Notifications
You must be signed in to change notification settings - Fork 0
/
echo2_config.cc
40 lines (31 loc) · 1.2 KB
/
echo2_config.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include <string>
#include "echo2.h"
#include "envoy/registry/registry.h"
#include "envoy/server/filter_config.h"
namespace Envoy {
namespace Server {
namespace Configuration {
/**
* Config registration for the echo2 filter. @see NamedNetworkFilterConfigFactory.
*/
class Echo2ConfigFactory : public NamedNetworkFilterConfigFactory {
public:
Network::FilterFactoryCb createFilterFactoryFromProto(const Protobuf::Message&,
FactoryContext&) override {
return [](Network::FilterManager& filter_manager) -> void {
filter_manager.addReadFilter(Network::ReadFilterSharedPtr{new Filter::Echo2()});
};
}
ProtobufTypes::MessagePtr createEmptyConfigProto() override {
return ProtobufTypes::MessagePtr{new Envoy::ProtobufWkt::Struct()};
}
std::string name() const override { return "echo2"; }
bool isTerminalFilterByProto(const Protobuf::Message&, FactoryContext&) override { return true; }
};
/**
* Static registration for the echo2 filter. @see RegisterFactory.
*/
static Registry::RegisterFactory<Echo2ConfigFactory, NamedNetworkFilterConfigFactory> registered_;
} // namespace Configuration
} // namespace Server
} // namespace Envoy