starpc 0.0.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/LICENSE +19 -0
  2. package/Makefile +140 -0
  3. package/README.md +128 -26
  4. package/dist/echo/echo.d.ts +59 -0
  5. package/dist/echo/echo.js +85 -0
  6. package/dist/srpc/broadcast-channel.d.ts +16 -0
  7. package/dist/srpc/broadcast-channel.js +60 -0
  8. package/dist/srpc/client-rpc.d.ts +31 -0
  9. package/dist/srpc/client-rpc.js +176 -0
  10. package/dist/srpc/client.d.ts +12 -0
  11. package/dist/srpc/client.js +129 -0
  12. package/dist/srpc/conn.d.ts +14 -0
  13. package/dist/srpc/conn.js +38 -0
  14. package/dist/srpc/index.d.ts +3 -0
  15. package/dist/srpc/index.js +2 -0
  16. package/dist/srpc/packet.d.ts +9 -0
  17. package/dist/srpc/packet.js +89 -0
  18. package/dist/srpc/rpcproto.d.ts +194 -0
  19. package/dist/srpc/rpcproto.js +322 -0
  20. package/dist/srpc/stream.d.ts +5 -0
  21. package/dist/srpc/stream.js +1 -0
  22. package/dist/srpc/ts-proto-rpc.d.ts +7 -0
  23. package/dist/srpc/ts-proto-rpc.js +1 -0
  24. package/dist/srpc/websocket.d.ts +7 -0
  25. package/dist/srpc/websocket.js +18 -0
  26. package/e2e/e2e.go +1 -0
  27. package/e2e/e2e_test.go +158 -0
  28. package/echo/echo.go +1 -0
  29. package/echo/echo.pb.go +165 -0
  30. package/echo/echo.proto +19 -0
  31. package/echo/echo.ts +191 -0
  32. package/echo/echo_srpc.pb.go +333 -0
  33. package/echo/echo_vtproto.pb.go +271 -0
  34. package/echo/server.go +73 -0
  35. package/go.mod +50 -0
  36. package/go.sum +210 -0
  37. package/integration/integration.bash +25 -0
  38. package/integration/integration.go +30 -0
  39. package/integration/integration.ts +54 -0
  40. package/integration/tsconfig.json +11 -0
  41. package/package.json +77 -9
  42. package/patches/@libp2p+mplex+1.2.1.patch +22 -0
  43. package/srpc/broadcast-channel.ts +72 -0
  44. package/srpc/client-rpc.go +163 -0
  45. package/srpc/client-rpc.ts +197 -0
  46. package/srpc/client.go +96 -0
  47. package/srpc/client.ts +182 -0
  48. package/srpc/conn.go +7 -0
  49. package/srpc/conn.ts +49 -0
  50. package/srpc/errors.go +20 -0
  51. package/srpc/handler.go +13 -0
  52. package/srpc/index.ts +3 -0
  53. package/srpc/message.go +7 -0
  54. package/srpc/mux.go +76 -0
  55. package/srpc/packet-rw.go +102 -0
  56. package/srpc/packet.go +71 -0
  57. package/srpc/packet.ts +105 -0
  58. package/srpc/rpc-stream.go +76 -0
  59. package/srpc/rpcproto.pb.go +455 -0
  60. package/srpc/rpcproto.proto +46 -0
  61. package/srpc/rpcproto.ts +467 -0
  62. package/srpc/rpcproto_vtproto.pb.go +1094 -0
  63. package/srpc/server-http.go +66 -0
  64. package/srpc/server-pipe.go +26 -0
  65. package/srpc/server-rpc.go +160 -0
  66. package/srpc/server.go +29 -0
  67. package/srpc/stream-pipe.go +86 -0
  68. package/srpc/stream.go +24 -0
  69. package/srpc/stream.ts +11 -0
  70. package/srpc/ts-proto-rpc.ts +29 -0
  71. package/srpc/websocket.go +68 -0
  72. package/srpc/websocket.ts +22 -0
  73. package/srpc/writer.go +9 -0
