@cryptotaxi247 / kubo / commits / 0a43ceaa1

add in message wrapper protobuf code

Jeromy committed Aug 17, 2014 at 16:20 UTC 0a43ceaa1365b328ca80192679ee4f1e36af2a47
2 files changed +89
swarm/mes_wrapper.pb.go new
+79
@@ -0,0 +1,79 @@
1 +// Code generated by protoc-gen-go.
2 +// source: mes_wrapper.proto
3 +// DO NOT EDIT!
4 +
5 +/*
6 +Package swarm is a generated protocol buffer package.
7 +
8 +It is generated from these files:
9 + mes_wrapper.proto
10 +
11 +It has these top-level messages:
12 + PBWrapper
13 +*/
14 +package swarm
15 +
16 +import proto "code.google.com/p/goprotobuf/proto"
17 +import math "math"
18 +
19 +// Reference imports to suppress errors if they are not otherwise used.
20 +var _ = proto.Marshal
21 +var _ = math.Inf
22 +
23 +type PBWrapper_MessageType int32
24 +
25 +const (
26 + PBWrapper_DHT_MESSAGE PBWrapper_MessageType = 0
27 +)
28 +
29 +var PBWrapper_MessageType_name = map[int32]string{
30 + 0: "DHT_MESSAGE",
31 +}
32 +var PBWrapper_MessageType_value = map[string]int32{
33 + "DHT_MESSAGE": 0,
34 +}
35 +
36 +func (x PBWrapper_MessageType) Enum() *PBWrapper_MessageType {
37 + p := new(PBWrapper_MessageType)
38 + *p = x
39 + return p
40 +}
41 +func (x PBWrapper_MessageType) String() string {
42 + return proto.EnumName(PBWrapper_MessageType_name, int32(x))
43 +}
44 +func (x *PBWrapper_MessageType) UnmarshalJSON(data []byte) error {
45 + value, err := proto.UnmarshalJSONEnum(PBWrapper_MessageType_value, data, "PBWrapper_MessageType")
46 + if err != nil {
47 + return err
48 + }
49 + *x = PBWrapper_MessageType(value)
50 + return nil
51 +}
52 +
53 +type PBWrapper struct {
54 + Type *PBWrapper_MessageType `protobuf:"varint,1,req,enum=swarm.PBWrapper_MessageType" json:"Type,omitempty"`
55 + Message []byte `protobuf:"bytes,2,req" json:"Message,omitempty"`
56 + XXX_unrecognized []byte `json:"-"`
57 +}
58 +
59 +func (m *PBWrapper) Reset() { *m = PBWrapper{} }
60 +func (m *PBWrapper) String() string { return proto.CompactTextString(m) }
61 +func (*PBWrapper) ProtoMessage() {}
62 +
63 +func (m *PBWrapper) GetType() PBWrapper_MessageType {
64 + if m != nil && m.Type != nil {
65 + return *m.Type
66 + }
67 + return PBWrapper_DHT_MESSAGE
68 +}
69 +
70 +func (m *PBWrapper) GetMessage() []byte {
71 + if m != nil {
72 + return m.Message
73 + }
74 + return nil
75 +}
76 +
77 +func init() {
78 + proto.RegisterEnum("swarm.PBWrapper_MessageType", PBWrapper_MessageType_name, PBWrapper_MessageType_value)
79 +}
swarm/mes_wrapper.proto new
+10
@@ -0,0 +1,10 @@
1 +package swarm;
2 +
3 +message PBWrapper {
4 + enum MessageType {
5 + DHT_MESSAGE = 0;
6 + }
7 +
8 + required MessageType Type = 1;
9 + required bytes Message = 2;
10 +}