p2p.proto 1.29 KB
Newer Older
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
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
    string id = 3;        // allows requesters to match response with a request
    bool gossip = 4;      // true to have receiver peer gossip the message to neighbors
    string nodeId = 5;    // id of node that created the message (not the one that may have relayed it)
    string sign = 6;      // signature of message data + method specific data by message authoring node
}

//// 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
}