// Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.6.1 // - protoc (unknown) // source: nostr/v1/nostr.proto package nostrv1 import ( context "context" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" ) // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. // Requires gRPC-Go v1.64.0 or later. const _ = grpc.SupportPackageIsVersion9 const ( NostrRelay_PublishEvent_FullMethodName = "/nostr.v1.NostrRelay/PublishEvent" NostrRelay_Subscribe_FullMethodName = "/nostr.v1.NostrRelay/Subscribe" NostrRelay_Unsubscribe_FullMethodName = "/nostr.v1.NostrRelay/Unsubscribe" NostrRelay_PublishBatch_FullMethodName = "/nostr.v1.NostrRelay/PublishBatch" NostrRelay_QueryEvents_FullMethodName = "/nostr.v1.NostrRelay/QueryEvents" NostrRelay_CountEvents_FullMethodName = "/nostr.v1.NostrRelay/CountEvents" ) // NostrRelayClient is the client API for NostrRelay service. // // 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. // // Main relay service type NostrRelayClient interface { // Publish a single event PublishEvent(ctx context.Context, in *PublishEventRequest, opts ...grpc.CallOption) (*PublishEventResponse, error) // Subscribe to events matching filters (streaming) Subscribe(ctx context.Context, in *SubscribeRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[Event], error) // Unsubscribe from an active subscription Unsubscribe(ctx context.Context, in *UnsubscribeRequest, opts ...grpc.CallOption) (*Empty, error) // gRPC-specific: batch publish PublishBatch(ctx context.Context, in *PublishBatchRequest, opts ...grpc.CallOption) (*PublishBatchResponse, error) // gRPC-specific: paginated query (non-streaming) QueryEvents(ctx context.Context, in *QueryRequest, opts ...grpc.CallOption) (*QueryResponse, error) // Event counts (NIP-45) CountEvents(ctx context.Context, in *CountRequest, opts ...grpc.CallOption) (*CountResponse, error) } type nostrRelayClient struct { cc grpc.ClientConnInterface } func NewNostrRelayClient(cc grpc.ClientConnInterface) NostrRelayClient { return &nostrRelayClient{cc} } func (c *nostrRelayClient) PublishEvent(ctx context.Context, in *PublishEventRequest, opts ...grpc.CallOption) (*PublishEventResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(PublishEventResponse) err := c.cc.Invoke(ctx, NostrRelay_PublishEvent_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } func (c *nostrRelayClient) Subscribe(ctx context.Context, in *SubscribeRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[Event], error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) stream, err := c.cc.NewStream(ctx, &NostrRelay_ServiceDesc.Streams[0], NostrRelay_Subscribe_FullMethodName, cOpts...) if err != nil { return nil, err } x := &grpc.GenericClientStream[SubscribeRequest, Event]{ClientStream: stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } if err := x.ClientStream.CloseSend(); err != nil { return nil, err } return x, nil } // This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. type NostrRelay_SubscribeClient = grpc.ServerStreamingClient[Event] func (c *nostrRelayClient) Unsubscribe(ctx context.Context, in *UnsubscribeRequest, opts ...grpc.CallOption) (*Empty, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(Empty) err := c.cc.Invoke(ctx, NostrRelay_Unsubscribe_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } func (c *nostrRelayClient) PublishBatch(ctx context.Context, in *PublishBatchRequest, opts ...grpc.CallOption) (*PublishBatchResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(PublishBatchResponse) err := c.cc.Invoke(ctx, NostrRelay_PublishBatch_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } func (c *nostrRelayClient) QueryEvents(ctx context.Context, in *QueryRequest, opts ...grpc.CallOption) (*QueryResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(QueryResponse) err := c.cc.Invoke(ctx, NostrRelay_QueryEvents_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } func (c *nostrRelayClient) CountEvents(ctx context.Context, in *CountRequest, opts ...grpc.CallOption) (*CountResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(CountResponse) err := c.cc.Invoke(ctx, NostrRelay_CountEvents_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } // NostrRelayServer is the server API for NostrRelay service. // All implementations must embed UnimplementedNostrRelayServer // for forward compatibility. // // Main relay service type NostrRelayServer interface { // Publish a single event PublishEvent(context.Context, *PublishEventRequest) (*PublishEventResponse, error) // Subscribe to events matching filters (streaming) Subscribe(*SubscribeRequest, grpc.ServerStreamingServer[Event]) error // Unsubscribe from an active subscription Unsubscribe(context.Context, *UnsubscribeRequest) (*Empty, error) // gRPC-specific: batch publish PublishBatch(context.Context, *PublishBatchRequest) (*PublishBatchResponse, error) // gRPC-specific: paginated query (non-streaming) QueryEvents(context.Context, *QueryRequest) (*QueryResponse, error) // Event counts (NIP-45) CountEvents(context.Context, *CountRequest) (*CountResponse, error) mustEmbedUnimplementedNostrRelayServer() } // UnimplementedNostrRelayServer must be embedded to have // forward compatible implementations. // // NOTE: this should be embedded by value instead of pointer to avoid a nil // pointer dereference when methods are called. type UnimplementedNostrRelayServer struct{} func (UnimplementedNostrRelayServer) PublishEvent(context.Context, *PublishEventRequest) (*PublishEventResponse, error) { return nil, status.Error(codes.Unimplemented, "method PublishEvent not implemented") } func (UnimplementedNostrRelayServer) Subscribe(*SubscribeRequest, grpc.ServerStreamingServer[Event]) error { return status.Error(codes.Unimplemented, "method Subscribe not implemented") } func (UnimplementedNostrRelayServer) Unsubscribe(context.Context, *UnsubscribeRequest) (*Empty, error) { return nil, status.Error(codes.Unimplemented, "method Unsubscribe not implemented") } func (UnimplementedNostrRelayServer) PublishBatch(context.Context, *PublishBatchRequest) (*PublishBatchResponse, error) { return nil, status.Error(codes.Unimplemented, "method PublishBatch not implemented") } func (UnimplementedNostrRelayServer) QueryEvents(context.Context, *QueryRequest) (*QueryResponse, error) { return nil, status.Error(codes.Unimplemented, "method QueryEvents not implemented") } func (UnimplementedNostrRelayServer) CountEvents(context.Context, *CountRequest) (*CountResponse, error) { return nil, status.Error(codes.Unimplemented, "method CountEvents not implemented") } func (UnimplementedNostrRelayServer) mustEmbedUnimplementedNostrRelayServer() {} func (UnimplementedNostrRelayServer) testEmbeddedByValue() {} // UnsafeNostrRelayServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to NostrRelayServer will // result in compilation errors. type UnsafeNostrRelayServer interface { mustEmbedUnimplementedNostrRelayServer() } func RegisterNostrRelayServer(s grpc.ServiceRegistrar, srv NostrRelayServer) { // If the following call panics, it indicates UnimplementedNostrRelayServer was // embedded by pointer and is nil. This will cause panics if an // unimplemented method is ever invoked, so we test this at initialization // time to prevent it from happening at runtime later due to I/O. if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { t.testEmbeddedByValue() } s.RegisterService(&NostrRelay_ServiceDesc, srv) } func _NostrRelay_PublishEvent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(PublishEventRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(NostrRelayServer).PublishEvent(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: NostrRelay_PublishEvent_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(NostrRelayServer).PublishEvent(ctx, req.(*PublishEventRequest)) } return interceptor(ctx, in, info, handler) } func _NostrRelay_Subscribe_Handler(srv interface{}, stream grpc.ServerStream) error { m := new(SubscribeRequest) if err := stream.RecvMsg(m); err != nil { return err } return srv.(NostrRelayServer).Subscribe(m, &grpc.GenericServerStream[SubscribeRequest, Event]{ServerStream: stream}) } // This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. type NostrRelay_SubscribeServer = grpc.ServerStreamingServer[Event] func _NostrRelay_Unsubscribe_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(UnsubscribeRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(NostrRelayServer).Unsubscribe(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: NostrRelay_Unsubscribe_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(NostrRelayServer).Unsubscribe(ctx, req.(*UnsubscribeRequest)) } return interceptor(ctx, in, info, handler) } func _NostrRelay_PublishBatch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(PublishBatchRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(NostrRelayServer).PublishBatch(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: NostrRelay_PublishBatch_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(NostrRelayServer).PublishBatch(ctx, req.(*PublishBatchRequest)) } return interceptor(ctx, in, info, handler) } func _NostrRelay_QueryEvents_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(QueryRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(NostrRelayServer).QueryEvents(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: NostrRelay_QueryEvents_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(NostrRelayServer).QueryEvents(ctx, req.(*QueryRequest)) } return interceptor(ctx, in, info, handler) } func _NostrRelay_CountEvents_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(CountRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(NostrRelayServer).CountEvents(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: NostrRelay_CountEvents_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(NostrRelayServer).CountEvents(ctx, req.(*CountRequest)) } return interceptor(ctx, in, info, handler) } // NostrRelay_ServiceDesc is the grpc.ServiceDesc for NostrRelay service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) var NostrRelay_ServiceDesc = grpc.ServiceDesc{ ServiceName: "nostr.v1.NostrRelay", HandlerType: (*NostrRelayServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "PublishEvent", Handler: _NostrRelay_PublishEvent_Handler, }, { MethodName: "Unsubscribe", Handler: _NostrRelay_Unsubscribe_Handler, }, { MethodName: "PublishBatch", Handler: _NostrRelay_PublishBatch_Handler, }, { MethodName: "QueryEvents", Handler: _NostrRelay_QueryEvents_Handler, }, { MethodName: "CountEvents", Handler: _NostrRelay_CountEvents_Handler, }, }, Streams: []grpc.StreamDesc{ { StreamName: "Subscribe", Handler: _NostrRelay_Subscribe_Handler, ServerStreams: true, }, }, Metadata: "nostr/v1/nostr.proto", } const ( RelayAdmin_GetStats_FullMethodName = "/nostr.v1.RelayAdmin/GetStats" RelayAdmin_GetConnections_FullMethodName = "/nostr.v1.RelayAdmin/GetConnections" RelayAdmin_BanPublicKey_FullMethodName = "/nostr.v1.RelayAdmin/BanPublicKey" RelayAdmin_GetStorageInfo_FullMethodName = "/nostr.v1.RelayAdmin/GetStorageInfo" ) // RelayAdminClient is the client API for RelayAdmin service. // // 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. // // Admin service (optional, secured separately) type RelayAdminClient interface { GetStats(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*RelayStats, error) GetConnections(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*ConnectionList, error) BanPublicKey(ctx context.Context, in *BanRequest, opts ...grpc.CallOption) (*Empty, error) GetStorageInfo(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*StorageStats, error) } type relayAdminClient struct { cc grpc.ClientConnInterface } func NewRelayAdminClient(cc grpc.ClientConnInterface) RelayAdminClient { return &relayAdminClient{cc} } func (c *relayAdminClient) GetStats(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*RelayStats, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(RelayStats) err := c.cc.Invoke(ctx, RelayAdmin_GetStats_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } func (c *relayAdminClient) GetConnections(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*ConnectionList, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(ConnectionList) err := c.cc.Invoke(ctx, RelayAdmin_GetConnections_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } func (c *relayAdminClient) BanPublicKey(ctx context.Context, in *BanRequest, opts ...grpc.CallOption) (*Empty, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(Empty) err := c.cc.Invoke(ctx, RelayAdmin_BanPublicKey_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } func (c *relayAdminClient) GetStorageInfo(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*StorageStats, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(StorageStats) err := c.cc.Invoke(ctx, RelayAdmin_GetStorageInfo_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } // RelayAdminServer is the server API for RelayAdmin service. // All implementations must embed UnimplementedRelayAdminServer // for forward compatibility. // // Admin service (optional, secured separately) type RelayAdminServer interface { GetStats(context.Context, *Empty) (*RelayStats, error) GetConnections(context.Context, *Empty) (*ConnectionList, error) BanPublicKey(context.Context, *BanRequest) (*Empty, error) GetStorageInfo(context.Context, *Empty) (*StorageStats, error) mustEmbedUnimplementedRelayAdminServer() } // UnimplementedRelayAdminServer must be embedded to have // forward compatible implementations. // // NOTE: this should be embedded by value instead of pointer to avoid a nil // pointer dereference when methods are called. type UnimplementedRelayAdminServer struct{} func (UnimplementedRelayAdminServer) GetStats(context.Context, *Empty) (*RelayStats, error) { return nil, status.Error(codes.Unimplemented, "method GetStats not implemented") } func (UnimplementedRelayAdminServer) GetConnections(context.Context, *Empty) (*ConnectionList, error) { return nil, status.Error(codes.Unimplemented, "method GetConnections not implemented") } func (UnimplementedRelayAdminServer) BanPublicKey(context.Context, *BanRequest) (*Empty, error) { return nil, status.Error(codes.Unimplemented, "method BanPublicKey not implemented") } func (UnimplementedRelayAdminServer) GetStorageInfo(context.Context, *Empty) (*StorageStats, error) { return nil, status.Error(codes.Unimplemented, "method GetStorageInfo not implemented") } func (UnimplementedRelayAdminServer) mustEmbedUnimplementedRelayAdminServer() {} func (UnimplementedRelayAdminServer) testEmbeddedByValue() {} // UnsafeRelayAdminServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to RelayAdminServer will // result in compilation errors. type UnsafeRelayAdminServer interface { mustEmbedUnimplementedRelayAdminServer() } func RegisterRelayAdminServer(s grpc.ServiceRegistrar, srv RelayAdminServer) { // If the following call panics, it indicates UnimplementedRelayAdminServer was // embedded by pointer and is nil. This will cause panics if an // unimplemented method is ever invoked, so we test this at initialization // time to prevent it from happening at runtime later due to I/O. if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { t.testEmbeddedByValue() } s.RegisterService(&RelayAdmin_ServiceDesc, srv) } func _RelayAdmin_GetStats_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(Empty) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(RelayAdminServer).GetStats(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: RelayAdmin_GetStats_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(RelayAdminServer).GetStats(ctx, req.(*Empty)) } return interceptor(ctx, in, info, handler) } func _RelayAdmin_GetConnections_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(Empty) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(RelayAdminServer).GetConnections(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: RelayAdmin_GetConnections_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(RelayAdminServer).GetConnections(ctx, req.(*Empty)) } return interceptor(ctx, in, info, handler) } func _RelayAdmin_BanPublicKey_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(BanRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(RelayAdminServer).BanPublicKey(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: RelayAdmin_BanPublicKey_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(RelayAdminServer).BanPublicKey(ctx, req.(*BanRequest)) } return interceptor(ctx, in, info, handler) } func _RelayAdmin_GetStorageInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(Empty) if err := dec(in); err != nil { return nil, err } if interceptor == nil { return srv.(RelayAdminServer).GetStorageInfo(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, FullMethod: RelayAdmin_GetStorageInfo_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(RelayAdminServer).GetStorageInfo(ctx, req.(*Empty)) } return interceptor(ctx, in, info, handler) } // RelayAdmin_ServiceDesc is the grpc.ServiceDesc for RelayAdmin service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) var RelayAdmin_ServiceDesc = grpc.ServiceDesc{ ServiceName: "nostr.v1.RelayAdmin", HandlerType: (*RelayAdminServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "GetStats", Handler: _RelayAdmin_GetStats_Handler, }, { MethodName: "GetConnections", Handler: _RelayAdmin_GetConnections_Handler, }, { MethodName: "BanPublicKey", Handler: _RelayAdmin_BanPublicKey_Handler, }, { MethodName: "GetStorageInfo", Handler: _RelayAdmin_GetStorageInfo_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "nostr/v1/nostr.proto", }