1
2
3
4
14 package echo
15
16 import proto "github.com/golang/protobuf/proto"
17 import fmt "fmt"
18 import math "math"
19
20 import (
21 context "golang.org/x/net/context"
22 grpc "google.golang.org/grpc"
23 )
24
25
26 var _ = proto.Marshal
27 var _ = fmt.Errorf
28 var _ = math.Inf
29
30
31
32
33
34 const _ = proto.ProtoPackageIsVersion2
35
36 type EchoRequest struct {
37 Req string `protobuf:"bytes,1,opt,name=req" json:"req,omitempty"`
38 }
39
40 func (m *EchoRequest) Reset() { *m = EchoRequest{} }
41 func (m *EchoRequest) String() string { return proto.CompactTextString(m) }
42 func (*EchoRequest) ProtoMessage() {}
43 func (*EchoRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
44
45 func (m *EchoRequest) GetReq() string {
46 if m != nil {
47 return m.Req
48 }
49 return ""
50 }
51
52 type EchoResponse struct {
53 Result string `protobuf:"bytes,1,opt,name=result" json:"result,omitempty"`
54 }
55
56 func (m *EchoResponse) Reset() { *m = EchoResponse{} }
57 func (m *EchoResponse) String() string { return proto.CompactTextString(m) }
58 func (*EchoResponse) ProtoMessage() {}
59 func (*EchoResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
60
61 func (m *EchoResponse) GetResult() string {
62 if m != nil {
63 return m.Result
64 }
65 return ""
66 }
67
68 func init() {
69 proto.RegisterType((*EchoRequest)(nil), "echo.EchoRequest")
70 proto.RegisterType((*EchoResponse)(nil), "echo.EchoResponse")
71 }
72
73
74 var _ context.Context
75 var _ grpc.ClientConn
76
77
78
79 const _ = grpc.SupportPackageIsVersion4
80
81
82
83 type EchoClient interface {
84 Echo(ctx context.Context, in *EchoRequest, opts ...grpc.CallOption) (*EchoResponse, error)
85 }
86
87 type echoClient struct {
88 cc *grpc.ClientConn
89 }
90
91 func NewEchoClient(cc *grpc.ClientConn) EchoClient {
92 return &echoClient{cc}
93 }
94
95 func (c *echoClient) Echo(ctx context.Context, in *EchoRequest, opts ...grpc.CallOption) (*EchoResponse, error) {
96 out := new(EchoResponse)
97 err := grpc.Invoke(ctx, "/echo.Echo/Echo", in, out, c.cc, opts...)
98 if err != nil {
99 return nil, err
100 }
101 return out, nil
102 }
103
104
105
106 type EchoServer interface {
107 Echo(context.Context, *EchoRequest) (*EchoResponse, error)
108 }
109
110 func RegisterEchoServer(s *grpc.Server, srv EchoServer) {
111 s.RegisterService(&_Echo_serviceDesc, srv)
112 }
113
114 func _Echo_Echo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
115 in := new(EchoRequest)
116 if err := dec(in); err != nil {
117 return nil, err
118 }
119 if interceptor == nil {
120 return srv.(EchoServer).Echo(ctx, in)
121 }
122 info := &grpc.UnaryServerInfo{
123 Server: srv,
124 FullMethod: "/echo.Echo/Echo",
125 }
126 handler := func(ctx context.Context, req interface{}) (interface{}, error) {
127 return srv.(EchoServer).Echo(ctx, req.(*EchoRequest))
128 }
129 return interceptor(ctx, in, info, handler)
130 }
131
132 var _Echo_serviceDesc = grpc.ServiceDesc{
133 ServiceName: "echo.Echo",
134 HandlerType: (*EchoServer)(nil),
135 Methods: []grpc.MethodDesc{
136 {
137 MethodName: "Echo",
138 Handler: _Echo_Echo_Handler,
139 },
140 },
141 Streams: []grpc.StreamDesc{},
142 Metadata: "echo.proto",
143 }
144
145 func init() { proto.RegisterFile("echo.proto", fileDescriptor0) }
146
147 var fileDescriptor0 = []byte{
148
149 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x4a, 0x4d, 0xce, 0xc8,
150 0xd7, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x01, 0xb1, 0x95, 0xe4, 0xb9, 0xb8, 0x5d, 0x93,
151 0x33, 0xf2, 0x83, 0x52, 0x0b, 0x4b, 0x53, 0x8b, 0x4b, 0x84, 0x04, 0xb8, 0x98, 0x8b, 0x52, 0x0b,
152 0x25, 0x18, 0x15, 0x18, 0x35, 0x38, 0x83, 0x40, 0x4c, 0x25, 0x35, 0x2e, 0x1e, 0x88, 0x82, 0xe2,
153 0x82, 0xfc, 0xbc, 0xe2, 0x54, 0x21, 0x31, 0x2e, 0xb6, 0xa2, 0xd4, 0xe2, 0xd2, 0x9c, 0x12, 0xa8,
154 0x22, 0x28, 0xcf, 0xc8, 0x9c, 0x8b, 0x05, 0xa4, 0x4e, 0x48, 0x1f, 0x4a, 0x0b, 0xea, 0x81, 0xed,
155 0x42, 0x32, 0x5c, 0x4a, 0x08, 0x59, 0x08, 0x62, 0x9c, 0x12, 0x43, 0x12, 0x1b, 0xd8, 0x39, 0xc6,
156 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x1b, 0x48, 0x20, 0x0f, 0x9c, 0x00, 0x00, 0x00,
157 }
158
View as plain text