diff options
Diffstat (limited to 'api/nostr/v1/nostr_grpc.pb.go')
| -rw-r--r-- | api/nostr/v1/nostr_grpc.pb.go | 551 |
1 files changed, 551 insertions, 0 deletions
diff --git a/api/nostr/v1/nostr_grpc.pb.go b/api/nostr/v1/nostr_grpc.pb.go new file mode 100644 index 0000000..fba3f79 --- /dev/null +++ b/api/nostr/v1/nostr_grpc.pb.go | |||
| @@ -0,0 +1,551 @@ | |||
| 1 | // Code generated by protoc-gen-go-grpc. DO NOT EDIT. | ||
| 2 | // versions: | ||
| 3 | // - protoc-gen-go-grpc v1.6.1 | ||
| 4 | // - protoc (unknown) | ||
| 5 | // source: nostr/v1/nostr.proto | ||
| 6 | |||
| 7 | package nostrv1 | ||
| 8 | |||
| 9 | import ( | ||
| 10 | context "context" | ||
| 11 | grpc "google.golang.org/grpc" | ||
| 12 | codes "google.golang.org/grpc/codes" | ||
| 13 | status "google.golang.org/grpc/status" | ||
| 14 | ) | ||
| 15 | |||
| 16 | // This is a compile-time assertion to ensure that this generated file | ||
| 17 | // is compatible with the grpc package it is being compiled against. | ||
| 18 | // Requires gRPC-Go v1.64.0 or later. | ||
| 19 | const _ = grpc.SupportPackageIsVersion9 | ||
| 20 | |||
| 21 | const ( | ||
| 22 | NostrRelay_PublishEvent_FullMethodName = "/nostr.v1.NostrRelay/PublishEvent" | ||
| 23 | NostrRelay_Subscribe_FullMethodName = "/nostr.v1.NostrRelay/Subscribe" | ||
| 24 | NostrRelay_Unsubscribe_FullMethodName = "/nostr.v1.NostrRelay/Unsubscribe" | ||
| 25 | NostrRelay_PublishBatch_FullMethodName = "/nostr.v1.NostrRelay/PublishBatch" | ||
| 26 | NostrRelay_QueryEvents_FullMethodName = "/nostr.v1.NostrRelay/QueryEvents" | ||
| 27 | NostrRelay_CountEvents_FullMethodName = "/nostr.v1.NostrRelay/CountEvents" | ||
| 28 | ) | ||
| 29 | |||
| 30 | // NostrRelayClient is the client API for NostrRelay service. | ||
| 31 | // | ||
| 32 | // 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. | ||
| 33 | // | ||
| 34 | // Main relay service | ||
| 35 | type NostrRelayClient interface { | ||
| 36 | // Publish a single event | ||
| 37 | PublishEvent(ctx context.Context, in *PublishEventRequest, opts ...grpc.CallOption) (*PublishEventResponse, error) | ||
| 38 | // Subscribe to events matching filters (streaming) | ||
| 39 | Subscribe(ctx context.Context, in *SubscribeRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[Event], error) | ||
| 40 | // Unsubscribe from an active subscription | ||
| 41 | Unsubscribe(ctx context.Context, in *UnsubscribeRequest, opts ...grpc.CallOption) (*Empty, error) | ||
| 42 | // gRPC-specific: batch publish | ||
| 43 | PublishBatch(ctx context.Context, in *PublishBatchRequest, opts ...grpc.CallOption) (*PublishBatchResponse, error) | ||
| 44 | // gRPC-specific: paginated query (non-streaming) | ||
| 45 | QueryEvents(ctx context.Context, in *QueryRequest, opts ...grpc.CallOption) (*QueryResponse, error) | ||
| 46 | // Event counts (NIP-45) | ||
| 47 | CountEvents(ctx context.Context, in *CountRequest, opts ...grpc.CallOption) (*CountResponse, error) | ||
| 48 | } | ||
| 49 | |||
| 50 | type nostrRelayClient struct { | ||
| 51 | cc grpc.ClientConnInterface | ||
| 52 | } | ||
| 53 | |||
| 54 | func NewNostrRelayClient(cc grpc.ClientConnInterface) NostrRelayClient { | ||
| 55 | return &nostrRelayClient{cc} | ||
| 56 | } | ||
| 57 | |||
| 58 | func (c *nostrRelayClient) PublishEvent(ctx context.Context, in *PublishEventRequest, opts ...grpc.CallOption) (*PublishEventResponse, error) { | ||
| 59 | cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) | ||
| 60 | out := new(PublishEventResponse) | ||
| 61 | err := c.cc.Invoke(ctx, NostrRelay_PublishEvent_FullMethodName, in, out, cOpts...) | ||
| 62 | if err != nil { | ||
| 63 | return nil, err | ||
| 64 | } | ||
| 65 | return out, nil | ||
| 66 | } | ||
| 67 | |||
| 68 | func (c *nostrRelayClient) Subscribe(ctx context.Context, in *SubscribeRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[Event], error) { | ||
| 69 | cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) | ||
| 70 | stream, err := c.cc.NewStream(ctx, &NostrRelay_ServiceDesc.Streams[0], NostrRelay_Subscribe_FullMethodName, cOpts...) | ||
| 71 | if err != nil { | ||
| 72 | return nil, err | ||
| 73 | } | ||
| 74 | x := &grpc.GenericClientStream[SubscribeRequest, Event]{ClientStream: stream} | ||
| 75 | if err := x.ClientStream.SendMsg(in); err != nil { | ||
| 76 | return nil, err | ||
| 77 | } | ||
| 78 | if err := x.ClientStream.CloseSend(); err != nil { | ||
| 79 | return nil, err | ||
| 80 | } | ||
| 81 | return x, nil | ||
| 82 | } | ||
| 83 | |||
| 84 | // This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. | ||
| 85 | type NostrRelay_SubscribeClient = grpc.ServerStreamingClient[Event] | ||
| 86 | |||
| 87 | func (c *nostrRelayClient) Unsubscribe(ctx context.Context, in *UnsubscribeRequest, opts ...grpc.CallOption) (*Empty, error) { | ||
| 88 | cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) | ||
| 89 | out := new(Empty) | ||
| 90 | err := c.cc.Invoke(ctx, NostrRelay_Unsubscribe_FullMethodName, in, out, cOpts...) | ||
| 91 | if err != nil { | ||
| 92 | return nil, err | ||
| 93 | } | ||
| 94 | return out, nil | ||
| 95 | } | ||
| 96 | |||
| 97 | func (c *nostrRelayClient) PublishBatch(ctx context.Context, in *PublishBatchRequest, opts ...grpc.CallOption) (*PublishBatchResponse, error) { | ||
| 98 | cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) | ||
| 99 | out := new(PublishBatchResponse) | ||
| 100 | err := c.cc.Invoke(ctx, NostrRelay_PublishBatch_FullMethodName, in, out, cOpts...) | ||
| 101 | if err != nil { | ||
| 102 | return nil, err | ||
| 103 | } | ||
| 104 | return out, nil | ||
| 105 | } | ||
| 106 | |||
| 107 | func (c *nostrRelayClient) QueryEvents(ctx context.Context, in *QueryRequest, opts ...grpc.CallOption) (*QueryResponse, error) { | ||
| 108 | cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) | ||
| 109 | out := new(QueryResponse) | ||
| 110 | err := c.cc.Invoke(ctx, NostrRelay_QueryEvents_FullMethodName, in, out, cOpts...) | ||
| 111 | if err != nil { | ||
| 112 | return nil, err | ||
| 113 | } | ||
| 114 | return out, nil | ||
| 115 | } | ||
| 116 | |||
| 117 | func (c *nostrRelayClient) CountEvents(ctx context.Context, in *CountRequest, opts ...grpc.CallOption) (*CountResponse, error) { | ||
| 118 | cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) | ||
| 119 | out := new(CountResponse) | ||
| 120 | err := c.cc.Invoke(ctx, NostrRelay_CountEvents_FullMethodName, in, out, cOpts...) | ||
| 121 | if err != nil { | ||
| 122 | return nil, err | ||
| 123 | } | ||
| 124 | return out, nil | ||
| 125 | } | ||
| 126 | |||
| 127 | // NostrRelayServer is the server API for NostrRelay service. | ||
| 128 | // All implementations must embed UnimplementedNostrRelayServer | ||
| 129 | // for forward compatibility. | ||
| 130 | // | ||
| 131 | // Main relay service | ||
| 132 | type NostrRelayServer interface { | ||
| 133 | // Publish a single event | ||
| 134 | PublishEvent(context.Context, *PublishEventRequest) (*PublishEventResponse, error) | ||
| 135 | // Subscribe to events matching filters (streaming) | ||
| 136 | Subscribe(*SubscribeRequest, grpc.ServerStreamingServer[Event]) error | ||
| 137 | // Unsubscribe from an active subscription | ||
| 138 | Unsubscribe(context.Context, *UnsubscribeRequest) (*Empty, error) | ||
| 139 | // gRPC-specific: batch publish | ||
| 140 | PublishBatch(context.Context, *PublishBatchRequest) (*PublishBatchResponse, error) | ||
| 141 | // gRPC-specific: paginated query (non-streaming) | ||
| 142 | QueryEvents(context.Context, *QueryRequest) (*QueryResponse, error) | ||
| 143 | // Event counts (NIP-45) | ||
| 144 | CountEvents(context.Context, *CountRequest) (*CountResponse, error) | ||
| 145 | mustEmbedUnimplementedNostrRelayServer() | ||
| 146 | } | ||
| 147 | |||
| 148 | // UnimplementedNostrRelayServer must be embedded to have | ||
| 149 | // forward compatible implementations. | ||
| 150 | // | ||
| 151 | // NOTE: this should be embedded by value instead of pointer to avoid a nil | ||
| 152 | // pointer dereference when methods are called. | ||
| 153 | type UnimplementedNostrRelayServer struct{} | ||
| 154 | |||
| 155 | func (UnimplementedNostrRelayServer) PublishEvent(context.Context, *PublishEventRequest) (*PublishEventResponse, error) { | ||
| 156 | return nil, status.Error(codes.Unimplemented, "method PublishEvent not implemented") | ||
| 157 | } | ||
| 158 | func (UnimplementedNostrRelayServer) Subscribe(*SubscribeRequest, grpc.ServerStreamingServer[Event]) error { | ||
| 159 | return status.Error(codes.Unimplemented, "method Subscribe not implemented") | ||
| 160 | } | ||
| 161 | func (UnimplementedNostrRelayServer) Unsubscribe(context.Context, *UnsubscribeRequest) (*Empty, error) { | ||
| 162 | return nil, status.Error(codes.Unimplemented, "method Unsubscribe not implemented") | ||
| 163 | } | ||
| 164 | func (UnimplementedNostrRelayServer) PublishBatch(context.Context, *PublishBatchRequest) (*PublishBatchResponse, error) { | ||
| 165 | return nil, status.Error(codes.Unimplemented, "method PublishBatch not implemented") | ||
| 166 | } | ||
| 167 | func (UnimplementedNostrRelayServer) QueryEvents(context.Context, *QueryRequest) (*QueryResponse, error) { | ||
| 168 | return nil, status.Error(codes.Unimplemented, "method QueryEvents not implemented") | ||
| 169 | } | ||
| 170 | func (UnimplementedNostrRelayServer) CountEvents(context.Context, *CountRequest) (*CountResponse, error) { | ||
| 171 | return nil, status.Error(codes.Unimplemented, "method CountEvents not implemented") | ||
| 172 | } | ||
| 173 | func (UnimplementedNostrRelayServer) mustEmbedUnimplementedNostrRelayServer() {} | ||
| 174 | func (UnimplementedNostrRelayServer) testEmbeddedByValue() {} | ||
| 175 | |||
| 176 | // UnsafeNostrRelayServer may be embedded to opt out of forward compatibility for this service. | ||
| 177 | // Use of this interface is not recommended, as added methods to NostrRelayServer will | ||
| 178 | // result in compilation errors. | ||
| 179 | type UnsafeNostrRelayServer interface { | ||
| 180 | mustEmbedUnimplementedNostrRelayServer() | ||
| 181 | } | ||
| 182 | |||
| 183 | func RegisterNostrRelayServer(s grpc.ServiceRegistrar, srv NostrRelayServer) { | ||
| 184 | // If the following call panics, it indicates UnimplementedNostrRelayServer was | ||
| 185 | // embedded by pointer and is nil. This will cause panics if an | ||
| 186 | // unimplemented method is ever invoked, so we test this at initialization | ||
| 187 | // time to prevent it from happening at runtime later due to I/O. | ||
| 188 | if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { | ||
| 189 | t.testEmbeddedByValue() | ||
| 190 | } | ||
| 191 | s.RegisterService(&NostrRelay_ServiceDesc, srv) | ||
| 192 | } | ||
| 193 | |||
| 194 | func _NostrRelay_PublishEvent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { | ||
| 195 | in := new(PublishEventRequest) | ||
| 196 | if err := dec(in); err != nil { | ||
| 197 | return nil, err | ||
| 198 | } | ||
| 199 | if interceptor == nil { | ||
| 200 | return srv.(NostrRelayServer).PublishEvent(ctx, in) | ||
| 201 | } | ||
| 202 | info := &grpc.UnaryServerInfo{ | ||
| 203 | Server: srv, | ||
| 204 | FullMethod: NostrRelay_PublishEvent_FullMethodName, | ||
| 205 | } | ||
| 206 | handler := func(ctx context.Context, req interface{}) (interface{}, error) { | ||
| 207 | return srv.(NostrRelayServer).PublishEvent(ctx, req.(*PublishEventRequest)) | ||
| 208 | } | ||
| 209 | return interceptor(ctx, in, info, handler) | ||
| 210 | } | ||
| 211 | |||
| 212 | func _NostrRelay_Subscribe_Handler(srv interface{}, stream grpc.ServerStream) error { | ||
| 213 | m := new(SubscribeRequest) | ||
| 214 | if err := stream.RecvMsg(m); err != nil { | ||
| 215 | return err | ||
| 216 | } | ||
| 217 | return srv.(NostrRelayServer).Subscribe(m, &grpc.GenericServerStream[SubscribeRequest, Event]{ServerStream: stream}) | ||
| 218 | } | ||
| 219 | |||
| 220 | // This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. | ||
| 221 | type NostrRelay_SubscribeServer = grpc.ServerStreamingServer[Event] | ||
| 222 | |||
| 223 | func _NostrRelay_Unsubscribe_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { | ||
| 224 | in := new(UnsubscribeRequest) | ||
| 225 | if err := dec(in); err != nil { | ||
| 226 | return nil, err | ||
| 227 | } | ||
| 228 | if interceptor == nil { | ||
| 229 | return srv.(NostrRelayServer).Unsubscribe(ctx, in) | ||
| 230 | } | ||
| 231 | info := &grpc.UnaryServerInfo{ | ||
| 232 | Server: srv, | ||
| 233 | FullMethod: NostrRelay_Unsubscribe_FullMethodName, | ||
| 234 | } | ||
| 235 | handler := func(ctx context.Context, req interface{}) (interface{}, error) { | ||
| 236 | return srv.(NostrRelayServer).Unsubscribe(ctx, req.(*UnsubscribeRequest)) | ||
| 237 | } | ||
| 238 | return interceptor(ctx, in, info, handler) | ||
| 239 | } | ||
| 240 | |||
| 241 | func _NostrRelay_PublishBatch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { | ||
| 242 | in := new(PublishBatchRequest) | ||
| 243 | if err := dec(in); err != nil { | ||
| 244 | return nil, err | ||
| 245 | } | ||
| 246 | if interceptor == nil { | ||
| 247 | return srv.(NostrRelayServer).PublishBatch(ctx, in) | ||
| 248 | } | ||
| 249 | info := &grpc.UnaryServerInfo{ | ||
| 250 | Server: srv, | ||
| 251 | FullMethod: NostrRelay_PublishBatch_FullMethodName, | ||
| 252 | } | ||
| 253 | handler := func(ctx context.Context, req interface{}) (interface{}, error) { | ||
| 254 | return srv.(NostrRelayServer).PublishBatch(ctx, req.(*PublishBatchRequest)) | ||
| 255 | } | ||
| 256 | return interceptor(ctx, in, info, handler) | ||
| 257 | } | ||
| 258 | |||
| 259 | func _NostrRelay_QueryEvents_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { | ||
| 260 | in := new(QueryRequest) | ||
| 261 | if err := dec(in); err != nil { | ||
| 262 | return nil, err | ||
| 263 | } | ||
| 264 | if interceptor == nil { | ||
| 265 | return srv.(NostrRelayServer).QueryEvents(ctx, in) | ||
| 266 | } | ||
| 267 | info := &grpc.UnaryServerInfo{ | ||
| 268 | Server: srv, | ||
| 269 | FullMethod: NostrRelay_QueryEvents_FullMethodName, | ||
| 270 | } | ||
| 271 | handler := func(ctx context.Context, req interface{}) (interface{}, error) { | ||
| 272 | return srv.(NostrRelayServer).QueryEvents(ctx, req.(*QueryRequest)) | ||
| 273 | } | ||
| 274 | return interceptor(ctx, in, info, handler) | ||
| 275 | } | ||
| 276 | |||
| 277 | func _NostrRelay_CountEvents_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { | ||
| 278 | in := new(CountRequest) | ||
| 279 | if err := dec(in); err != nil { | ||
| 280 | return nil, err | ||
| 281 | } | ||
| 282 | if interceptor == nil { | ||
| 283 | return srv.(NostrRelayServer).CountEvents(ctx, in) | ||
| 284 | } | ||
| 285 | info := &grpc.UnaryServerInfo{ | ||
| 286 | Server: srv, | ||
| 287 | FullMethod: NostrRelay_CountEvents_FullMethodName, | ||
| 288 | } | ||
| 289 | handler := func(ctx context.Context, req interface{}) (interface{}, error) { | ||
| 290 | return srv.(NostrRelayServer).CountEvents(ctx, req.(*CountRequest)) | ||
| 291 | } | ||
| 292 | return interceptor(ctx, in, info, handler) | ||
| 293 | } | ||
| 294 | |||
| 295 | // NostrRelay_ServiceDesc is the grpc.ServiceDesc for NostrRelay service. | ||
| 296 | // It's only intended for direct use with grpc.RegisterService, | ||
| 297 | // and not to be introspected or modified (even as a copy) | ||
| 298 | var NostrRelay_ServiceDesc = grpc.ServiceDesc{ | ||
| 299 | ServiceName: "nostr.v1.NostrRelay", | ||
| 300 | HandlerType: (*NostrRelayServer)(nil), | ||
| 301 | Methods: []grpc.MethodDesc{ | ||
| 302 | { | ||
| 303 | MethodName: "PublishEvent", | ||
| 304 | Handler: _NostrRelay_PublishEvent_Handler, | ||
| 305 | }, | ||
| 306 | { | ||
| 307 | MethodName: "Unsubscribe", | ||
| 308 | Handler: _NostrRelay_Unsubscribe_Handler, | ||
| 309 | }, | ||
| 310 | { | ||
| 311 | MethodName: "PublishBatch", | ||
| 312 | Handler: _NostrRelay_PublishBatch_Handler, | ||
| 313 | }, | ||
| 314 | { | ||
| 315 | MethodName: "QueryEvents", | ||
| 316 | Handler: _NostrRelay_QueryEvents_Handler, | ||
| 317 | }, | ||
| 318 | { | ||
| 319 | MethodName: "CountEvents", | ||
| 320 | Handler: _NostrRelay_CountEvents_Handler, | ||
| 321 | }, | ||
| 322 | }, | ||
| 323 | Streams: []grpc.StreamDesc{ | ||
| 324 | { | ||
| 325 | StreamName: "Subscribe", | ||
| 326 | Handler: _NostrRelay_Subscribe_Handler, | ||
| 327 | ServerStreams: true, | ||
| 328 | }, | ||
| 329 | }, | ||
| 330 | Metadata: "nostr/v1/nostr.proto", | ||
| 331 | } | ||
| 332 | |||
| 333 | const ( | ||
| 334 | RelayAdmin_GetStats_FullMethodName = "/nostr.v1.RelayAdmin/GetStats" | ||
| 335 | RelayAdmin_GetConnections_FullMethodName = "/nostr.v1.RelayAdmin/GetConnections" | ||
| 336 | RelayAdmin_BanPublicKey_FullMethodName = "/nostr.v1.RelayAdmin/BanPublicKey" | ||
| 337 | RelayAdmin_GetStorageInfo_FullMethodName = "/nostr.v1.RelayAdmin/GetStorageInfo" | ||
| 338 | ) | ||
| 339 | |||
| 340 | // RelayAdminClient is the client API for RelayAdmin service. | ||
| 341 | // | ||
| 342 | // 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. | ||
| 343 | // | ||
| 344 | // Admin service (optional, secured separately) | ||
| 345 | type RelayAdminClient interface { | ||
| 346 | GetStats(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*RelayStats, error) | ||
| 347 | GetConnections(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*ConnectionList, error) | ||
| 348 | BanPublicKey(ctx context.Context, in *BanRequest, opts ...grpc.CallOption) (*Empty, error) | ||
| 349 | GetStorageInfo(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*StorageStats, error) | ||
| 350 | } | ||
| 351 | |||
| 352 | type relayAdminClient struct { | ||
| 353 | cc grpc.ClientConnInterface | ||
| 354 | } | ||
| 355 | |||
| 356 | func NewRelayAdminClient(cc grpc.ClientConnInterface) RelayAdminClient { | ||
| 357 | return &relayAdminClient{cc} | ||
| 358 | } | ||
| 359 | |||
| 360 | func (c *relayAdminClient) GetStats(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*RelayStats, error) { | ||
| 361 | cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) | ||
| 362 | out := new(RelayStats) | ||
| 363 | err := c.cc.Invoke(ctx, RelayAdmin_GetStats_FullMethodName, in, out, cOpts...) | ||
| 364 | if err != nil { | ||
| 365 | return nil, err | ||
| 366 | } | ||
| 367 | return out, nil | ||
| 368 | } | ||
| 369 | |||
| 370 | func (c *relayAdminClient) GetConnections(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*ConnectionList, error) { | ||
| 371 | cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) | ||
| 372 | out := new(ConnectionList) | ||
| 373 | err := c.cc.Invoke(ctx, RelayAdmin_GetConnections_FullMethodName, in, out, cOpts...) | ||
| 374 | if err != nil { | ||
| 375 | return nil, err | ||
| 376 | } | ||
| 377 | return out, nil | ||
| 378 | } | ||
| 379 | |||
| 380 | func (c *relayAdminClient) BanPublicKey(ctx context.Context, in *BanRequest, opts ...grpc.CallOption) (*Empty, error) { | ||
| 381 | cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) | ||
| 382 | out := new(Empty) | ||
| 383 | err := c.cc.Invoke(ctx, RelayAdmin_BanPublicKey_FullMethodName, in, out, cOpts...) | ||
| 384 | if err != nil { | ||
| 385 | return nil, err | ||
| 386 | } | ||
| 387 | return out, nil | ||
| 388 | } | ||
| 389 | |||
| 390 | func (c *relayAdminClient) GetStorageInfo(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*StorageStats, error) { | ||
| 391 | cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) | ||
| 392 | out := new(StorageStats) | ||
| 393 | err := c.cc.Invoke(ctx, RelayAdmin_GetStorageInfo_FullMethodName, in, out, cOpts...) | ||
| 394 | if err != nil { | ||
| 395 | return nil, err | ||
| 396 | } | ||
| 397 | return out, nil | ||
| 398 | } | ||
| 399 | |||
| 400 | // RelayAdminServer is the server API for RelayAdmin service. | ||
| 401 | // All implementations must embed UnimplementedRelayAdminServer | ||
| 402 | // for forward compatibility. | ||
| 403 | // | ||
| 404 | // Admin service (optional, secured separately) | ||
| 405 | type RelayAdminServer interface { | ||
| 406 | GetStats(context.Context, *Empty) (*RelayStats, error) | ||
| 407 | GetConnections(context.Context, *Empty) (*ConnectionList, error) | ||
| 408 | BanPublicKey(context.Context, *BanRequest) (*Empty, error) | ||
| 409 | GetStorageInfo(context.Context, *Empty) (*StorageStats, error) | ||
| 410 | mustEmbedUnimplementedRelayAdminServer() | ||
| 411 | } | ||
| 412 | |||
| 413 | // UnimplementedRelayAdminServer must be embedded to have | ||
| 414 | // forward compatible implementations. | ||
| 415 | // | ||
| 416 | // NOTE: this should be embedded by value instead of pointer to avoid a nil | ||
| 417 | // pointer dereference when methods are called. | ||
| 418 | type UnimplementedRelayAdminServer struct{} | ||
| 419 | |||
| 420 | func (UnimplementedRelayAdminServer) GetStats(context.Context, *Empty) (*RelayStats, error) { | ||
| 421 | return nil, status.Error(codes.Unimplemented, "method GetStats not implemented") | ||
| 422 | } | ||
| 423 | func (UnimplementedRelayAdminServer) GetConnections(context.Context, *Empty) (*ConnectionList, error) { | ||
| 424 | return nil, status.Error(codes.Unimplemented, "method GetConnections not implemented") | ||
| 425 | } | ||
| 426 | func (UnimplementedRelayAdminServer) BanPublicKey(context.Context, *BanRequest) (*Empty, error) { | ||
| 427 | return nil, status.Error(codes.Unimplemented, "method BanPublicKey not implemented") | ||
| 428 | } | ||
| 429 | func (UnimplementedRelayAdminServer) GetStorageInfo(context.Context, *Empty) (*StorageStats, error) { | ||
| 430 | return nil, status.Error(codes.Unimplemented, "method GetStorageInfo not implemented") | ||
| 431 | } | ||
| 432 | func (UnimplementedRelayAdminServer) mustEmbedUnimplementedRelayAdminServer() {} | ||
| 433 | func (UnimplementedRelayAdminServer) testEmbeddedByValue() {} | ||
| 434 | |||
| 435 | // UnsafeRelayAdminServer may be embedded to opt out of forward compatibility for this service. | ||
| 436 | // Use of this interface is not recommended, as added methods to RelayAdminServer will | ||
| 437 | // result in compilation errors. | ||
| 438 | type UnsafeRelayAdminServer interface { | ||
| 439 | mustEmbedUnimplementedRelayAdminServer() | ||
| 440 | } | ||
| 441 | |||
| 442 | func RegisterRelayAdminServer(s grpc.ServiceRegistrar, srv RelayAdminServer) { | ||
| 443 | // If the following call panics, it indicates UnimplementedRelayAdminServer was | ||
| 444 | // embedded by pointer and is nil. This will cause panics if an | ||
| 445 | // unimplemented method is ever invoked, so we test this at initialization | ||
| 446 | // time to prevent it from happening at runtime later due to I/O. | ||
| 447 | if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { | ||
| 448 | t.testEmbeddedByValue() | ||
| 449 | } | ||
| 450 | s.RegisterService(&RelayAdmin_ServiceDesc, srv) | ||
| 451 | } | ||
| 452 | |||
| 453 | func _RelayAdmin_GetStats_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { | ||
| 454 | in := new(Empty) | ||
| 455 | if err := dec(in); err != nil { | ||
| 456 | return nil, err | ||
| 457 | } | ||
| 458 | if interceptor == nil { | ||
| 459 | return srv.(RelayAdminServer).GetStats(ctx, in) | ||
| 460 | } | ||
| 461 | info := &grpc.UnaryServerInfo{ | ||
| 462 | Server: srv, | ||
| 463 | FullMethod: RelayAdmin_GetStats_FullMethodName, | ||
| 464 | } | ||
| 465 | handler := func(ctx context.Context, req interface{}) (interface{}, error) { | ||
| 466 | return srv.(RelayAdminServer).GetStats(ctx, req.(*Empty)) | ||
| 467 | } | ||
| 468 | return interceptor(ctx, in, info, handler) | ||
| 469 | } | ||
| 470 | |||
| 471 | func _RelayAdmin_GetConnections_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { | ||
| 472 | in := new(Empty) | ||
| 473 | if err := dec(in); err != nil { | ||
| 474 | return nil, err | ||
| 475 | } | ||
| 476 | if interceptor == nil { | ||
| 477 | return srv.(RelayAdminServer).GetConnections(ctx, in) | ||
| 478 | } | ||
| 479 | info := &grpc.UnaryServerInfo{ | ||
| 480 | Server: srv, | ||
| 481 | FullMethod: RelayAdmin_GetConnections_FullMethodName, | ||
| 482 | } | ||
| 483 | handler := func(ctx context.Context, req interface{}) (interface{}, error) { | ||
| 484 | return srv.(RelayAdminServer).GetConnections(ctx, req.(*Empty)) | ||
| 485 | } | ||
| 486 | return interceptor(ctx, in, info, handler) | ||
| 487 | } | ||
| 488 | |||
| 489 | func _RelayAdmin_BanPublicKey_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { | ||
| 490 | in := new(BanRequest) | ||
| 491 | if err := dec(in); err != nil { | ||
| 492 | return nil, err | ||
| 493 | } | ||
| 494 | if interceptor == nil { | ||
| 495 | return srv.(RelayAdminServer).BanPublicKey(ctx, in) | ||
| 496 | } | ||
| 497 | info := &grpc.UnaryServerInfo{ | ||
| 498 | Server: srv, | ||
| 499 | FullMethod: RelayAdmin_BanPublicKey_FullMethodName, | ||
| 500 | } | ||
| 501 | handler := func(ctx context.Context, req interface{}) (interface{}, error) { | ||
| 502 | return srv.(RelayAdminServer).BanPublicKey(ctx, req.(*BanRequest)) | ||
| 503 | } | ||
| 504 | return interceptor(ctx, in, info, handler) | ||
| 505 | } | ||
| 506 | |||
| 507 | func _RelayAdmin_GetStorageInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { | ||
| 508 | in := new(Empty) | ||
| 509 | if err := dec(in); err != nil { | ||
| 510 | return nil, err | ||
| 511 | } | ||
| 512 | if interceptor == nil { | ||
| 513 | return srv.(RelayAdminServer).GetStorageInfo(ctx, in) | ||
| 514 | } | ||
| 515 | info := &grpc.UnaryServerInfo{ | ||
| 516 | Server: srv, | ||
| 517 | FullMethod: RelayAdmin_GetStorageInfo_FullMethodName, | ||
| 518 | } | ||
| 519 | handler := func(ctx context.Context, req interface{}) (interface{}, error) { | ||
| 520 | return srv.(RelayAdminServer).GetStorageInfo(ctx, req.(*Empty)) | ||
| 521 | } | ||
| 522 | return interceptor(ctx, in, info, handler) | ||
| 523 | } | ||
| 524 | |||
| 525 | // RelayAdmin_ServiceDesc is the grpc.ServiceDesc for RelayAdmin service. | ||
| 526 | // It's only intended for direct use with grpc.RegisterService, | ||
| 527 | // and not to be introspected or modified (even as a copy) | ||
| 528 | var RelayAdmin_ServiceDesc = grpc.ServiceDesc{ | ||
| 529 | ServiceName: "nostr.v1.RelayAdmin", | ||
| 530 | HandlerType: (*RelayAdminServer)(nil), | ||
| 531 | Methods: []grpc.MethodDesc{ | ||
| 532 | { | ||
| 533 | MethodName: "GetStats", | ||
| 534 | Handler: _RelayAdmin_GetStats_Handler, | ||
| 535 | }, | ||
| 536 | { | ||
| 537 | MethodName: "GetConnections", | ||
| 538 | Handler: _RelayAdmin_GetConnections_Handler, | ||
| 539 | }, | ||
| 540 | { | ||
| 541 | MethodName: "BanPublicKey", | ||
| 542 | Handler: _RelayAdmin_BanPublicKey_Handler, | ||
| 543 | }, | ||
| 544 | { | ||
| 545 | MethodName: "GetStorageInfo", | ||
| 546 | Handler: _RelayAdmin_GetStorageInfo_Handler, | ||
| 547 | }, | ||
| 548 | }, | ||
| 549 | Streams: []grpc.StreamDesc{}, | ||
| 550 | Metadata: "nostr/v1/nostr.proto", | ||
| 551 | } | ||
