forked from envoyproxy/envoy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproxy_proto_integration_test.h
34 lines (27 loc) · 1.28 KB
/
proxy_proto_integration_test.h
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
#pragma once
#include "envoy/config/bootstrap/v3/bootstrap.pb.h"
#include "common/http/codec_client.h"
#include "extensions/filters/listener/proxy_protocol/proxy_protocol.h"
#include "test/integration/fake_upstream.h"
#include "test/integration/http_integration.h"
#include "test/integration/server.h"
#include "gtest/gtest.h"
namespace Envoy {
class ProxyProtoIntegrationTest : public testing::TestWithParam<Network::Address::IpVersion>,
public HttpIntegrationTest {
public:
ProxyProtoIntegrationTest() : HttpIntegrationTest(Http::CodecClient::Type::HTTP1, GetParam()) {
config_helper_.addConfigModifier(
[&](envoy::config::bootstrap::v3::Bootstrap& bootstrap) -> void {
::envoy::extensions::filters::listener::proxy_protocol::v3::ProxyProtocol proxy_protocol;
auto rule = proxy_protocol.add_rules();
rule->set_tlv_type(0x02);
rule->mutable_on_tlv_present()->set_key("PP2TypeAuthority");
auto* listener = bootstrap.mutable_static_resources()->mutable_listeners(0);
auto* ppv_filter = listener->add_listener_filters();
ppv_filter->set_name("envoy.listener.proxy_protocol");
ppv_filter->mutable_typed_config()->PackFrom(proxy_protocol);
});
}
};
} // namespace Envoy