forked from DanielKrawisz/bmd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rpc.pb.go
351 lines (306 loc) · 13.3 KB
/
rpc.pb.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
// Code generated by protoc-gen-go.
// source: rpc.proto
// DO NOT EDIT!
/*
Package rpcproto is a generated protocol buffer package.
It is generated from these files:
rpc.proto
It has these top-level messages:
GetIdentityRequest
GetIdentityReply
Object
SendObjectReply
GetObjectsRequest
*/
package rpcproto
import proto "github.com/golang/protobuf/proto"
import fmt "fmt"
import math "math"
import (
context "golang.org/x/net/context"
grpc "google.golang.org/grpc"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
const _ = proto.ProtoPackageIsVersion1
// ObjectType is an enum which contains various types of objects.
type ObjectType int32
const (
ObjectType_GETPUBKEY ObjectType = 0
ObjectType_PUBKEY ObjectType = 1
ObjectType_MESSAGE ObjectType = 2
ObjectType_BROADCAST ObjectType = 3
ObjectType_UNKNOWN ObjectType = 99
)
var ObjectType_name = map[int32]string{
0: "GETPUBKEY",
1: "PUBKEY",
2: "MESSAGE",
3: "BROADCAST",
99: "UNKNOWN",
}
var ObjectType_value = map[string]int32{
"GETPUBKEY": 0,
"PUBKEY": 1,
"MESSAGE": 2,
"BROADCAST": 3,
"UNKNOWN": 99,
}
func (x ObjectType) String() string {
return proto.EnumName(ObjectType_name, int32(x))
}
func (ObjectType) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
type GetIdentityRequest struct {
// A properly formatted Bitmessage address.
Address string `protobuf:"bytes,1,opt,name=address" json:"address,omitempty"`
}
func (m *GetIdentityRequest) Reset() { *m = GetIdentityRequest{} }
func (m *GetIdentityRequest) String() string { return proto.CompactTextString(m) }
func (*GetIdentityRequest) ProtoMessage() {}
func (*GetIdentityRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
type GetIdentityReply struct {
// Nonce Trials Per Byte: POW parameter.
NonceTrials uint64 `protobuf:"varint,1,opt,name=nonce_trials,json=nonceTrials" json:"nonce_trials,omitempty"`
// Extra bytes: POW parameter.
ExtraBytes uint64 `protobuf:"varint,2,opt,name=extra_bytes,json=extraBytes" json:"extra_bytes,omitempty"`
// Uncompressed secp256k1 public key.
SigningKey []byte `protobuf:"bytes,3,opt,name=signing_key,json=signingKey,proto3" json:"signing_key,omitempty"`
// Uncompressed secp256k1 public key.
EncryptionKey []byte `protobuf:"bytes,4,opt,name=encryption_key,json=encryptionKey,proto3" json:"encryption_key,omitempty"`
}
func (m *GetIdentityReply) Reset() { *m = GetIdentityReply{} }
func (m *GetIdentityReply) String() string { return proto.CompactTextString(m) }
func (*GetIdentityReply) ProtoMessage() {}
func (*GetIdentityReply) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
type Object struct {
// Properly serialized object bytes. It includes the object header (but not
// the Bitmessage message header).
Contents []byte `protobuf:"bytes,1,opt,name=contents,proto3" json:"contents,omitempty"`
// Counter value of the object, as in bmd's database. It is ignored with
// SendObject.
Counter uint64 `protobuf:"varint,2,opt,name=counter" json:"counter,omitempty"`
}
func (m *Object) Reset() { *m = Object{} }
func (m *Object) String() string { return proto.CompactTextString(m) }
func (*Object) ProtoMessage() {}
func (*Object) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} }
type SendObjectReply struct {
// Counter value of the object, as inserted in bmd's database.
Counter uint64 `protobuf:"varint,1,opt,name=counter" json:"counter,omitempty"`
}
func (m *SendObjectReply) Reset() { *m = SendObjectReply{} }
func (m *SendObjectReply) String() string { return proto.CompactTextString(m) }
func (*SendObjectReply) ProtoMessage() {}
func (*SendObjectReply) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} }
type GetObjectsRequest struct {
// Type of object the client wants to receive.
ObjectType ObjectType `protobuf:"varint,1,opt,name=object_type,json=objectType,enum=ObjectType" json:"object_type,omitempty"`
// Counter value the server should start sending object messages from.
FromCounter uint64 `protobuf:"varint,2,opt,name=from_counter,json=fromCounter" json:"from_counter,omitempty"`
}
func (m *GetObjectsRequest) Reset() { *m = GetObjectsRequest{} }
func (m *GetObjectsRequest) String() string { return proto.CompactTextString(m) }
func (*GetObjectsRequest) ProtoMessage() {}
func (*GetObjectsRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} }
func init() {
proto.RegisterType((*GetIdentityRequest)(nil), "GetIdentityRequest")
proto.RegisterType((*GetIdentityReply)(nil), "GetIdentityReply")
proto.RegisterType((*Object)(nil), "Object")
proto.RegisterType((*SendObjectReply)(nil), "SendObjectReply")
proto.RegisterType((*GetObjectsRequest)(nil), "GetObjectsRequest")
proto.RegisterEnum("ObjectType", ObjectType_name, ObjectType_value)
}
// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ grpc.ClientConn
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
const _ = grpc.SupportPackageIsVersion2
// Client API for Bmd service
type BmdClient interface {
// Retrieve the public identity of the given address. This is constructed from
// public keys stored in the database. If the public key for the specified
// address doesn't exist, an error is returned.
GetIdentity(ctx context.Context, in *GetIdentityRequest, opts ...grpc.CallOption) (*GetIdentityReply, error)
// Send the specified object onto the network. The object is first verified,
// then inserted into bmd's database and advertised onto the network. Return
// value is the counter value of the inserted object.
SendObject(ctx context.Context, in *Object, opts ...grpc.CallOption) (*SendObjectReply, error)
// Gets objects of the specified type that have their counter values starting
// from what is specified. This method streams new objects until the stream
// is closed. Objects are guaranteed to be in ascending order.
GetObjects(ctx context.Context, in *GetObjectsRequest, opts ...grpc.CallOption) (Bmd_GetObjectsClient, error)
}
type bmdClient struct {
cc *grpc.ClientConn
}
func NewBmdClient(cc *grpc.ClientConn) BmdClient {
return &bmdClient{cc}
}
func (c *bmdClient) GetIdentity(ctx context.Context, in *GetIdentityRequest, opts ...grpc.CallOption) (*GetIdentityReply, error) {
out := new(GetIdentityReply)
err := grpc.Invoke(ctx, "/Bmd/GetIdentity", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *bmdClient) SendObject(ctx context.Context, in *Object, opts ...grpc.CallOption) (*SendObjectReply, error) {
out := new(SendObjectReply)
err := grpc.Invoke(ctx, "/Bmd/SendObject", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *bmdClient) GetObjects(ctx context.Context, in *GetObjectsRequest, opts ...grpc.CallOption) (Bmd_GetObjectsClient, error) {
stream, err := grpc.NewClientStream(ctx, &_Bmd_serviceDesc.Streams[0], c.cc, "/Bmd/GetObjects", opts...)
if err != nil {
return nil, err
}
x := &bmdGetObjectsClient{stream}
if err := x.ClientStream.SendMsg(in); err != nil {
return nil, err
}
if err := x.ClientStream.CloseSend(); err != nil {
return nil, err
}
return x, nil
}
type Bmd_GetObjectsClient interface {
Recv() (*Object, error)
grpc.ClientStream
}
type bmdGetObjectsClient struct {
grpc.ClientStream
}
func (x *bmdGetObjectsClient) Recv() (*Object, error) {
m := new(Object)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
// Server API for Bmd service
type BmdServer interface {
// Retrieve the public identity of the given address. This is constructed from
// public keys stored in the database. If the public key for the specified
// address doesn't exist, an error is returned.
GetIdentity(context.Context, *GetIdentityRequest) (*GetIdentityReply, error)
// Send the specified object onto the network. The object is first verified,
// then inserted into bmd's database and advertised onto the network. Return
// value is the counter value of the inserted object.
SendObject(context.Context, *Object) (*SendObjectReply, error)
// Gets objects of the specified type that have their counter values starting
// from what is specified. This method streams new objects until the stream
// is closed. Objects are guaranteed to be in ascending order.
GetObjects(*GetObjectsRequest, Bmd_GetObjectsServer) error
}
func RegisterBmdServer(s *grpc.Server, srv BmdServer) {
s.RegisterService(&_Bmd_serviceDesc, srv)
}
func _Bmd_GetIdentity_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetIdentityRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(BmdServer).GetIdentity(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/Bmd/GetIdentity",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(BmdServer).GetIdentity(ctx, req.(*GetIdentityRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Bmd_SendObject_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(Object)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(BmdServer).SendObject(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/Bmd/SendObject",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(BmdServer).SendObject(ctx, req.(*Object))
}
return interceptor(ctx, in, info, handler)
}
func _Bmd_GetObjects_Handler(srv interface{}, stream grpc.ServerStream) error {
m := new(GetObjectsRequest)
if err := stream.RecvMsg(m); err != nil {
return err
}
return srv.(BmdServer).GetObjects(m, &bmdGetObjectsServer{stream})
}
type Bmd_GetObjectsServer interface {
Send(*Object) error
grpc.ServerStream
}
type bmdGetObjectsServer struct {
grpc.ServerStream
}
func (x *bmdGetObjectsServer) Send(m *Object) error {
return x.ServerStream.SendMsg(m)
}
var _Bmd_serviceDesc = grpc.ServiceDesc{
ServiceName: "Bmd",
HandlerType: (*BmdServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "GetIdentity",
Handler: _Bmd_GetIdentity_Handler,
},
{
MethodName: "SendObject",
Handler: _Bmd_SendObject_Handler,
},
},
Streams: []grpc.StreamDesc{
{
StreamName: "GetObjects",
Handler: _Bmd_GetObjects_Handler,
ServerStreams: true,
},
},
}
var fileDescriptor0 = []byte{
// 406 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x64, 0x92, 0xdf, 0x8e, 0x9a, 0x40,
0x14, 0xc6, 0x8b, 0x1a, 0xff, 0x1c, 0xd4, 0xe2, 0xf4, 0x86, 0x70, 0xd3, 0x96, 0xa4, 0x69, 0x53,
0x1b, 0xd2, 0xd8, 0xf4, 0xb6, 0x89, 0x58, 0x62, 0x36, 0x66, 0xd5, 0x00, 0x66, 0xb3, 0x7b, 0x43,
0x14, 0x66, 0x0d, 0xbb, 0x3a, 0xc3, 0x0e, 0x63, 0xb2, 0xbc, 0xc6, 0x3e, 0xc0, 0x3e, 0xeb, 0xc2,
0x00, 0xa2, 0xeb, 0x15, 0x73, 0x3e, 0x7e, 0xdf, 0xe4, 0x9c, 0x6f, 0x0e, 0x74, 0x58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