Skip to content

Commit 30feee0

Browse files
AlexeyAkhunovAskAlexSharovDanielAtCosmicDNAbattlmonstr
authored
[alpha] move from devel (#103)
* torrent_peers_stat (#99) * 📝 Update component diagram with UML compliant diagram. (#72) * sentry.proto: rename Peers to PeerEvents (#101) * rename Peers() -> PeerEvents() * rename PeersRequest -> PeerEventsRequest * rename PeerEvent -> PeerEventId * rename PeersReply -> PeerEvent * RPC/Sentry: Peers method (#102) Add a method to return information about all connected peers. This is needed to implement admin_peers RPC call. Co-authored-by: Alex Sharov <[email protected]> Co-authored-by: Daniel At Cosmic DNA <[email protected]> Co-authored-by: battlmonstr <[email protected]>
1 parent 4782035 commit 30feee0

File tree

4 files changed

+37
-9
lines changed

4 files changed

+37
-9
lines changed

p2psentry/sentry.proto

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -123,18 +123,23 @@ message MessagesRequest {
123123
repeated MessageId ids = 1;
124124
}
125125

126+
message PeersReply {
127+
repeated types.PeerInfo peers = 1;
128+
}
129+
126130
message PeerCountRequest {}
127131

128132
message PeerCountReply {uint64 count = 1;}
129133

130-
message PeersRequest {}
131-
message PeersReply {
132-
enum PeerEvent {
134+
message PeerEventsRequest {}
135+
message PeerEvent {
136+
enum PeerEventId {
137+
// Happens after after a successful sub-protocol handshake.
133138
Connect = 0;
134139
Disconnect = 1;
135140
}
136141
types.H512 peer_id = 1;
137-
PeerEvent event = 2;
142+
PeerEventId event_id = 2;
138143
}
139144

140145
service Sentry {
@@ -153,15 +158,16 @@ service Sentry {
153158
returns (SentPeers);
154159
rpc SendMessageToAll(OutboundMessageData) returns (SentPeers);
155160

156-
157161
// Subscribe to receive messages.
158162
// Calling multiple times with a different set of ids starts separate streams.
159163
// It is possible to subscribe to the same set if ids more than once.
160164
rpc Messages(MessagesRequest) returns (stream InboundMessage);
165+
166+
rpc Peers(google.protobuf.Empty) returns (PeersReply);
161167
rpc PeerCount(PeerCountRequest) returns (PeerCountReply);
168+
// Subscribe to notifications about connected or lost peers.
169+
rpc PeerEvents(PeerEventsRequest) returns (stream PeerEvent);
162170

163-
// Notifications about connected (after sub-protocol handshake) or lost peer
164-
rpc Peers(PeersRequest) returns (stream PeersReply);
165171
// NodeInfo returns a collection of metadata known about the host.
166172
rpc NodeInfo(google.protobuf.Empty) returns(types.NodeInfoReply);
167173
}

remote/ethbackend.proto

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,16 @@ service ETHBACKEND {
4747
// it doesn't provide consistency
4848
// Request fields are optional - it's ok to request block only by hash or only by number
4949
rpc Block(BlockRequest) returns (BlockReply);
50+
5051
// High-level method - can find block number by txn hash
5152
// it doesn't provide consistency
5253
rpc TxnLookup(TxnLookupRequest) returns (TxnLookupReply);
53-
// NodeInfo collects and returns NodeInfo from all running celery instances.
54-
rpc NodeInfo(NodesInfoRequest) returns(NodesInfoReply);
54+
55+
// NodeInfo collects and returns NodeInfo from all running sentry instances.
56+
rpc NodeInfo(NodesInfoRequest) returns (NodesInfoReply);
57+
58+
// Peers collects and returns peers information from all running sentry instances.
59+
rpc Peers(google.protobuf.Empty) returns (PeersReply);
5560
}
5661

5762
enum Event {
@@ -179,3 +184,7 @@ message NodesInfoRequest {
179184
message NodesInfoReply {
180185
repeated types.NodeInfoReply nodesInfo = 1;
181186
}
187+
188+
message PeersReply {
189+
repeated types.PeerInfo peers = 1;
190+
}

turbo-geth-architecture.png

-74.4 KB
Loading

types/types.proto

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,3 +89,16 @@ message NodeInfoReply {
8989
string listenerAddr = 6;
9090
bytes protocols = 7;
9191
}
92+
93+
message PeerInfo {
94+
string id = 1;
95+
string name = 2;
96+
string enode = 3;
97+
string enr = 4;
98+
repeated string caps = 5;
99+
string connLocalAddr = 6;
100+
string connRemoteAddr = 7;
101+
bool connIsInbound = 8;
102+
bool connIsTrusted = 9;
103+
bool connIsStatic = 10;
104+
}

0 commit comments

Comments
 (0)