starpc 0.13.2 → 0.14.0

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.
package/srpc/packet.go CHANGED
@@ -16,6 +16,8 @@ func (p *Packet) Validate() error {
16
16
  return b.CallStart.Validate()
17
17
  case *Packet_CallData:
18
18
  return b.CallData.Validate()
19
+ case *Packet_CallCancel:
20
+ return nil
19
21
  default:
20
22
  return ErrUnrecognizedPacket
21
23
  }
@@ -62,6 +64,11 @@ func NewCallDataPacket(data []byte, dataIsZero bool, complete bool, err error) *
62
64
  }}
63
65
  }
64
66
 
67
+ // NewCallCancelPacket constructs a new CallCancel packet with cancel.
68
+ func NewCallCancelPacket() *Packet {
69
+ return &Packet{Body: &Packet_CallCancel{CallCancel: true}}
70
+ }
71
+
65
72
  // Validate performs cursory validation of the packet.
66
73
  func (p *CallData) Validate() error {
67
74
  if len(p.GetData()) == 0 && !p.GetComplete() && len(p.GetError()) == 0 && !p.GetDataIsZero() {
@@ -33,6 +33,7 @@ type Packet struct {
33
33
  //
34
34
  // *Packet_CallStart
35
35
  // *Packet_CallData
36
+ // *Packet_CallCancel
36
37
  Body isPacket_Body `protobuf_oneof:"body"`
37
38
  }
38
39
 
@@ -89,6 +90,13 @@ func (x *Packet) GetCallData() *CallData {
89
90
  return nil
90
91
  }
91
92
 
93
+ func (x *Packet) GetCallCancel() bool {
94
+ if x, ok := x.GetBody().(*Packet_CallCancel); ok {
95
+ return x.CallCancel
96
+ }
97
+ return false
98
+ }
99
+
92
100
  type isPacket_Body interface {
93
101
  isPacket_Body()
94
102
  }
@@ -103,10 +111,17 @@ type Packet_CallData struct {
103
111
  CallData *CallData `protobuf:"bytes,2,opt,name=call_data,json=callData,proto3,oneof"`
104
112
  }
105
113
 
114
+ type Packet_CallCancel struct {
115
+ // CallCancel cancels the call.
116
+ CallCancel bool `protobuf:"varint,3,opt,name=call_cancel,json=callCancel,proto3,oneof"`
117
+ }
118
+
106
119
  func (*Packet_CallStart) isPacket_Body() {}
107
120
 
108
121
  func (*Packet_CallData) isPacket_Body() {}
109
122
 
123
+ func (*Packet_CallCancel) isPacket_Body() {}
124
+
110
125
  // CallStart requests starting a new RPC call.
111
126
  type CallStart struct {
112
127
  state protoimpl.MessageState
@@ -269,31 +284,33 @@ var file_github_com_aperturerobotics_starpc_srpc_rpcproto_proto_rawDesc = []byte
269
284
  0x0a, 0x36, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x65,
270
285
  0x72, 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, 0x73, 0x74,
271
286
  0x61, 0x72, 0x70, 0x63, 0x2f, 0x73, 0x72, 0x70, 0x63, 0x2f, 0x72, 0x70, 0x63, 0x70, 0x72, 0x6f,
272
- 0x74, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x04, 0x73, 0x72, 0x70, 0x63, 0x22, 0x71,
273
- 0x0a, 0x06, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x12, 0x30, 0x0a, 0x0a, 0x63, 0x61, 0x6c, 0x6c,
274
- 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x73,
275
- 0x72, 0x70, 0x63, 0x2e, 0x43, 0x61, 0x6c, 0x6c, 0x53, 0x74, 0x61, 0x72, 0x74, 0x48, 0x00, 0x52,
276
- 0x09, 0x63, 0x61, 0x6c, 0x6c, 0x53, 0x74, 0x61, 0x72, 0x74, 0x12, 0x2d, 0x0a, 0x09, 0x63, 0x61,
277
- 0x6c, 0x6c, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e,
278
- 0x73, 0x72, 0x70, 0x63, 0x2e, 0x43, 0x61, 0x6c, 0x6c, 0x44, 0x61, 0x74, 0x61, 0x48, 0x00, 0x52,
279
- 0x08, 0x63, 0x61, 0x6c, 0x6c, 0x44, 0x61, 0x74, 0x61, 0x42, 0x06, 0x0a, 0x04, 0x62, 0x6f, 0x64,
280
- 0x79, 0x22, 0x81, 0x01, 0x0a, 0x09, 0x43, 0x61, 0x6c, 0x6c, 0x53, 0x74, 0x61, 0x72, 0x74, 0x12,
281
- 0x1f, 0x0a, 0x0b, 0x72, 0x70, 0x63, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, 0x01,
282
- 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x70, 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
283
- 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x70, 0x63, 0x5f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x02,
284
- 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, 0x70, 0x63, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12,
285
- 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64,
286
- 0x61, 0x74, 0x61, 0x12, 0x20, 0x0a, 0x0c, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x69, 0x73, 0x5f, 0x7a,
287
- 0x65, 0x72, 0x6f, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x64, 0x61, 0x74, 0x61, 0x49,
288
- 0x73, 0x5a, 0x65, 0x72, 0x6f, 0x22, 0x72, 0x0a, 0x08, 0x43, 0x61, 0x6c, 0x6c, 0x44, 0x61, 0x74,
289
- 0x61, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52,
290
- 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x20, 0x0a, 0x0c, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x69, 0x73,
291
- 0x5f, 0x7a, 0x65, 0x72, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x64, 0x61, 0x74,
292
- 0x61, 0x49, 0x73, 0x5a, 0x65, 0x72, 0x6f, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6f, 0x6d, 0x70, 0x6c,
293
- 0x65, 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x63, 0x6f, 0x6d, 0x70, 0x6c,
294
- 0x65, 0x74, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x04, 0x20, 0x01,
295
- 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
296
- 0x33,
287
+ 0x74, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x04, 0x73, 0x72, 0x70, 0x63, 0x22, 0x94,
288
+ 0x01, 0x0a, 0x06, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x12, 0x30, 0x0a, 0x0a, 0x63, 0x61, 0x6c,
289
+ 0x6c, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e,
290
+ 0x73, 0x72, 0x70, 0x63, 0x2e, 0x43, 0x61, 0x6c, 0x6c, 0x53, 0x74, 0x61, 0x72, 0x74, 0x48, 0x00,
291
+ 0x52, 0x09, 0x63, 0x61, 0x6c, 0x6c, 0x53, 0x74, 0x61, 0x72, 0x74, 0x12, 0x2d, 0x0a, 0x09, 0x63,
292
+ 0x61, 0x6c, 0x6c, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e,
293
+ 0x2e, 0x73, 0x72, 0x70, 0x63, 0x2e, 0x43, 0x61, 0x6c, 0x6c, 0x44, 0x61, 0x74, 0x61, 0x48, 0x00,
294
+ 0x52, 0x08, 0x63, 0x61, 0x6c, 0x6c, 0x44, 0x61, 0x74, 0x61, 0x12, 0x21, 0x0a, 0x0b, 0x63, 0x61,
295
+ 0x6c, 0x6c, 0x5f, 0x63, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x48,
296
+ 0x00, 0x52, 0x0a, 0x63, 0x61, 0x6c, 0x6c, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x42, 0x06, 0x0a,
297
+ 0x04, 0x62, 0x6f, 0x64, 0x79, 0x22, 0x81, 0x01, 0x0a, 0x09, 0x43, 0x61, 0x6c, 0x6c, 0x53, 0x74,
298
+ 0x61, 0x72, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x72, 0x70, 0x63, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69,
299
+ 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x70, 0x63, 0x53, 0x65, 0x72,
300
+ 0x76, 0x69, 0x63, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x70, 0x63, 0x5f, 0x6d, 0x65, 0x74, 0x68,
301
+ 0x6f, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, 0x70, 0x63, 0x4d, 0x65, 0x74,
302
+ 0x68, 0x6f, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28,
303
+ 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x20, 0x0a, 0x0c, 0x64, 0x61, 0x74, 0x61, 0x5f,
304
+ 0x69, 0x73, 0x5f, 0x7a, 0x65, 0x72, 0x6f, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x64,
305
+ 0x61, 0x74, 0x61, 0x49, 0x73, 0x5a, 0x65, 0x72, 0x6f, 0x22, 0x72, 0x0a, 0x08, 0x43, 0x61, 0x6c,
306
+ 0x6c, 0x44, 0x61, 0x74, 0x61, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20,
307
+ 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x20, 0x0a, 0x0c, 0x64, 0x61, 0x74,
308
+ 0x61, 0x5f, 0x69, 0x73, 0x5f, 0x7a, 0x65, 0x72, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52,
309
+ 0x0a, 0x64, 0x61, 0x74, 0x61, 0x49, 0x73, 0x5a, 0x65, 0x72, 0x6f, 0x12, 0x1a, 0x0a, 0x08, 0x63,
310
+ 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x63,
311
+ 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72,
312
+ 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x62, 0x06, 0x70,
313
+ 0x72, 0x6f, 0x74, 0x6f, 0x33,
297
314
  }
298
315
 
299
316
  var (
@@ -370,6 +387,7 @@ func file_github_com_aperturerobotics_starpc_srpc_rpcproto_proto_init() {
370
387
  file_github_com_aperturerobotics_starpc_srpc_rpcproto_proto_msgTypes[0].OneofWrappers = []interface{}{
371
388
  (*Packet_CallStart)(nil),
372
389
  (*Packet_CallData)(nil),
390
+ (*Packet_CallCancel)(nil),
373
391
  }
374
392
  type x struct{}
375
393
  out := protoimpl.TypeBuilder{