-
Notifications
You must be signed in to change notification settings - Fork 269
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature: Golang Http Tcp Bridge (#36667)
As mentioned in the proposal: envoyproxy/envoy#35749 , this PR is to support using Golang to extend TCP upstream proxy, to make changes to connections and data messages in the http2tcp situation of envoy. (this PR does) ### Here is my thought about Golang extension function points: 1. Support encoding message processing for upstream TCP requests (route and cluster have been determined, and targeted message processing can be performed for route and cluster) 2. Support the handling of conn connection status during the encoding stage of upstream TCP requests (for example, by setting end_stream=false to avoid envoy semi connected status) 3. Support decoding message processing and aggregation for upstream TCP response in onUpstreamData.(for example, by setting end_stream=true to indicate that the message is encapsulated and can be passed to downstream) 4. Aggregate the tcp messages received multiple times by onUpstreamData of tcp response. 5. Support obtaining route and cluster information, which can be referenced for targeted processing in the above stages. ### What we can do with this Golang extension: With this golang extension, developers can quickly get started with envoy and use golang to implement http2tcp such as http2dubbo、http2rpc. Signed-off-by: duxin40 <duxin40@gamil.com> Signed-off-by: duxin40 <33946910+duxin40@users.noreply.github.com> Mirrored from https://github.com/envoyproxy/envoy @ b034c57c7328237a4b12c7d5c2ca41b19569c9b5
- Loading branch information
1 parent
7714d2d
commit 64bdd0e
Showing
4 changed files
with
66 additions
and
0 deletions.
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
12 changes: 12 additions & 0 deletions
12
contrib/envoy/extensions/upstreams/http/tcp/golang/v3alpha/BUILD
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,12 @@ | ||
# DO NOT EDIT. This file is generated by tools/proto_format/proto_sync.py. | ||
|
||
load("@envoy_api//bazel:api_build_system.bzl", "api_proto_package") | ||
|
||
licenses(["notice"]) # Apache 2 | ||
|
||
api_proto_package( | ||
deps = [ | ||
"@com_github_cncf_xds//udpa/annotations:pkg", | ||
"@com_github_cncf_xds//xds/annotations/v3:pkg", | ||
], | ||
) |
52 changes: 52 additions & 0 deletions
52
contrib/envoy/extensions/upstreams/http/tcp/golang/v3alpha/golang.proto
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,52 @@ | ||
syntax = "proto3"; | ||
|
||
package envoy.extensions.upstreams.http.tcp.golang.v3alpha; | ||
|
||
import "google/protobuf/any.proto"; | ||
|
||
import "xds/annotations/v3/status.proto"; | ||
|
||
import "udpa/annotations/status.proto"; | ||
import "validate/validate.proto"; | ||
|
||
option java_package = "io.envoyproxy.envoy.extensions.upstreams.http.tcp.golang.v3alpha"; | ||
option java_outer_classname = "GolangProto"; | ||
option java_multiple_files = true; | ||
option go_package = "github.com/envoyproxy/go-control-plane/contrib/envoy/extensions/upstreams/http/tcp/golang/v3alpha"; | ||
option (udpa.annotations.file_status).package_version_status = ACTIVE; | ||
option (xds.annotations.v3.file_status).work_in_progress = true; | ||
|
||
// [#protodoc-title: Golang] | ||
// | ||
// This bridge enables an Http client to connect to a TCP server via a Golang plugin, facilitating Protocol Convert from HTTP to any RPC protocol in Envoy. | ||
// | ||
// For an overview of the Golang HTTP TCP bridge please see the :ref:`configuration reference documentation <config_http_tcp_bridge_golang>`. | ||
// [#extension: envoy.upstreams.http.tcp.golang] | ||
|
||
// [#extension-category: envoy.upstreams] | ||
message Config { | ||
// Globally unique ID for a dynamic library file. | ||
string library_id = 1 [(validate.rules).string = {min_len: 1}]; | ||
|
||
// Path to a dynamic library implementing the | ||
// :repo:`HttpTcpBridge API <contrib/golang/common/go/api.HttpTcpBridge>` | ||
// interface. | ||
string library_path = 2 [(validate.rules).string = {min_len: 1}]; | ||
|
||
// Globally unique name of the Go plugin. | ||
// | ||
// This name **must** be consistent with the name registered in ``tcp::RegisterHttpTcpBridgeFactoryAndConfigParser`` | ||
// | ||
string plugin_name = 3 [(validate.rules).string = {min_len: 1}]; | ||
|
||
// Configuration for the Go plugin. | ||
// | ||
// .. note:: | ||
// This configuration is only parsed in the Golang plugin, and is therefore not validated | ||
// by Envoy. | ||
// | ||
// See the :repo:`HttpTcpBridge API <contrib/golang/common/go/api/filter.go>` | ||
// for more information about how the plugin's configuration data can be accessed. | ||
// | ||
google.protobuf.Any plugin_config = 4; | ||
} |
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