-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathp2pd.proto
158 lines (133 loc) · 3.01 KB
/
p2pd.proto
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
syntax = "proto2";
package p2pd.pb;
message Request {
enum Type {
IDENTIFY = 0;
CONNECT = 1;
STREAM_OPEN = 2;
STREAM_HANDLER = 3;
DHT = 4;
LIST_PEERS = 5;
CONNMANAGER = 6;
DISCONNECT = 7;
PUBSUB = 8;
}
required Type type = 1;
optional ConnectRequest connect = 2;
optional StreamOpenRequest streamOpen = 3;
optional StreamHandlerRequest streamHandler = 4;
optional DHTRequest dht = 5;
optional ConnManagerRequest connManager = 6;
optional DisconnectRequest disconnect = 7;
optional PSRequest pubsub = 8;
}
message Response {
enum Type {
OK = 0;
ERROR = 1;
}
required Type type = 1;
optional ErrorResponse error = 2;
optional StreamInfo streamInfo = 3;
optional IdentifyResponse identify = 4;
optional DHTResponse dht = 5;
repeated PeerInfo peers = 6;
optional PSResponse pubsub = 7;
}
message IdentifyResponse {
required bytes id = 1;
repeated bytes addrs = 2;
}
message ConnectRequest {
required bytes peer = 1;
repeated bytes addrs = 2;
optional int64 timeout = 3;
}
message StreamOpenRequest {
required bytes peer = 1;
repeated string proto = 2;
optional int64 timeout = 3;
}
message StreamHandlerRequest {
required bytes addr = 1;
repeated string proto = 2;
}
message ErrorResponse {
required string msg = 1;
}
message StreamInfo {
required bytes peer = 1;
required bytes addr = 2;
required string proto = 3;
}
message DHTRequest {
enum Type {
FIND_PEER = 0;
FIND_PEERS_CONNECTED_TO_PEER = 1;
FIND_PROVIDERS = 2;
GET_CLOSEST_PEERS = 3;
GET_PUBLIC_KEY = 4;
GET_VALUE = 5;
SEARCH_VALUE = 6;
PUT_VALUE = 7;
PROVIDE = 8;
}
required Type type = 1;
optional bytes peer = 2;
optional bytes cid = 3;
optional bytes key = 4;
optional bytes value = 5;
optional int32 count = 6;
optional int64 timeout = 7;
}
message DHTResponse {
enum Type {
BEGIN = 0;
VALUE = 1;
END = 2;
}
required Type type = 1;
optional PeerInfo peer = 2;
optional bytes value = 3;
}
message PeerInfo {
required bytes id = 1;
repeated bytes addrs = 2;
}
message ConnManagerRequest {
enum Type {
TAG_PEER = 0;
UNTAG_PEER = 1;
TRIM = 2;
}
required Type type = 1;
optional bytes peer = 2;
optional string tag = 3;
optional int64 weight = 4;
}
message DisconnectRequest {
required bytes peer = 1;
}
message PSRequest {
enum Type {
GET_TOPICS = 0;
LIST_PEERS = 1;
PUBLISH = 2;
SUBSCRIBE = 3;
}
required Type type = 1;
optional string topic = 2;
optional bytes data = 3;
}
message PSMessage {
optional bytes from = 1;
optional bytes data = 2;
optional bytes seqno = 3;
repeated string topicIDs = 4;
optional bytes signature = 5;
optional bytes key = 6;
}
message PSResponse {
repeated string topics = 1;
repeated bytes peerIDs = 2;
}