forked from envoyproxy/envoy-filter-example
-
Notifications
You must be signed in to change notification settings - Fork 0
/
echo2_config.cc
32 lines (26 loc) · 974 Bytes
/
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
#include "envoy/network/connection.h"
#include "echo2.h"
#include "server/configuration_impl.h"
namespace Server {
namespace Configuration {
/**
* Config registration for the echo filter. @see NetworkFilterConfigFactory.
*/
class Echo2ConfigFactory : public NetworkFilterConfigFactory {
public:
// NetworkFilterConfigFactory
NetworkFilterFactoryCb tryCreateFilterFactory(NetworkFilterType type, const std::string& name,
const Json::Object&, Server::Instance&) {
if (type != NetworkFilterType::Read || name != "echo2") {
return nullptr;
}
return [](Network::FilterManager& filter_manager)
-> void { filter_manager.addReadFilter(Network::ReadFilterSharedPtr{new Filter::Echo2()}); };
}
};
/**
* Static registration for the echo filter. @see RegisterNetworkFilterConfigFactory.
*/
static RegisterNetworkFilterConfigFactory<Echo2ConfigFactory> registered_;
} // Configuration
} // Server