diff options
Diffstat (limited to 'api/nostr')
| -rw-r--r-- | api/nostr/v1/nostr.pb.go | 1416 | ||||
| -rw-r--r-- | api/nostr/v1/nostr_grpc.pb.go | 551 |
2 files changed, 1967 insertions, 0 deletions
diff --git a/api/nostr/v1/nostr.pb.go b/api/nostr/v1/nostr.pb.go new file mode 100644 index 0000000..04aa0fe --- /dev/null +++ b/api/nostr/v1/nostr.pb.go | |||
| @@ -0,0 +1,1416 @@ | |||
| 1 | // Code generated by protoc-gen-go. DO NOT EDIT. | ||
| 2 | // versions: | ||
| 3 | // protoc-gen-go v1.36.11 | ||
| 4 | // protoc (unknown) | ||
| 5 | // source: nostr/v1/nostr.proto | ||
| 6 | |||
| 7 | package nostrv1 | ||
| 8 | |||
| 9 | import ( | ||
| 10 | protoreflect "google.golang.org/protobuf/reflect/protoreflect" | ||
| 11 | protoimpl "google.golang.org/protobuf/runtime/protoimpl" | ||
| 12 | reflect "reflect" | ||
| 13 | sync "sync" | ||
| 14 | unsafe "unsafe" | ||
| 15 | ) | ||
| 16 | |||
| 17 | const ( | ||
| 18 | // Verify that this generated code is sufficiently up-to-date. | ||
| 19 | _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) | ||
| 20 | // Verify that runtime/protoimpl is sufficiently up-to-date. | ||
| 21 | _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) | ||
| 22 | ) | ||
| 23 | |||
| 24 | // Core Nostr event as defined in NIP-01 | ||
| 25 | type Event struct { | ||
| 26 | state protoimpl.MessageState `protogen:"open.v1"` | ||
| 27 | Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` | ||
| 28 | Pubkey string `protobuf:"bytes,2,opt,name=pubkey,proto3" json:"pubkey,omitempty"` | ||
| 29 | CreatedAt int64 `protobuf:"varint,3,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` | ||
| 30 | Kind int32 `protobuf:"varint,4,opt,name=kind,proto3" json:"kind,omitempty"` | ||
| 31 | Tags []*Tag `protobuf:"bytes,5,rep,name=tags,proto3" json:"tags,omitempty"` | ||
| 32 | Content string `protobuf:"bytes,6,opt,name=content,proto3" json:"content,omitempty"` | ||
| 33 | Sig string `protobuf:"bytes,7,opt,name=sig,proto3" json:"sig,omitempty"` | ||
| 34 | // Optional: only populated if client requests verification | ||
| 35 | // Contains exact canonical JSON bytes that were signed | ||
| 36 | CanonicalJson []byte `protobuf:"bytes,8,opt,name=canonical_json,json=canonicalJson,proto3,oneof" json:"canonical_json,omitempty"` | ||
| 37 | unknownFields protoimpl.UnknownFields | ||
| 38 | sizeCache protoimpl.SizeCache | ||
| 39 | } | ||
| 40 | |||
| 41 | func (x *Event) Reset() { | ||
| 42 | *x = Event{} | ||
| 43 | mi := &file_nostr_v1_nostr_proto_msgTypes[0] | ||
| 44 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||
| 45 | ms.StoreMessageInfo(mi) | ||
| 46 | } | ||
| 47 | |||
| 48 | func (x *Event) String() string { | ||
| 49 | return protoimpl.X.MessageStringOf(x) | ||
| 50 | } | ||
| 51 | |||
| 52 | func (*Event) ProtoMessage() {} | ||
| 53 | |||
| 54 | func (x *Event) ProtoReflect() protoreflect.Message { | ||
| 55 | mi := &file_nostr_v1_nostr_proto_msgTypes[0] | ||
| 56 | if x != nil { | ||
| 57 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||
| 58 | if ms.LoadMessageInfo() == nil { | ||
| 59 | ms.StoreMessageInfo(mi) | ||
| 60 | } | ||
| 61 | return ms | ||
| 62 | } | ||
| 63 | return mi.MessageOf(x) | ||
| 64 | } | ||
| 65 | |||
| 66 | // Deprecated: Use Event.ProtoReflect.Descriptor instead. | ||
| 67 | func (*Event) Descriptor() ([]byte, []int) { | ||
| 68 | return file_nostr_v1_nostr_proto_rawDescGZIP(), []int{0} | ||
| 69 | } | ||
| 70 | |||
| 71 | func (x *Event) GetId() string { | ||
| 72 | if x != nil { | ||
| 73 | return x.Id | ||
| 74 | } | ||
| 75 | return "" | ||
| 76 | } | ||
| 77 | |||
| 78 | func (x *Event) GetPubkey() string { | ||
| 79 | if x != nil { | ||
| 80 | return x.Pubkey | ||
| 81 | } | ||
| 82 | return "" | ||
| 83 | } | ||
| 84 | |||
| 85 | func (x *Event) GetCreatedAt() int64 { | ||
| 86 | if x != nil { | ||
| 87 | return x.CreatedAt | ||
| 88 | } | ||
| 89 | return 0 | ||
| 90 | } | ||
| 91 | |||
| 92 | func (x *Event) GetKind() int32 { | ||
| 93 | if x != nil { | ||
| 94 | return x.Kind | ||
| 95 | } | ||
| 96 | return 0 | ||
| 97 | } | ||
| 98 | |||
| 99 | func (x *Event) GetTags() []*Tag { | ||
| 100 | if x != nil { | ||
| 101 | return x.Tags | ||
| 102 | } | ||
| 103 | return nil | ||
| 104 | } | ||
| 105 | |||
| 106 | func (x *Event) GetContent() string { | ||
| 107 | if x != nil { | ||
| 108 | return x.Content | ||
| 109 | } | ||
| 110 | return "" | ||
| 111 | } | ||
| 112 | |||
| 113 | func (x *Event) GetSig() string { | ||
| 114 | if x != nil { | ||
| 115 | return x.Sig | ||
| 116 | } | ||
| 117 | return "" | ||
| 118 | } | ||
| 119 | |||
| 120 | func (x *Event) GetCanonicalJson() []byte { | ||
| 121 | if x != nil { | ||
| 122 | return x.CanonicalJson | ||
| 123 | } | ||
| 124 | return nil | ||
| 125 | } | ||
| 126 | |||
| 127 | // Tag is an array of strings (e.g., ["e", "event_id", "relay_url"]) | ||
| 128 | type Tag struct { | ||
| 129 | state protoimpl.MessageState `protogen:"open.v1"` | ||
| 130 | Values []string `protobuf:"bytes,1,rep,name=values,proto3" json:"values,omitempty"` | ||
| 131 | unknownFields protoimpl.UnknownFields | ||
| 132 | sizeCache protoimpl.SizeCache | ||
| 133 | } | ||
| 134 | |||
| 135 | func (x *Tag) Reset() { | ||
| 136 | *x = Tag{} | ||
| 137 | mi := &file_nostr_v1_nostr_proto_msgTypes[1] | ||
| 138 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||
| 139 | ms.StoreMessageInfo(mi) | ||
| 140 | } | ||
| 141 | |||
| 142 | func (x *Tag) String() string { | ||
| 143 | return protoimpl.X.MessageStringOf(x) | ||
| 144 | } | ||
| 145 | |||
| 146 | func (*Tag) ProtoMessage() {} | ||
| 147 | |||
| 148 | func (x *Tag) ProtoReflect() protoreflect.Message { | ||
| 149 | mi := &file_nostr_v1_nostr_proto_msgTypes[1] | ||
| 150 | if x != nil { | ||
| 151 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||
| 152 | if ms.LoadMessageInfo() == nil { | ||
| 153 | ms.StoreMessageInfo(mi) | ||
| 154 | } | ||
| 155 | return ms | ||
| 156 | } | ||
| 157 | return mi.MessageOf(x) | ||
| 158 | } | ||
| 159 | |||
| 160 | // Deprecated: Use Tag.ProtoReflect.Descriptor instead. | ||
| 161 | func (*Tag) Descriptor() ([]byte, []int) { | ||
| 162 | return file_nostr_v1_nostr_proto_rawDescGZIP(), []int{1} | ||
| 163 | } | ||
| 164 | |||
| 165 | func (x *Tag) GetValues() []string { | ||
| 166 | if x != nil { | ||
| 167 | return x.Values | ||
| 168 | } | ||
| 169 | return nil | ||
| 170 | } | ||
| 171 | |||
| 172 | // Nostr filter for querying events (REQ) | ||
| 173 | type Filter struct { | ||
| 174 | state protoimpl.MessageState `protogen:"open.v1"` | ||
| 175 | Ids []string `protobuf:"bytes,1,rep,name=ids,proto3" json:"ids,omitempty"` | ||
| 176 | Authors []string `protobuf:"bytes,2,rep,name=authors,proto3" json:"authors,omitempty"` // pubkeys | ||
| 177 | Kinds []int32 `protobuf:"varint,3,rep,packed,name=kinds,proto3" json:"kinds,omitempty"` | ||
| 178 | ETags []string `protobuf:"bytes,4,rep,name=e_tags,json=eTags,proto3" json:"e_tags,omitempty"` // #e tag values | ||
| 179 | PTags []string `protobuf:"bytes,5,rep,name=p_tags,json=pTags,proto3" json:"p_tags,omitempty"` // #p tag values | ||
| 180 | Since *int64 `protobuf:"varint,6,opt,name=since,proto3,oneof" json:"since,omitempty"` | ||
| 181 | Until *int64 `protobuf:"varint,7,opt,name=until,proto3,oneof" json:"until,omitempty"` | ||
| 182 | Limit *int32 `protobuf:"varint,8,opt,name=limit,proto3,oneof" json:"limit,omitempty"` | ||
| 183 | // Extension: support for arbitrary tag filters | ||
| 184 | TagFilters map[string]*TagFilter `protobuf:"bytes,9,rep,name=tag_filters,json=tagFilters,proto3" json:"tag_filters,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` | ||
| 185 | unknownFields protoimpl.UnknownFields | ||
| 186 | sizeCache protoimpl.SizeCache | ||
| 187 | } | ||
| 188 | |||
| 189 | func (x *Filter) Reset() { | ||
| 190 | *x = Filter{} | ||
| 191 | mi := &file_nostr_v1_nostr_proto_msgTypes[2] | ||
| 192 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||
| 193 | ms.StoreMessageInfo(mi) | ||
| 194 | } | ||
| 195 | |||
| 196 | func (x *Filter) String() string { | ||
| 197 | return protoimpl.X.MessageStringOf(x) | ||
| 198 | } | ||
| 199 | |||
| 200 | func (*Filter) ProtoMessage() {} | ||
| 201 | |||
| 202 | func (x *Filter) ProtoReflect() protoreflect.Message { | ||
| 203 | mi := &file_nostr_v1_nostr_proto_msgTypes[2] | ||
| 204 | if x != nil { | ||
| 205 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||
| 206 | if ms.LoadMessageInfo() == nil { | ||
| 207 | ms.StoreMessageInfo(mi) | ||
| 208 | } | ||
| 209 | return ms | ||
| 210 | } | ||
| 211 | return mi.MessageOf(x) | ||
| 212 | } | ||
| 213 | |||
| 214 | // Deprecated: Use Filter.ProtoReflect.Descriptor instead. | ||
| 215 | func (*Filter) Descriptor() ([]byte, []int) { | ||
| 216 | return file_nostr_v1_nostr_proto_rawDescGZIP(), []int{2} | ||
| 217 | } | ||
| 218 | |||
| 219 | func (x *Filter) GetIds() []string { | ||
| 220 | if x != nil { | ||
| 221 | return x.Ids | ||
| 222 | } | ||
| 223 | return nil | ||
| 224 | } | ||
| 225 | |||
| 226 | func (x *Filter) GetAuthors() []string { | ||
| 227 | if x != nil { | ||
| 228 | return x.Authors | ||
| 229 | } | ||
| 230 | return nil | ||
| 231 | } | ||
| 232 | |||
| 233 | func (x *Filter) GetKinds() []int32 { | ||
| 234 | if x != nil { | ||
| 235 | return x.Kinds | ||
| 236 | } | ||
| 237 | return nil | ||
| 238 | } | ||
| 239 | |||
| 240 | func (x *Filter) GetETags() []string { | ||
| 241 | if x != nil { | ||
| 242 | return x.ETags | ||
| 243 | } | ||
| 244 | return nil | ||
| 245 | } | ||
| 246 | |||
| 247 | func (x *Filter) GetPTags() []string { | ||
| 248 | if x != nil { | ||
| 249 | return x.PTags | ||
| 250 | } | ||
| 251 | return nil | ||
| 252 | } | ||
| 253 | |||
| 254 | func (x *Filter) GetSince() int64 { | ||
| 255 | if x != nil && x.Since != nil { | ||
| 256 | return *x.Since | ||
| 257 | } | ||
| 258 | return 0 | ||
| 259 | } | ||
| 260 | |||
| 261 | func (x *Filter) GetUntil() int64 { | ||
| 262 | if x != nil && x.Until != nil { | ||
| 263 | return *x.Until | ||
| 264 | } | ||
| 265 | return 0 | ||
| 266 | } | ||
| 267 | |||
| 268 | func (x *Filter) GetLimit() int32 { | ||
| 269 | if x != nil && x.Limit != nil { | ||
| 270 | return *x.Limit | ||
| 271 | } | ||
| 272 | return 0 | ||
| 273 | } | ||
| 274 | |||
| 275 | func (x *Filter) GetTagFilters() map[string]*TagFilter { | ||
| 276 | if x != nil { | ||
| 277 | return x.TagFilters | ||
| 278 | } | ||
| 279 | return nil | ||
| 280 | } | ||
| 281 | |||
| 282 | // Filter for arbitrary tags | ||
| 283 | type TagFilter struct { | ||
| 284 | state protoimpl.MessageState `protogen:"open.v1"` | ||
| 285 | Values []string `protobuf:"bytes,1,rep,name=values,proto3" json:"values,omitempty"` | ||
| 286 | unknownFields protoimpl.UnknownFields | ||
| 287 | sizeCache protoimpl.SizeCache | ||
| 288 | } | ||
| 289 | |||
| 290 | func (x *TagFilter) Reset() { | ||
| 291 | *x = TagFilter{} | ||
| 292 | mi := &file_nostr_v1_nostr_proto_msgTypes[3] | ||
| 293 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||
| 294 | ms.StoreMessageInfo(mi) | ||
| 295 | } | ||
| 296 | |||
| 297 | func (x *TagFilter) String() string { | ||
| 298 | return protoimpl.X.MessageStringOf(x) | ||
| 299 | } | ||
| 300 | |||
| 301 | func (*TagFilter) ProtoMessage() {} | ||
| 302 | |||
| 303 | func (x *TagFilter) ProtoReflect() protoreflect.Message { | ||
| 304 | mi := &file_nostr_v1_nostr_proto_msgTypes[3] | ||
| 305 | if x != nil { | ||
| 306 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||
| 307 | if ms.LoadMessageInfo() == nil { | ||
| 308 | ms.StoreMessageInfo(mi) | ||
| 309 | } | ||
| 310 | return ms | ||
| 311 | } | ||
| 312 | return mi.MessageOf(x) | ||
| 313 | } | ||
| 314 | |||
| 315 | // Deprecated: Use TagFilter.ProtoReflect.Descriptor instead. | ||
| 316 | func (*TagFilter) Descriptor() ([]byte, []int) { | ||
| 317 | return file_nostr_v1_nostr_proto_rawDescGZIP(), []int{3} | ||
| 318 | } | ||
| 319 | |||
| 320 | func (x *TagFilter) GetValues() []string { | ||
| 321 | if x != nil { | ||
| 322 | return x.Values | ||
| 323 | } | ||
| 324 | return nil | ||
| 325 | } | ||
| 326 | |||
| 327 | // Request to publish a single event | ||
| 328 | type PublishEventRequest struct { | ||
| 329 | state protoimpl.MessageState `protogen:"open.v1"` | ||
| 330 | Event *Event `protobuf:"bytes,1,opt,name=event,proto3" json:"event,omitempty"` | ||
| 331 | unknownFields protoimpl.UnknownFields | ||
| 332 | sizeCache protoimpl.SizeCache | ||
| 333 | } | ||
| 334 | |||
| 335 | func (x *PublishEventRequest) Reset() { | ||
| 336 | *x = PublishEventRequest{} | ||
| 337 | mi := &file_nostr_v1_nostr_proto_msgTypes[4] | ||
| 338 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||
| 339 | ms.StoreMessageInfo(mi) | ||
| 340 | } | ||
| 341 | |||
| 342 | func (x *PublishEventRequest) String() string { | ||
| 343 | return protoimpl.X.MessageStringOf(x) | ||
| 344 | } | ||
| 345 | |||
| 346 | func (*PublishEventRequest) ProtoMessage() {} | ||
| 347 | |||
| 348 | func (x *PublishEventRequest) ProtoReflect() protoreflect.Message { | ||
| 349 | mi := &file_nostr_v1_nostr_proto_msgTypes[4] | ||
| 350 | if x != nil { | ||
| 351 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||
| 352 | if ms.LoadMessageInfo() == nil { | ||
| 353 | ms.StoreMessageInfo(mi) | ||
| 354 | } | ||
| 355 | return ms | ||
| 356 | } | ||
| 357 | return mi.MessageOf(x) | ||
| 358 | } | ||
| 359 | |||
| 360 | // Deprecated: Use PublishEventRequest.ProtoReflect.Descriptor instead. | ||
| 361 | func (*PublishEventRequest) Descriptor() ([]byte, []int) { | ||
| 362 | return file_nostr_v1_nostr_proto_rawDescGZIP(), []int{4} | ||
| 363 | } | ||
| 364 | |||
| 365 | func (x *PublishEventRequest) GetEvent() *Event { | ||
| 366 | if x != nil { | ||
| 367 | return x.Event | ||
| 368 | } | ||
| 369 | return nil | ||
| 370 | } | ||
| 371 | |||
| 372 | // Response after publishing an event | ||
| 373 | type PublishEventResponse struct { | ||
| 374 | state protoimpl.MessageState `protogen:"open.v1"` | ||
| 375 | Accepted bool `protobuf:"varint,1,opt,name=accepted,proto3" json:"accepted,omitempty"` | ||
| 376 | Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` // Error message or "duplicate" or "success" | ||
| 377 | // Always include canonical JSON so client can verify | ||
| 378 | // what the relay stored | ||
| 379 | CanonicalJson []byte `protobuf:"bytes,3,opt,name=canonical_json,json=canonicalJson,proto3" json:"canonical_json,omitempty"` | ||
| 380 | unknownFields protoimpl.UnknownFields | ||
| 381 | sizeCache protoimpl.SizeCache | ||
| 382 | } | ||
| 383 | |||
| 384 | func (x *PublishEventResponse) Reset() { | ||
| 385 | *x = PublishEventResponse{} | ||
| 386 | mi := &file_nostr_v1_nostr_proto_msgTypes[5] | ||
| 387 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||
| 388 | ms.StoreMessageInfo(mi) | ||
| 389 | } | ||
| 390 | |||
| 391 | func (x *PublishEventResponse) String() string { | ||
| 392 | return protoimpl.X.MessageStringOf(x) | ||
| 393 | } | ||
| 394 | |||
| 395 | func (*PublishEventResponse) ProtoMessage() {} | ||
| 396 | |||
| 397 | func (x *PublishEventResponse) ProtoReflect() protoreflect.Message { | ||
| 398 | mi := &file_nostr_v1_nostr_proto_msgTypes[5] | ||
| 399 | if x != nil { | ||
| 400 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||
| 401 | if ms.LoadMessageInfo() == nil { | ||
| 402 | ms.StoreMessageInfo(mi) | ||
| 403 | } | ||
| 404 | return ms | ||
| 405 | } | ||
| 406 | return mi.MessageOf(x) | ||
| 407 | } | ||
| 408 | |||
| 409 | // Deprecated: Use PublishEventResponse.ProtoReflect.Descriptor instead. | ||
| 410 | func (*PublishEventResponse) Descriptor() ([]byte, []int) { | ||
| 411 | return file_nostr_v1_nostr_proto_rawDescGZIP(), []int{5} | ||
| 412 | } | ||
| 413 | |||
| 414 | func (x *PublishEventResponse) GetAccepted() bool { | ||
| 415 | if x != nil { | ||
| 416 | return x.Accepted | ||
| 417 | } | ||
| 418 | return false | ||
| 419 | } | ||
| 420 | |||
| 421 | func (x *PublishEventResponse) GetMessage() string { | ||
| 422 | if x != nil { | ||
| 423 | return x.Message | ||
| 424 | } | ||
| 425 | return "" | ||
| 426 | } | ||
| 427 | |||
| 428 | func (x *PublishEventResponse) GetCanonicalJson() []byte { | ||
| 429 | if x != nil { | ||
| 430 | return x.CanonicalJson | ||
| 431 | } | ||
| 432 | return nil | ||
| 433 | } | ||
| 434 | |||
| 435 | // Request to subscribe to events matching filters | ||
| 436 | type SubscribeRequest struct { | ||
| 437 | state protoimpl.MessageState `protogen:"open.v1"` | ||
| 438 | Filters []*Filter `protobuf:"bytes,1,rep,name=filters,proto3" json:"filters,omitempty"` | ||
| 439 | // If true, include canonical_json in streamed Event messages | ||
| 440 | // Allows client-side signature verification | ||
| 441 | // Default: false (most clients trust the relay) | ||
| 442 | IncludeCanonicalJson bool `protobuf:"varint,2,opt,name=include_canonical_json,json=includeCanonicalJson,proto3" json:"include_canonical_json,omitempty"` | ||
| 443 | // Optional client-provided subscription ID for tracking | ||
| 444 | SubscriptionId string `protobuf:"bytes,3,opt,name=subscription_id,json=subscriptionId,proto3" json:"subscription_id,omitempty"` | ||
| 445 | unknownFields protoimpl.UnknownFields | ||
| 446 | sizeCache protoimpl.SizeCache | ||
| 447 | } | ||
| 448 | |||
| 449 | func (x *SubscribeRequest) Reset() { | ||
| 450 | *x = SubscribeRequest{} | ||
| 451 | mi := &file_nostr_v1_nostr_proto_msgTypes[6] | ||
| 452 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||
| 453 | ms.StoreMessageInfo(mi) | ||
| 454 | } | ||
| 455 | |||
| 456 | func (x *SubscribeRequest) String() string { | ||
| 457 | return protoimpl.X.MessageStringOf(x) | ||
| 458 | } | ||
| 459 | |||
| 460 | func (*SubscribeRequest) ProtoMessage() {} | ||
| 461 | |||
| 462 | func (x *SubscribeRequest) ProtoReflect() protoreflect.Message { | ||
| 463 | mi := &file_nostr_v1_nostr_proto_msgTypes[6] | ||
| 464 | if x != nil { | ||
| 465 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||
| 466 | if ms.LoadMessageInfo() == nil { | ||
| 467 | ms.StoreMessageInfo(mi) | ||
| 468 | } | ||
| 469 | return ms | ||
| 470 | } | ||
| 471 | return mi.MessageOf(x) | ||
| 472 | } | ||
| 473 | |||
| 474 | // Deprecated: Use SubscribeRequest.ProtoReflect.Descriptor instead. | ||
| 475 | func (*SubscribeRequest) Descriptor() ([]byte, []int) { | ||
| 476 | return file_nostr_v1_nostr_proto_rawDescGZIP(), []int{6} | ||
| 477 | } | ||
| 478 | |||
| 479 | func (x *SubscribeRequest) GetFilters() []*Filter { | ||
| 480 | if x != nil { | ||
| 481 | return x.Filters | ||
| 482 | } | ||
| 483 | return nil | ||
| 484 | } | ||
| 485 | |||
| 486 | func (x *SubscribeRequest) GetIncludeCanonicalJson() bool { | ||
| 487 | if x != nil { | ||
| 488 | return x.IncludeCanonicalJson | ||
| 489 | } | ||
| 490 | return false | ||
| 491 | } | ||
| 492 | |||
| 493 | func (x *SubscribeRequest) GetSubscriptionId() string { | ||
| 494 | if x != nil { | ||
| 495 | return x.SubscriptionId | ||
| 496 | } | ||
| 497 | return "" | ||
| 498 | } | ||
| 499 | |||
| 500 | // Request to unsubscribe from an active subscription | ||
| 501 | type UnsubscribeRequest struct { | ||
| 502 | state protoimpl.MessageState `protogen:"open.v1"` | ||
| 503 | SubscriptionId string `protobuf:"bytes,1,opt,name=subscription_id,json=subscriptionId,proto3" json:"subscription_id,omitempty"` | ||
| 504 | unknownFields protoimpl.UnknownFields | ||
| 505 | sizeCache protoimpl.SizeCache | ||
| 506 | } | ||
| 507 | |||
| 508 | func (x *UnsubscribeRequest) Reset() { | ||
| 509 | *x = UnsubscribeRequest{} | ||
| 510 | mi := &file_nostr_v1_nostr_proto_msgTypes[7] | ||
| 511 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||
| 512 | ms.StoreMessageInfo(mi) | ||
| 513 | } | ||
| 514 | |||
| 515 | func (x *UnsubscribeRequest) String() string { | ||
| 516 | return protoimpl.X.MessageStringOf(x) | ||
| 517 | } | ||
| 518 | |||
| 519 | func (*UnsubscribeRequest) ProtoMessage() {} | ||
| 520 | |||
| 521 | func (x *UnsubscribeRequest) ProtoReflect() protoreflect.Message { | ||
| 522 | mi := &file_nostr_v1_nostr_proto_msgTypes[7] | ||
| 523 | if x != nil { | ||
| 524 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||
| 525 | if ms.LoadMessageInfo() == nil { | ||
| 526 | ms.StoreMessageInfo(mi) | ||
| 527 | } | ||
| 528 | return ms | ||
| 529 | } | ||
| 530 | return mi.MessageOf(x) | ||
| 531 | } | ||
| 532 | |||
| 533 | // Deprecated: Use UnsubscribeRequest.ProtoReflect.Descriptor instead. | ||
| 534 | func (*UnsubscribeRequest) Descriptor() ([]byte, []int) { | ||
| 535 | return file_nostr_v1_nostr_proto_rawDescGZIP(), []int{7} | ||
| 536 | } | ||
| 537 | |||
| 538 | func (x *UnsubscribeRequest) GetSubscriptionId() string { | ||
| 539 | if x != nil { | ||
| 540 | return x.SubscriptionId | ||
| 541 | } | ||
| 542 | return "" | ||
| 543 | } | ||
| 544 | |||
| 545 | // Batch publish request | ||
| 546 | type PublishBatchRequest struct { | ||
| 547 | state protoimpl.MessageState `protogen:"open.v1"` | ||
| 548 | Events []*Event `protobuf:"bytes,1,rep,name=events,proto3" json:"events,omitempty"` | ||
| 549 | unknownFields protoimpl.UnknownFields | ||
| 550 | sizeCache protoimpl.SizeCache | ||
| 551 | } | ||
| 552 | |||
| 553 | func (x *PublishBatchRequest) Reset() { | ||
| 554 | *x = PublishBatchRequest{} | ||
| 555 | mi := &file_nostr_v1_nostr_proto_msgTypes[8] | ||
| 556 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||
| 557 | ms.StoreMessageInfo(mi) | ||
| 558 | } | ||
| 559 | |||
| 560 | func (x *PublishBatchRequest) String() string { | ||
| 561 | return protoimpl.X.MessageStringOf(x) | ||
| 562 | } | ||
| 563 | |||
| 564 | func (*PublishBatchRequest) ProtoMessage() {} | ||
| 565 | |||
| 566 | func (x *PublishBatchRequest) ProtoReflect() protoreflect.Message { | ||
| 567 | mi := &file_nostr_v1_nostr_proto_msgTypes[8] | ||
| 568 | if x != nil { | ||
| 569 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||
| 570 | if ms.LoadMessageInfo() == nil { | ||
| 571 | ms.StoreMessageInfo(mi) | ||
| 572 | } | ||
| 573 | return ms | ||
| 574 | } | ||
| 575 | return mi.MessageOf(x) | ||
| 576 | } | ||
| 577 | |||
| 578 | // Deprecated: Use PublishBatchRequest.ProtoReflect.Descriptor instead. | ||
| 579 | func (*PublishBatchRequest) Descriptor() ([]byte, []int) { | ||
| 580 | return file_nostr_v1_nostr_proto_rawDescGZIP(), []int{8} | ||
| 581 | } | ||
| 582 | |||
| 583 | func (x *PublishBatchRequest) GetEvents() []*Event { | ||
| 584 | if x != nil { | ||
| 585 | return x.Events | ||
| 586 | } | ||
| 587 | return nil | ||
| 588 | } | ||
| 589 | |||
| 590 | // Batch publish response | ||
| 591 | type PublishBatchResponse struct { | ||
| 592 | state protoimpl.MessageState `protogen:"open.v1"` | ||
| 593 | Results []*PublishEventResponse `protobuf:"bytes,1,rep,name=results,proto3" json:"results,omitempty"` | ||
| 594 | unknownFields protoimpl.UnknownFields | ||
| 595 | sizeCache protoimpl.SizeCache | ||
| 596 | } | ||
| 597 | |||
| 598 | func (x *PublishBatchResponse) Reset() { | ||
| 599 | *x = PublishBatchResponse{} | ||
| 600 | mi := &file_nostr_v1_nostr_proto_msgTypes[9] | ||
| 601 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||
| 602 | ms.StoreMessageInfo(mi) | ||
| 603 | } | ||
| 604 | |||
| 605 | func (x *PublishBatchResponse) String() string { | ||
| 606 | return protoimpl.X.MessageStringOf(x) | ||
| 607 | } | ||
| 608 | |||
| 609 | func (*PublishBatchResponse) ProtoMessage() {} | ||
| 610 | |||
| 611 | func (x *PublishBatchResponse) ProtoReflect() protoreflect.Message { | ||
| 612 | mi := &file_nostr_v1_nostr_proto_msgTypes[9] | ||
| 613 | if x != nil { | ||
| 614 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||
| 615 | if ms.LoadMessageInfo() == nil { | ||
| 616 | ms.StoreMessageInfo(mi) | ||
| 617 | } | ||
| 618 | return ms | ||
| 619 | } | ||
| 620 | return mi.MessageOf(x) | ||
| 621 | } | ||
| 622 | |||
| 623 | // Deprecated: Use PublishBatchResponse.ProtoReflect.Descriptor instead. | ||
| 624 | func (*PublishBatchResponse) Descriptor() ([]byte, []int) { | ||
| 625 | return file_nostr_v1_nostr_proto_rawDescGZIP(), []int{9} | ||
| 626 | } | ||
| 627 | |||
| 628 | func (x *PublishBatchResponse) GetResults() []*PublishEventResponse { | ||
| 629 | if x != nil { | ||
| 630 | return x.Results | ||
| 631 | } | ||
| 632 | return nil | ||
| 633 | } | ||
| 634 | |||
| 635 | // Paginated query request | ||
| 636 | type QueryRequest struct { | ||
| 637 | state protoimpl.MessageState `protogen:"open.v1"` | ||
| 638 | Filters []*Filter `protobuf:"bytes,1,rep,name=filters,proto3" json:"filters,omitempty"` | ||
| 639 | IncludeCanonicalJson bool `protobuf:"varint,2,opt,name=include_canonical_json,json=includeCanonicalJson,proto3" json:"include_canonical_json,omitempty"` | ||
| 640 | // Pagination | ||
| 641 | Cursor string `protobuf:"bytes,3,opt,name=cursor,proto3" json:"cursor,omitempty"` // Opaque cursor from previous response | ||
| 642 | PageSize int32 `protobuf:"varint,4,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` // Default: 100 | ||
| 643 | unknownFields protoimpl.UnknownFields | ||
| 644 | sizeCache protoimpl.SizeCache | ||
| 645 | } | ||
| 646 | |||
| 647 | func (x *QueryRequest) Reset() { | ||
| 648 | *x = QueryRequest{} | ||
| 649 | mi := &file_nostr_v1_nostr_proto_msgTypes[10] | ||
| 650 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||
| 651 | ms.StoreMessageInfo(mi) | ||
| 652 | } | ||
| 653 | |||
| 654 | func (x *QueryRequest) String() string { | ||
| 655 | return protoimpl.X.MessageStringOf(x) | ||
| 656 | } | ||
| 657 | |||
| 658 | func (*QueryRequest) ProtoMessage() {} | ||
| 659 | |||
| 660 | func (x *QueryRequest) ProtoReflect() protoreflect.Message { | ||
| 661 | mi := &file_nostr_v1_nostr_proto_msgTypes[10] | ||
| 662 | if x != nil { | ||
| 663 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||
| 664 | if ms.LoadMessageInfo() == nil { | ||
| 665 | ms.StoreMessageInfo(mi) | ||
| 666 | } | ||
| 667 | return ms | ||
| 668 | } | ||
| 669 | return mi.MessageOf(x) | ||
| 670 | } | ||
| 671 | |||
| 672 | // Deprecated: Use QueryRequest.ProtoReflect.Descriptor instead. | ||
| 673 | func (*QueryRequest) Descriptor() ([]byte, []int) { | ||
| 674 | return file_nostr_v1_nostr_proto_rawDescGZIP(), []int{10} | ||
| 675 | } | ||
| 676 | |||
| 677 | func (x *QueryRequest) GetFilters() []*Filter { | ||
| 678 | if x != nil { | ||
| 679 | return x.Filters | ||
| 680 | } | ||
| 681 | return nil | ||
| 682 | } | ||
| 683 | |||
| 684 | func (x *QueryRequest) GetIncludeCanonicalJson() bool { | ||
| 685 | if x != nil { | ||
| 686 | return x.IncludeCanonicalJson | ||
| 687 | } | ||
| 688 | return false | ||
| 689 | } | ||
| 690 | |||
| 691 | func (x *QueryRequest) GetCursor() string { | ||
| 692 | if x != nil { | ||
| 693 | return x.Cursor | ||
| 694 | } | ||
| 695 | return "" | ||
| 696 | } | ||
| 697 | |||
| 698 | func (x *QueryRequest) GetPageSize() int32 { | ||
| 699 | if x != nil { | ||
| 700 | return x.PageSize | ||
| 701 | } | ||
| 702 | return 0 | ||
| 703 | } | ||
| 704 | |||
| 705 | // Paginated query response | ||
| 706 | type QueryResponse struct { | ||
| 707 | state protoimpl.MessageState `protogen:"open.v1"` | ||
| 708 | Events []*Event `protobuf:"bytes,1,rep,name=events,proto3" json:"events,omitempty"` | ||
| 709 | NextCursor string `protobuf:"bytes,2,opt,name=next_cursor,json=nextCursor,proto3" json:"next_cursor,omitempty"` // Empty if no more results | ||
| 710 | TotalCount int32 `protobuf:"varint,3,opt,name=total_count,json=totalCount,proto3" json:"total_count,omitempty"` // Optional: total matching events | ||
| 711 | unknownFields protoimpl.UnknownFields | ||
| 712 | sizeCache protoimpl.SizeCache | ||
| 713 | } | ||
| 714 | |||
| 715 | func (x *QueryResponse) Reset() { | ||
| 716 | *x = QueryResponse{} | ||
| 717 | mi := &file_nostr_v1_nostr_proto_msgTypes[11] | ||
| 718 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||
| 719 | ms.StoreMessageInfo(mi) | ||
| 720 | } | ||
| 721 | |||
| 722 | func (x *QueryResponse) String() string { | ||
| 723 | return protoimpl.X.MessageStringOf(x) | ||
| 724 | } | ||
| 725 | |||
| 726 | func (*QueryResponse) ProtoMessage() {} | ||
| 727 | |||
| 728 | func (x *QueryResponse) ProtoReflect() protoreflect.Message { | ||
| 729 | mi := &file_nostr_v1_nostr_proto_msgTypes[11] | ||
| 730 | if x != nil { | ||
| 731 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||
| 732 | if ms.LoadMessageInfo() == nil { | ||
| 733 | ms.StoreMessageInfo(mi) | ||
| 734 | } | ||
| 735 | return ms | ||
| 736 | } | ||
| 737 | return mi.MessageOf(x) | ||
| 738 | } | ||
| 739 | |||
| 740 | // Deprecated: Use QueryResponse.ProtoReflect.Descriptor instead. | ||
| 741 | func (*QueryResponse) Descriptor() ([]byte, []int) { | ||
| 742 | return file_nostr_v1_nostr_proto_rawDescGZIP(), []int{11} | ||
| 743 | } | ||
| 744 | |||
| 745 | func (x *QueryResponse) GetEvents() []*Event { | ||
| 746 | if x != nil { | ||
| 747 | return x.Events | ||
| 748 | } | ||
| 749 | return nil | ||
| 750 | } | ||
| 751 | |||
| 752 | func (x *QueryResponse) GetNextCursor() string { | ||
| 753 | if x != nil { | ||
| 754 | return x.NextCursor | ||
| 755 | } | ||
| 756 | return "" | ||
| 757 | } | ||
| 758 | |||
| 759 | func (x *QueryResponse) GetTotalCount() int32 { | ||
| 760 | if x != nil { | ||
| 761 | return x.TotalCount | ||
| 762 | } | ||
| 763 | return 0 | ||
| 764 | } | ||
| 765 | |||
| 766 | // Event count request (NIP-45) | ||
| 767 | type CountRequest struct { | ||
| 768 | state protoimpl.MessageState `protogen:"open.v1"` | ||
| 769 | Filters []*Filter `protobuf:"bytes,1,rep,name=filters,proto3" json:"filters,omitempty"` | ||
| 770 | unknownFields protoimpl.UnknownFields | ||
| 771 | sizeCache protoimpl.SizeCache | ||
| 772 | } | ||
| 773 | |||
| 774 | func (x *CountRequest) Reset() { | ||
| 775 | *x = CountRequest{} | ||
| 776 | mi := &file_nostr_v1_nostr_proto_msgTypes[12] | ||
| 777 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||
| 778 | ms.StoreMessageInfo(mi) | ||
| 779 | } | ||
| 780 | |||
| 781 | func (x *CountRequest) String() string { | ||
| 782 | return protoimpl.X.MessageStringOf(x) | ||
| 783 | } | ||
| 784 | |||
| 785 | func (*CountRequest) ProtoMessage() {} | ||
| 786 | |||
| 787 | func (x *CountRequest) ProtoReflect() protoreflect.Message { | ||
| 788 | mi := &file_nostr_v1_nostr_proto_msgTypes[12] | ||
| 789 | if x != nil { | ||
| 790 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||
| 791 | if ms.LoadMessageInfo() == nil { | ||
| 792 | ms.StoreMessageInfo(mi) | ||
| 793 | } | ||
| 794 | return ms | ||
| 795 | } | ||
| 796 | return mi.MessageOf(x) | ||
| 797 | } | ||
| 798 | |||
| 799 | // Deprecated: Use CountRequest.ProtoReflect.Descriptor instead. | ||
| 800 | func (*CountRequest) Descriptor() ([]byte, []int) { | ||
| 801 | return file_nostr_v1_nostr_proto_rawDescGZIP(), []int{12} | ||
| 802 | } | ||
| 803 | |||
| 804 | func (x *CountRequest) GetFilters() []*Filter { | ||
| 805 | if x != nil { | ||
| 806 | return x.Filters | ||
| 807 | } | ||
| 808 | return nil | ||
| 809 | } | ||
| 810 | |||
| 811 | // Event count response | ||
| 812 | type CountResponse struct { | ||
| 813 | state protoimpl.MessageState `protogen:"open.v1"` | ||
| 814 | Count int64 `protobuf:"varint,1,opt,name=count,proto3" json:"count,omitempty"` | ||
| 815 | unknownFields protoimpl.UnknownFields | ||
| 816 | sizeCache protoimpl.SizeCache | ||
| 817 | } | ||
| 818 | |||
| 819 | func (x *CountResponse) Reset() { | ||
| 820 | *x = CountResponse{} | ||
| 821 | mi := &file_nostr_v1_nostr_proto_msgTypes[13] | ||
| 822 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||
| 823 | ms.StoreMessageInfo(mi) | ||
| 824 | } | ||
| 825 | |||
| 826 | func (x *CountResponse) String() string { | ||
| 827 | return protoimpl.X.MessageStringOf(x) | ||
| 828 | } | ||
| 829 | |||
| 830 | func (*CountResponse) ProtoMessage() {} | ||
| 831 | |||
| 832 | func (x *CountResponse) ProtoReflect() protoreflect.Message { | ||
| 833 | mi := &file_nostr_v1_nostr_proto_msgTypes[13] | ||
| 834 | if x != nil { | ||
| 835 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||
| 836 | if ms.LoadMessageInfo() == nil { | ||
| 837 | ms.StoreMessageInfo(mi) | ||
| 838 | } | ||
| 839 | return ms | ||
| 840 | } | ||
| 841 | return mi.MessageOf(x) | ||
| 842 | } | ||
| 843 | |||
| 844 | // Deprecated: Use CountResponse.ProtoReflect.Descriptor instead. | ||
| 845 | func (*CountResponse) Descriptor() ([]byte, []int) { | ||
| 846 | return file_nostr_v1_nostr_proto_rawDescGZIP(), []int{13} | ||
| 847 | } | ||
| 848 | |||
| 849 | func (x *CountResponse) GetCount() int64 { | ||
| 850 | if x != nil { | ||
| 851 | return x.Count | ||
| 852 | } | ||
| 853 | return 0 | ||
| 854 | } | ||
| 855 | |||
| 856 | // Empty message | ||
| 857 | type Empty struct { | ||
| 858 | state protoimpl.MessageState `protogen:"open.v1"` | ||
| 859 | unknownFields protoimpl.UnknownFields | ||
| 860 | sizeCache protoimpl.SizeCache | ||
| 861 | } | ||
| 862 | |||
| 863 | func (x *Empty) Reset() { | ||
| 864 | *x = Empty{} | ||
| 865 | mi := &file_nostr_v1_nostr_proto_msgTypes[14] | ||
| 866 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||
| 867 | ms.StoreMessageInfo(mi) | ||
| 868 | } | ||
| 869 | |||
| 870 | func (x *Empty) String() string { | ||
| 871 | return protoimpl.X.MessageStringOf(x) | ||
| 872 | } | ||
| 873 | |||
| 874 | func (*Empty) ProtoMessage() {} | ||
| 875 | |||
| 876 | func (x *Empty) ProtoReflect() protoreflect.Message { | ||
| 877 | mi := &file_nostr_v1_nostr_proto_msgTypes[14] | ||
| 878 | if x != nil { | ||
| 879 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||
| 880 | if ms.LoadMessageInfo() == nil { | ||
| 881 | ms.StoreMessageInfo(mi) | ||
| 882 | } | ||
| 883 | return ms | ||
| 884 | } | ||
| 885 | return mi.MessageOf(x) | ||
| 886 | } | ||
| 887 | |||
| 888 | // Deprecated: Use Empty.ProtoReflect.Descriptor instead. | ||
| 889 | func (*Empty) Descriptor() ([]byte, []int) { | ||
| 890 | return file_nostr_v1_nostr_proto_rawDescGZIP(), []int{14} | ||
| 891 | } | ||
| 892 | |||
| 893 | // Relay statistics | ||
| 894 | type RelayStats struct { | ||
| 895 | state protoimpl.MessageState `protogen:"open.v1"` | ||
| 896 | TotalEvents int64 `protobuf:"varint,1,opt,name=total_events,json=totalEvents,proto3" json:"total_events,omitempty"` | ||
| 897 | TotalSubscriptions int64 `protobuf:"varint,2,opt,name=total_subscriptions,json=totalSubscriptions,proto3" json:"total_subscriptions,omitempty"` | ||
| 898 | ConnectedClients int64 `protobuf:"varint,3,opt,name=connected_clients,json=connectedClients,proto3" json:"connected_clients,omitempty"` | ||
| 899 | EventsPerSecond int64 `protobuf:"varint,4,opt,name=events_per_second,json=eventsPerSecond,proto3" json:"events_per_second,omitempty"` | ||
| 900 | UptimeSeconds int64 `protobuf:"varint,5,opt,name=uptime_seconds,json=uptimeSeconds,proto3" json:"uptime_seconds,omitempty"` | ||
| 901 | unknownFields protoimpl.UnknownFields | ||
| 902 | sizeCache protoimpl.SizeCache | ||
| 903 | } | ||
| 904 | |||
| 905 | func (x *RelayStats) Reset() { | ||
| 906 | *x = RelayStats{} | ||
| 907 | mi := &file_nostr_v1_nostr_proto_msgTypes[15] | ||
| 908 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||
| 909 | ms.StoreMessageInfo(mi) | ||
| 910 | } | ||
| 911 | |||
| 912 | func (x *RelayStats) String() string { | ||
| 913 | return protoimpl.X.MessageStringOf(x) | ||
| 914 | } | ||
| 915 | |||
| 916 | func (*RelayStats) ProtoMessage() {} | ||
| 917 | |||
| 918 | func (x *RelayStats) ProtoReflect() protoreflect.Message { | ||
| 919 | mi := &file_nostr_v1_nostr_proto_msgTypes[15] | ||
| 920 | if x != nil { | ||
| 921 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||
| 922 | if ms.LoadMessageInfo() == nil { | ||
| 923 | ms.StoreMessageInfo(mi) | ||
| 924 | } | ||
| 925 | return ms | ||
| 926 | } | ||
| 927 | return mi.MessageOf(x) | ||
| 928 | } | ||
| 929 | |||
| 930 | // Deprecated: Use RelayStats.ProtoReflect.Descriptor instead. | ||
| 931 | func (*RelayStats) Descriptor() ([]byte, []int) { | ||
| 932 | return file_nostr_v1_nostr_proto_rawDescGZIP(), []int{15} | ||
| 933 | } | ||
| 934 | |||
| 935 | func (x *RelayStats) GetTotalEvents() int64 { | ||
| 936 | if x != nil { | ||
| 937 | return x.TotalEvents | ||
| 938 | } | ||
| 939 | return 0 | ||
| 940 | } | ||
| 941 | |||
| 942 | func (x *RelayStats) GetTotalSubscriptions() int64 { | ||
| 943 | if x != nil { | ||
| 944 | return x.TotalSubscriptions | ||
| 945 | } | ||
| 946 | return 0 | ||
| 947 | } | ||
| 948 | |||
| 949 | func (x *RelayStats) GetConnectedClients() int64 { | ||
| 950 | if x != nil { | ||
| 951 | return x.ConnectedClients | ||
| 952 | } | ||
| 953 | return 0 | ||
| 954 | } | ||
| 955 | |||
| 956 | func (x *RelayStats) GetEventsPerSecond() int64 { | ||
| 957 | if x != nil { | ||
| 958 | return x.EventsPerSecond | ||
| 959 | } | ||
| 960 | return 0 | ||
| 961 | } | ||
| 962 | |||
| 963 | func (x *RelayStats) GetUptimeSeconds() int64 { | ||
| 964 | if x != nil { | ||
| 965 | return x.UptimeSeconds | ||
| 966 | } | ||
| 967 | return 0 | ||
| 968 | } | ||
| 969 | |||
| 970 | // List of active connections | ||
| 971 | type ConnectionList struct { | ||
| 972 | state protoimpl.MessageState `protogen:"open.v1"` | ||
| 973 | Connections []*Connection `protobuf:"bytes,1,rep,name=connections,proto3" json:"connections,omitempty"` | ||
| 974 | unknownFields protoimpl.UnknownFields | ||
| 975 | sizeCache protoimpl.SizeCache | ||
| 976 | } | ||
| 977 | |||
| 978 | func (x *ConnectionList) Reset() { | ||
| 979 | *x = ConnectionList{} | ||
| 980 | mi := &file_nostr_v1_nostr_proto_msgTypes[16] | ||
| 981 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||
| 982 | ms.StoreMessageInfo(mi) | ||
| 983 | } | ||
| 984 | |||
| 985 | func (x *ConnectionList) String() string { | ||
| 986 | return protoimpl.X.MessageStringOf(x) | ||
| 987 | } | ||
| 988 | |||
| 989 | func (*ConnectionList) ProtoMessage() {} | ||
| 990 | |||
| 991 | func (x *ConnectionList) ProtoReflect() protoreflect.Message { | ||
| 992 | mi := &file_nostr_v1_nostr_proto_msgTypes[16] | ||
| 993 | if x != nil { | ||
| 994 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||
| 995 | if ms.LoadMessageInfo() == nil { | ||
| 996 | ms.StoreMessageInfo(mi) | ||
| 997 | } | ||
| 998 | return ms | ||
| 999 | } | ||
| 1000 | return mi.MessageOf(x) | ||
| 1001 | } | ||
| 1002 | |||
| 1003 | // Deprecated: Use ConnectionList.ProtoReflect.Descriptor instead. | ||
| 1004 | func (*ConnectionList) Descriptor() ([]byte, []int) { | ||
| 1005 | return file_nostr_v1_nostr_proto_rawDescGZIP(), []int{16} | ||
| 1006 | } | ||
| 1007 | |||
| 1008 | func (x *ConnectionList) GetConnections() []*Connection { | ||
| 1009 | if x != nil { | ||
| 1010 | return x.Connections | ||
| 1011 | } | ||
| 1012 | return nil | ||
| 1013 | } | ||
| 1014 | |||
| 1015 | // Single connection info | ||
| 1016 | type Connection struct { | ||
| 1017 | state protoimpl.MessageState `protogen:"open.v1"` | ||
| 1018 | ClientId string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` | ||
| 1019 | Protocol string `protobuf:"bytes,2,opt,name=protocol,proto3" json:"protocol,omitempty"` // "websocket" or "grpc" | ||
| 1020 | ConnectedAt int64 `protobuf:"varint,3,opt,name=connected_at,json=connectedAt,proto3" json:"connected_at,omitempty"` | ||
| 1021 | ActiveSubscriptions int32 `protobuf:"varint,4,opt,name=active_subscriptions,json=activeSubscriptions,proto3" json:"active_subscriptions,omitempty"` | ||
| 1022 | unknownFields protoimpl.UnknownFields | ||
| 1023 | sizeCache protoimpl.SizeCache | ||
| 1024 | } | ||
| 1025 | |||
| 1026 | func (x *Connection) Reset() { | ||
| 1027 | *x = Connection{} | ||
| 1028 | mi := &file_nostr_v1_nostr_proto_msgTypes[17] | ||
| 1029 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||
| 1030 | ms.StoreMessageInfo(mi) | ||
| 1031 | } | ||
| 1032 | |||
| 1033 | func (x *Connection) String() string { | ||
| 1034 | return protoimpl.X.MessageStringOf(x) | ||
| 1035 | } | ||
| 1036 | |||
| 1037 | func (*Connection) ProtoMessage() {} | ||
| 1038 | |||
| 1039 | func (x *Connection) ProtoReflect() protoreflect.Message { | ||
| 1040 | mi := &file_nostr_v1_nostr_proto_msgTypes[17] | ||
| 1041 | if x != nil { | ||
| 1042 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||
| 1043 | if ms.LoadMessageInfo() == nil { | ||
| 1044 | ms.StoreMessageInfo(mi) | ||
| 1045 | } | ||
| 1046 | return ms | ||
| 1047 | } | ||
| 1048 | return mi.MessageOf(x) | ||
| 1049 | } | ||
| 1050 | |||
| 1051 | // Deprecated: Use Connection.ProtoReflect.Descriptor instead. | ||
| 1052 | func (*Connection) Descriptor() ([]byte, []int) { | ||
| 1053 | return file_nostr_v1_nostr_proto_rawDescGZIP(), []int{17} | ||
| 1054 | } | ||
| 1055 | |||
| 1056 | func (x *Connection) GetClientId() string { | ||
| 1057 | if x != nil { | ||
| 1058 | return x.ClientId | ||
| 1059 | } | ||
| 1060 | return "" | ||
| 1061 | } | ||
| 1062 | |||
| 1063 | func (x *Connection) GetProtocol() string { | ||
| 1064 | if x != nil { | ||
| 1065 | return x.Protocol | ||
| 1066 | } | ||
| 1067 | return "" | ||
| 1068 | } | ||
| 1069 | |||
| 1070 | func (x *Connection) GetConnectedAt() int64 { | ||
| 1071 | if x != nil { | ||
| 1072 | return x.ConnectedAt | ||
| 1073 | } | ||
| 1074 | return 0 | ||
| 1075 | } | ||
| 1076 | |||
| 1077 | func (x *Connection) GetActiveSubscriptions() int32 { | ||
| 1078 | if x != nil { | ||
| 1079 | return x.ActiveSubscriptions | ||
| 1080 | } | ||
| 1081 | return 0 | ||
| 1082 | } | ||
| 1083 | |||
| 1084 | // Request to ban a public key | ||
| 1085 | type BanRequest struct { | ||
| 1086 | state protoimpl.MessageState `protogen:"open.v1"` | ||
| 1087 | Pubkey string `protobuf:"bytes,1,opt,name=pubkey,proto3" json:"pubkey,omitempty"` | ||
| 1088 | Until int64 `protobuf:"varint,2,opt,name=until,proto3" json:"until,omitempty"` // Unix timestamp, 0 for permanent | ||
| 1089 | Reason string `protobuf:"bytes,3,opt,name=reason,proto3" json:"reason,omitempty"` | ||
| 1090 | unknownFields protoimpl.UnknownFields | ||
| 1091 | sizeCache protoimpl.SizeCache | ||
| 1092 | } | ||
| 1093 | |||
| 1094 | func (x *BanRequest) Reset() { | ||
| 1095 | *x = BanRequest{} | ||
| 1096 | mi := &file_nostr_v1_nostr_proto_msgTypes[18] | ||
| 1097 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||
| 1098 | ms.StoreMessageInfo(mi) | ||
| 1099 | } | ||
| 1100 | |||
| 1101 | func (x *BanRequest) String() string { | ||
| 1102 | return protoimpl.X.MessageStringOf(x) | ||
| 1103 | } | ||
| 1104 | |||
| 1105 | func (*BanRequest) ProtoMessage() {} | ||
| 1106 | |||
| 1107 | func (x *BanRequest) ProtoReflect() protoreflect.Message { | ||
| 1108 | mi := &file_nostr_v1_nostr_proto_msgTypes[18] | ||
| 1109 | if x != nil { | ||
| 1110 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||
| 1111 | if ms.LoadMessageInfo() == nil { | ||
| 1112 | ms.StoreMessageInfo(mi) | ||
| 1113 | } | ||
| 1114 | return ms | ||
| 1115 | } | ||
| 1116 | return mi.MessageOf(x) | ||
| 1117 | } | ||
| 1118 | |||
| 1119 | // Deprecated: Use BanRequest.ProtoReflect.Descriptor instead. | ||
| 1120 | func (*BanRequest) Descriptor() ([]byte, []int) { | ||
| 1121 | return file_nostr_v1_nostr_proto_rawDescGZIP(), []int{18} | ||
| 1122 | } | ||
| 1123 | |||
| 1124 | func (x *BanRequest) GetPubkey() string { | ||
| 1125 | if x != nil { | ||
| 1126 | return x.Pubkey | ||
| 1127 | } | ||
| 1128 | return "" | ||
| 1129 | } | ||
| 1130 | |||
| 1131 | func (x *BanRequest) GetUntil() int64 { | ||
| 1132 | if x != nil { | ||
| 1133 | return x.Until | ||
| 1134 | } | ||
| 1135 | return 0 | ||
| 1136 | } | ||
| 1137 | |||
| 1138 | func (x *BanRequest) GetReason() string { | ||
| 1139 | if x != nil { | ||
| 1140 | return x.Reason | ||
| 1141 | } | ||
| 1142 | return "" | ||
| 1143 | } | ||
| 1144 | |||
| 1145 | // Storage statistics | ||
| 1146 | type StorageStats struct { | ||
| 1147 | state protoimpl.MessageState `protogen:"open.v1"` | ||
| 1148 | TotalBytes int64 `protobuf:"varint,1,opt,name=total_bytes,json=totalBytes,proto3" json:"total_bytes,omitempty"` | ||
| 1149 | TotalEvents int64 `protobuf:"varint,2,opt,name=total_events,json=totalEvents,proto3" json:"total_events,omitempty"` | ||
| 1150 | DbSizeBytes int64 `protobuf:"varint,3,opt,name=db_size_bytes,json=dbSizeBytes,proto3" json:"db_size_bytes,omitempty"` | ||
| 1151 | unknownFields protoimpl.UnknownFields | ||
| 1152 | sizeCache protoimpl.SizeCache | ||
| 1153 | } | ||
| 1154 | |||
| 1155 | func (x *StorageStats) Reset() { | ||
| 1156 | *x = StorageStats{} | ||
| 1157 | mi := &file_nostr_v1_nostr_proto_msgTypes[19] | ||
| 1158 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||
| 1159 | ms.StoreMessageInfo(mi) | ||
| 1160 | } | ||
| 1161 | |||
| 1162 | func (x *StorageStats) String() string { | ||
| 1163 | return protoimpl.X.MessageStringOf(x) | ||
| 1164 | } | ||
| 1165 | |||
| 1166 | func (*StorageStats) ProtoMessage() {} | ||
| 1167 | |||
| 1168 | func (x *StorageStats) ProtoReflect() protoreflect.Message { | ||
| 1169 | mi := &file_nostr_v1_nostr_proto_msgTypes[19] | ||
| 1170 | if x != nil { | ||
| 1171 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||
| 1172 | if ms.LoadMessageInfo() == nil { | ||
| 1173 | ms.StoreMessageInfo(mi) | ||
| 1174 | } | ||
| 1175 | return ms | ||
| 1176 | } | ||
| 1177 | return mi.MessageOf(x) | ||
| 1178 | } | ||
| 1179 | |||
| 1180 | // Deprecated: Use StorageStats.ProtoReflect.Descriptor instead. | ||
| 1181 | func (*StorageStats) Descriptor() ([]byte, []int) { | ||
| 1182 | return file_nostr_v1_nostr_proto_rawDescGZIP(), []int{19} | ||
| 1183 | } | ||
| 1184 | |||
| 1185 | func (x *StorageStats) GetTotalBytes() int64 { | ||
| 1186 | if x != nil { | ||
| 1187 | return x.TotalBytes | ||
| 1188 | } | ||
| 1189 | return 0 | ||
| 1190 | } | ||
| 1191 | |||
| 1192 | func (x *StorageStats) GetTotalEvents() int64 { | ||
| 1193 | if x != nil { | ||
| 1194 | return x.TotalEvents | ||
| 1195 | } | ||
| 1196 | return 0 | ||
| 1197 | } | ||
| 1198 | |||
| 1199 | func (x *StorageStats) GetDbSizeBytes() int64 { | ||
| 1200 | if x != nil { | ||
| 1201 | return x.DbSizeBytes | ||
| 1202 | } | ||
| 1203 | return 0 | ||
| 1204 | } | ||
| 1205 | |||
| 1206 | var File_nostr_v1_nostr_proto protoreflect.FileDescriptor | ||
| 1207 | |||
| 1208 | const file_nostr_v1_nostr_proto_rawDesc = "" + | ||
| 1209 | "\n" + | ||
| 1210 | "\x14nostr/v1/nostr.proto\x12\bnostr.v1\"\xf0\x01\n" + | ||
| 1211 | "\x05Event\x12\x0e\n" + | ||
| 1212 | "\x02id\x18\x01 \x01(\tR\x02id\x12\x16\n" + | ||
| 1213 | "\x06pubkey\x18\x02 \x01(\tR\x06pubkey\x12\x1d\n" + | ||
| 1214 | "\n" + | ||
| 1215 | "created_at\x18\x03 \x01(\x03R\tcreatedAt\x12\x12\n" + | ||
| 1216 | "\x04kind\x18\x04 \x01(\x05R\x04kind\x12!\n" + | ||
| 1217 | "\x04tags\x18\x05 \x03(\v2\r.nostr.v1.TagR\x04tags\x12\x18\n" + | ||
| 1218 | "\acontent\x18\x06 \x01(\tR\acontent\x12\x10\n" + | ||
| 1219 | "\x03sig\x18\a \x01(\tR\x03sig\x12*\n" + | ||
| 1220 | "\x0ecanonical_json\x18\b \x01(\fH\x00R\rcanonicalJson\x88\x01\x01B\x11\n" + | ||
| 1221 | "\x0f_canonical_json\"\x1d\n" + | ||
| 1222 | "\x03Tag\x12\x16\n" + | ||
| 1223 | "\x06values\x18\x01 \x03(\tR\x06values\"\xfe\x02\n" + | ||
| 1224 | "\x06Filter\x12\x10\n" + | ||
| 1225 | "\x03ids\x18\x01 \x03(\tR\x03ids\x12\x18\n" + | ||
| 1226 | "\aauthors\x18\x02 \x03(\tR\aauthors\x12\x14\n" + | ||
| 1227 | "\x05kinds\x18\x03 \x03(\x05R\x05kinds\x12\x15\n" + | ||
| 1228 | "\x06e_tags\x18\x04 \x03(\tR\x05eTags\x12\x15\n" + | ||
| 1229 | "\x06p_tags\x18\x05 \x03(\tR\x05pTags\x12\x19\n" + | ||
| 1230 | "\x05since\x18\x06 \x01(\x03H\x00R\x05since\x88\x01\x01\x12\x19\n" + | ||
| 1231 | "\x05until\x18\a \x01(\x03H\x01R\x05until\x88\x01\x01\x12\x19\n" + | ||
| 1232 | "\x05limit\x18\b \x01(\x05H\x02R\x05limit\x88\x01\x01\x12A\n" + | ||
| 1233 | "\vtag_filters\x18\t \x03(\v2 .nostr.v1.Filter.TagFiltersEntryR\n" + | ||
| 1234 | "tagFilters\x1aR\n" + | ||
| 1235 | "\x0fTagFiltersEntry\x12\x10\n" + | ||
| 1236 | "\x03key\x18\x01 \x01(\tR\x03key\x12)\n" + | ||
| 1237 | "\x05value\x18\x02 \x01(\v2\x13.nostr.v1.TagFilterR\x05value:\x028\x01B\b\n" + | ||
| 1238 | "\x06_sinceB\b\n" + | ||
| 1239 | "\x06_untilB\b\n" + | ||
| 1240 | "\x06_limit\"#\n" + | ||
| 1241 | "\tTagFilter\x12\x16\n" + | ||
| 1242 | "\x06values\x18\x01 \x03(\tR\x06values\"<\n" + | ||
| 1243 | "\x13PublishEventRequest\x12%\n" + | ||
| 1244 | "\x05event\x18\x01 \x01(\v2\x0f.nostr.v1.EventR\x05event\"s\n" + | ||
| 1245 | "\x14PublishEventResponse\x12\x1a\n" + | ||
| 1246 | "\baccepted\x18\x01 \x01(\bR\baccepted\x12\x18\n" + | ||
| 1247 | "\amessage\x18\x02 \x01(\tR\amessage\x12%\n" + | ||
| 1248 | "\x0ecanonical_json\x18\x03 \x01(\fR\rcanonicalJson\"\x9d\x01\n" + | ||
| 1249 | "\x10SubscribeRequest\x12*\n" + | ||
| 1250 | "\afilters\x18\x01 \x03(\v2\x10.nostr.v1.FilterR\afilters\x124\n" + | ||
| 1251 | "\x16include_canonical_json\x18\x02 \x01(\bR\x14includeCanonicalJson\x12'\n" + | ||
| 1252 | "\x0fsubscription_id\x18\x03 \x01(\tR\x0esubscriptionId\"=\n" + | ||
| 1253 | "\x12UnsubscribeRequest\x12'\n" + | ||
| 1254 | "\x0fsubscription_id\x18\x01 \x01(\tR\x0esubscriptionId\">\n" + | ||
| 1255 | "\x13PublishBatchRequest\x12'\n" + | ||
| 1256 | "\x06events\x18\x01 \x03(\v2\x0f.nostr.v1.EventR\x06events\"P\n" + | ||
| 1257 | "\x14PublishBatchResponse\x128\n" + | ||
| 1258 | "\aresults\x18\x01 \x03(\v2\x1e.nostr.v1.PublishEventResponseR\aresults\"\xa5\x01\n" + | ||
| 1259 | "\fQueryRequest\x12*\n" + | ||
| 1260 | "\afilters\x18\x01 \x03(\v2\x10.nostr.v1.FilterR\afilters\x124\n" + | ||
| 1261 | "\x16include_canonical_json\x18\x02 \x01(\bR\x14includeCanonicalJson\x12\x16\n" + | ||
| 1262 | "\x06cursor\x18\x03 \x01(\tR\x06cursor\x12\x1b\n" + | ||
| 1263 | "\tpage_size\x18\x04 \x01(\x05R\bpageSize\"z\n" + | ||
| 1264 | "\rQueryResponse\x12'\n" + | ||
| 1265 | "\x06events\x18\x01 \x03(\v2\x0f.nostr.v1.EventR\x06events\x12\x1f\n" + | ||
| 1266 | "\vnext_cursor\x18\x02 \x01(\tR\n" + | ||
| 1267 | "nextCursor\x12\x1f\n" + | ||
| 1268 | "\vtotal_count\x18\x03 \x01(\x05R\n" + | ||
| 1269 | "totalCount\":\n" + | ||
| 1270 | "\fCountRequest\x12*\n" + | ||
| 1271 | "\afilters\x18\x01 \x03(\v2\x10.nostr.v1.FilterR\afilters\"%\n" + | ||
| 1272 | "\rCountResponse\x12\x14\n" + | ||
| 1273 | "\x05count\x18\x01 \x01(\x03R\x05count\"\a\n" + | ||
| 1274 | "\x05Empty\"\xe0\x01\n" + | ||
| 1275 | "\n" + | ||
| 1276 | "RelayStats\x12!\n" + | ||
| 1277 | "\ftotal_events\x18\x01 \x01(\x03R\vtotalEvents\x12/\n" + | ||
| 1278 | "\x13total_subscriptions\x18\x02 \x01(\x03R\x12totalSubscriptions\x12+\n" + | ||
| 1279 | "\x11connected_clients\x18\x03 \x01(\x03R\x10connectedClients\x12*\n" + | ||
| 1280 | "\x11events_per_second\x18\x04 \x01(\x03R\x0feventsPerSecond\x12%\n" + | ||
| 1281 | "\x0euptime_seconds\x18\x05 \x01(\x03R\ruptimeSeconds\"H\n" + | ||
| 1282 | "\x0eConnectionList\x126\n" + | ||
| 1283 | "\vconnections\x18\x01 \x03(\v2\x14.nostr.v1.ConnectionR\vconnections\"\x9b\x01\n" + | ||
| 1284 | "\n" + | ||
| 1285 | "Connection\x12\x1b\n" + | ||
| 1286 | "\tclient_id\x18\x01 \x01(\tR\bclientId\x12\x1a\n" + | ||
| 1287 | "\bprotocol\x18\x02 \x01(\tR\bprotocol\x12!\n" + | ||
| 1288 | "\fconnected_at\x18\x03 \x01(\x03R\vconnectedAt\x121\n" + | ||
| 1289 | "\x14active_subscriptions\x18\x04 \x01(\x05R\x13activeSubscriptions\"R\n" + | ||
| 1290 | "\n" + | ||
| 1291 | "BanRequest\x12\x16\n" + | ||
| 1292 | "\x06pubkey\x18\x01 \x01(\tR\x06pubkey\x12\x14\n" + | ||
| 1293 | "\x05until\x18\x02 \x01(\x03R\x05until\x12\x16\n" + | ||
| 1294 | "\x06reason\x18\x03 \x01(\tR\x06reason\"v\n" + | ||
| 1295 | "\fStorageStats\x12\x1f\n" + | ||
| 1296 | "\vtotal_bytes\x18\x01 \x01(\x03R\n" + | ||
| 1297 | "totalBytes\x12!\n" + | ||
| 1298 | "\ftotal_events\x18\x02 \x01(\x03R\vtotalEvents\x12\"\n" + | ||
| 1299 | "\rdb_size_bytes\x18\x03 \x01(\x03R\vdbSizeBytes2\xa4\x03\n" + | ||
| 1300 | "\n" + | ||
| 1301 | "NostrRelay\x12M\n" + | ||
| 1302 | "\fPublishEvent\x12\x1d.nostr.v1.PublishEventRequest\x1a\x1e.nostr.v1.PublishEventResponse\x12:\n" + | ||
| 1303 | "\tSubscribe\x12\x1a.nostr.v1.SubscribeRequest\x1a\x0f.nostr.v1.Event0\x01\x12<\n" + | ||
| 1304 | "\vUnsubscribe\x12\x1c.nostr.v1.UnsubscribeRequest\x1a\x0f.nostr.v1.Empty\x12M\n" + | ||
| 1305 | "\fPublishBatch\x12\x1d.nostr.v1.PublishBatchRequest\x1a\x1e.nostr.v1.PublishBatchResponse\x12>\n" + | ||
| 1306 | "\vQueryEvents\x12\x16.nostr.v1.QueryRequest\x1a\x17.nostr.v1.QueryResponse\x12>\n" + | ||
| 1307 | "\vCountEvents\x12\x16.nostr.v1.CountRequest\x1a\x17.nostr.v1.CountResponse2\xee\x01\n" + | ||
| 1308 | "\n" + | ||
| 1309 | "RelayAdmin\x121\n" + | ||
| 1310 | "\bGetStats\x12\x0f.nostr.v1.Empty\x1a\x14.nostr.v1.RelayStats\x12;\n" + | ||
| 1311 | "\x0eGetConnections\x12\x0f.nostr.v1.Empty\x1a\x18.nostr.v1.ConnectionList\x125\n" + | ||
| 1312 | "\fBanPublicKey\x12\x14.nostr.v1.BanRequest\x1a\x0f.nostr.v1.Empty\x129\n" + | ||
| 1313 | "\x0eGetStorageInfo\x12\x0f.nostr.v1.Empty\x1a\x16.nostr.v1.StorageStatsB\x89\x01\n" + | ||
| 1314 | "\fcom.nostr.v1B\n" + | ||
| 1315 | "NostrProtoP\x01Z,northwest.io/nostr-grpc/api/nostr/v1;nostrv1\xa2\x02\x03NXX\xaa\x02\bNostr.V1\xca\x02\bNostr\\V1\xe2\x02\x14Nostr\\V1\\GPBMetadata\xea\x02\tNostr::V1b\x06proto3" | ||
| 1316 | |||
| 1317 | var ( | ||
| 1318 | file_nostr_v1_nostr_proto_rawDescOnce sync.Once | ||
| 1319 | file_nostr_v1_nostr_proto_rawDescData []byte | ||
| 1320 | ) | ||
| 1321 | |||
| 1322 | func file_nostr_v1_nostr_proto_rawDescGZIP() []byte { | ||
| 1323 | file_nostr_v1_nostr_proto_rawDescOnce.Do(func() { | ||
| 1324 | file_nostr_v1_nostr_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_nostr_v1_nostr_proto_rawDesc), len(file_nostr_v1_nostr_proto_rawDesc))) | ||
| 1325 | }) | ||
| 1326 | return file_nostr_v1_nostr_proto_rawDescData | ||
| 1327 | } | ||
| 1328 | |||
| 1329 | var file_nostr_v1_nostr_proto_msgTypes = make([]protoimpl.MessageInfo, 21) | ||
| 1330 | var file_nostr_v1_nostr_proto_goTypes = []any{ | ||
| 1331 | (*Event)(nil), // 0: nostr.v1.Event | ||
| 1332 | (*Tag)(nil), // 1: nostr.v1.Tag | ||
| 1333 | (*Filter)(nil), // 2: nostr.v1.Filter | ||
| 1334 | (*TagFilter)(nil), // 3: nostr.v1.TagFilter | ||
| 1335 | (*PublishEventRequest)(nil), // 4: nostr.v1.PublishEventRequest | ||
| 1336 | (*PublishEventResponse)(nil), // 5: nostr.v1.PublishEventResponse | ||
| 1337 | (*SubscribeRequest)(nil), // 6: nostr.v1.SubscribeRequest | ||
| 1338 | (*UnsubscribeRequest)(nil), // 7: nostr.v1.UnsubscribeRequest | ||
| 1339 | (*PublishBatchRequest)(nil), // 8: nostr.v1.PublishBatchRequest | ||
| 1340 | (*PublishBatchResponse)(nil), // 9: nostr.v1.PublishBatchResponse | ||
| 1341 | (*QueryRequest)(nil), // 10: nostr.v1.QueryRequest | ||
| 1342 | (*QueryResponse)(nil), // 11: nostr.v1.QueryResponse | ||
| 1343 | (*CountRequest)(nil), // 12: nostr.v1.CountRequest | ||
| 1344 | (*CountResponse)(nil), // 13: nostr.v1.CountResponse | ||
| 1345 | (*Empty)(nil), // 14: nostr.v1.Empty | ||
| 1346 | (*RelayStats)(nil), // 15: nostr.v1.RelayStats | ||
| 1347 | (*ConnectionList)(nil), // 16: nostr.v1.ConnectionList | ||
| 1348 | (*Connection)(nil), // 17: nostr.v1.Connection | ||
| 1349 | (*BanRequest)(nil), // 18: nostr.v1.BanRequest | ||
| 1350 | (*StorageStats)(nil), // 19: nostr.v1.StorageStats | ||
| 1351 | nil, // 20: nostr.v1.Filter.TagFiltersEntry | ||
| 1352 | } | ||
| 1353 | var file_nostr_v1_nostr_proto_depIdxs = []int32{ | ||
| 1354 | 1, // 0: nostr.v1.Event.tags:type_name -> nostr.v1.Tag | ||
| 1355 | 20, // 1: nostr.v1.Filter.tag_filters:type_name -> nostr.v1.Filter.TagFiltersEntry | ||
| 1356 | 0, // 2: nostr.v1.PublishEventRequest.event:type_name -> nostr.v1.Event | ||
| 1357 | 2, // 3: nostr.v1.SubscribeRequest.filters:type_name -> nostr.v1.Filter | ||
| 1358 | 0, // 4: nostr.v1.PublishBatchRequest.events:type_name -> nostr.v1.Event | ||
| 1359 | 5, // 5: nostr.v1.PublishBatchResponse.results:type_name -> nostr.v1.PublishEventResponse | ||
| 1360 | 2, // 6: nostr.v1.QueryRequest.filters:type_name -> nostr.v1.Filter | ||
| 1361 | 0, // 7: nostr.v1.QueryResponse.events:type_name -> nostr.v1.Event | ||
| 1362 | 2, // 8: nostr.v1.CountRequest.filters:type_name -> nostr.v1.Filter | ||
| 1363 | 17, // 9: nostr.v1.ConnectionList.connections:type_name -> nostr.v1.Connection | ||
| 1364 | 3, // 10: nostr.v1.Filter.TagFiltersEntry.value:type_name -> nostr.v1.TagFilter | ||
| 1365 | 4, // 11: nostr.v1.NostrRelay.PublishEvent:input_type -> nostr.v1.PublishEventRequest | ||
| 1366 | 6, // 12: nostr.v1.NostrRelay.Subscribe:input_type -> nostr.v1.SubscribeRequest | ||
| 1367 | 7, // 13: nostr.v1.NostrRelay.Unsubscribe:input_type -> nostr.v1.UnsubscribeRequest | ||
| 1368 | 8, // 14: nostr.v1.NostrRelay.PublishBatch:input_type -> nostr.v1.PublishBatchRequest | ||
| 1369 | 10, // 15: nostr.v1.NostrRelay.QueryEvents:input_type -> nostr.v1.QueryRequest | ||
| 1370 | 12, // 16: nostr.v1.NostrRelay.CountEvents:input_type -> nostr.v1.CountRequest | ||
| 1371 | 14, // 17: nostr.v1.RelayAdmin.GetStats:input_type -> nostr.v1.Empty | ||
| 1372 | 14, // 18: nostr.v1.RelayAdmin.GetConnections:input_type -> nostr.v1.Empty | ||
| 1373 | 18, // 19: nostr.v1.RelayAdmin.BanPublicKey:input_type -> nostr.v1.BanRequest | ||
| 1374 | 14, // 20: nostr.v1.RelayAdmin.GetStorageInfo:input_type -> nostr.v1.Empty | ||
| 1375 | 5, // 21: nostr.v1.NostrRelay.PublishEvent:output_type -> nostr.v1.PublishEventResponse | ||
| 1376 | 0, // 22: nostr.v1.NostrRelay.Subscribe:output_type -> nostr.v1.Event | ||
| 1377 | 14, // 23: nostr.v1.NostrRelay.Unsubscribe:output_type -> nostr.v1.Empty | ||
| 1378 | 9, // 24: nostr.v1.NostrRelay.PublishBatch:output_type -> nostr.v1.PublishBatchResponse | ||
| 1379 | 11, // 25: nostr.v1.NostrRelay.QueryEvents:output_type -> nostr.v1.QueryResponse | ||
| 1380 | 13, // 26: nostr.v1.NostrRelay.CountEvents:output_type -> nostr.v1.CountResponse | ||
| 1381 | 15, // 27: nostr.v1.RelayAdmin.GetStats:output_type -> nostr.v1.RelayStats | ||
| 1382 | 16, // 28: nostr.v1.RelayAdmin.GetConnections:output_type -> nostr.v1.ConnectionList | ||
| 1383 | 14, // 29: nostr.v1.RelayAdmin.BanPublicKey:output_type -> nostr.v1.Empty | ||
| 1384 | 19, // 30: nostr.v1.RelayAdmin.GetStorageInfo:output_type -> nostr.v1.StorageStats | ||
| 1385 | 21, // [21:31] is the sub-list for method output_type | ||
| 1386 | 11, // [11:21] is the sub-list for method input_type | ||
| 1387 | 11, // [11:11] is the sub-list for extension type_name | ||
| 1388 | 11, // [11:11] is the sub-list for extension extendee | ||
| 1389 | 0, // [0:11] is the sub-list for field type_name | ||
| 1390 | } | ||
| 1391 | |||
| 1392 | func init() { file_nostr_v1_nostr_proto_init() } | ||
| 1393 | func file_nostr_v1_nostr_proto_init() { | ||
| 1394 | if File_nostr_v1_nostr_proto != nil { | ||
| 1395 | return | ||
| 1396 | } | ||
| 1397 | file_nostr_v1_nostr_proto_msgTypes[0].OneofWrappers = []any{} | ||
| 1398 | file_nostr_v1_nostr_proto_msgTypes[2].OneofWrappers = []any{} | ||
| 1399 | type x struct{} | ||
| 1400 | out := protoimpl.TypeBuilder{ | ||
| 1401 | File: protoimpl.DescBuilder{ | ||
| 1402 | GoPackagePath: reflect.TypeOf(x{}).PkgPath(), | ||
| 1403 | RawDescriptor: unsafe.Slice(unsafe.StringData(file_nostr_v1_nostr_proto_rawDesc), len(file_nostr_v1_nostr_proto_rawDesc)), | ||
| 1404 | NumEnums: 0, | ||
| 1405 | NumMessages: 21, | ||
| 1406 | NumExtensions: 0, | ||
| 1407 | NumServices: 2, | ||
| 1408 | }, | ||
| 1409 | GoTypes: file_nostr_v1_nostr_proto_goTypes, | ||
| 1410 | DependencyIndexes: file_nostr_v1_nostr_proto_depIdxs, | ||
| 1411 | MessageInfos: file_nostr_v1_nostr_proto_msgTypes, | ||
| 1412 | }.Build() | ||
| 1413 | File_nostr_v1_nostr_proto = out.File | ||
| 1414 | file_nostr_v1_nostr_proto_goTypes = nil | ||
| 1415 | file_nostr_v1_nostr_proto_depIdxs = nil | ||
| 1416 | } | ||
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 | } | ||
