This is an automated email from the ASF dual-hosted git repository.
AlexStocks pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/dubbo-go-samples.git
The following commit(s) were added to refs/heads/main by this push:
new 2a1177a4 Add sample Demonstrates Triple request metadata/attachments
and response headers/trailers exposed through `http.Header`. (#1112)
2a1177a4 is described below
commit 2a1177a4fb395175f58564f3a15b27b0a48b896e
Author: Xuetao Li <[email protected]>
AuthorDate: Tue Jul 28 01:31:04 2026 +0000
Add sample Demonstrates Triple request metadata/attachments and response
headers/trailers exposed through `http.Header`. (#1112)
* add sample
* import format
* dubbo-go now support unary call
* unary support metadata
* fix lint
* fix trailer read time
* import formatter
---
README.md | 1 +
README_CN.md | 1 +
start_integrate_test.sh | 3 +
streaming/README_zh.md | 4 +-
triple_header_trailer/README.md | 50 +++
triple_header_trailer/README_CN.md | 50 +++
triple_header_trailer/go-client/cmd/main.go | 233 ++++++++++
triple_header_trailer/go-server/cmd/main.go | 172 ++++++++
triple_header_trailer/proto/greet.pb.go | 633 ++++++++++++++++++++++++++++
triple_header_trailer/proto/greet.proto | 61 +++
triple_header_trailer/proto/greet.triple.go | 375 ++++++++++++++++
11 files changed, 1581 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index 6dbf4cff..10ecbdd0 100644
--- a/README.md
+++ b/README.md
@@ -73,6 +73,7 @@ Please refer to [HOWTO.md](HOWTO.md) for detailed
instructions on running the sa
* `streaming`: Streaming RPC example, also includes Go–Java interoperability
when both use streaming.
* `task`: Task scheduling and execution example.
* `timeout`: Demonstrates timeout handling in Dubbo-go.
+* `triple_header_trailer`: Demonstrates Triple request metadata/attachments
and response headers/trailers exposed through `http.Header`.
* `tls`: Demonstrates how to use TLS (based on X.509 certificates) in Dubbo-go
to enable encrypted communication and/or mutual authentication between client
and server, also includes Go–Java interoperability.
* `transaction/seata-go`: Distributed transaction example using `seata-go`.
diff --git a/README_CN.md b/README_CN.md
index 5a6fb186..a2084e6a 100644
--- a/README_CN.md
+++ b/README_CN.md
@@ -73,6 +73,7 @@
* `streaming`:流式 RPC 调用示例,并包含了Dubbo-go与Dubbo-java同时使用流式传输的互操作示例。
* `task`:任务调度与执行示例。
* `timeout`:Dubbo-go 超时处理示例。
+* `triple_header_trailer`:演示 Triple 请求 metadata/attachments 以及基于 `http.Header`
暴露的响应 header / trailer。
* `tls`:演示如何在 Dubbo-go 中使用 TLS(基于 X.509 证书),实现客户端与服务端之间的加密通信和/或双向认证,同时包含 Go 与
Java 的互操作示例。
* `transaction/seata-go`:基于 `seata-go` 的分布式事务示例。
diff --git a/start_integrate_test.sh b/start_integrate_test.sh
index dc65a21f..649e46fe 100755
--- a/start_integrate_test.sh
+++ b/start_integrate_test.sh
@@ -54,6 +54,9 @@ array+=("graceful_shutdown")
# streaming
array+=("streaming")
+# triple metadata
+array+=("triple_header_trailer")
+
# retry
array+=("retry")
diff --git a/streaming/README_zh.md b/streaming/README_zh.md
index 92204a13..cafc7d0e 100644
--- a/streaming/README_zh.md
+++ b/streaming/README_zh.md
@@ -8,7 +8,7 @@
- Go 与 Java 之间的互通性验证
支持的流式模式:
-- 一元调用 (Unary): 单个请求,单个响应
+- Unary 调用 (Unary): 单个请求,单个响应
- 双向流 (Bidirectional Stream): 多个请求,多个响应
- 客户端流 (Client Stream): 多个请求,单个响应
- 服务端流 (Server Stream): 单个请求,多个响应
@@ -224,7 +224,7 @@ streaming/
```java
public class GreeterImpl extends DubboGreetServiceTriple.GreetServiceImplBase {
- // 一元调用
+ // Unary 调用
@Override
public GreetResponse greet(GreetRequest request) {
return GreetResponse.newBuilder()
diff --git a/triple_header_trailer/README.md b/triple_header_trailer/README.md
new file mode 100644
index 00000000..df7e6b80
--- /dev/null
+++ b/triple_header_trailer/README.md
@@ -0,0 +1,50 @@
+# Dubbo-Go Triple Header and Trailer Sample
+
+English | [中文](README_CN.md)
+
+This sample demonstrates how to pass request metadata and read response
metadata with the Triple protocol.
+
+It covers:
+
+- Client request headers with `triple.NewOutgoingContext` and
`triple.AppendToOutgoingContext`
+- Server request metadata with `triple.FromIncomingContext` and generated
stream `RequestHeader`
+- Unary response headers and trailers with `triple.SetHeader`,
`triple.SetTrailer`, `client.WithResponseHeader`, and
`client.WithResponseTrailer`
+- Server stream response headers and trailers with `ResponseHeader` /
`ResponseTrailer`
+- Client-side stream response headers and trailers with generated stream
methods
+- `http.Header` style key lookup with `Values("X-Sample-Token")`
+
+This is different from the `context` sample. The `context` sample demonstrates
Dubbo attachments through `constant.AttachmentKey`. This sample demonstrates
Triple metadata APIs exposed as `http.Header`.
+
+For generated Dubbo-Go unary calls, the server uses `triple.SetHeader` and
`triple.SetTrailer` to attach response metadata, and the client passes
`client.WithResponseHeader` and `client.WithResponseTrailer` to capture it for
that call. For generated bidi-stream and client-stream calls, pass request
metadata before stream creation with `NewOutgoingContext` /
`AppendToOutgoingContext`. On the server side, handlers can read the resulting
metadata from `triple.FromIncomingContext`; generated [...]
+
+## Run
+
+Start the server:
+
+```bash
+go run ./triple_header_trailer/go-server/cmd
+```
+
+Run the client in another terminal:
+
+```bash
+go run ./triple_header_trailer/go-client/cmd
+```
+
+You can also run it through the integration script:
+
+```bash
+./integrate_test.sh triple_header_trailer
+```
+
+## Regenerate Code
+
+The generated files under `proto` are produced from `proto/greet.proto`:
+
+```bash
+protoc --go_out=. --go_opt=paths=source_relative --go-triple_out=.
--go-triple_opt=paths=source_relative ./triple_header_trailer/proto/greet.proto
+```
+
+## Notes
+
+Triple metadata keys are case-insensitive. In Go, these APIs expose metadata
as `http.Header`, so application code should use the normal `http.Header`
accessors such as `Get` and `Values`.
diff --git a/triple_header_trailer/README_CN.md
b/triple_header_trailer/README_CN.md
new file mode 100644
index 00000000..46cf78b4
--- /dev/null
+++ b/triple_header_trailer/README_CN.md
@@ -0,0 +1,50 @@
+# Dubbo-Go Triple Header 和 Trailer 示例
+
+中文 | [English](README.md)
+
+本示例演示如何在 Triple 协议中传递请求元数据,以及读写响应 header / trailer。
+
+示例覆盖:
+
+- 客户端通过 `triple.NewOutgoingContext` 和 `triple.AppendToOutgoingContext` 发送请求
header
+- 服务端通过 `triple.FromIncomingContext` 和生成流式接口的 `RequestHeader` 读取请求 metadata
+- Unary 调用通过
`triple.SetHeader`、`triple.SetTrailer`、`client.WithResponseHeader` 和
`client.WithResponseTrailer` 读写响应 header / trailer
+- 服务端通过流式接口的 `ResponseHeader` / `ResponseTrailer` 设置响应 header / trailer
+- 客户端通过生成的流式接口读取响应 header / trailer
+- 按 `http.Header` 的方式使用 `Values("X-Sample-Token")` 读取 header
+
+这和 `context` 示例不同。`context` 示例演示的是通过 `constant.AttachmentKey` 传递 Dubbo
attachments;本示例演示的是 Triple metadata API,并以 `http.Header` 的形式暴露给应用代码。
+
+对于 Dubbo-Go 生成的 Unary 调用,服务端通过 `triple.SetHeader` 和 `triple.SetTrailer` 写入响应
metadata,客户端通过 `client.WithResponseHeader` 和 `client.WithResponseTrailer`
捕获本次调用的响应 metadata。对于生成的双向流和客户端流调用,应在创建 stream 前通过 `NewOutgoingContext` /
`AppendToOutgoingContext` 传入请求 metadata。服务端 handler 可以通过
`triple.FromIncomingContext` 读取这些 metadata;生成的 stream handler 也可以通过
`RequestHeader` 查看。
+
+## 运行方式
+
+启动服务端:
+
+```bash
+go run ./triple_header_trailer/go-server/cmd
+```
+
+在另一个终端启动客户端:
+
+```bash
+go run ./triple_header_trailer/go-client/cmd
+```
+
+也可以通过集成测试脚本运行:
+
+```bash
+./integrate_test.sh triple_header_trailer
+```
+
+## 重新生成代码
+
+`proto` 目录下的生成代码来自 `proto/greet.proto`:
+
+```bash
+protoc --go_out=. --go_opt=paths=source_relative --go-triple_out=.
--go-triple_opt=paths=source_relative ./triple_header_trailer/proto/greet.proto
+```
+
+## 说明
+
+Triple metadata key 语义上大小写不敏感。在 Go API 层,这些 metadata 以 `http.Header`
暴露,因此应用代码应按标准 `http.Header` 方式使用 `Get` / `Values` 读取。
diff --git a/triple_header_trailer/go-client/cmd/main.go
b/triple_header_trailer/go-client/cmd/main.go
new file mode 100644
index 00000000..8f1cb075
--- /dev/null
+++ b/triple_header_trailer/go-client/cmd/main.go
@@ -0,0 +1,233 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package main
+
+import (
+ "context"
+ "errors"
+ "fmt"
+ "io"
+ "net/http"
+)
+
+import (
+ "dubbo.apache.org/dubbo-go/v3/client"
+ _ "dubbo.apache.org/dubbo-go/v3/imports"
+ triple "dubbo.apache.org/dubbo-go/v3/protocol/triple/triple_protocol"
+
+ "github.com/dubbogo/gost/log/logger"
+)
+
+import (
+ greet "github.com/apache/dubbo-go-samples/triple_header_trailer/proto"
+)
+
+const (
+ tokenHeader = "X-Sample-Token"
+ modeHeader = "X-Sample-Mode"
+ unaryResponseKey = "X-Unary-Response"
+ unaryTrailerKey = "X-Unary-Trailer"
+ streamResponseKey = "X-Stream-Response"
+ streamTrailerKey = "X-Stream-Trailer"
+)
+
+func main() {
+ cli, err := client.NewClient(
+ client.WithClientURL("tri://127.0.0.1:20000"),
+ )
+ if err != nil {
+ panic(err)
+ }
+
+ svc, err := greet.NewGreetService(cli)
+ if err != nil {
+ panic(err)
+ }
+
+ if err := testUnary(svc); err != nil {
+ panic(err)
+ }
+ if err := testBidiStream(svc); err != nil {
+ panic(err)
+ }
+ if err := testClientStream(svc); err != nil {
+ panic(err)
+ }
+ if err := testServerStream(svc); err != nil {
+ panic(err)
+ }
+}
+
+func testUnary(cli greet.GreetService) error {
+ var responseHeader http.Header
+ var responseTrailer http.Header
+ resp, err := cli.Greet(
+ outgoingContext("unary-token"),
+ &greet.GreetRequest{Name: "unary"},
+ client.WithResponseHeader(&responseHeader),
+ client.WithResponseTrailer(&responseTrailer),
+ )
+ if err != nil {
+ return err
+ }
+ if err := requireGreeting(resp.Greeting, "hello unary,
token=unary-token, modes=metadata,trailer-demo"); err != nil {
+ return err
+ }
+ logger.Infof("unary response: %s", resp.Greeting)
+ logger.Infof("unary response header %s=%v", unaryResponseKey,
responseHeader.Values(unaryResponseKey))
+ logger.Infof("unary response trailer %s=%v", unaryTrailerKey,
responseTrailer.Values(unaryTrailerKey))
+ if err := requireHeader(responseHeader, unaryResponseKey,
"unary-header"); err != nil {
+ return err
+ }
+ return requireHeader(responseTrailer, unaryTrailerKey, "unary-trailer")
+}
+
+func testBidiStream(cli greet.GreetService) error {
+ stream, err := cli.GreetStream(outgoingContext("bidi-token"))
+ if err != nil {
+ return err
+ }
+
+ if err = stream.Send(&greet.GreetStreamRequest{Name: "bidi"}); err !=
nil {
+ return err
+ }
+ resp, err := stream.Recv()
+ if err != nil {
+ return err
+ }
+ if resp == nil {
+ return fmt.Errorf("unexpected empty bidi response")
+ }
+ if err := requireGreeting(resp.Greeting, "bidi hello bidi,
token=bidi-token"); err != nil {
+ return err
+ }
+ logger.Infof("bidi response: %s", resp.Greeting)
+ logger.Infof("bidi response header %s=%v", streamResponseKey,
stream.ResponseHeader().Values(streamResponseKey))
+
+ if err := stream.CloseRequest(); err != nil {
+ return err
+ }
+
+ // Wait stream to reach io.EOF,
+ // Trailers aren't fully populated until Receive() returns an error
wrapping [io.EOF].
+ // See dubbo-go/protocol/triple/triple_protocol/client_stream.go:265
+ for {
+ _, err := stream.Recv()
+ if errors.Is(err, io.EOF) {
+ break
+ }
+ if triple.IsEnded(err) {
+ break
+ }
+ if err != nil {
+ return err
+ }
+ }
+
+ if err := stream.CloseResponse(); err != nil {
+ return err
+ }
+
+ logger.Infof("bidi response trailer %s=%v", streamTrailerKey,
stream.ResponseTrailer().Values(streamTrailerKey))
+ return requireHeader(stream.ResponseTrailer(), streamTrailerKey,
"bidi-trailer")
+}
+
+func testClientStream(cli greet.GreetService) error {
+ stream, err :=
cli.GreetClientStream(outgoingContext("client-stream-token"))
+ if err != nil {
+ return err
+ }
+
+ for _, name := range []string{"client", "stream"} {
+ if err = stream.Send(&greet.GreetClientStreamRequest{Name:
name}); err != nil {
+ return err
+ }
+ }
+ resp, err := stream.CloseAndRecv()
+ if err != nil {
+ return err
+ }
+ if err := requireGreeting(resp.Greeting, "client-stream hello
client,stream, token=client-stream-token"); err != nil {
+ return err
+ }
+ logger.Infof("client-stream response: %s", resp.Greeting)
+ return nil
+}
+
+func testServerStream(cli greet.GreetService) error {
+ stream, err :=
cli.GreetServerStream(outgoingContext("server-stream-token"),
&greet.GreetServerStreamRequest{Name: "server-stream"})
+ if err != nil {
+ return err
+ }
+
+ var count int
+ expectedGreetings := []string{
+ "server-stream hello server-stream #1,
token=server-stream-token",
+ "server-stream hello server-stream #2,
token=server-stream-token",
+ "server-stream hello server-stream #3,
token=server-stream-token",
+ }
+ for stream.Recv() {
+ if count >= len(expectedGreetings) {
+ return fmt.Errorf("unexpected extra server-stream
response: %s", stream.Msg().Greeting)
+ }
+ if err := requireGreeting(stream.Msg().Greeting,
expectedGreetings[count]); err != nil {
+ return err
+ }
+ count++
+ logger.Infof("server-stream response #%d: %s", count,
stream.Msg().Greeting)
+ }
+ if stream.Err() != nil {
+ return stream.Err()
+ }
+ if count != len(expectedGreetings) {
+ return fmt.Errorf("unexpected server-stream response count:
%d", count)
+ }
+ if err := stream.Close(); err != nil {
+ return err
+ }
+
+ logger.Infof("server-stream response header %s=%v", streamResponseKey,
stream.ResponseHeader().Values(streamResponseKey))
+ logger.Infof("server-stream response trailer %s=%v", streamTrailerKey,
stream.ResponseTrailer().Values(streamTrailerKey))
+ if err := requireHeader(stream.ResponseHeader(), streamResponseKey,
"server-stream-header"); err != nil {
+ return err
+ }
+ return requireHeader(stream.ResponseTrailer(), streamTrailerKey,
"server-stream-trailer")
+}
+
+func outgoingContext(token string) context.Context {
+ ctx := triple.NewOutgoingContext(context.Background(), http.Header{
+ tokenHeader: []string{token},
+ })
+ return triple.AppendToOutgoingContext(ctx, modeHeader, "metadata",
modeHeader, "trailer-demo")
+}
+
+func requireGreeting(got string, want string) error {
+ if got != want {
+ return fmt.Errorf("unexpected response: got %q, want %q", got,
want)
+ }
+ return nil
+}
+
+func requireHeader(headers http.Header, key string, want string) error {
+ for _, got := range headers.Values(key) {
+ if got == want {
+ return nil
+ }
+ }
+ return fmt.Errorf("missing header %s=%q in %v", key, want, headers)
+}
diff --git a/triple_header_trailer/go-server/cmd/main.go
b/triple_header_trailer/go-server/cmd/main.go
new file mode 100644
index 00000000..ac0d42c2
--- /dev/null
+++ b/triple_header_trailer/go-server/cmd/main.go
@@ -0,0 +1,172 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package main
+
+import (
+ "context"
+ "fmt"
+ "net/http"
+ "strings"
+)
+
+import (
+ _ "dubbo.apache.org/dubbo-go/v3/imports"
+ "dubbo.apache.org/dubbo-go/v3/protocol"
+ triple "dubbo.apache.org/dubbo-go/v3/protocol/triple/triple_protocol"
+ "dubbo.apache.org/dubbo-go/v3/server"
+
+ "github.com/dubbogo/gost/log/logger"
+)
+
+import (
+ greet "github.com/apache/dubbo-go-samples/triple_header_trailer/proto"
+)
+
+const (
+ tokenHeader = "X-Sample-Token"
+ modeHeader = "X-Sample-Mode"
+ unaryResponseKey = "X-Unary-Response"
+ unaryTrailerKey = "X-Unary-Trailer"
+ streamResponseKey = "X-Stream-Response"
+ streamTrailerKey = "X-Stream-Trailer"
+)
+
+type GreetTripleServer struct{}
+
+func (srv *GreetTripleServer) Greet(ctx context.Context, req
*greet.GreetRequest) (*greet.GreetResponse, error) {
+ token, modes := incomingMetadata(ctx)
+ logger.Infof("unary request metadata: token=%q modes=%v", token, modes)
+
+ if err := triple.SetHeader(ctx, http.Header{unaryResponseKey:
[]string{"unary-header"}}); err != nil {
+ return nil, err
+ }
+ if err := triple.SetTrailer(ctx, http.Header{unaryTrailerKey:
[]string{"unary-trailer"}}); err != nil {
+ return nil, err
+ }
+
+ return &greet.GreetResponse{
+ Greeting: fmt.Sprintf("hello %s, token=%s, modes=%s", req.Name,
token, strings.Join(modes, ",")),
+ }, nil
+}
+
+func (srv *GreetTripleServer) GreetStream(ctx context.Context, stream
greet.GreetService_GreetStreamServer) error {
+ token := firstValue(stream.RequestHeader(), tokenHeader)
+ if token == "" {
+ token = firstIncomingValue(ctx, tokenHeader)
+ }
+ logger.Infof("bidi request header %s=%q", tokenHeader, token)
+
+ stream.ResponseHeader().Set(streamResponseKey, "bidi-header")
+ stream.ResponseTrailer().Set(streamTrailerKey, "bidi-trailer")
+
+ for {
+ req, err := stream.Recv()
+ if err != nil {
+ if triple.IsEnded(err) {
+ return nil
+ }
+ return err
+ }
+ if err := stream.Send(&greet.GreetStreamResponse{
+ Greeting: fmt.Sprintf("bidi hello %s, token=%s",
req.Name, token),
+ }); err != nil {
+ return err
+ }
+ }
+}
+
+func (srv *GreetTripleServer) GreetClientStream(ctx context.Context, stream
greet.GreetService_GreetClientStreamServer) (*greet.GreetClientStreamResponse,
error) {
+ token := firstValue(stream.RequestHeader(), tokenHeader)
+ if token == "" {
+ token = firstIncomingValue(ctx, tokenHeader)
+ }
+ logger.Infof("client-stream request header %s=%q", tokenHeader, token)
+
+ var names []string
+ for stream.Recv() {
+ names = append(names, stream.Msg().Name)
+ }
+ if stream.Err() != nil && !triple.IsEnded(stream.Err()) {
+ return nil, stream.Err()
+ }
+
+ return &greet.GreetClientStreamResponse{
+ Greeting: fmt.Sprintf("client-stream hello %s, token=%s",
strings.Join(names, ","), token),
+ }, nil
+}
+
+func (srv *GreetTripleServer) GreetServerStream(ctx context.Context, req
*greet.GreetServerStreamRequest, stream
greet.GreetService_GreetServerStreamServer) error {
+ token := firstIncomingValue(ctx, tokenHeader)
+ logger.Infof("server-stream request metadata %s=%q", tokenHeader, token)
+
+ stream.ResponseHeader().Set(streamResponseKey, "server-stream-header")
+ stream.ResponseTrailer().Set(streamTrailerKey, "server-stream-trailer")
+
+ for i := 0; i < 3; i++ {
+ if err := stream.Send(&greet.GreetServerStreamResponse{
+ Greeting: fmt.Sprintf("server-stream hello %s #%d,
token=%s", req.Name, i+1, token),
+ }); err != nil {
+ return err
+ }
+ }
+ return nil
+}
+
+func incomingMetadata(ctx context.Context) (string, []string) {
+ headers, ok := triple.FromIncomingContext(ctx)
+ if !ok {
+ return "", nil
+ }
+ return firstValue(headers, tokenHeader), headers.Values(modeHeader)
+}
+
+func firstIncomingValue(ctx context.Context, key string) string {
+ headers, ok := triple.FromIncomingContext(ctx)
+ if !ok {
+ return ""
+ }
+ return firstValue(headers, key)
+}
+
+func firstValue(headers http.Header, key string) string {
+ values := headers.Values(key)
+ if len(values) == 0 {
+ return ""
+ }
+ return values[0]
+}
+
+func main() {
+ srv, err := server.NewServer(
+ server.WithServerProtocol(
+ protocol.WithPort(20000),
+ protocol.WithTriple(),
+ ),
+ )
+ if err != nil {
+ panic(err)
+ }
+
+ if err := greet.RegisterGreetServiceHandler(srv, &GreetTripleServer{});
err != nil {
+ panic(err)
+ }
+
+ if err := srv.Serve(); err != nil {
+ panic(err)
+ }
+}
diff --git a/triple_header_trailer/proto/greet.pb.go
b/triple_header_trailer/proto/greet.pb.go
new file mode 100644
index 00000000..6b393e46
--- /dev/null
+++ b/triple_header_trailer/proto/greet.pb.go
@@ -0,0 +1,633 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// Code generated by protoc-gen-go. DO NOT EDIT.
+// versions:
+// protoc-gen-go v1.31.0
+// protoc v3.21.12
+// source: triple_header_trailer/proto/greet.proto
+
+package greet
+
+import (
+ protoreflect "google.golang.org/protobuf/reflect/protoreflect"
+ protoimpl "google.golang.org/protobuf/runtime/protoimpl"
+ reflect "reflect"
+ sync "sync"
+)
+
+const (
+ // Verify that this generated code is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
+ // Verify that runtime/protoimpl is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
+)
+
+type GreetRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Name string `protobuf:"bytes,1,opt,name=name,proto3"
json:"name,omitempty"`
+}
+
+func (x *GreetRequest) Reset() {
+ *x = GreetRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_triple_header_trailer_proto_greet_proto_msgTypes[0]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *GreetRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GreetRequest) ProtoMessage() {}
+
+func (x *GreetRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_triple_header_trailer_proto_greet_proto_msgTypes[0]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use GreetRequest.ProtoReflect.Descriptor instead.
+func (*GreetRequest) Descriptor() ([]byte, []int) {
+ return file_triple_header_trailer_proto_greet_proto_rawDescGZIP(),
[]int{0}
+}
+
+func (x *GreetRequest) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+type GreetResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Greeting string `protobuf:"bytes,1,opt,name=greeting,proto3"
json:"greeting,omitempty"`
+}
+
+func (x *GreetResponse) Reset() {
+ *x = GreetResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_triple_header_trailer_proto_greet_proto_msgTypes[1]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *GreetResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GreetResponse) ProtoMessage() {}
+
+func (x *GreetResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_triple_header_trailer_proto_greet_proto_msgTypes[1]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use GreetResponse.ProtoReflect.Descriptor instead.
+func (*GreetResponse) Descriptor() ([]byte, []int) {
+ return file_triple_header_trailer_proto_greet_proto_rawDescGZIP(),
[]int{1}
+}
+
+func (x *GreetResponse) GetGreeting() string {
+ if x != nil {
+ return x.Greeting
+ }
+ return ""
+}
+
+type GreetStreamRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Name string `protobuf:"bytes,1,opt,name=name,proto3"
json:"name,omitempty"`
+}
+
+func (x *GreetStreamRequest) Reset() {
+ *x = GreetStreamRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_triple_header_trailer_proto_greet_proto_msgTypes[2]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *GreetStreamRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GreetStreamRequest) ProtoMessage() {}
+
+func (x *GreetStreamRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_triple_header_trailer_proto_greet_proto_msgTypes[2]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use GreetStreamRequest.ProtoReflect.Descriptor instead.
+func (*GreetStreamRequest) Descriptor() ([]byte, []int) {
+ return file_triple_header_trailer_proto_greet_proto_rawDescGZIP(),
[]int{2}
+}
+
+func (x *GreetStreamRequest) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+type GreetStreamResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Greeting string `protobuf:"bytes,1,opt,name=greeting,proto3"
json:"greeting,omitempty"`
+}
+
+func (x *GreetStreamResponse) Reset() {
+ *x = GreetStreamResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_triple_header_trailer_proto_greet_proto_msgTypes[3]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *GreetStreamResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GreetStreamResponse) ProtoMessage() {}
+
+func (x *GreetStreamResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_triple_header_trailer_proto_greet_proto_msgTypes[3]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use GreetStreamResponse.ProtoReflect.Descriptor instead.
+func (*GreetStreamResponse) Descriptor() ([]byte, []int) {
+ return file_triple_header_trailer_proto_greet_proto_rawDescGZIP(),
[]int{3}
+}
+
+func (x *GreetStreamResponse) GetGreeting() string {
+ if x != nil {
+ return x.Greeting
+ }
+ return ""
+}
+
+type GreetClientStreamRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Name string `protobuf:"bytes,1,opt,name=name,proto3"
json:"name,omitempty"`
+}
+
+func (x *GreetClientStreamRequest) Reset() {
+ *x = GreetClientStreamRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_triple_header_trailer_proto_greet_proto_msgTypes[4]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *GreetClientStreamRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GreetClientStreamRequest) ProtoMessage() {}
+
+func (x *GreetClientStreamRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_triple_header_trailer_proto_greet_proto_msgTypes[4]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use GreetClientStreamRequest.ProtoReflect.Descriptor instead.
+func (*GreetClientStreamRequest) Descriptor() ([]byte, []int) {
+ return file_triple_header_trailer_proto_greet_proto_rawDescGZIP(),
[]int{4}
+}
+
+func (x *GreetClientStreamRequest) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+type GreetClientStreamResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Greeting string `protobuf:"bytes,1,opt,name=greeting,proto3"
json:"greeting,omitempty"`
+}
+
+func (x *GreetClientStreamResponse) Reset() {
+ *x = GreetClientStreamResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_triple_header_trailer_proto_greet_proto_msgTypes[5]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *GreetClientStreamResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GreetClientStreamResponse) ProtoMessage() {}
+
+func (x *GreetClientStreamResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_triple_header_trailer_proto_greet_proto_msgTypes[5]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use GreetClientStreamResponse.ProtoReflect.Descriptor instead.
+func (*GreetClientStreamResponse) Descriptor() ([]byte, []int) {
+ return file_triple_header_trailer_proto_greet_proto_rawDescGZIP(),
[]int{5}
+}
+
+func (x *GreetClientStreamResponse) GetGreeting() string {
+ if x != nil {
+ return x.Greeting
+ }
+ return ""
+}
+
+type GreetServerStreamRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Name string `protobuf:"bytes,1,opt,name=name,proto3"
json:"name,omitempty"`
+}
+
+func (x *GreetServerStreamRequest) Reset() {
+ *x = GreetServerStreamRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_triple_header_trailer_proto_greet_proto_msgTypes[6]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *GreetServerStreamRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GreetServerStreamRequest) ProtoMessage() {}
+
+func (x *GreetServerStreamRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_triple_header_trailer_proto_greet_proto_msgTypes[6]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use GreetServerStreamRequest.ProtoReflect.Descriptor instead.
+func (*GreetServerStreamRequest) Descriptor() ([]byte, []int) {
+ return file_triple_header_trailer_proto_greet_proto_rawDescGZIP(),
[]int{6}
+}
+
+func (x *GreetServerStreamRequest) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+type GreetServerStreamResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Greeting string `protobuf:"bytes,1,opt,name=greeting,proto3"
json:"greeting,omitempty"`
+}
+
+func (x *GreetServerStreamResponse) Reset() {
+ *x = GreetServerStreamResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_triple_header_trailer_proto_greet_proto_msgTypes[7]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *GreetServerStreamResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GreetServerStreamResponse) ProtoMessage() {}
+
+func (x *GreetServerStreamResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_triple_header_trailer_proto_greet_proto_msgTypes[7]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use GreetServerStreamResponse.ProtoReflect.Descriptor instead.
+func (*GreetServerStreamResponse) Descriptor() ([]byte, []int) {
+ return file_triple_header_trailer_proto_greet_proto_rawDescGZIP(),
[]int{7}
+}
+
+func (x *GreetServerStreamResponse) GetGreeting() string {
+ if x != nil {
+ return x.Greeting
+ }
+ return ""
+}
+
+var File_triple_header_trailer_proto_greet_proto protoreflect.FileDescriptor
+
+var file_triple_header_trailer_proto_greet_proto_rawDesc = []byte{
+ 0x0a, 0x27, 0x74, 0x72, 0x69, 0x70, 0x6c, 0x65, 0x5f, 0x68, 0x65, 0x61,
0x64, 0x65, 0x72, 0x5f,
+ 0x74, 0x72, 0x61, 0x69, 0x6c, 0x65, 0x72, 0x2f, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x2f, 0x67, 0x72,
+ 0x65, 0x65, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x67,
0x72, 0x65, 0x65, 0x74,
+ 0x22, 0x22, 0x0a, 0x0c, 0x47, 0x72, 0x65, 0x65, 0x74, 0x52, 0x65, 0x71,
0x75, 0x65, 0x73, 0x74,
+ 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01,
0x28, 0x09, 0x52, 0x04,
+ 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x2b, 0x0a, 0x0d, 0x47, 0x72, 0x65, 0x65,
0x74, 0x52, 0x65, 0x73,
+ 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x67, 0x72, 0x65,
0x65, 0x74, 0x69, 0x6e,
+ 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x67, 0x72, 0x65,
0x65, 0x74, 0x69, 0x6e,
+ 0x67, 0x22, 0x28, 0x0a, 0x12, 0x47, 0x72, 0x65, 0x65, 0x74, 0x53, 0x74,
0x72, 0x65, 0x61, 0x6d,
+ 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e,
0x61, 0x6d, 0x65, 0x18,
+ 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22,
0x31, 0x0a, 0x13, 0x47,
+ 0x72, 0x65, 0x65, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, 0x65,
0x73, 0x70, 0x6f, 0x6e,
+ 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x67, 0x72, 0x65, 0x65, 0x74, 0x69,
0x6e, 0x67, 0x18, 0x01,
+ 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x67, 0x72, 0x65, 0x65, 0x74, 0x69,
0x6e, 0x67, 0x22, 0x2e,
+ 0x0a, 0x18, 0x47, 0x72, 0x65, 0x65, 0x74, 0x43, 0x6c, 0x69, 0x65, 0x6e,
0x74, 0x53, 0x74, 0x72,
+ 0x65, 0x61, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12,
0x0a, 0x04, 0x6e, 0x61,
+ 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61,
0x6d, 0x65, 0x22, 0x37,
+ 0x0a, 0x19, 0x47, 0x72, 0x65, 0x65, 0x74, 0x43, 0x6c, 0x69, 0x65, 0x6e,
0x74, 0x53, 0x74, 0x72,
+ 0x65, 0x61, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
0x1a, 0x0a, 0x08, 0x67,
+ 0x72, 0x65, 0x65, 0x74, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28,
0x09, 0x52, 0x08, 0x67,
+ 0x72, 0x65, 0x65, 0x74, 0x69, 0x6e, 0x67, 0x22, 0x2e, 0x0a, 0x18, 0x47,
0x72, 0x65, 0x65, 0x74,
+ 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d,
0x52, 0x65, 0x71, 0x75,
+ 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18,
0x01, 0x20, 0x01, 0x28,
+ 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x37, 0x0a, 0x19, 0x47,
0x72, 0x65, 0x65, 0x74,
+ 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d,
0x52, 0x65, 0x73, 0x70,
+ 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x67, 0x72, 0x65, 0x65,
0x74, 0x69, 0x6e, 0x67,
+ 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x67, 0x72, 0x65, 0x65,
0x74, 0x69, 0x6e, 0x67,
+ 0x32, 0xc8, 0x02, 0x0a, 0x0c, 0x47, 0x72, 0x65, 0x65, 0x74, 0x53, 0x65,
0x72, 0x76, 0x69, 0x63,
+ 0x65, 0x12, 0x34, 0x0a, 0x05, 0x47, 0x72, 0x65, 0x65, 0x74, 0x12, 0x13,
0x2e, 0x67, 0x72, 0x65,
+ 0x65, 0x74, 0x2e, 0x47, 0x72, 0x65, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75,
0x65, 0x73, 0x74, 0x1a,
+ 0x14, 0x2e, 0x67, 0x72, 0x65, 0x65, 0x74, 0x2e, 0x47, 0x72, 0x65, 0x65,
0x74, 0x52, 0x65, 0x73,
+ 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x4a, 0x0a, 0x0b, 0x47,
0x72, 0x65, 0x65, 0x74,
+ 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x19, 0x2e, 0x67, 0x72, 0x65,
0x65, 0x74, 0x2e, 0x47,
+ 0x72, 0x65, 0x65, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, 0x65,
0x71, 0x75, 0x65, 0x73,
+ 0x74, 0x1a, 0x1a, 0x2e, 0x67, 0x72, 0x65, 0x65, 0x74, 0x2e, 0x47, 0x72,
0x65, 0x65, 0x74, 0x53,
+ 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x65, 0x22, 0x00, 0x28,
+ 0x01, 0x30, 0x01, 0x12, 0x5a, 0x0a, 0x11, 0x47, 0x72, 0x65, 0x65, 0x74,
0x43, 0x6c, 0x69, 0x65,
+ 0x6e, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x1f, 0x2e, 0x67,
0x72, 0x65, 0x65, 0x74,
+ 0x2e, 0x47, 0x72, 0x65, 0x65, 0x74, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74,
0x53, 0x74, 0x72, 0x65,
+ 0x61, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e,
0x67, 0x72, 0x65, 0x65,
+ 0x74, 0x2e, 0x47, 0x72, 0x65, 0x65, 0x74, 0x43, 0x6c, 0x69, 0x65, 0x6e,
0x74, 0x53, 0x74, 0x72,
+ 0x65, 0x61, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22,
0x00, 0x28, 0x01, 0x12,
+ 0x5a, 0x0a, 0x11, 0x47, 0x72, 0x65, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76,
0x65, 0x72, 0x53, 0x74,
+ 0x72, 0x65, 0x61, 0x6d, 0x12, 0x1f, 0x2e, 0x67, 0x72, 0x65, 0x65, 0x74,
0x2e, 0x47, 0x72, 0x65,
+ 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x74, 0x72, 0x65,
0x61, 0x6d, 0x52, 0x65,
+ 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x67, 0x72, 0x65, 0x65,
0x74, 0x2e, 0x47, 0x72,
+ 0x65, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x74, 0x72,
0x65, 0x61, 0x6d, 0x52,
+ 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x30, 0x01, 0x42,
0x46, 0x5a, 0x44, 0x67,
+ 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70,
0x61, 0x63, 0x68, 0x65,
+ 0x2f, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x2d, 0x67, 0x6f, 0x2d, 0x73, 0x61,
0x6d, 0x70, 0x6c, 0x65,
+ 0x73, 0x2f, 0x74, 0x72, 0x69, 0x70, 0x6c, 0x65, 0x5f, 0x68, 0x65, 0x61,
0x64, 0x65, 0x72, 0x5f,
+ 0x74, 0x72, 0x61, 0x69, 0x6c, 0x65, 0x72, 0x2f, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x3b, 0x67, 0x72,
+ 0x65, 0x65, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+}
+
+var (
+ file_triple_header_trailer_proto_greet_proto_rawDescOnce sync.Once
+ file_triple_header_trailer_proto_greet_proto_rawDescData =
file_triple_header_trailer_proto_greet_proto_rawDesc
+)
+
+func file_triple_header_trailer_proto_greet_proto_rawDescGZIP() []byte {
+ file_triple_header_trailer_proto_greet_proto_rawDescOnce.Do(func() {
+ file_triple_header_trailer_proto_greet_proto_rawDescData =
protoimpl.X.CompressGZIP(file_triple_header_trailer_proto_greet_proto_rawDescData)
+ })
+ return file_triple_header_trailer_proto_greet_proto_rawDescData
+}
+
+var file_triple_header_trailer_proto_greet_proto_msgTypes =
make([]protoimpl.MessageInfo, 8)
+var file_triple_header_trailer_proto_greet_proto_goTypes = []interface{}{
+ (*GreetRequest)(nil), // 0: greet.GreetRequest
+ (*GreetResponse)(nil), // 1: greet.GreetResponse
+ (*GreetStreamRequest)(nil), // 2: greet.GreetStreamRequest
+ (*GreetStreamResponse)(nil), // 3: greet.GreetStreamResponse
+ (*GreetClientStreamRequest)(nil), // 4: greet.GreetClientStreamRequest
+ (*GreetClientStreamResponse)(nil), // 5: greet.GreetClientStreamResponse
+ (*GreetServerStreamRequest)(nil), // 6: greet.GreetServerStreamRequest
+ (*GreetServerStreamResponse)(nil), // 7: greet.GreetServerStreamResponse
+}
+var file_triple_header_trailer_proto_greet_proto_depIdxs = []int32{
+ 0, // 0: greet.GreetService.Greet:input_type -> greet.GreetRequest
+ 2, // 1: greet.GreetService.GreetStream:input_type ->
greet.GreetStreamRequest
+ 4, // 2: greet.GreetService.GreetClientStream:input_type ->
greet.GreetClientStreamRequest
+ 6, // 3: greet.GreetService.GreetServerStream:input_type ->
greet.GreetServerStreamRequest
+ 1, // 4: greet.GreetService.Greet:output_type -> greet.GreetResponse
+ 3, // 5: greet.GreetService.GreetStream:output_type ->
greet.GreetStreamResponse
+ 5, // 6: greet.GreetService.GreetClientStream:output_type ->
greet.GreetClientStreamResponse
+ 7, // 7: greet.GreetService.GreetServerStream:output_type ->
greet.GreetServerStreamResponse
+ 4, // [4:8] is the sub-list for method output_type
+ 0, // [0:4] is the sub-list for method input_type
+ 0, // [0:0] is the sub-list for extension type_name
+ 0, // [0:0] is the sub-list for extension extendee
+ 0, // [0:0] is the sub-list for field type_name
+}
+
+func init() { file_triple_header_trailer_proto_greet_proto_init() }
+func file_triple_header_trailer_proto_greet_proto_init() {
+ if File_triple_header_trailer_proto_greet_proto != nil {
+ return
+ }
+ if !protoimpl.UnsafeEnabled {
+
file_triple_header_trailer_proto_greet_proto_msgTypes[0].Exporter = func(v
interface{}, i int) interface{} {
+ switch v := v.(*GreetRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+
file_triple_header_trailer_proto_greet_proto_msgTypes[1].Exporter = func(v
interface{}, i int) interface{} {
+ switch v := v.(*GreetResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+
file_triple_header_trailer_proto_greet_proto_msgTypes[2].Exporter = func(v
interface{}, i int) interface{} {
+ switch v := v.(*GreetStreamRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+
file_triple_header_trailer_proto_greet_proto_msgTypes[3].Exporter = func(v
interface{}, i int) interface{} {
+ switch v := v.(*GreetStreamResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+
file_triple_header_trailer_proto_greet_proto_msgTypes[4].Exporter = func(v
interface{}, i int) interface{} {
+ switch v := v.(*GreetClientStreamRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+
file_triple_header_trailer_proto_greet_proto_msgTypes[5].Exporter = func(v
interface{}, i int) interface{} {
+ switch v := v.(*GreetClientStreamResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+
file_triple_header_trailer_proto_greet_proto_msgTypes[6].Exporter = func(v
interface{}, i int) interface{} {
+ switch v := v.(*GreetServerStreamRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+
file_triple_header_trailer_proto_greet_proto_msgTypes[7].Exporter = func(v
interface{}, i int) interface{} {
+ switch v := v.(*GreetServerStreamResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ }
+ type x struct{}
+ out := protoimpl.TypeBuilder{
+ File: protoimpl.DescBuilder{
+ GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
+ RawDescriptor:
file_triple_header_trailer_proto_greet_proto_rawDesc,
+ NumEnums: 0,
+ NumMessages: 8,
+ NumExtensions: 0,
+ NumServices: 1,
+ },
+ GoTypes:
file_triple_header_trailer_proto_greet_proto_goTypes,
+ DependencyIndexes:
file_triple_header_trailer_proto_greet_proto_depIdxs,
+ MessageInfos:
file_triple_header_trailer_proto_greet_proto_msgTypes,
+ }.Build()
+ File_triple_header_trailer_proto_greet_proto = out.File
+ file_triple_header_trailer_proto_greet_proto_rawDesc = nil
+ file_triple_header_trailer_proto_greet_proto_goTypes = nil
+ file_triple_header_trailer_proto_greet_proto_depIdxs = nil
+}
diff --git a/triple_header_trailer/proto/greet.proto
b/triple_header_trailer/proto/greet.proto
new file mode 100644
index 00000000..1db97f99
--- /dev/null
+++ b/triple_header_trailer/proto/greet.proto
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+syntax = "proto3";
+
+package greet;
+
+option go_package =
"github.com/apache/dubbo-go-samples/triple_header_trailer/proto;greet";
+
+message GreetRequest {
+ string name = 1;
+}
+
+message GreetResponse {
+ string greeting = 1;
+}
+
+message GreetStreamRequest {
+ string name = 1;
+}
+
+message GreetStreamResponse {
+ string greeting = 1;
+}
+
+message GreetClientStreamRequest {
+ string name = 1;
+}
+
+message GreetClientStreamResponse {
+ string greeting = 1;
+}
+
+message GreetServerStreamRequest {
+ string name = 1;
+}
+
+message GreetServerStreamResponse {
+ string greeting = 1;
+}
+
+service GreetService {
+ rpc Greet(GreetRequest) returns (GreetResponse) {}
+ rpc GreetStream(stream GreetStreamRequest) returns (stream
GreetStreamResponse) {}
+ rpc GreetClientStream(stream GreetClientStreamRequest) returns
(GreetClientStreamResponse) {}
+ rpc GreetServerStream(GreetServerStreamRequest) returns (stream
GreetServerStreamResponse) {}
+}
diff --git a/triple_header_trailer/proto/greet.triple.go
b/triple_header_trailer/proto/greet.triple.go
new file mode 100644
index 00000000..6c80f526
--- /dev/null
+++ b/triple_header_trailer/proto/greet.triple.go
@@ -0,0 +1,375 @@
+// Code generated by protoc-gen-triple. DO NOT EDIT.
+//
+// Source: triple_header_trailer/proto/greet.proto
+package greet
+
+import (
+ "context"
+ "net/http"
+)
+
+import (
+ "dubbo.apache.org/dubbo-go/v3"
+ "dubbo.apache.org/dubbo-go/v3/client"
+ "dubbo.apache.org/dubbo-go/v3/common"
+ "dubbo.apache.org/dubbo-go/v3/common/constant"
+ "dubbo.apache.org/dubbo-go/v3/protocol/triple/triple_protocol"
+ "dubbo.apache.org/dubbo-go/v3/server"
+)
+
+// This is a compile-time assertion to ensure that this generated file and the
Triple package
+// are compatible. If you get a compiler error that this constant is not
defined, this code was
+// generated with a version of Triple newer than the one compiled into your
binary. You can fix the
+// problem by either regenerating this code with an older version of Triple or
updating the Triple
+// version compiled into your binary.
+const _ = triple_protocol.IsAtLeastVersion0_1_0
+
+const (
+ // GreetServiceName is the fully-qualified name of the GreetService
service.
+ GreetServiceName = "greet.GreetService"
+)
+
+// These constants are the fully-qualified names of the RPCs defined in this
package. They're
+// exposed at runtime as procedure and as the final two segments of the HTTP
route.
+//
+// Note that these are different from the fully-qualified method names used by
+// google.golang.org/protobuf/reflect/protoreflect. To convert from these
constants to
+// reflection-formatted method names, remove the leading slash and convert the
remaining slash to a
+// period.
+const (
+ // GreetServiceGreetProcedure is the fully-qualified name of the
GreetService's Greet RPC.
+ GreetServiceGreetProcedure = "/greet.GreetService/Greet"
+ // GreetServiceGreetStreamProcedure is the fully-qualified name of the
GreetService's GreetStream RPC.
+ GreetServiceGreetStreamProcedure = "/greet.GreetService/GreetStream"
+ // GreetServiceGreetClientStreamProcedure is the fully-qualified name
of the GreetService's GreetClientStream RPC.
+ GreetServiceGreetClientStreamProcedure =
"/greet.GreetService/GreetClientStream"
+ // GreetServiceGreetServerStreamProcedure is the fully-qualified name
of the GreetService's GreetServerStream RPC.
+ GreetServiceGreetServerStreamProcedure =
"/greet.GreetService/GreetServerStream"
+)
+
+var (
+ _ GreetService = (*GreetServiceImpl)(nil)
+
+ _ GreetService_GreetStreamClient =
(*GreetServiceGreetStreamClient)(nil)
+ _ GreetService_GreetClientStreamClient =
(*GreetServiceGreetClientStreamClient)(nil)
+ _ GreetService_GreetServerStreamClient =
(*GreetServiceGreetServerStreamClient)(nil)
+
+ _ GreetService_GreetStreamServer =
(*GreetServiceGreetStreamServer)(nil)
+ _ GreetService_GreetClientStreamServer =
(*GreetServiceGreetClientStreamServer)(nil)
+ _ GreetService_GreetServerStreamServer =
(*GreetServiceGreetServerStreamServer)(nil)
+)
+
+// GreetService is a client for the greet.GreetService service.
+type GreetService interface {
+ Greet(ctx context.Context, req *GreetRequest, opts
...client.CallOption) (*GreetResponse, error)
+ GreetStream(ctx context.Context, opts ...client.CallOption)
(GreetService_GreetStreamClient, error)
+ GreetClientStream(ctx context.Context, opts ...client.CallOption)
(GreetService_GreetClientStreamClient, error)
+ GreetServerStream(ctx context.Context, req *GreetServerStreamRequest,
opts ...client.CallOption) (GreetService_GreetServerStreamClient, error)
+}
+
+// NewGreetService constructs a client for the greet.GreetService service.
+func NewGreetService(cli *client.Client, opts ...client.ReferenceOption)
(GreetService, error) {
+ conn, err := cli.DialWithInfo("greet.GreetService",
&GreetService_ClientInfo, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return &GreetServiceImpl{
+ conn: conn,
+ }, nil
+}
+
+func SetConsumerGreetService(srv common.RPCService) {
+ dubbo.SetConsumerServiceWithInfo(srv, &GreetService_ClientInfo)
+}
+
+// GreetServiceImpl implements GreetService.
+type GreetServiceImpl struct {
+ conn *client.Connection
+}
+
+func (c *GreetServiceImpl) Greet(ctx context.Context, req *GreetRequest, opts
...client.CallOption) (*GreetResponse, error) {
+ resp := new(GreetResponse)
+ if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "Greet",
opts...); err != nil {
+ return nil, err
+ }
+ return resp, nil
+}
+
+func (c *GreetServiceImpl) GreetStream(ctx context.Context, opts
...client.CallOption) (GreetService_GreetStreamClient, error) {
+ stream, err := c.conn.CallBidiStream(ctx, "GreetStream", opts...)
+ if err != nil {
+ return nil, err
+ }
+ rawStream := stream.(*triple_protocol.BidiStreamForClient)
+ return &GreetServiceGreetStreamClient{rawStream}, nil
+}
+
+func (c *GreetServiceImpl) GreetClientStream(ctx context.Context, opts
...client.CallOption) (GreetService_GreetClientStreamClient, error) {
+ stream, err := c.conn.CallClientStream(ctx, "GreetClientStream",
opts...)
+ if err != nil {
+ return nil, err
+ }
+ rawStream := stream.(*triple_protocol.ClientStreamForClient)
+ return &GreetServiceGreetClientStreamClient{rawStream}, nil
+}
+
+func (c *GreetServiceImpl) GreetServerStream(ctx context.Context, req
*GreetServerStreamRequest, opts ...client.CallOption)
(GreetService_GreetServerStreamClient, error) {
+ stream, err := c.conn.CallServerStream(ctx, req, "GreetServerStream",
opts...)
+ if err != nil {
+ return nil, err
+ }
+ rawStream := stream.(*triple_protocol.ServerStreamForClient)
+ return &GreetServiceGreetServerStreamClient{rawStream}, nil
+}
+
+type GreetService_GreetStreamClient interface {
+ Spec() triple_protocol.Spec
+ Peer() triple_protocol.Peer
+ Send(*GreetStreamRequest) error
+ RequestHeader() http.Header
+ CloseRequest() error
+ Recv() (*GreetStreamResponse, error)
+ ResponseHeader() http.Header
+ ResponseTrailer() http.Header
+ CloseResponse() error
+}
+
+type GreetServiceGreetStreamClient struct {
+ *triple_protocol.BidiStreamForClient
+}
+
+func (cli *GreetServiceGreetStreamClient) Send(msg *GreetStreamRequest) error {
+ return cli.BidiStreamForClient.Send(msg)
+}
+
+func (cli *GreetServiceGreetStreamClient) Recv() (*GreetStreamResponse, error)
{
+ msg := new(GreetStreamResponse)
+ if err := cli.BidiStreamForClient.Receive(msg); err != nil {
+ return nil, err
+ }
+ return msg, nil
+}
+
+type GreetService_GreetClientStreamClient interface {
+ Spec() triple_protocol.Spec
+ Peer() triple_protocol.Peer
+ Send(*GreetClientStreamRequest) error
+ RequestHeader() http.Header
+ CloseAndRecv() (*GreetClientStreamResponse, error)
+ Conn() (triple_protocol.StreamingClientConn, error)
+}
+
+type GreetServiceGreetClientStreamClient struct {
+ *triple_protocol.ClientStreamForClient
+}
+
+func (cli *GreetServiceGreetClientStreamClient) Send(msg
*GreetClientStreamRequest) error {
+ return cli.ClientStreamForClient.Send(msg)
+}
+
+func (cli *GreetServiceGreetClientStreamClient) CloseAndRecv()
(*GreetClientStreamResponse, error) {
+ msg := new(GreetClientStreamResponse)
+ resp := triple_protocol.NewResponse(msg)
+ if err := cli.ClientStreamForClient.CloseAndReceive(resp); err != nil {
+ return nil, err
+ }
+ return msg, nil
+}
+
+func (cli *GreetServiceGreetClientStreamClient) Conn()
(triple_protocol.StreamingClientConn, error) {
+ return cli.ClientStreamForClient.Conn()
+}
+
+type GreetService_GreetServerStreamClient interface {
+ Recv() bool
+ ResponseHeader() http.Header
+ ResponseTrailer() http.Header
+ Msg() *GreetServerStreamResponse
+ Err() error
+ Conn() (triple_protocol.StreamingClientConn, error)
+ Close() error
+}
+
+type GreetServiceGreetServerStreamClient struct {
+ *triple_protocol.ServerStreamForClient
+}
+
+func (cli *GreetServiceGreetServerStreamClient) Recv() bool {
+ msg := new(GreetServerStreamResponse)
+ return cli.ServerStreamForClient.Receive(msg)
+}
+
+func (cli *GreetServiceGreetServerStreamClient) Msg()
*GreetServerStreamResponse {
+ msg := cli.ServerStreamForClient.Msg()
+ if msg == nil {
+ return new(GreetServerStreamResponse)
+ }
+ return msg.(*GreetServerStreamResponse)
+}
+
+func (cli *GreetServiceGreetServerStreamClient) Conn()
(triple_protocol.StreamingClientConn, error) {
+ return cli.ServerStreamForClient.Conn()
+}
+
+var GreetService_ClientInfo = client.ClientInfo{
+ InterfaceName: "greet.GreetService",
+ MethodNames: []string{"Greet", "GreetStream", "GreetClientStream",
"GreetServerStream"},
+ ConnectionInjectFunc: func(dubboCliRaw interface{}, conn
*client.Connection) {
+ dubboCli := dubboCliRaw.(*GreetServiceImpl)
+ dubboCli.conn = conn
+ },
+}
+
+// GreetServiceHandler is an implementation of the greet.GreetService service.
+type GreetServiceHandler interface {
+ Greet(context.Context, *GreetRequest) (*GreetResponse, error)
+ GreetStream(context.Context, GreetService_GreetStreamServer) error
+ GreetClientStream(context.Context,
GreetService_GreetClientStreamServer) (*GreetClientStreamResponse, error)
+ GreetServerStream(context.Context, *GreetServerStreamRequest,
GreetService_GreetServerStreamServer) error
+}
+
+func RegisterGreetServiceHandler(srv *server.Server, hdlr GreetServiceHandler,
opts ...server.ServiceOption) error {
+ return srv.Register(hdlr, &GreetService_ServiceInfo, opts...)
+}
+
+func SetProviderGreetService(srv common.RPCService) {
+ dubbo.SetProviderServiceWithInfo(srv, &GreetService_ServiceInfo)
+}
+
+type GreetService_GreetStreamServer interface {
+ Send(*GreetStreamResponse) error
+ Recv() (*GreetStreamRequest, error)
+ Spec() triple_protocol.Spec
+ Peer() triple_protocol.Peer
+ RequestHeader() http.Header
+ ResponseHeader() http.Header
+ ResponseTrailer() http.Header
+ Conn() triple_protocol.StreamingHandlerConn
+}
+
+type GreetServiceGreetStreamServer struct {
+ *triple_protocol.BidiStream
+}
+
+func (srv *GreetServiceGreetStreamServer) Send(msg *GreetStreamResponse) error
{
+ return srv.BidiStream.Send(msg)
+}
+
+func (srv GreetServiceGreetStreamServer) Recv() (*GreetStreamRequest, error) {
+ msg := new(GreetStreamRequest)
+ if err := srv.BidiStream.Receive(msg); err != nil {
+ return nil, err
+ }
+ return msg, nil
+}
+
+type GreetService_GreetClientStreamServer interface {
+ Spec() triple_protocol.Spec
+ Peer() triple_protocol.Peer
+ Recv() bool
+ RequestHeader() http.Header
+ Msg() *GreetClientStreamRequest
+ Err() error
+ Conn() triple_protocol.StreamingHandlerConn
+}
+
+type GreetServiceGreetClientStreamServer struct {
+ *triple_protocol.ClientStream
+}
+
+func (srv *GreetServiceGreetClientStreamServer) Recv() bool {
+ msg := new(GreetClientStreamRequest)
+ return srv.ClientStream.Receive(msg)
+}
+
+func (srv *GreetServiceGreetClientStreamServer) Msg()
*GreetClientStreamRequest {
+ msgRaw := srv.ClientStream.Msg()
+ if msgRaw == nil {
+ return new(GreetClientStreamRequest)
+ }
+ return msgRaw.(*GreetClientStreamRequest)
+}
+
+type GreetService_GreetServerStreamServer interface {
+ Send(*GreetServerStreamResponse) error
+ ResponseHeader() http.Header
+ ResponseTrailer() http.Header
+ Conn() triple_protocol.StreamingHandlerConn
+}
+
+type GreetServiceGreetServerStreamServer struct {
+ *triple_protocol.ServerStream
+}
+
+func (g *GreetServiceGreetServerStreamServer) Send(msg
*GreetServerStreamResponse) error {
+ return g.ServerStream.Send(msg)
+}
+
+var GreetService_ServiceInfo = server.ServiceInfo{
+ InterfaceName: "greet.GreetService",
+ ServiceType: (*GreetServiceHandler)(nil),
+ Methods: []server.MethodInfo{
+ {
+ Name: "Greet",
+ Type: constant.CallUnary,
+ ReqInitFunc: func() interface{} {
+ return new(GreetRequest)
+ },
+ MethodFunc: func(ctx context.Context, args
[]interface{}, handler interface{}) (interface{}, error) {
+ req := args[0].(*GreetRequest)
+ res, err :=
handler.(GreetServiceHandler).Greet(ctx, req)
+ if err != nil {
+ return nil, err
+ }
+ return triple_protocol.NewResponse(res), nil
+ },
+ },
+ {
+ Name: "GreetStream",
+ Type: constant.CallBidiStream,
+ StreamInitFunc: func(baseStream interface{})
interface{} {
+ return
&GreetServiceGreetStreamServer{baseStream.(*triple_protocol.BidiStream)}
+ },
+ MethodFunc: func(ctx context.Context, args
[]interface{}, handler interface{}) (interface{}, error) {
+ stream :=
args[0].(GreetService_GreetStreamServer)
+ if err :=
handler.(GreetServiceHandler).GreetStream(ctx, stream); err != nil {
+ return nil, err
+ }
+ return nil, nil
+ },
+ },
+ {
+ Name: "GreetClientStream",
+ Type: constant.CallClientStream,
+ StreamInitFunc: func(baseStream interface{})
interface{} {
+ return
&GreetServiceGreetClientStreamServer{baseStream.(*triple_protocol.ClientStream)}
+ },
+ MethodFunc: func(ctx context.Context, args
[]interface{}, handler interface{}) (interface{}, error) {
+ stream :=
args[0].(GreetService_GreetClientStreamServer)
+ res, err :=
handler.(GreetServiceHandler).GreetClientStream(ctx, stream)
+ if err != nil {
+ return nil, err
+ }
+ return triple_protocol.NewResponse(res), nil
+ },
+ },
+ {
+ Name: "GreetServerStream",
+ Type: constant.CallServerStream,
+ ReqInitFunc: func() interface{} {
+ return new(GreetServerStreamRequest)
+ },
+ StreamInitFunc: func(baseStream interface{})
interface{} {
+ return
&GreetServiceGreetServerStreamServer{baseStream.(*triple_protocol.ServerStream)}
+ },
+ MethodFunc: func(ctx context.Context, args
[]interface{}, handler interface{}) (interface{}, error) {
+ req := args[0].(*GreetServerStreamRequest)
+ stream :=
args[1].(GreetService_GreetServerStreamServer)
+ if err :=
handler.(GreetServiceHandler).GreetServerStream(ctx, req, stream); err != nil {
+ return nil, err
+ }
+ return nil, nil
+ },
+ },
+ },
+}