forked from envoyproxy/envoy-filter-example
-
Notifications
You must be signed in to change notification settings - Fork 0
/
echo2_config.cc
42 lines (33 loc) · 1.21 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
41
42
#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::Empty()};
}
std::string name() override { return "echo2"; }
Network::FilterFactoryCb createFilterFactory(const Json::Object&, FactoryContext&) override {
NOT_IMPLEMENTED;
}
};
/**
* Static registration for the echo2 filter. @see RegisterFactory.
*/
static Registry::RegisterFactory<Echo2ConfigFactory, NamedNetworkFilterConfigFactory> registered_;
} // namespace Configuration
} // namespace Server
} // namespace Envoy