@@ -0,0 +1,19 @@
1
+ syntax = "proto3";
2
+ package echo;
3
+
4
+ // Echoer service returns the given message.
5
+ service Echoer {
6
+ // Echo returns the given message.
7
+ rpc Echo(EchoMsg) returns (EchoMsg);
8
+ // EchoServerStream is an example of a server -> client one-way stream.
9
+ rpc EchoServerStream(EchoMsg) returns (stream EchoMsg);
10
+ // EchoClientStream is an example of client->server one-way stream.
11
+ rpc EchoClientStream(stream EchoMsg) returns (EchoMsg);
12
+ // EchoBidiStream is an example of a two-way stream.
13
+ rpc EchoBidiStream(stream EchoMsg) returns (stream EchoMsg);
14
+ }
15
+
16
+ // EchoMsg is the message body for Echo.
17
+ message EchoMsg {
18
+ string body = 1;
19
+ }
package/echo/echo.ts ADDED
@@ -0,0 +1,191 @@
1
+ /* eslint-disable */
2
+ import Long from 'long'
3
+ import * as _m0 from 'protobufjs/minimal'
4
+ import { Observable } from 'rxjs'
5
+ import { map } from 'rxjs/operators'
6
+
7
+ export const protobufPackage = 'echo'
8
+
9
+ /** EchoMsg is the message body for Echo. */
10
+ export interface EchoMsg {
11
+ body: string
12
+ }
13
+
14
+ function createBaseEchoMsg(): EchoMsg {
15
+ return { body: '' }
16
+ }
17
+
18
+ export const EchoMsg = {
19
+ encode(
20
+ message: EchoMsg,
21
+ writer: _m0.Writer = _m0.Writer.create()
22
+ ): _m0.Writer {
23
+ if (message.body !== '') {
24
+ writer.uint32(10).string(message.body)
25
+ }
26
+ return writer
27
+ },
28
+
29
+ decode(input: _m0.Reader | Uint8Array, length?: number): EchoMsg {
30
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input)
31
+ let end = length === undefined ? reader.len : reader.pos + length
32
+ const message = createBaseEchoMsg()
33
+ while (reader.pos < end) {
34
+ const tag = reader.uint32()
35
+ switch (tag >>> 3) {
36
+ case 1:
37
+ message.body = reader.string()
38
+ break
39
+ default:
40
+ reader.skipType(tag & 7)
41
+ break
42
+ }
43
+ }
44
+ return message
45
+ },
46
+
47
+ fromJSON(object: any): EchoMsg {
48
+ return {
49
+ body: isSet(object.body) ? String(object.body) : '',
50
+ }
51
+ },
52
+
53
+ toJSON(message: EchoMsg): unknown {
54
+ const obj: any = {}
55
+ message.body !== undefined && (obj.body = message.body)
56
+ return obj
57
+ },
58
+
59
+ fromPartial<I extends Exact<DeepPartial<EchoMsg>, I>>(object: I): EchoMsg {
60
+ const message = createBaseEchoMsg()
61
+ message.body = object.body ?? ''
62
+ return message
63
+ },
64
+ }
65
+
66
+ /** Echoer service returns the given message. */
67
+ export interface Echoer {
68
+ /** Echo returns the given message. */
69
+ Echo(request: EchoMsg): Promise<EchoMsg>
70
+ /** EchoServerStream is an example of a server -> client one-way stream. */
71
+ EchoServerStream(request: EchoMsg): Observable<EchoMsg>
72
+ /** EchoClientStream is an example of client->server one-way stream. */
73
+ EchoClientStream(request: Observable<EchoMsg>): Promise<EchoMsg>
74
+ /** EchoBidiStream is an example of a two-way stream. */
75
+ EchoBidiStream(request: Observable<EchoMsg>): Observable<EchoMsg>
76
+ }
77
+
78
+ export class EchoerClientImpl implements Echoer {
79
+ private readonly rpc: Rpc
80
+ constructor(rpc: Rpc) {
81
+ this.rpc = rpc
82
+ this.Echo = this.Echo.bind(this)
83
+ this.EchoServerStream = this.EchoServerStream.bind(this)
84
+ this.EchoClientStream = this.EchoClientStream.bind(this)
85
+ this.EchoBidiStream = this.EchoBidiStream.bind(this)
86
+ }
87
+ Echo(request: EchoMsg): Promise<EchoMsg> {
88
+ const data = EchoMsg.encode(request).finish()
89
+ const promise = this.rpc.request('echo.Echoer', 'Echo', data)
90
+ return promise.then((data) => EchoMsg.decode(new _m0.Reader(data)))
91
+ }
92
+
93
+ EchoServerStream(request: EchoMsg): Observable<EchoMsg> {
94
+ const data = EchoMsg.encode(request).finish()
95
+ const result = this.rpc.serverStreamingRequest(
96
+ 'echo.Echoer',
97
+ 'EchoServerStream',
98
+ data
99
+ )
100
+ return result.pipe(map((data) => EchoMsg.decode(new _m0.Reader(data))))
101
+ }
102
+
103
+ EchoClientStream(request: Observable<EchoMsg>): Promise<EchoMsg> {
104
+ const data = request.pipe(
105
+ map((request) => EchoMsg.encode(request).finish())
106
+ )
107
+ const promise = this.rpc.clientStreamingRequest(
108
+ 'echo.Echoer',
109
+ 'EchoClientStream',
110
+ data
111
+ )
112
+ return promise.then((data) => EchoMsg.decode(new _m0.Reader(data)))
113
+ }
114
+
115
+ EchoBidiStream(request: Observable<EchoMsg>): Observable<EchoMsg> {
116
+ const data = request.pipe(
117
+ map((request) => EchoMsg.encode(request).finish())
118
+ )
119
+ const result = this.rpc.bidirectionalStreamingRequest(
120
+ 'echo.Echoer',
121
+ 'EchoBidiStream',
122
+ data
123
+ )
124
+ return result.pipe(map((data) => EchoMsg.decode(new _m0.Reader(data))))
125
+ }
126
+ }
127
+
128
+ interface Rpc {
129
+ request(
130
+ service: string,
131
+ method: string,
132
+ data: Uint8Array
133
+ ): Promise<Uint8Array>
134
+ clientStreamingRequest(
135
+ service: string,
136
+ method: string,
137
+ data: Observable<Uint8Array>
138
+ ): Promise<Uint8Array>
139
+ serverStreamingRequest(
140
+ service: string,
141
+ method: string,
142
+ data: Uint8Array
143
+ ): Observable<Uint8Array>
144
+ bidirectionalStreamingRequest(
145
+ service: string,
146
+ method: string,
147
+ data: Observable<Uint8Array>
148
+ ): Observable<Uint8Array>
149
+ }
150
+
151
+ type Builtin =
152
+ | Date
153
+ | Function
154
+ | Uint8Array
155
+ | string
156
+ | number
157
+ | boolean
158
+ | undefined
159
+
160
+ export type DeepPartial<T> = T extends Builtin
161
+ ? T
162
+ : T extends Long
163
+ ? string | number | Long
164
+ : T extends Array<infer U>
165
+ ? Array<DeepPartial<U>>
166
+ : T extends ReadonlyArray<infer U>
167
+ ? ReadonlyArray<DeepPartial<U>>
168
+ : T extends { $case: string }
169
+ ? { [K in keyof Omit<T, '$case'>]?: DeepPartial<T[K]> } & {
170
+ $case: T['$case']
171
+ }
172
+ : T extends {}
173
+ ? { [K in keyof T]?: DeepPartial<T[K]> }
174
+ : Partial<T>
175
+
176
+ type KeysOfUnion<T> = T extends T ? keyof T : never
177
+ export type Exact<P, I extends P> = P extends Builtin
178
+ ? P
179
+ : P & { [K in keyof P]: Exact<P[K], I[K]> } & Record<
180
+ Exclude<keyof I, KeysOfUnion<P>>,
181
+ never
182
+ >
183
+
184
+ if (_m0.util.Long !== Long) {
185
+ _m0.util.Long = Long as any
186
+ _m0.configure()
187
+ }
188
+
189
+ function isSet(value: any): boolean {
190
+ return value !== null && value !== undefined
191
+ }
@@ -0,0 +1,333 @@
1
+ // Code generated by protoc-gen-srpc. DO NOT EDIT.
2
+ // protoc-gen-srpc version: v0.0.0-20220611014014-aa9dc5523865
3
+ // source: github.com/aperturerobotics/starpc/echo/echo.proto
4
+
5
+ package echo
6
+
7
+ import (
8
+ context "context"
9
+
10
+ srpc "github.com/aperturerobotics/starpc/srpc"
11
+ )
12
+
13
+ type SRPCEchoerClient interface {
14
+ SRPCClient() srpc.Client
15
+
16
+ Echo(ctx context.Context, in *EchoMsg) (*EchoMsg, error)
17
+ EchoServerStream(ctx context.Context, in *EchoMsg) (SRPCEchoer_EchoServerStreamClient, error)
18
+ EchoClientStream(ctx context.Context) (SRPCEchoer_EchoClientStreamClient, error)
19
+ EchoBidiStream(ctx context.Context) (SRPCEchoer_EchoBidiStreamClient, error)
20
+ }
21
+
22
+ type srpcEchoerClient struct {
23
+ cc srpc.Client
24
+ }
25
+
26
+ func NewSRPCEchoerClient(cc srpc.Client) SRPCEchoerClient {
27
+ return &srpcEchoerClient{cc}
28
+ }
29
+
30
+ func (c *srpcEchoerClient) SRPCClient() srpc.Client { return c.cc }
31
+
32
+ func (c *srpcEchoerClient) Echo(ctx context.Context, in *EchoMsg) (*EchoMsg, error) {
33
+ out := new(EchoMsg)
34
+ err := c.cc.Invoke(ctx, "echo.Echoer", "Echo", in, out)
35
+ if err != nil {
36
+ return nil, err
37
+ }
38
+ return out, nil
39
+ }
40
+
41
+ func (c *srpcEchoerClient) EchoServerStream(ctx context.Context, in *EchoMsg) (SRPCEchoer_EchoServerStreamClient, error) {
42
+ stream, err := c.cc.NewStream(ctx, "echo.Echoer", "EchoServerStream", in)
43
+ if err != nil {
44
+ return nil, err
45
+ }
46
+ strm := &srpcEchoer_EchoServerStreamClient{stream}
47
+ if err := strm.CloseSend(); err != nil {
48
+ return nil, err
49
+ }
50
+ return strm, nil
51
+ }
52
+
53
+ type SRPCEchoer_EchoServerStreamClient interface {
54
+ srpc.Stream
55
+ Recv() (*EchoMsg, error)
56
+ RecvTo(*EchoMsg) error
57
+ }
58
+
59
+ type srpcEchoer_EchoServerStreamClient struct {
60
+ srpc.Stream
61
+ }
62
+
63
+ func (x *srpcEchoer_EchoServerStreamClient) Recv() (*EchoMsg, error) {
64
+ m := new(EchoMsg)
65
+ if err := x.MsgRecv(m); err != nil {
66
+ return nil, err
67
+ }
68
+ return m, nil
69
+ }
70
+
71
+ func (x *srpcEchoer_EchoServerStreamClient) RecvTo(m *EchoMsg) error {
72
+ return x.MsgRecv(m)
73
+ }
74
+
75
+ func (c *srpcEchoerClient) EchoClientStream(ctx context.Context) (SRPCEchoer_EchoClientStreamClient, error) {
76
+ stream, err := c.cc.NewStream(ctx, "echo.Echoer", "EchoClientStream", nil)
77
+ if err != nil {
78
+ return nil, err
79
+ }
80
+ strm := &srpcEchoer_EchoClientStreamClient{stream}
81
+ return strm, nil
82
+ }
83
+
84
+ type SRPCEchoer_EchoClientStreamClient interface {
85
+ srpc.Stream
86
+ Send(*EchoMsg) error
87
+ CloseAndRecv() (*EchoMsg, error)
88
+ }
89
+
90
+ type srpcEchoer_EchoClientStreamClient struct {
91
+ srpc.Stream
92
+ }
93
+
94
+ func (x *srpcEchoer_EchoClientStreamClient) Send(m *EchoMsg) error {
95
+ return x.MsgSend(m)
96
+ }
97
+
98
+ func (x *srpcEchoer_EchoClientStreamClient) CloseAndRecv() (*EchoMsg, error) {
99
+ if err := x.CloseSend(); err != nil {
100
+ return nil, err
101
+ }
102
+ m := new(EchoMsg)
103
+ if err := x.MsgRecv(m); err != nil {
104
+ return nil, err
105
+ }
106
+ return m, nil
107
+ }
108
+
109
+ func (x *srpcEchoer_EchoClientStreamClient) CloseAndMsgRecv(m *EchoMsg) error {
110
+ if err := x.CloseSend(); err != nil {
111
+ return err
112
+ }
113
+ return x.MsgRecv(m)
114
+ }
115
+
116
+ func (c *srpcEchoerClient) EchoBidiStream(ctx context.Context) (SRPCEchoer_EchoBidiStreamClient, error) {
117
+ stream, err := c.cc.NewStream(ctx, "echo.Echoer", "EchoBidiStream", nil)
118
+ if err != nil {
119
+ return nil, err
120
+ }
121
+ strm := &srpcEchoer_EchoBidiStreamClient{stream}
122
+ return strm, nil
123
+ }
124
+
125
+ type SRPCEchoer_EchoBidiStreamClient interface {
126
+ srpc.Stream
127
+ Send(*EchoMsg) error
128
+ Recv() (*EchoMsg, error)
129
+ RecvTo(*EchoMsg) error
130
+ }
131
+
132
+ type srpcEchoer_EchoBidiStreamClient struct {
133
+ srpc.Stream
134
+ }
135
+
136
+ func (x *srpcEchoer_EchoBidiStreamClient) Send(m *EchoMsg) error {
137
+ return x.MsgSend(m)
138
+ }
139
+
140
+ func (x *srpcEchoer_EchoBidiStreamClient) Recv() (*EchoMsg, error) {
141
+ m := new(EchoMsg)
142
+ if err := x.MsgRecv(m); err != nil {
143
+ return nil, err
144
+ }
145
+ return m, nil
146
+ }
147
+
148
+ func (x *srpcEchoer_EchoBidiStreamClient) RecvTo(m *EchoMsg) error {
149
+ return x.MsgRecv(m)
150
+ }
151
+
152
+ type SRPCEchoerServer interface {
153
+ Echo(context.Context, *EchoMsg) (*EchoMsg, error)
154
+ EchoServerStream(*EchoMsg, SRPCEchoer_EchoServerStreamStream) error
155
+ EchoClientStream(SRPCEchoer_EchoClientStreamStream) error
156
+ EchoBidiStream(SRPCEchoer_EchoBidiStreamStream) error
157
+ }
158
+
159
+ type SRPCEchoerUnimplementedServer struct{}
160
+
161
+ func (s *SRPCEchoerUnimplementedServer) Echo(context.Context, *EchoMsg) (*EchoMsg, error) {
162
+ return nil, srpc.ErrUnimplemented
163
+ }
164
+
165
+ func (s *SRPCEchoerUnimplementedServer) EchoServerStream(*EchoMsg, SRPCEchoer_EchoServerStreamStream) error {
166
+ return srpc.ErrUnimplemented
167
+ }
168
+
169
+ func (s *SRPCEchoerUnimplementedServer) EchoClientStream(SRPCEchoer_EchoClientStreamStream) error {
170
+ return srpc.ErrUnimplemented
171
+ }
172
+
173
+ func (s *SRPCEchoerUnimplementedServer) EchoBidiStream(SRPCEchoer_EchoBidiStreamStream) error {
174
+ return srpc.ErrUnimplemented
175
+ }
176
+
177
+ const SRPCEchoerServiceID = "echo.Echoer"
178
+
179
+ type SRPCEchoerHandler struct {
180
+ impl SRPCEchoerServer
181
+ }
182
+
183
+ func (SRPCEchoerHandler) GetServiceID() string { return SRPCEchoerServiceID }
184
+
185
+ func (SRPCEchoerHandler) GetMethodIDs() []string {
186
+ return []string{
187
+ "Echo",
188
+ "EchoServerStream",
189
+ "EchoClientStream",
190
+ "EchoBidiStream",
191
+ }
192
+ }
193
+
194
+ func (d *SRPCEchoerHandler) InvokeMethod(
195
+ serviceID, methodID string,
196
+ strm srpc.Stream,
197
+ ) (bool, error) {
198
+ if serviceID != "" && serviceID != d.GetServiceID() {
199
+ return false, nil
200
+ }
201
+
202
+ switch methodID {
203
+ case "Echo":
204
+ return true, d.InvokeMethod_Echo(d.impl, strm)
205
+ case "EchoServerStream":
206
+ return true, d.InvokeMethod_EchoServerStream(d.impl, strm)
207
+ case "EchoClientStream":
208
+ return true, d.InvokeMethod_EchoClientStream(d.impl, strm)
209
+ case "EchoBidiStream":
210
+ return true, d.InvokeMethod_EchoBidiStream(d.impl, strm)
211
+ default:
212
+ return false, nil
213
+ }
214
+ }
215
+
216
+ func (SRPCEchoerHandler) InvokeMethod_Echo(impl SRPCEchoerServer, strm srpc.Stream) error {
217
+ req := new(EchoMsg)
218
+ if err := strm.MsgRecv(req); err != nil {
219
+ return err
220
+ }
221
+ out, err := impl.Echo(strm.Context(), req)
222
+ if err != nil {
223
+ return err
224
+ }
225
+ return strm.MsgSend(out)
226
+ }
227
+
228
+ func (SRPCEchoerHandler) InvokeMethod_EchoServerStream(impl SRPCEchoerServer, strm srpc.Stream) error {
229
+ req := new(EchoMsg)
230
+ if err := strm.MsgRecv(req); err != nil {
231
+ return err
232
+ }
233
+ serverStrm := &srpcEchoer_EchoServerStreamStream{strm}
234
+ return impl.EchoServerStream(req, serverStrm)
235
+ }
236
+
237
+ func (SRPCEchoerHandler) InvokeMethod_EchoClientStream(impl SRPCEchoerServer, strm srpc.Stream) error {
238
+ clientStrm := &srpcEchoer_EchoClientStreamStream{strm}
239
+ return impl.EchoClientStream(clientStrm)
240
+ }
241
+
242
+ func (SRPCEchoerHandler) InvokeMethod_EchoBidiStream(impl SRPCEchoerServer, strm srpc.Stream) error {
243
+ clientStrm := &srpcEchoer_EchoBidiStreamStream{strm}
244
+ return impl.EchoBidiStream(clientStrm)
245
+ }
246
+
247
+ func SRPCRegisterEchoer(mux srpc.Mux, impl SRPCEchoerServer) error {
248
+ return mux.Register(&SRPCEchoerHandler{impl: impl})
249
+ }
250
+
251
+ type SRPCEchoer_EchoStream interface {
252
+ srpc.Stream
253
+ SendAndClose(*EchoMsg) error
254
+ }
255
+
256
+ type srpcEchoer_EchoStream struct {
257
+ srpc.Stream
258
+ }
259
+
260
+ func (x *srpcEchoer_EchoStream) SendAndClose(m *EchoMsg) error {
261
+ if err := x.MsgSend(m); err != nil {
262
+ return err
263
+ }
264
+ return x.CloseSend()
265
+ }
266
+
267
+ type SRPCEchoer_EchoServerStreamStream interface {
268
+ srpc.Stream
269
+ Send(*EchoMsg) error
270
+ }
271
+
272
+ type srpcEchoer_EchoServerStreamStream struct {
273
+ srpc.Stream
274
+ }
275
+
276
+ func (x *srpcEchoer_EchoServerStreamStream) Send(m *EchoMsg) error {
277
+ return x.MsgSend(m)
278
+ }
279
+
280
+ type SRPCEchoer_EchoClientStreamStream interface {
281
+ srpc.Stream
282
+ SendAndClose(*EchoMsg) error
283
+ Recv() (*EchoMsg, error)
284
+ }
285
+
286
+ type srpcEchoer_EchoClientStreamStream struct {
287
+ srpc.Stream
288
+ }
289
+
290
+ func (x *srpcEchoer_EchoClientStreamStream) SendAndClose(m *EchoMsg) error {
291
+ if err := x.MsgSend(m); err != nil {
292
+ return err
293
+ }
294
+ return x.CloseSend()
295
+ }
296
+
297
+ func (x *srpcEchoer_EchoClientStreamStream) Recv() (*EchoMsg, error) {
298
+ m := new(EchoMsg)
299
+ if err := x.MsgRecv(m); err != nil {
300
+ return nil, err
301
+ }
302
+ return m, nil
303
+ }
304
+
305
+ func (x *srpcEchoer_EchoClientStreamStream) RecvTo(m *EchoMsg) error {
306
+ return x.MsgRecv(m)
307
+ }
308
+
309
+ type SRPCEchoer_EchoBidiStreamStream interface {
310
+ srpc.Stream
311
+ Send(*EchoMsg) error
312
+ Recv() (*EchoMsg, error)
313
+ }
314
+
315
+ type srpcEchoer_EchoBidiStreamStream struct {
316
+ srpc.Stream
317
+ }
318
+
319
+ func (x *srpcEchoer_EchoBidiStreamStream) Send(m *EchoMsg) error {
320
+ return x.MsgSend(m)
321
+ }
322
+
323
+ func (x *srpcEchoer_EchoBidiStreamStream) Recv() (*EchoMsg, error) {
324
+ m := new(EchoMsg)
325
+ if err := x.MsgRecv(m); err != nil {
326
+ return nil, err
327
+ }
328
+ return m, nil
329
+ }
330
+
331
+ func (x *srpcEchoer_EchoBidiStreamStream) RecvTo(m *EchoMsg) error {
332
+ return x.MsgRecv(m)
333
+ }