p2p.proto 1.31 KB
Newer Older
1
2
3
4
5
6
7
8
9
syntax = "proto3";

package protocols.p2p;

// designed to be shared between all app protocols
message MessageData {
    // shared between all requests
    string clientVersion = 1; // client version
    int64 timestamp = 2;  // unix time
Aviv Eyal's avatar
Aviv Eyal committed
10
    string id = 3;        // allows requesters to use request data when processing a response
11
    bool gossip = 4;      // true to have receiver peer gossip the message to neighbors
Aviv Eyal's avatar
Aviv Eyal committed
12
    string nodeId = 5;    // id of node that created the message (not the peer that may have sent it)
Aviv Eyal's avatar
Aviv Eyal committed
13
    bytes sign = 6;      // signature of message data + method specific data by message authoring node
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
}

//// ping protocol

// a protocol define a set of reuqest and responses
message PingRequest {
    MessageData messageData = 1;

    // method specific data
    string message = 2;
    // add any data here....
}

message PingResponse {
    MessageData messageData = 1;

    // response specific data
    string message = 2;
    // ... add any data here
}

//// echo protocol

// a protocol define a set of reuqest and responses
message EchoRequest {
    MessageData messageData = 1;

    // method specific data
    string message = 2;
    // add any data here....
}

message EchoResponse {
    MessageData messageData = 1;

    // response specific data
    string message = 2;
    // ... add any data here
}