github.com/ledgerwatch/erigon-lib@v1.0.0/gointerfaces/sentry/sentry_grpc.pb.go (about) 1 // Code generated by protoc-gen-go-grpc. DO NOT EDIT. 2 // versions: 3 // - protoc-gen-go-grpc v1.3.0 4 // - protoc v4.24.2 5 // source: p2psentry/sentry.proto 6 7 package sentry 8 9 import ( 10 context "context" 11 types "github.com/ledgerwatch/erigon-lib/gointerfaces/types" 12 grpc "google.golang.org/grpc" 13 codes "google.golang.org/grpc/codes" 14 status "google.golang.org/grpc/status" 15 emptypb "google.golang.org/protobuf/types/known/emptypb" 16 ) 17 18 // This is a compile-time assertion to ensure that this generated file 19 // is compatible with the grpc package it is being compiled against. 20 // Requires gRPC-Go v1.32.0 or later. 21 const _ = grpc.SupportPackageIsVersion7 22 23 const ( 24 Sentry_SetStatus_FullMethodName = "/sentry.Sentry/SetStatus" 25 Sentry_PenalizePeer_FullMethodName = "/sentry.Sentry/PenalizePeer" 26 Sentry_PeerMinBlock_FullMethodName = "/sentry.Sentry/PeerMinBlock" 27 Sentry_HandShake_FullMethodName = "/sentry.Sentry/HandShake" 28 Sentry_SendMessageByMinBlock_FullMethodName = "/sentry.Sentry/SendMessageByMinBlock" 29 Sentry_SendMessageById_FullMethodName = "/sentry.Sentry/SendMessageById" 30 Sentry_SendMessageToRandomPeers_FullMethodName = "/sentry.Sentry/SendMessageToRandomPeers" 31 Sentry_SendMessageToAll_FullMethodName = "/sentry.Sentry/SendMessageToAll" 32 Sentry_Messages_FullMethodName = "/sentry.Sentry/Messages" 33 Sentry_Peers_FullMethodName = "/sentry.Sentry/Peers" 34 Sentry_PeerCount_FullMethodName = "/sentry.Sentry/PeerCount" 35 Sentry_PeerById_FullMethodName = "/sentry.Sentry/PeerById" 36 Sentry_PeerEvents_FullMethodName = "/sentry.Sentry/PeerEvents" 37 Sentry_AddPeer_FullMethodName = "/sentry.Sentry/AddPeer" 38 Sentry_NodeInfo_FullMethodName = "/sentry.Sentry/NodeInfo" 39 ) 40 41 // SentryClient is the client API for Sentry service. 42 // 43 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. 44 type SentryClient interface { 45 // SetStatus - force new ETH client state of sentry - network_id, max_block, etc... 46 SetStatus(ctx context.Context, in *StatusData, opts ...grpc.CallOption) (*SetStatusReply, error) 47 PenalizePeer(ctx context.Context, in *PenalizePeerRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) 48 PeerMinBlock(ctx context.Context, in *PeerMinBlockRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) 49 // HandShake - pre-requirement for all Send* methods - returns list of ETH protocol versions, 50 // without knowledge of protocol - impossible encode correct P2P message 51 HandShake(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*HandShakeReply, error) 52 SendMessageByMinBlock(ctx context.Context, in *SendMessageByMinBlockRequest, opts ...grpc.CallOption) (*SentPeers, error) 53 SendMessageById(ctx context.Context, in *SendMessageByIdRequest, opts ...grpc.CallOption) (*SentPeers, error) 54 SendMessageToRandomPeers(ctx context.Context, in *SendMessageToRandomPeersRequest, opts ...grpc.CallOption) (*SentPeers, error) 55 SendMessageToAll(ctx context.Context, in *OutboundMessageData, opts ...grpc.CallOption) (*SentPeers, error) 56 // Subscribe to receive messages. 57 // Calling multiple times with a different set of ids starts separate streams. 58 // It is possible to subscribe to the same set if ids more than once. 59 Messages(ctx context.Context, in *MessagesRequest, opts ...grpc.CallOption) (Sentry_MessagesClient, error) 60 Peers(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*PeersReply, error) 61 PeerCount(ctx context.Context, in *PeerCountRequest, opts ...grpc.CallOption) (*PeerCountReply, error) 62 PeerById(ctx context.Context, in *PeerByIdRequest, opts ...grpc.CallOption) (*PeerByIdReply, error) 63 // Subscribe to notifications about connected or lost peers. 64 PeerEvents(ctx context.Context, in *PeerEventsRequest, opts ...grpc.CallOption) (Sentry_PeerEventsClient, error) 65 AddPeer(ctx context.Context, in *AddPeerRequest, opts ...grpc.CallOption) (*AddPeerReply, error) 66 // NodeInfo returns a collection of metadata known about the host. 67 NodeInfo(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*types.NodeInfoReply, error) 68 } 69 70 type sentryClient struct { 71 cc grpc.ClientConnInterface 72 } 73 74 func NewSentryClient(cc grpc.ClientConnInterface) SentryClient { 75 return &sentryClient{cc} 76 } 77 78 func (c *sentryClient) SetStatus(ctx context.Context, in *StatusData, opts ...grpc.CallOption) (*SetStatusReply, error) { 79 out := new(SetStatusReply) 80 err := c.cc.Invoke(ctx, Sentry_SetStatus_FullMethodName, in, out, opts...) 81 if err != nil { 82 return nil, err 83 } 84 return out, nil 85 } 86 87 func (c *sentryClient) PenalizePeer(ctx context.Context, in *PenalizePeerRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { 88 out := new(emptypb.Empty) 89 err := c.cc.Invoke(ctx, Sentry_PenalizePeer_FullMethodName, in, out, opts...) 90 if err != nil { 91 return nil, err 92 } 93 return out, nil 94 } 95 96 func (c *sentryClient) PeerMinBlock(ctx context.Context, in *PeerMinBlockRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { 97 out := new(emptypb.Empty) 98 err := c.cc.Invoke(ctx, Sentry_PeerMinBlock_FullMethodName, in, out, opts...) 99 if err != nil { 100 return nil, err 101 } 102 return out, nil 103 } 104 105 func (c *sentryClient) HandShake(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*HandShakeReply, error) { 106 out := new(HandShakeReply) 107 err := c.cc.Invoke(ctx, Sentry_HandShake_FullMethodName, in, out, opts...) 108 if err != nil { 109 return nil, err 110 } 111 return out, nil 112 } 113 114 func (c *sentryClient) SendMessageByMinBlock(ctx context.Context, in *SendMessageByMinBlockRequest, opts ...grpc.CallOption) (*SentPeers, error) { 115 out := new(SentPeers) 116 err := c.cc.Invoke(ctx, Sentry_SendMessageByMinBlock_FullMethodName, in, out, opts...) 117 if err != nil { 118 return nil, err 119 } 120 return out, nil 121 } 122 123 func (c *sentryClient) SendMessageById(ctx context.Context, in *SendMessageByIdRequest, opts ...grpc.CallOption) (*SentPeers, error) { 124 out := new(SentPeers) 125 err := c.cc.Invoke(ctx, Sentry_SendMessageById_FullMethodName, in, out, opts...) 126 if err != nil { 127 return nil, err 128 } 129 return out, nil 130 } 131 132 func (c *sentryClient) SendMessageToRandomPeers(ctx context.Context, in *SendMessageToRandomPeersRequest, opts ...grpc.CallOption) (*SentPeers, error) { 133 out := new(SentPeers) 134 err := c.cc.Invoke(ctx, Sentry_SendMessageToRandomPeers_FullMethodName, in, out, opts...) 135 if err != nil { 136 return nil, err 137 } 138 return out, nil 139 } 140 141 func (c *sentryClient) SendMessageToAll(ctx context.Context, in *OutboundMessageData, opts ...grpc.CallOption) (*SentPeers, error) { 142 out := new(SentPeers) 143 err := c.cc.Invoke(ctx, Sentry_SendMessageToAll_FullMethodName, in, out, opts...) 144 if err != nil { 145 return nil, err 146 } 147 return out, nil 148 } 149 150 func (c *sentryClient) Messages(ctx context.Context, in *MessagesRequest, opts ...grpc.CallOption) (Sentry_MessagesClient, error) { 151 stream, err := c.cc.NewStream(ctx, &Sentry_ServiceDesc.Streams[0], Sentry_Messages_FullMethodName, opts...) 152 if err != nil { 153 return nil, err 154 } 155 x := &sentryMessagesClient{stream} 156 if err := x.ClientStream.SendMsg(in); err != nil { 157 return nil, err 158 } 159 if err := x.ClientStream.CloseSend(); err != nil { 160 return nil, err 161 } 162 return x, nil 163 } 164 165 type Sentry_MessagesClient interface { 166 Recv() (*InboundMessage, error) 167 grpc.ClientStream 168 } 169 170 type sentryMessagesClient struct { 171 grpc.ClientStream 172 } 173 174 func (x *sentryMessagesClient) Recv() (*InboundMessage, error) { 175 m := new(InboundMessage) 176 if err := x.ClientStream.RecvMsg(m); err != nil { 177 return nil, err 178 } 179 return m, nil 180 } 181 182 func (c *sentryClient) Peers(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*PeersReply, error) { 183 out := new(PeersReply) 184 err := c.cc.Invoke(ctx, Sentry_Peers_FullMethodName, in, out, opts...) 185 if err != nil { 186 return nil, err 187 } 188 return out, nil 189 } 190 191 func (c *sentryClient) PeerCount(ctx context.Context, in *PeerCountRequest, opts ...grpc.CallOption) (*PeerCountReply, error) { 192 out := new(PeerCountReply) 193 err := c.cc.Invoke(ctx, Sentry_PeerCount_FullMethodName, in, out, opts...) 194 if err != nil { 195 return nil, err 196 } 197 return out, nil 198 } 199 200 func (c *sentryClient) PeerById(ctx context.Context, in *PeerByIdRequest, opts ...grpc.CallOption) (*PeerByIdReply, error) { 201 out := new(PeerByIdReply) 202 err := c.cc.Invoke(ctx, Sentry_PeerById_FullMethodName, in, out, opts...) 203 if err != nil { 204 return nil, err 205 } 206 return out, nil 207 } 208 209 func (c *sentryClient) PeerEvents(ctx context.Context, in *PeerEventsRequest, opts ...grpc.CallOption) (Sentry_PeerEventsClient, error) { 210 stream, err := c.cc.NewStream(ctx, &Sentry_ServiceDesc.Streams[1], Sentry_PeerEvents_FullMethodName, opts...) 211 if err != nil { 212 return nil, err 213 } 214 x := &sentryPeerEventsClient{stream} 215 if err := x.ClientStream.SendMsg(in); err != nil { 216 return nil, err 217 } 218 if err := x.ClientStream.CloseSend(); err != nil { 219 return nil, err 220 } 221 return x, nil 222 } 223 224 type Sentry_PeerEventsClient interface { 225 Recv() (*PeerEvent, error) 226 grpc.ClientStream 227 } 228 229 type sentryPeerEventsClient struct { 230 grpc.ClientStream 231 } 232 233 func (x *sentryPeerEventsClient) Recv() (*PeerEvent, error) { 234 m := new(PeerEvent) 235 if err := x.ClientStream.RecvMsg(m); err != nil { 236 return nil, err 237 } 238 return m, nil 239 } 240 241 func (c *sentryClient) AddPeer(ctx context.Context, in *AddPeerRequest, opts ...grpc.CallOption) (*AddPeerReply, error) { 242 out := new(AddPeerReply) 243 err := c.cc.Invoke(ctx, Sentry_AddPeer_FullMethodName, in, out, opts...) 244 if err != nil { 245 return nil, err 246 } 247 return out, nil 248 } 249 250 func (c *sentryClient) NodeInfo(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*types.NodeInfoReply, error) { 251 out := new(types.NodeInfoReply) 252 err := c.cc.Invoke(ctx, Sentry_NodeInfo_FullMethodName, in, out, opts...) 253 if err != nil { 254 return nil, err 255 } 256 return out, nil 257 } 258 259 // SentryServer is the server API for Sentry service. 260 // All implementations must embed UnimplementedSentryServer 261 // for forward compatibility 262 type SentryServer interface { 263 // SetStatus - force new ETH client state of sentry - network_id, max_block, etc... 264 SetStatus(context.Context, *StatusData) (*SetStatusReply, error) 265 PenalizePeer(context.Context, *PenalizePeerRequest) (*emptypb.Empty, error) 266 PeerMinBlock(context.Context, *PeerMinBlockRequest) (*emptypb.Empty, error) 267 // HandShake - pre-requirement for all Send* methods - returns list of ETH protocol versions, 268 // without knowledge of protocol - impossible encode correct P2P message 269 HandShake(context.Context, *emptypb.Empty) (*HandShakeReply, error) 270 SendMessageByMinBlock(context.Context, *SendMessageByMinBlockRequest) (*SentPeers, error) 271 SendMessageById(context.Context, *SendMessageByIdRequest) (*SentPeers, error) 272 SendMessageToRandomPeers(context.Context, *SendMessageToRandomPeersRequest) (*SentPeers, error) 273 SendMessageToAll(context.Context, *OutboundMessageData) (*SentPeers, error) 274 // Subscribe to receive messages. 275 // Calling multiple times with a different set of ids starts separate streams. 276 // It is possible to subscribe to the same set if ids more than once. 277 Messages(*MessagesRequest, Sentry_MessagesServer) error 278 Peers(context.Context, *emptypb.Empty) (*PeersReply, error) 279 PeerCount(context.Context, *PeerCountRequest) (*PeerCountReply, error) 280 PeerById(context.Context, *PeerByIdRequest) (*PeerByIdReply, error) 281 // Subscribe to notifications about connected or lost peers. 282 PeerEvents(*PeerEventsRequest, Sentry_PeerEventsServer) error 283 AddPeer(context.Context, *AddPeerRequest) (*AddPeerReply, error) 284 // NodeInfo returns a collection of metadata known about the host. 285 NodeInfo(context.Context, *emptypb.Empty) (*types.NodeInfoReply, error) 286 mustEmbedUnimplementedSentryServer() 287 } 288 289 // UnimplementedSentryServer must be embedded to have forward compatible implementations. 290 type UnimplementedSentryServer struct { 291 } 292 293 func (UnimplementedSentryServer) SetStatus(context.Context, *StatusData) (*SetStatusReply, error) { 294 return nil, status.Errorf(codes.Unimplemented, "method SetStatus not implemented") 295 } 296 func (UnimplementedSentryServer) PenalizePeer(context.Context, *PenalizePeerRequest) (*emptypb.Empty, error) { 297 return nil, status.Errorf(codes.Unimplemented, "method PenalizePeer not implemented") 298 } 299 func (UnimplementedSentryServer) PeerMinBlock(context.Context, *PeerMinBlockRequest) (*emptypb.Empty, error) { 300 return nil, status.Errorf(codes.Unimplemented, "method PeerMinBlock not implemented") 301 } 302 func (UnimplementedSentryServer) HandShake(context.Context, *emptypb.Empty) (*HandShakeReply, error) { 303 return nil, status.Errorf(codes.Unimplemented, "method HandShake not implemented") 304 } 305 func (UnimplementedSentryServer) SendMessageByMinBlock(context.Context, *SendMessageByMinBlockRequest) (*SentPeers, error) { 306 return nil, status.Errorf(codes.Unimplemented, "method SendMessageByMinBlock not implemented") 307 } 308 func (UnimplementedSentryServer) SendMessageById(context.Context, *SendMessageByIdRequest) (*SentPeers, error) { 309 return nil, status.Errorf(codes.Unimplemented, "method SendMessageById not implemented") 310 } 311 func (UnimplementedSentryServer) SendMessageToRandomPeers(context.Context, *SendMessageToRandomPeersRequest) (*SentPeers, error) { 312 return nil, status.Errorf(codes.Unimplemented, "method SendMessageToRandomPeers not implemented") 313 } 314 func (UnimplementedSentryServer) SendMessageToAll(context.Context, *OutboundMessageData) (*SentPeers, error) { 315 return nil, status.Errorf(codes.Unimplemented, "method SendMessageToAll not implemented") 316 } 317 func (UnimplementedSentryServer) Messages(*MessagesRequest, Sentry_MessagesServer) error { 318 return status.Errorf(codes.Unimplemented, "method Messages not implemented") 319 } 320 func (UnimplementedSentryServer) Peers(context.Context, *emptypb.Empty) (*PeersReply, error) { 321 return nil, status.Errorf(codes.Unimplemented, "method Peers not implemented") 322 } 323 func (UnimplementedSentryServer) PeerCount(context.Context, *PeerCountRequest) (*PeerCountReply, error) { 324 return nil, status.Errorf(codes.Unimplemented, "method PeerCount not implemented") 325 } 326 func (UnimplementedSentryServer) PeerById(context.Context, *PeerByIdRequest) (*PeerByIdReply, error) { 327 return nil, status.Errorf(codes.Unimplemented, "method PeerById not implemented") 328 } 329 func (UnimplementedSentryServer) PeerEvents(*PeerEventsRequest, Sentry_PeerEventsServer) error { 330 return status.Errorf(codes.Unimplemented, "method PeerEvents not implemented") 331 } 332 func (UnimplementedSentryServer) AddPeer(context.Context, *AddPeerRequest) (*AddPeerReply, error) { 333 return nil, status.Errorf(codes.Unimplemented, "method AddPeer not implemented") 334 } 335 func (UnimplementedSentryServer) NodeInfo(context.Context, *emptypb.Empty) (*types.NodeInfoReply, error) { 336 return nil, status.Errorf(codes.Unimplemented, "method NodeInfo not implemented") 337 } 338 func (UnimplementedSentryServer) mustEmbedUnimplementedSentryServer() {} 339 340 // UnsafeSentryServer may be embedded to opt out of forward compatibility for this service. 341 // Use of this interface is not recommended, as added methods to SentryServer will 342 // result in compilation errors. 343 type UnsafeSentryServer interface { 344 mustEmbedUnimplementedSentryServer() 345 } 346 347 func RegisterSentryServer(s grpc.ServiceRegistrar, srv SentryServer) { 348 s.RegisterService(&Sentry_ServiceDesc, srv) 349 } 350 351 func _Sentry_SetStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 352 in := new(StatusData) 353 if err := dec(in); err != nil { 354 return nil, err 355 } 356 if interceptor == nil { 357 return srv.(SentryServer).SetStatus(ctx, in) 358 } 359 info := &grpc.UnaryServerInfo{ 360 Server: srv, 361 FullMethod: Sentry_SetStatus_FullMethodName, 362 } 363 handler := func(ctx context.Context, req interface{}) (interface{}, error) { 364 return srv.(SentryServer).SetStatus(ctx, req.(*StatusData)) 365 } 366 return interceptor(ctx, in, info, handler) 367 } 368 369 func _Sentry_PenalizePeer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 370 in := new(PenalizePeerRequest) 371 if err := dec(in); err != nil { 372 return nil, err 373 } 374 if interceptor == nil { 375 return srv.(SentryServer).PenalizePeer(ctx, in) 376 } 377 info := &grpc.UnaryServerInfo{ 378 Server: srv, 379 FullMethod: Sentry_PenalizePeer_FullMethodName, 380 } 381 handler := func(ctx context.Context, req interface{}) (interface{}, error) { 382 return srv.(SentryServer).PenalizePeer(ctx, req.(*PenalizePeerRequest)) 383 } 384 return interceptor(ctx, in, info, handler) 385 } 386 387 func _Sentry_PeerMinBlock_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 388 in := new(PeerMinBlockRequest) 389 if err := dec(in); err != nil { 390 return nil, err 391 } 392 if interceptor == nil { 393 return srv.(SentryServer).PeerMinBlock(ctx, in) 394 } 395 info := &grpc.UnaryServerInfo{ 396 Server: srv, 397 FullMethod: Sentry_PeerMinBlock_FullMethodName, 398 } 399 handler := func(ctx context.Context, req interface{}) (interface{}, error) { 400 return srv.(SentryServer).PeerMinBlock(ctx, req.(*PeerMinBlockRequest)) 401 } 402 return interceptor(ctx, in, info, handler) 403 } 404 405 func _Sentry_HandShake_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 406 in := new(emptypb.Empty) 407 if err := dec(in); err != nil { 408 return nil, err 409 } 410 if interceptor == nil { 411 return srv.(SentryServer).HandShake(ctx, in) 412 } 413 info := &grpc.UnaryServerInfo{ 414 Server: srv, 415 FullMethod: Sentry_HandShake_FullMethodName, 416 } 417 handler := func(ctx context.Context, req interface{}) (interface{}, error) { 418 return srv.(SentryServer).HandShake(ctx, req.(*emptypb.Empty)) 419 } 420 return interceptor(ctx, in, info, handler) 421 } 422 423 func _Sentry_SendMessageByMinBlock_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 424 in := new(SendMessageByMinBlockRequest) 425 if err := dec(in); err != nil { 426 return nil, err 427 } 428 if interceptor == nil { 429 return srv.(SentryServer).SendMessageByMinBlock(ctx, in) 430 } 431 info := &grpc.UnaryServerInfo{ 432 Server: srv, 433 FullMethod: Sentry_SendMessageByMinBlock_FullMethodName, 434 } 435 handler := func(ctx context.Context, req interface{}) (interface{}, error) { 436 return srv.(SentryServer).SendMessageByMinBlock(ctx, req.(*SendMessageByMinBlockRequest)) 437 } 438 return interceptor(ctx, in, info, handler) 439 } 440 441 func _Sentry_SendMessageById_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 442 in := new(SendMessageByIdRequest) 443 if err := dec(in); err != nil { 444 return nil, err 445 } 446 if interceptor == nil { 447 return srv.(SentryServer).SendMessageById(ctx, in) 448 } 449 info := &grpc.UnaryServerInfo{ 450 Server: srv, 451 FullMethod: Sentry_SendMessageById_FullMethodName, 452 } 453 handler := func(ctx context.Context, req interface{}) (interface{}, error) { 454 return srv.(SentryServer).SendMessageById(ctx, req.(*SendMessageByIdRequest)) 455 } 456 return interceptor(ctx, in, info, handler) 457 } 458 459 func _Sentry_SendMessageToRandomPeers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 460 in := new(SendMessageToRandomPeersRequest) 461 if err := dec(in); err != nil { 462 return nil, err 463 } 464 if interceptor == nil { 465 return srv.(SentryServer).SendMessageToRandomPeers(ctx, in) 466 } 467 info := &grpc.UnaryServerInfo{ 468 Server: srv, 469 FullMethod: Sentry_SendMessageToRandomPeers_FullMethodName, 470 } 471 handler := func(ctx context.Context, req interface{}) (interface{}, error) { 472 return srv.(SentryServer).SendMessageToRandomPeers(ctx, req.(*SendMessageToRandomPeersRequest)) 473 } 474 return interceptor(ctx, in, info, handler) 475 } 476 477 func _Sentry_SendMessageToAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 478 in := new(OutboundMessageData) 479 if err := dec(in); err != nil { 480 return nil, err 481 } 482 if interceptor == nil { 483 return srv.(SentryServer).SendMessageToAll(ctx, in) 484 } 485 info := &grpc.UnaryServerInfo{ 486 Server: srv, 487 FullMethod: Sentry_SendMessageToAll_FullMethodName, 488 } 489 handler := func(ctx context.Context, req interface{}) (interface{}, error) { 490 return srv.(SentryServer).SendMessageToAll(ctx, req.(*OutboundMessageData)) 491 } 492 return interceptor(ctx, in, info, handler) 493 } 494 495 func _Sentry_Messages_Handler(srv interface{}, stream grpc.ServerStream) error { 496 m := new(MessagesRequest) 497 if err := stream.RecvMsg(m); err != nil { 498 return err 499 } 500 return srv.(SentryServer).Messages(m, &sentryMessagesServer{stream}) 501 } 502 503 type Sentry_MessagesServer interface { 504 Send(*InboundMessage) error 505 grpc.ServerStream 506 } 507 508 type sentryMessagesServer struct { 509 grpc.ServerStream 510 } 511 512 func (x *sentryMessagesServer) Send(m *InboundMessage) error { 513 return x.ServerStream.SendMsg(m) 514 } 515 516 func _Sentry_Peers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 517 in := new(emptypb.Empty) 518 if err := dec(in); err != nil { 519 return nil, err 520 } 521 if interceptor == nil { 522 return srv.(SentryServer).Peers(ctx, in) 523 } 524 info := &grpc.UnaryServerInfo{ 525 Server: srv, 526 FullMethod: Sentry_Peers_FullMethodName, 527 } 528 handler := func(ctx context.Context, req interface{}) (interface{}, error) { 529 return srv.(SentryServer).Peers(ctx, req.(*emptypb.Empty)) 530 } 531 return interceptor(ctx, in, info, handler) 532 } 533 534 func _Sentry_PeerCount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 535 in := new(PeerCountRequest) 536 if err := dec(in); err != nil { 537 return nil, err 538 } 539 if interceptor == nil { 540 return srv.(SentryServer).PeerCount(ctx, in) 541 } 542 info := &grpc.UnaryServerInfo{ 543 Server: srv, 544 FullMethod: Sentry_PeerCount_FullMethodName, 545 } 546 handler := func(ctx context.Context, req interface{}) (interface{}, error) { 547 return srv.(SentryServer).PeerCount(ctx, req.(*PeerCountRequest)) 548 } 549 return interceptor(ctx, in, info, handler) 550 } 551 552 func _Sentry_PeerById_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 553 in := new(PeerByIdRequest) 554 if err := dec(in); err != nil { 555 return nil, err 556 } 557 if interceptor == nil { 558 return srv.(SentryServer).PeerById(ctx, in) 559 } 560 info := &grpc.UnaryServerInfo{ 561 Server: srv, 562 FullMethod: Sentry_PeerById_FullMethodName, 563 } 564 handler := func(ctx context.Context, req interface{}) (interface{}, error) { 565 return srv.(SentryServer).PeerById(ctx, req.(*PeerByIdRequest)) 566 } 567 return interceptor(ctx, in, info, handler) 568 } 569 570 func _Sentry_PeerEvents_Handler(srv interface{}, stream grpc.ServerStream) error { 571 m := new(PeerEventsRequest) 572 if err := stream.RecvMsg(m); err != nil { 573 return err 574 } 575 return srv.(SentryServer).PeerEvents(m, &sentryPeerEventsServer{stream}) 576 } 577 578 type Sentry_PeerEventsServer interface { 579 Send(*PeerEvent) error 580 grpc.ServerStream 581 } 582 583 type sentryPeerEventsServer struct { 584 grpc.ServerStream 585 } 586 587 func (x *sentryPeerEventsServer) Send(m *PeerEvent) error { 588 return x.ServerStream.SendMsg(m) 589 } 590 591 func _Sentry_AddPeer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 592 in := new(AddPeerRequest) 593 if err := dec(in); err != nil { 594 return nil, err 595 } 596 if interceptor == nil { 597 return srv.(SentryServer).AddPeer(ctx, in) 598 } 599 info := &grpc.UnaryServerInfo{ 600 Server: srv, 601 FullMethod: Sentry_AddPeer_FullMethodName, 602 } 603 handler := func(ctx context.Context, req interface{}) (interface{}, error) { 604 return srv.(SentryServer).AddPeer(ctx, req.(*AddPeerRequest)) 605 } 606 return interceptor(ctx, in, info, handler) 607 } 608 609 func _Sentry_NodeInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 610 in := new(emptypb.Empty) 611 if err := dec(in); err != nil { 612 return nil, err 613 } 614 if interceptor == nil { 615 return srv.(SentryServer).NodeInfo(ctx, in) 616 } 617 info := &grpc.UnaryServerInfo{ 618 Server: srv, 619 FullMethod: Sentry_NodeInfo_FullMethodName, 620 } 621 handler := func(ctx context.Context, req interface{}) (interface{}, error) { 622 return srv.(SentryServer).NodeInfo(ctx, req.(*emptypb.Empty)) 623 } 624 return interceptor(ctx, in, info, handler) 625 } 626 627 // Sentry_ServiceDesc is the grpc.ServiceDesc for Sentry service. 628 // It's only intended for direct use with grpc.RegisterService, 629 // and not to be introspected or modified (even as a copy) 630 var Sentry_ServiceDesc = grpc.ServiceDesc{ 631 ServiceName: "sentry.Sentry", 632 HandlerType: (*SentryServer)(nil), 633 Methods: []grpc.MethodDesc{ 634 { 635 MethodName: "SetStatus", 636 Handler: _Sentry_SetStatus_Handler, 637 }, 638 { 639 MethodName: "PenalizePeer", 640 Handler: _Sentry_PenalizePeer_Handler, 641 }, 642 { 643 MethodName: "PeerMinBlock", 644 Handler: _Sentry_PeerMinBlock_Handler, 645 }, 646 { 647 MethodName: "HandShake", 648 Handler: _Sentry_HandShake_Handler, 649 }, 650 { 651 MethodName: "SendMessageByMinBlock", 652 Handler: _Sentry_SendMessageByMinBlock_Handler, 653 }, 654 { 655 MethodName: "SendMessageById", 656 Handler: _Sentry_SendMessageById_Handler, 657 }, 658 { 659 MethodName: "SendMessageToRandomPeers", 660 Handler: _Sentry_SendMessageToRandomPeers_Handler, 661 }, 662 { 663 MethodName: "SendMessageToAll", 664 Handler: _Sentry_SendMessageToAll_Handler, 665 }, 666 { 667 MethodName: "Peers", 668 Handler: _Sentry_Peers_Handler, 669 }, 670 { 671 MethodName: "PeerCount", 672 Handler: _Sentry_PeerCount_Handler, 673 }, 674 { 675 MethodName: "PeerById", 676 Handler: _Sentry_PeerById_Handler, 677 }, 678 { 679 MethodName: "AddPeer", 680 Handler: _Sentry_AddPeer_Handler, 681 }, 682 { 683 MethodName: "NodeInfo", 684 Handler: _Sentry_NodeInfo_Handler, 685 }, 686 }, 687 Streams: []grpc.StreamDesc{ 688 { 689 StreamName: "Messages", 690 Handler: _Sentry_Messages_Handler, 691 ServerStreams: true, 692 }, 693 { 694 StreamName: "PeerEvents", 695 Handler: _Sentry_PeerEvents_Handler, 696 ServerStreams: true, 697 }, 698 }, 699 Metadata: "p2psentry/sentry.proto", 700 }