forked from envoyproxy/envoy
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add option to disable TCP tunneling by filter state (envoyproxy#25885)
Signed-off-by: Ohad Vano <[email protected]>
- Loading branch information
Showing
15 changed files
with
177 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#pragma once | ||
|
||
#include "envoy/common/pure.h" | ||
#include "envoy/stream_info/filter_state.h" | ||
|
||
namespace Envoy { | ||
namespace StreamInfo { | ||
|
||
/** | ||
* A FilterState object that tracks a single boolean value. | ||
*/ | ||
class BoolAccessor : public FilterState::Object { | ||
public: | ||
/** | ||
* @return the tracked value. | ||
*/ | ||
virtual bool value() const PURE; | ||
}; | ||
|
||
} // namespace StreamInfo | ||
} // namespace Envoy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#pragma once | ||
|
||
#include "envoy/stream_info/bool_accessor.h" | ||
|
||
namespace Envoy { | ||
namespace StreamInfo { | ||
|
||
/* | ||
* A FilterState object that tracks a single boolean value. | ||
*/ | ||
class BoolAccessorImpl : public BoolAccessor { | ||
public: | ||
BoolAccessorImpl(bool value) : value_(value) {} | ||
|
||
// From FilterState::Object | ||
ProtobufTypes::MessagePtr serializeAsProto() const override { | ||
auto message = std::make_unique<ProtobufWkt::BoolValue>(); | ||
message->set_value(value_); | ||
return message; | ||
} | ||
|
||
// From BoolAccessor. | ||
bool value() const override { return value_; } | ||
|
||
private: | ||
bool value_; | ||
}; | ||
|
||
} // namespace StreamInfo | ||
} // namespace Envoy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#include "source/common/stream_info/bool_accessor_impl.h" | ||
|
||
#include "gtest/gtest.h" | ||
|
||
namespace Envoy { | ||
namespace StreamInfo { | ||
namespace { | ||
|
||
TEST(BoolAccessorImplTest, FalseValue) { | ||
BoolAccessorImpl accessor(false); | ||
EXPECT_EQ(false, accessor.value()); | ||
} | ||
|
||
TEST(BoolAccessorImplTest, TrueValue) { | ||
BoolAccessorImpl accessor(true); | ||
EXPECT_EQ(true, accessor.value()); | ||
} | ||
|
||
TEST(BoolAccessorImplTest, TestProto) { | ||
BoolAccessorImpl accessor(true); | ||
auto message = accessor.serializeAsProto(); | ||
EXPECT_NE(nullptr, message); | ||
} | ||
|
||
} // namespace | ||
} // namespace StreamInfo | ||
} // namespace Envoy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters