2020-10-25 22:05:37 +00:00
|
|
|
syntax = "proto3";
|
|
|
|
|
|
|
|
import "google/protobuf/empty.proto";
|
|
|
|
|
2020-10-29 16:38:46 +00:00
|
|
|
package sentry;
|
2020-10-25 22:05:37 +00:00
|
|
|
|
2020-10-29 16:38:46 +00:00
|
|
|
option go_package = "./sentry;sentry";
|
2020-10-25 22:05:37 +00:00
|
|
|
|
2021-02-15 18:54:45 +00:00
|
|
|
enum MessageId {
|
2020-10-29 16:38:46 +00:00
|
|
|
GetBlockHeaders = 0; GetBlockBodies = 1; GetNodeData = 2;
|
2021-02-15 18:54:45 +00:00
|
|
|
NewBlockHashes = 3; BlockHeaders = 4; BlockBodies = 5; NewBlock = 6;
|
|
|
|
NodeData = 7;
|
2020-10-29 16:38:46 +00:00
|
|
|
}
|
2020-10-25 22:05:37 +00:00
|
|
|
|
|
|
|
message OutboundMessageData {
|
2021-02-15 18:54:45 +00:00
|
|
|
MessageId id = 1;
|
2020-10-25 22:05:37 +00:00
|
|
|
bytes data = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
message SendMessageByMinBlockRequest {
|
|
|
|
OutboundMessageData data = 1;
|
|
|
|
uint64 min_block = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
message SendMessageByIdRequest {
|
|
|
|
OutboundMessageData data = 1;
|
|
|
|
bytes peer_id = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
message SendMessageToRandomPeersRequest {
|
|
|
|
OutboundMessageData data = 1;
|
|
|
|
uint64 max_peers = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
message SentPeers { repeated bytes peers = 1; }
|
|
|
|
|
|
|
|
enum PenaltyKind { Kick = 0; }
|
|
|
|
|
|
|
|
message PenalizePeerRequest {
|
|
|
|
bytes peer_id = 1;
|
|
|
|
PenaltyKind penalty = 2;
|
|
|
|
}
|
|
|
|
|
2021-02-15 18:54:45 +00:00
|
|
|
message PeerMinBlockRequest {
|
|
|
|
bytes peer_id = 1;
|
|
|
|
uint64 min_block = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
message InboundMessage {
|
|
|
|
MessageId id = 1;
|
|
|
|
bytes data = 2;
|
|
|
|
bytes peer_id = 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
message Forks {
|
|
|
|
bytes genesis = 1;
|
|
|
|
repeated uint64 forks = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
message StatusData {
|
|
|
|
uint64 network_id = 1;
|
|
|
|
bytes total_difficulty = 2;
|
|
|
|
bytes best_hash = 3;
|
|
|
|
Forks fork_data = 4;
|
|
|
|
}
|
|
|
|
|
2020-10-25 22:05:37 +00:00
|
|
|
service Sentry {
|
|
|
|
rpc PenalizePeer(PenalizePeerRequest) returns(google.protobuf.Empty);
|
2021-02-15 18:54:45 +00:00
|
|
|
rpc PeerMinBlock(PeerMinBlockRequest) returns(google.protobuf.Empty);
|
2020-10-25 22:05:37 +00:00
|
|
|
rpc SendMessageByMinBlock(SendMessageByMinBlockRequest) returns(SentPeers);
|
|
|
|
rpc SendMessageById(SendMessageByIdRequest) returns(SentPeers);
|
|
|
|
rpc SendMessageToRandomPeers(SendMessageToRandomPeersRequest)
|
|
|
|
returns(SentPeers);
|
|
|
|
rpc SendMessageToAll(OutboundMessageData) returns(SentPeers);
|
2021-02-15 18:54:45 +00:00
|
|
|
rpc SetStatus(StatusData) returns (google.protobuf.Empty);
|
|
|
|
rpc ReceiveMessages(google.protobuf.Empty) returns (stream InboundMessage);
|
|
|
|
rpc ReceiveUploadMessages(google.protobuf.Empty) returns (stream InboundMessage);
|
|
|
|
rpc ReceiveTxMessages(google.protobuf.Empty) returns (stream InboundMessage);
|
|
|
|
}
|