Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5f4f42b9b9 | |||
| 10fcecf508 | |||
| 3b5c253797 | |||
| 291f87635b | |||
| eb2c8f6dc7 |
4
README.md
Normal file
4
README.md
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
## Compile
|
||||||
|
```bash
|
||||||
|
protoc --proto_path=proto proto/*.proto --go_out=. --go-grpc_out=.
|
||||||
|
```
|
||||||
727
gen/events.pb.go
Normal file
727
gen/events.pb.go
Normal file
@@ -0,0 +1,727 @@
|
|||||||
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// protoc-gen-go v1.36.11
|
||||||
|
// protoc v6.33.2
|
||||||
|
// source: events.proto
|
||||||
|
|
||||||
|
package gen
|
||||||
|
|
||||||
|
import (
|
||||||
|
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||||
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
|
timestamppb "google.golang.org/protobuf/types/known/timestamppb"
|
||||||
|
reflect "reflect"
|
||||||
|
sync "sync"
|
||||||
|
unsafe "unsafe"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// Verify that this generated code is sufficiently up-to-date.
|
||||||
|
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||||
|
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||||
|
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||||
|
)
|
||||||
|
|
||||||
|
type EventType int32
|
||||||
|
|
||||||
|
const (
|
||||||
|
EventType_AUTHENTICATION EventType = 0
|
||||||
|
EventType_SLUG_CHANGE EventType = 1
|
||||||
|
EventType_SLUG_CHANGE_RESPONSE EventType = 2
|
||||||
|
EventType_GET_SESSIONS EventType = 3
|
||||||
|
)
|
||||||
|
|
||||||
|
// Enum value maps for EventType.
|
||||||
|
var (
|
||||||
|
EventType_name = map[int32]string{
|
||||||
|
0: "AUTHENTICATION",
|
||||||
|
1: "SLUG_CHANGE",
|
||||||
|
2: "SLUG_CHANGE_RESPONSE",
|
||||||
|
3: "GET_SESSIONS",
|
||||||
|
}
|
||||||
|
EventType_value = map[string]int32{
|
||||||
|
"AUTHENTICATION": 0,
|
||||||
|
"SLUG_CHANGE": 1,
|
||||||
|
"SLUG_CHANGE_RESPONSE": 2,
|
||||||
|
"GET_SESSIONS": 3,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
func (x EventType) Enum() *EventType {
|
||||||
|
p := new(EventType)
|
||||||
|
*p = x
|
||||||
|
return p
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x EventType) String() string {
|
||||||
|
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (EventType) Descriptor() protoreflect.EnumDescriptor {
|
||||||
|
return file_events_proto_enumTypes[0].Descriptor()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (EventType) Type() protoreflect.EnumType {
|
||||||
|
return &file_events_proto_enumTypes[0]
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x EventType) Number() protoreflect.EnumNumber {
|
||||||
|
return protoreflect.EnumNumber(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use EventType.Descriptor instead.
|
||||||
|
func (EventType) EnumDescriptor() ([]byte, []int) {
|
||||||
|
return file_events_proto_rawDescGZIP(), []int{0}
|
||||||
|
}
|
||||||
|
|
||||||
|
type Events struct {
|
||||||
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
|
Type EventType `protobuf:"varint,1,opt,name=type,proto3,enum=events.EventType" json:"type,omitempty"`
|
||||||
|
// Types that are valid to be assigned to Payload:
|
||||||
|
//
|
||||||
|
// *Events_SlugEvent
|
||||||
|
// *Events_GetSessionsEvent
|
||||||
|
Payload isEvents_Payload `protobuf_oneof:"payload"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Events) Reset() {
|
||||||
|
*x = Events{}
|
||||||
|
mi := &file_events_proto_msgTypes[0]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Events) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*Events) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *Events) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_events_proto_msgTypes[0]
|
||||||
|
if x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use Events.ProtoReflect.Descriptor instead.
|
||||||
|
func (*Events) Descriptor() ([]byte, []int) {
|
||||||
|
return file_events_proto_rawDescGZIP(), []int{0}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Events) GetType() EventType {
|
||||||
|
if x != nil {
|
||||||
|
return x.Type
|
||||||
|
}
|
||||||
|
return EventType_AUTHENTICATION
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Events) GetPayload() isEvents_Payload {
|
||||||
|
if x != nil {
|
||||||
|
return x.Payload
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Events) GetSlugEvent() *SlugChangeEvent {
|
||||||
|
if x != nil {
|
||||||
|
if x, ok := x.Payload.(*Events_SlugEvent); ok {
|
||||||
|
return x.SlugEvent
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Events) GetGetSessionsEvent() *GetSessionsEvent {
|
||||||
|
if x != nil {
|
||||||
|
if x, ok := x.Payload.(*Events_GetSessionsEvent); ok {
|
||||||
|
return x.GetSessionsEvent
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type isEvents_Payload interface {
|
||||||
|
isEvents_Payload()
|
||||||
|
}
|
||||||
|
|
||||||
|
type Events_SlugEvent struct {
|
||||||
|
SlugEvent *SlugChangeEvent `protobuf:"bytes,11,opt,name=slug_event,json=slugEvent,proto3,oneof"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type Events_GetSessionsEvent struct {
|
||||||
|
GetSessionsEvent *GetSessionsEvent `protobuf:"bytes,12,opt,name=get_sessions_event,json=getSessionsEvent,proto3,oneof"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*Events_SlugEvent) isEvents_Payload() {}
|
||||||
|
|
||||||
|
func (*Events_GetSessionsEvent) isEvents_Payload() {}
|
||||||
|
|
||||||
|
type Node struct {
|
||||||
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
|
Type EventType `protobuf:"varint,1,opt,name=type,proto3,enum=events.EventType" json:"type,omitempty"`
|
||||||
|
// Types that are valid to be assigned to Payload:
|
||||||
|
//
|
||||||
|
// *Node_AuthEvent
|
||||||
|
// *Node_SlugEventResponse
|
||||||
|
// *Node_GetSessionsEvent
|
||||||
|
Payload isNode_Payload `protobuf_oneof:"payload"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Node) Reset() {
|
||||||
|
*x = Node{}
|
||||||
|
mi := &file_events_proto_msgTypes[1]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Node) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*Node) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *Node) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_events_proto_msgTypes[1]
|
||||||
|
if x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use Node.ProtoReflect.Descriptor instead.
|
||||||
|
func (*Node) Descriptor() ([]byte, []int) {
|
||||||
|
return file_events_proto_rawDescGZIP(), []int{1}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Node) GetType() EventType {
|
||||||
|
if x != nil {
|
||||||
|
return x.Type
|
||||||
|
}
|
||||||
|
return EventType_AUTHENTICATION
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Node) GetPayload() isNode_Payload {
|
||||||
|
if x != nil {
|
||||||
|
return x.Payload
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Node) GetAuthEvent() *Authentication {
|
||||||
|
if x != nil {
|
||||||
|
if x, ok := x.Payload.(*Node_AuthEvent); ok {
|
||||||
|
return x.AuthEvent
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Node) GetSlugEventResponse() *SlugChangeEventResponse {
|
||||||
|
if x != nil {
|
||||||
|
if x, ok := x.Payload.(*Node_SlugEventResponse); ok {
|
||||||
|
return x.SlugEventResponse
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Node) GetGetSessionsEvent() *GetSessionsResponse {
|
||||||
|
if x != nil {
|
||||||
|
if x, ok := x.Payload.(*Node_GetSessionsEvent); ok {
|
||||||
|
return x.GetSessionsEvent
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type isNode_Payload interface {
|
||||||
|
isNode_Payload()
|
||||||
|
}
|
||||||
|
|
||||||
|
type Node_AuthEvent struct {
|
||||||
|
AuthEvent *Authentication `protobuf:"bytes,10,opt,name=auth_event,json=authEvent,proto3,oneof"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type Node_SlugEventResponse struct {
|
||||||
|
SlugEventResponse *SlugChangeEventResponse `protobuf:"bytes,11,opt,name=slug_event_response,json=slugEventResponse,proto3,oneof"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type Node_GetSessionsEvent struct {
|
||||||
|
GetSessionsEvent *GetSessionsResponse `protobuf:"bytes,12,opt,name=get_sessions_event,json=getSessionsEvent,proto3,oneof"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*Node_AuthEvent) isNode_Payload() {}
|
||||||
|
|
||||||
|
func (*Node_SlugEventResponse) isNode_Payload() {}
|
||||||
|
|
||||||
|
func (*Node_GetSessionsEvent) isNode_Payload() {}
|
||||||
|
|
||||||
|
type Authentication struct {
|
||||||
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
|
AuthToken string `protobuf:"bytes,1,opt,name=auth_token,json=authToken,proto3" json:"auth_token,omitempty"`
|
||||||
|
Identity string `protobuf:"bytes,2,opt,name=identity,proto3" json:"identity,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Authentication) Reset() {
|
||||||
|
*x = Authentication{}
|
||||||
|
mi := &file_events_proto_msgTypes[2]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Authentication) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*Authentication) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *Authentication) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_events_proto_msgTypes[2]
|
||||||
|
if x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use Authentication.ProtoReflect.Descriptor instead.
|
||||||
|
func (*Authentication) Descriptor() ([]byte, []int) {
|
||||||
|
return file_events_proto_rawDescGZIP(), []int{2}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Authentication) GetAuthToken() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.AuthToken
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Authentication) GetIdentity() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Identity
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
type SlugChangeEvent struct {
|
||||||
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
|
Old string `protobuf:"bytes,1,opt,name=old,proto3" json:"old,omitempty"`
|
||||||
|
New string `protobuf:"bytes,2,opt,name=new,proto3" json:"new,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *SlugChangeEvent) Reset() {
|
||||||
|
*x = SlugChangeEvent{}
|
||||||
|
mi := &file_events_proto_msgTypes[3]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *SlugChangeEvent) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*SlugChangeEvent) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *SlugChangeEvent) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_events_proto_msgTypes[3]
|
||||||
|
if x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use SlugChangeEvent.ProtoReflect.Descriptor instead.
|
||||||
|
func (*SlugChangeEvent) Descriptor() ([]byte, []int) {
|
||||||
|
return file_events_proto_rawDescGZIP(), []int{3}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *SlugChangeEvent) GetOld() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Old
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *SlugChangeEvent) GetNew() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.New
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
type SlugChangeEventResponse struct {
|
||||||
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
|
Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"`
|
||||||
|
Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *SlugChangeEventResponse) Reset() {
|
||||||
|
*x = SlugChangeEventResponse{}
|
||||||
|
mi := &file_events_proto_msgTypes[4]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *SlugChangeEventResponse) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*SlugChangeEventResponse) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *SlugChangeEventResponse) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_events_proto_msgTypes[4]
|
||||||
|
if x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use SlugChangeEventResponse.ProtoReflect.Descriptor instead.
|
||||||
|
func (*SlugChangeEventResponse) Descriptor() ([]byte, []int) {
|
||||||
|
return file_events_proto_rawDescGZIP(), []int{4}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *SlugChangeEventResponse) GetSuccess() bool {
|
||||||
|
if x != nil {
|
||||||
|
return x.Success
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *SlugChangeEventResponse) GetMessage() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Message
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
type GetSessionsEvent struct {
|
||||||
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
|
Identity string `protobuf:"bytes,1,opt,name=identity,proto3" json:"identity,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *GetSessionsEvent) Reset() {
|
||||||
|
*x = GetSessionsEvent{}
|
||||||
|
mi := &file_events_proto_msgTypes[5]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *GetSessionsEvent) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*GetSessionsEvent) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *GetSessionsEvent) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_events_proto_msgTypes[5]
|
||||||
|
if x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use GetSessionsEvent.ProtoReflect.Descriptor instead.
|
||||||
|
func (*GetSessionsEvent) Descriptor() ([]byte, []int) {
|
||||||
|
return file_events_proto_rawDescGZIP(), []int{5}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *GetSessionsEvent) GetIdentity() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Identity
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
type GetSessionsResponse struct {
|
||||||
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
|
Details []*Detail `protobuf:"bytes,1,rep,name=details,proto3" json:"details,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *GetSessionsResponse) Reset() {
|
||||||
|
*x = GetSessionsResponse{}
|
||||||
|
mi := &file_events_proto_msgTypes[6]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *GetSessionsResponse) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*GetSessionsResponse) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *GetSessionsResponse) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_events_proto_msgTypes[6]
|
||||||
|
if x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use GetSessionsResponse.ProtoReflect.Descriptor instead.
|
||||||
|
func (*GetSessionsResponse) Descriptor() ([]byte, []int) {
|
||||||
|
return file_events_proto_rawDescGZIP(), []int{6}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *GetSessionsResponse) GetDetails() []*Detail {
|
||||||
|
if x != nil {
|
||||||
|
return x.Details
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type Detail struct {
|
||||||
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
|
Node string `protobuf:"bytes,1,opt,name=node,proto3" json:"node,omitempty"`
|
||||||
|
ForwardingType string `protobuf:"bytes,2,opt,name=forwarding_type,json=forwardingType,proto3" json:"forwarding_type,omitempty"`
|
||||||
|
Slug string `protobuf:"bytes,3,opt,name=slug,proto3" json:"slug,omitempty"`
|
||||||
|
UserId string `protobuf:"bytes,4,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
|
||||||
|
Active bool `protobuf:"varint,5,opt,name=active,proto3" json:"active,omitempty"`
|
||||||
|
StartedAt *timestamppb.Timestamp `protobuf:"bytes,6,opt,name=started_at,json=startedAt,proto3" json:"started_at,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Detail) Reset() {
|
||||||
|
*x = Detail{}
|
||||||
|
mi := &file_events_proto_msgTypes[7]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Detail) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*Detail) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *Detail) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_events_proto_msgTypes[7]
|
||||||
|
if x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use Detail.ProtoReflect.Descriptor instead.
|
||||||
|
func (*Detail) Descriptor() ([]byte, []int) {
|
||||||
|
return file_events_proto_rawDescGZIP(), []int{7}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Detail) GetNode() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Node
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Detail) GetForwardingType() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.ForwardingType
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Detail) GetSlug() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Slug
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Detail) GetUserId() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.UserId
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Detail) GetActive() bool {
|
||||||
|
if x != nil {
|
||||||
|
return x.Active
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Detail) GetStartedAt() *timestamppb.Timestamp {
|
||||||
|
if x != nil {
|
||||||
|
return x.StartedAt
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
var File_events_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
|
const file_events_proto_rawDesc = "" +
|
||||||
|
"\n" +
|
||||||
|
"\fevents.proto\x12\x06events\x1a\x1fgoogle/protobuf/timestamp.proto\"\xbe\x01\n" +
|
||||||
|
"\x06Events\x12%\n" +
|
||||||
|
"\x04type\x18\x01 \x01(\x0e2\x11.events.EventTypeR\x04type\x128\n" +
|
||||||
|
"\n" +
|
||||||
|
"slug_event\x18\v \x01(\v2\x17.events.SlugChangeEventH\x00R\tslugEvent\x12H\n" +
|
||||||
|
"\x12get_sessions_event\x18\f \x01(\v2\x18.events.GetSessionsEventH\x00R\x10getSessionsEventB\t\n" +
|
||||||
|
"\apayload\"\x91\x02\n" +
|
||||||
|
"\x04Node\x12%\n" +
|
||||||
|
"\x04type\x18\x01 \x01(\x0e2\x11.events.EventTypeR\x04type\x127\n" +
|
||||||
|
"\n" +
|
||||||
|
"auth_event\x18\n" +
|
||||||
|
" \x01(\v2\x16.events.AuthenticationH\x00R\tauthEvent\x12Q\n" +
|
||||||
|
"\x13slug_event_response\x18\v \x01(\v2\x1f.events.SlugChangeEventResponseH\x00R\x11slugEventResponse\x12K\n" +
|
||||||
|
"\x12get_sessions_event\x18\f \x01(\v2\x1b.events.GetSessionsResponseH\x00R\x10getSessionsEventB\t\n" +
|
||||||
|
"\apayload\"K\n" +
|
||||||
|
"\x0eAuthentication\x12\x1d\n" +
|
||||||
|
"\n" +
|
||||||
|
"auth_token\x18\x01 \x01(\tR\tauthToken\x12\x1a\n" +
|
||||||
|
"\bidentity\x18\x02 \x01(\tR\bidentity\"5\n" +
|
||||||
|
"\x0fSlugChangeEvent\x12\x10\n" +
|
||||||
|
"\x03old\x18\x01 \x01(\tR\x03old\x12\x10\n" +
|
||||||
|
"\x03new\x18\x02 \x01(\tR\x03new\"M\n" +
|
||||||
|
"\x17SlugChangeEventResponse\x12\x18\n" +
|
||||||
|
"\asuccess\x18\x01 \x01(\bR\asuccess\x12\x18\n" +
|
||||||
|
"\amessage\x18\x02 \x01(\tR\amessage\".\n" +
|
||||||
|
"\x10GetSessionsEvent\x12\x1a\n" +
|
||||||
|
"\bidentity\x18\x01 \x01(\tR\bidentity\"?\n" +
|
||||||
|
"\x13GetSessionsResponse\x12(\n" +
|
||||||
|
"\adetails\x18\x01 \x03(\v2\x0e.events.DetailR\adetails\"\xc5\x01\n" +
|
||||||
|
"\x06Detail\x12\x12\n" +
|
||||||
|
"\x04node\x18\x01 \x01(\tR\x04node\x12'\n" +
|
||||||
|
"\x0fforwarding_type\x18\x02 \x01(\tR\x0eforwardingType\x12\x12\n" +
|
||||||
|
"\x04slug\x18\x03 \x01(\tR\x04slug\x12\x17\n" +
|
||||||
|
"\auser_id\x18\x04 \x01(\tR\x06userId\x12\x16\n" +
|
||||||
|
"\x06active\x18\x05 \x01(\bR\x06active\x129\n" +
|
||||||
|
"\n" +
|
||||||
|
"started_at\x18\x06 \x01(\v2\x1a.google.protobuf.TimestampR\tstartedAt*\\\n" +
|
||||||
|
"\tEventType\x12\x12\n" +
|
||||||
|
"\x0eAUTHENTICATION\x10\x00\x12\x0f\n" +
|
||||||
|
"\vSLUG_CHANGE\x10\x01\x12\x18\n" +
|
||||||
|
"\x14SLUG_CHANGE_RESPONSE\x10\x02\x12\x10\n" +
|
||||||
|
"\fGET_SESSIONS\x10\x032=\n" +
|
||||||
|
"\fEventService\x12-\n" +
|
||||||
|
"\tSubscribe\x12\f.events.Node\x1a\x0e.events.Events(\x010\x01B\aZ\x05./genb\x06proto3"
|
||||||
|
|
||||||
|
var (
|
||||||
|
file_events_proto_rawDescOnce sync.Once
|
||||||
|
file_events_proto_rawDescData []byte
|
||||||
|
)
|
||||||
|
|
||||||
|
func file_events_proto_rawDescGZIP() []byte {
|
||||||
|
file_events_proto_rawDescOnce.Do(func() {
|
||||||
|
file_events_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_events_proto_rawDesc), len(file_events_proto_rawDesc)))
|
||||||
|
})
|
||||||
|
return file_events_proto_rawDescData
|
||||||
|
}
|
||||||
|
|
||||||
|
var file_events_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
|
||||||
|
var file_events_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
|
||||||
|
var file_events_proto_goTypes = []any{
|
||||||
|
(EventType)(0), // 0: events.EventType
|
||||||
|
(*Events)(nil), // 1: events.Events
|
||||||
|
(*Node)(nil), // 2: events.Node
|
||||||
|
(*Authentication)(nil), // 3: events.Authentication
|
||||||
|
(*SlugChangeEvent)(nil), // 4: events.SlugChangeEvent
|
||||||
|
(*SlugChangeEventResponse)(nil), // 5: events.SlugChangeEventResponse
|
||||||
|
(*GetSessionsEvent)(nil), // 6: events.GetSessionsEvent
|
||||||
|
(*GetSessionsResponse)(nil), // 7: events.GetSessionsResponse
|
||||||
|
(*Detail)(nil), // 8: events.Detail
|
||||||
|
(*timestamppb.Timestamp)(nil), // 9: google.protobuf.Timestamp
|
||||||
|
}
|
||||||
|
var file_events_proto_depIdxs = []int32{
|
||||||
|
0, // 0: events.Events.type:type_name -> events.EventType
|
||||||
|
4, // 1: events.Events.slug_event:type_name -> events.SlugChangeEvent
|
||||||
|
6, // 2: events.Events.get_sessions_event:type_name -> events.GetSessionsEvent
|
||||||
|
0, // 3: events.Node.type:type_name -> events.EventType
|
||||||
|
3, // 4: events.Node.auth_event:type_name -> events.Authentication
|
||||||
|
5, // 5: events.Node.slug_event_response:type_name -> events.SlugChangeEventResponse
|
||||||
|
7, // 6: events.Node.get_sessions_event:type_name -> events.GetSessionsResponse
|
||||||
|
8, // 7: events.GetSessionsResponse.details:type_name -> events.Detail
|
||||||
|
9, // 8: events.Detail.started_at:type_name -> google.protobuf.Timestamp
|
||||||
|
2, // 9: events.EventService.Subscribe:input_type -> events.Node
|
||||||
|
1, // 10: events.EventService.Subscribe:output_type -> events.Events
|
||||||
|
10, // [10:11] is the sub-list for method output_type
|
||||||
|
9, // [9:10] is the sub-list for method input_type
|
||||||
|
9, // [9:9] is the sub-list for extension type_name
|
||||||
|
9, // [9:9] is the sub-list for extension extendee
|
||||||
|
0, // [0:9] is the sub-list for field type_name
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() { file_events_proto_init() }
|
||||||
|
func file_events_proto_init() {
|
||||||
|
if File_events_proto != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
file_events_proto_msgTypes[0].OneofWrappers = []any{
|
||||||
|
(*Events_SlugEvent)(nil),
|
||||||
|
(*Events_GetSessionsEvent)(nil),
|
||||||
|
}
|
||||||
|
file_events_proto_msgTypes[1].OneofWrappers = []any{
|
||||||
|
(*Node_AuthEvent)(nil),
|
||||||
|
(*Node_SlugEventResponse)(nil),
|
||||||
|
(*Node_GetSessionsEvent)(nil),
|
||||||
|
}
|
||||||
|
type x struct{}
|
||||||
|
out := protoimpl.TypeBuilder{
|
||||||
|
File: protoimpl.DescBuilder{
|
||||||
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
|
RawDescriptor: unsafe.Slice(unsafe.StringData(file_events_proto_rawDesc), len(file_events_proto_rawDesc)),
|
||||||
|
NumEnums: 1,
|
||||||
|
NumMessages: 8,
|
||||||
|
NumExtensions: 0,
|
||||||
|
NumServices: 1,
|
||||||
|
},
|
||||||
|
GoTypes: file_events_proto_goTypes,
|
||||||
|
DependencyIndexes: file_events_proto_depIdxs,
|
||||||
|
EnumInfos: file_events_proto_enumTypes,
|
||||||
|
MessageInfos: file_events_proto_msgTypes,
|
||||||
|
}.Build()
|
||||||
|
File_events_proto = out.File
|
||||||
|
file_events_proto_goTypes = nil
|
||||||
|
file_events_proto_depIdxs = nil
|
||||||
|
}
|
||||||
115
gen/events_grpc.pb.go
Normal file
115
gen/events_grpc.pb.go
Normal file
@@ -0,0 +1,115 @@
|
|||||||
|
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// - protoc-gen-go-grpc v1.6.0
|
||||||
|
// - protoc v6.33.2
|
||||||
|
// source: events.proto
|
||||||
|
|
||||||
|
package gen
|
||||||
|
|
||||||
|
import (
|
||||||
|
context "context"
|
||||||
|
grpc "google.golang.org/grpc"
|
||||||
|
codes "google.golang.org/grpc/codes"
|
||||||
|
status "google.golang.org/grpc/status"
|
||||||
|
)
|
||||||
|
|
||||||
|
// This is a compile-time assertion to ensure that this generated file
|
||||||
|
// is compatible with the grpc package it is being compiled against.
|
||||||
|
// Requires gRPC-Go v1.64.0 or later.
|
||||||
|
const _ = grpc.SupportPackageIsVersion9
|
||||||
|
|
||||||
|
const (
|
||||||
|
EventService_Subscribe_FullMethodName = "/events.EventService/Subscribe"
|
||||||
|
)
|
||||||
|
|
||||||
|
// EventServiceClient is the client API for EventService service.
|
||||||
|
//
|
||||||
|
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||||
|
type EventServiceClient interface {
|
||||||
|
Subscribe(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[Node, Events], error)
|
||||||
|
}
|
||||||
|
|
||||||
|
type eventServiceClient struct {
|
||||||
|
cc grpc.ClientConnInterface
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewEventServiceClient(cc grpc.ClientConnInterface) EventServiceClient {
|
||||||
|
return &eventServiceClient{cc}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *eventServiceClient) Subscribe(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[Node, Events], error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
stream, err := c.cc.NewStream(ctx, &EventService_ServiceDesc.Streams[0], EventService_Subscribe_FullMethodName, cOpts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
x := &grpc.GenericClientStream[Node, Events]{ClientStream: stream}
|
||||||
|
return x, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
|
||||||
|
type EventService_SubscribeClient = grpc.BidiStreamingClient[Node, Events]
|
||||||
|
|
||||||
|
// EventServiceServer is the server API for EventService service.
|
||||||
|
// All implementations must embed UnimplementedEventServiceServer
|
||||||
|
// for forward compatibility.
|
||||||
|
type EventServiceServer interface {
|
||||||
|
Subscribe(grpc.BidiStreamingServer[Node, Events]) error
|
||||||
|
mustEmbedUnimplementedEventServiceServer()
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnimplementedEventServiceServer must be embedded to have
|
||||||
|
// forward compatible implementations.
|
||||||
|
//
|
||||||
|
// NOTE: this should be embedded by value instead of pointer to avoid a nil
|
||||||
|
// pointer dereference when methods are called.
|
||||||
|
type UnimplementedEventServiceServer struct{}
|
||||||
|
|
||||||
|
func (UnimplementedEventServiceServer) Subscribe(grpc.BidiStreamingServer[Node, Events]) error {
|
||||||
|
return status.Error(codes.Unimplemented, "method Subscribe not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedEventServiceServer) mustEmbedUnimplementedEventServiceServer() {}
|
||||||
|
func (UnimplementedEventServiceServer) testEmbeddedByValue() {}
|
||||||
|
|
||||||
|
// UnsafeEventServiceServer may be embedded to opt out of forward compatibility for this service.
|
||||||
|
// Use of this interface is not recommended, as added methods to EventServiceServer will
|
||||||
|
// result in compilation errors.
|
||||||
|
type UnsafeEventServiceServer interface {
|
||||||
|
mustEmbedUnimplementedEventServiceServer()
|
||||||
|
}
|
||||||
|
|
||||||
|
func RegisterEventServiceServer(s grpc.ServiceRegistrar, srv EventServiceServer) {
|
||||||
|
// If the following call panics, it indicates UnimplementedEventServiceServer was
|
||||||
|
// embedded by pointer and is nil. This will cause panics if an
|
||||||
|
// unimplemented method is ever invoked, so we test this at initialization
|
||||||
|
// time to prevent it from happening at runtime later due to I/O.
|
||||||
|
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
|
||||||
|
t.testEmbeddedByValue()
|
||||||
|
}
|
||||||
|
s.RegisterService(&EventService_ServiceDesc, srv)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _EventService_Subscribe_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||||||
|
return srv.(EventServiceServer).Subscribe(&grpc.GenericServerStream[Node, Events]{ServerStream: stream})
|
||||||
|
}
|
||||||
|
|
||||||
|
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
|
||||||
|
type EventService_SubscribeServer = grpc.BidiStreamingServer[Node, Events]
|
||||||
|
|
||||||
|
// EventService_ServiceDesc is the grpc.ServiceDesc for EventService service.
|
||||||
|
// It's only intended for direct use with grpc.RegisterService,
|
||||||
|
// and not to be introspected or modified (even as a copy)
|
||||||
|
var EventService_ServiceDesc = grpc.ServiceDesc{
|
||||||
|
ServiceName: "events.EventService",
|
||||||
|
HandlerType: (*EventServiceServer)(nil),
|
||||||
|
Methods: []grpc.MethodDesc{},
|
||||||
|
Streams: []grpc.StreamDesc{
|
||||||
|
{
|
||||||
|
StreamName: "Subscribe",
|
||||||
|
Handler: _EventService_Subscribe_Handler,
|
||||||
|
ServerStreams: true,
|
||||||
|
ClientStreams: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Metadata: "events.proto",
|
||||||
|
}
|
||||||
@@ -1,188 +0,0 @@
|
|||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
|
||||||
// versions:
|
|
||||||
// protoc-gen-go v1.36.11
|
|
||||||
// protoc v6.33.2
|
|
||||||
// source: identifier.proto
|
|
||||||
|
|
||||||
package gen
|
|
||||||
|
|
||||||
import (
|
|
||||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
|
||||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
|
||||||
emptypb "google.golang.org/protobuf/types/known/emptypb"
|
|
||||||
reflect "reflect"
|
|
||||||
sync "sync"
|
|
||||||
unsafe "unsafe"
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
|
||||||
// Verify that this generated code is sufficiently up-to-date.
|
|
||||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
|
||||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
|
||||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
|
||||||
)
|
|
||||||
|
|
||||||
type IdentifierRequest struct {
|
|
||||||
state protoimpl.MessageState `protogen:"open.v1"`
|
|
||||||
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
|
|
||||||
unknownFields protoimpl.UnknownFields
|
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *IdentifierRequest) Reset() {
|
|
||||||
*x = IdentifierRequest{}
|
|
||||||
mi := &file_identifier_proto_msgTypes[0]
|
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
||||||
ms.StoreMessageInfo(mi)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *IdentifierRequest) String() string {
|
|
||||||
return protoimpl.X.MessageStringOf(x)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (*IdentifierRequest) ProtoMessage() {}
|
|
||||||
|
|
||||||
func (x *IdentifierRequest) ProtoReflect() protoreflect.Message {
|
|
||||||
mi := &file_identifier_proto_msgTypes[0]
|
|
||||||
if x != nil {
|
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
||||||
if ms.LoadMessageInfo() == nil {
|
|
||||||
ms.StoreMessageInfo(mi)
|
|
||||||
}
|
|
||||||
return ms
|
|
||||||
}
|
|
||||||
return mi.MessageOf(x)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Deprecated: Use IdentifierRequest.ProtoReflect.Descriptor instead.
|
|
||||||
func (*IdentifierRequest) Descriptor() ([]byte, []int) {
|
|
||||||
return file_identifier_proto_rawDescGZIP(), []int{0}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *IdentifierRequest) GetId() string {
|
|
||||||
if x != nil {
|
|
||||||
return x.Id
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
type IdentifierResponse struct {
|
|
||||||
state protoimpl.MessageState `protogen:"open.v1"`
|
|
||||||
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
|
|
||||||
Slug string `protobuf:"bytes,2,opt,name=slug,proto3" json:"slug,omitempty"`
|
|
||||||
unknownFields protoimpl.UnknownFields
|
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *IdentifierResponse) Reset() {
|
|
||||||
*x = IdentifierResponse{}
|
|
||||||
mi := &file_identifier_proto_msgTypes[1]
|
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
||||||
ms.StoreMessageInfo(mi)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *IdentifierResponse) String() string {
|
|
||||||
return protoimpl.X.MessageStringOf(x)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (*IdentifierResponse) ProtoMessage() {}
|
|
||||||
|
|
||||||
func (x *IdentifierResponse) ProtoReflect() protoreflect.Message {
|
|
||||||
mi := &file_identifier_proto_msgTypes[1]
|
|
||||||
if x != nil {
|
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
||||||
if ms.LoadMessageInfo() == nil {
|
|
||||||
ms.StoreMessageInfo(mi)
|
|
||||||
}
|
|
||||||
return ms
|
|
||||||
}
|
|
||||||
return mi.MessageOf(x)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Deprecated: Use IdentifierResponse.ProtoReflect.Descriptor instead.
|
|
||||||
func (*IdentifierResponse) Descriptor() ([]byte, []int) {
|
|
||||||
return file_identifier_proto_rawDescGZIP(), []int{1}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *IdentifierResponse) GetId() string {
|
|
||||||
if x != nil {
|
|
||||||
return x.Id
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *IdentifierResponse) GetSlug() string {
|
|
||||||
if x != nil {
|
|
||||||
return x.Slug
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
var File_identifier_proto protoreflect.FileDescriptor
|
|
||||||
|
|
||||||
const file_identifier_proto_rawDesc = "" +
|
|
||||||
"\n" +
|
|
||||||
"\x10identifier.proto\x12\n" +
|
|
||||||
"identifier\x1a\x1bgoogle/protobuf/empty.proto\"#\n" +
|
|
||||||
"\x11IdentifierRequest\x12\x0e\n" +
|
|
||||||
"\x02id\x18\x01 \x01(\tR\x02id\"8\n" +
|
|
||||||
"\x12IdentifierResponse\x12\x0e\n" +
|
|
||||||
"\x02id\x18\x01 \x01(\tR\x02id\x12\x12\n" +
|
|
||||||
"\x04slug\x18\x02 \x01(\tR\x04slug2\x92\x01\n" +
|
|
||||||
"\bIdentity\x12D\n" +
|
|
||||||
"\x03Get\x12\x1d.identifier.IdentifierRequest\x1a\x1e.identifier.IdentifierResponse\x12@\n" +
|
|
||||||
"\x06Create\x12\x16.google.protobuf.Empty\x1a\x1e.identifier.IdentifierResponseB\aZ\x05./genb\x06proto3"
|
|
||||||
|
|
||||||
var (
|
|
||||||
file_identifier_proto_rawDescOnce sync.Once
|
|
||||||
file_identifier_proto_rawDescData []byte
|
|
||||||
)
|
|
||||||
|
|
||||||
func file_identifier_proto_rawDescGZIP() []byte {
|
|
||||||
file_identifier_proto_rawDescOnce.Do(func() {
|
|
||||||
file_identifier_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_identifier_proto_rawDesc), len(file_identifier_proto_rawDesc)))
|
|
||||||
})
|
|
||||||
return file_identifier_proto_rawDescData
|
|
||||||
}
|
|
||||||
|
|
||||||
var file_identifier_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
|
|
||||||
var file_identifier_proto_goTypes = []any{
|
|
||||||
(*IdentifierRequest)(nil), // 0: identifier.IdentifierRequest
|
|
||||||
(*IdentifierResponse)(nil), // 1: identifier.IdentifierResponse
|
|
||||||
(*emptypb.Empty)(nil), // 2: google.protobuf.Empty
|
|
||||||
}
|
|
||||||
var file_identifier_proto_depIdxs = []int32{
|
|
||||||
0, // 0: identifier.Identity.Get:input_type -> identifier.IdentifierRequest
|
|
||||||
2, // 1: identifier.Identity.Create:input_type -> google.protobuf.Empty
|
|
||||||
1, // 2: identifier.Identity.Get:output_type -> identifier.IdentifierResponse
|
|
||||||
1, // 3: identifier.Identity.Create:output_type -> identifier.IdentifierResponse
|
|
||||||
2, // [2:4] is the sub-list for method output_type
|
|
||||||
0, // [0:2] is the sub-list for method input_type
|
|
||||||
0, // [0:0] is the sub-list for extension type_name
|
|
||||||
0, // [0:0] is the sub-list for extension extendee
|
|
||||||
0, // [0:0] is the sub-list for field type_name
|
|
||||||
}
|
|
||||||
|
|
||||||
func init() { file_identifier_proto_init() }
|
|
||||||
func file_identifier_proto_init() {
|
|
||||||
if File_identifier_proto != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
type x struct{}
|
|
||||||
out := protoimpl.TypeBuilder{
|
|
||||||
File: protoimpl.DescBuilder{
|
|
||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
|
||||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_identifier_proto_rawDesc), len(file_identifier_proto_rawDesc)),
|
|
||||||
NumEnums: 0,
|
|
||||||
NumMessages: 2,
|
|
||||||
NumExtensions: 0,
|
|
||||||
NumServices: 1,
|
|
||||||
},
|
|
||||||
GoTypes: file_identifier_proto_goTypes,
|
|
||||||
DependencyIndexes: file_identifier_proto_depIdxs,
|
|
||||||
MessageInfos: file_identifier_proto_msgTypes,
|
|
||||||
}.Build()
|
|
||||||
File_identifier_proto = out.File
|
|
||||||
file_identifier_proto_goTypes = nil
|
|
||||||
file_identifier_proto_depIdxs = nil
|
|
||||||
}
|
|
||||||
@@ -1,160 +0,0 @@
|
|||||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
|
||||||
// versions:
|
|
||||||
// - protoc-gen-go-grpc v1.6.0
|
|
||||||
// - protoc v6.33.2
|
|
||||||
// source: identifier.proto
|
|
||||||
|
|
||||||
package gen
|
|
||||||
|
|
||||||
import (
|
|
||||||
context "context"
|
|
||||||
grpc "google.golang.org/grpc"
|
|
||||||
codes "google.golang.org/grpc/codes"
|
|
||||||
status "google.golang.org/grpc/status"
|
|
||||||
emptypb "google.golang.org/protobuf/types/known/emptypb"
|
|
||||||
)
|
|
||||||
|
|
||||||
// This is a compile-time assertion to ensure that this generated file
|
|
||||||
// is compatible with the grpc package it is being compiled against.
|
|
||||||
// Requires gRPC-Go v1.64.0 or later.
|
|
||||||
const _ = grpc.SupportPackageIsVersion9
|
|
||||||
|
|
||||||
const (
|
|
||||||
Identity_Get_FullMethodName = "/identifier.Identity/Get"
|
|
||||||
Identity_Create_FullMethodName = "/identifier.Identity/Create"
|
|
||||||
)
|
|
||||||
|
|
||||||
// IdentityClient is the client API for Identity service.
|
|
||||||
//
|
|
||||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
|
||||||
type IdentityClient interface {
|
|
||||||
Get(ctx context.Context, in *IdentifierRequest, opts ...grpc.CallOption) (*IdentifierResponse, error)
|
|
||||||
Create(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*IdentifierResponse, error)
|
|
||||||
}
|
|
||||||
|
|
||||||
type identityClient struct {
|
|
||||||
cc grpc.ClientConnInterface
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewIdentityClient(cc grpc.ClientConnInterface) IdentityClient {
|
|
||||||
return &identityClient{cc}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *identityClient) Get(ctx context.Context, in *IdentifierRequest, opts ...grpc.CallOption) (*IdentifierResponse, error) {
|
|
||||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
||||||
out := new(IdentifierResponse)
|
|
||||||
err := c.cc.Invoke(ctx, Identity_Get_FullMethodName, in, out, cOpts...)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return out, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *identityClient) Create(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*IdentifierResponse, error) {
|
|
||||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
||||||
out := new(IdentifierResponse)
|
|
||||||
err := c.cc.Invoke(ctx, Identity_Create_FullMethodName, in, out, cOpts...)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return out, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// IdentityServer is the server API for Identity service.
|
|
||||||
// All implementations must embed UnimplementedIdentityServer
|
|
||||||
// for forward compatibility.
|
|
||||||
type IdentityServer interface {
|
|
||||||
Get(context.Context, *IdentifierRequest) (*IdentifierResponse, error)
|
|
||||||
Create(context.Context, *emptypb.Empty) (*IdentifierResponse, error)
|
|
||||||
mustEmbedUnimplementedIdentityServer()
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnimplementedIdentityServer must be embedded to have
|
|
||||||
// forward compatible implementations.
|
|
||||||
//
|
|
||||||
// NOTE: this should be embedded by value instead of pointer to avoid a nil
|
|
||||||
// pointer dereference when methods are called.
|
|
||||||
type UnimplementedIdentityServer struct{}
|
|
||||||
|
|
||||||
func (UnimplementedIdentityServer) Get(context.Context, *IdentifierRequest) (*IdentifierResponse, error) {
|
|
||||||
return nil, status.Error(codes.Unimplemented, "method Get not implemented")
|
|
||||||
}
|
|
||||||
func (UnimplementedIdentityServer) Create(context.Context, *emptypb.Empty) (*IdentifierResponse, error) {
|
|
||||||
return nil, status.Error(codes.Unimplemented, "method Create not implemented")
|
|
||||||
}
|
|
||||||
func (UnimplementedIdentityServer) mustEmbedUnimplementedIdentityServer() {}
|
|
||||||
func (UnimplementedIdentityServer) testEmbeddedByValue() {}
|
|
||||||
|
|
||||||
// UnsafeIdentityServer may be embedded to opt out of forward compatibility for this service.
|
|
||||||
// Use of this interface is not recommended, as added methods to IdentityServer will
|
|
||||||
// result in compilation errors.
|
|
||||||
type UnsafeIdentityServer interface {
|
|
||||||
mustEmbedUnimplementedIdentityServer()
|
|
||||||
}
|
|
||||||
|
|
||||||
func RegisterIdentityServer(s grpc.ServiceRegistrar, srv IdentityServer) {
|
|
||||||
// If the following call panics, it indicates UnimplementedIdentityServer was
|
|
||||||
// embedded by pointer and is nil. This will cause panics if an
|
|
||||||
// unimplemented method is ever invoked, so we test this at initialization
|
|
||||||
// time to prevent it from happening at runtime later due to I/O.
|
|
||||||
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
|
|
||||||
t.testEmbeddedByValue()
|
|
||||||
}
|
|
||||||
s.RegisterService(&Identity_ServiceDesc, srv)
|
|
||||||
}
|
|
||||||
|
|
||||||
func _Identity_Get_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
||||||
in := new(IdentifierRequest)
|
|
||||||
if err := dec(in); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if interceptor == nil {
|
|
||||||
return srv.(IdentityServer).Get(ctx, in)
|
|
||||||
}
|
|
||||||
info := &grpc.UnaryServerInfo{
|
|
||||||
Server: srv,
|
|
||||||
FullMethod: Identity_Get_FullMethodName,
|
|
||||||
}
|
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
||||||
return srv.(IdentityServer).Get(ctx, req.(*IdentifierRequest))
|
|
||||||
}
|
|
||||||
return interceptor(ctx, in, info, handler)
|
|
||||||
}
|
|
||||||
|
|
||||||
func _Identity_Create_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
||||||
in := new(emptypb.Empty)
|
|
||||||
if err := dec(in); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if interceptor == nil {
|
|
||||||
return srv.(IdentityServer).Create(ctx, in)
|
|
||||||
}
|
|
||||||
info := &grpc.UnaryServerInfo{
|
|
||||||
Server: srv,
|
|
||||||
FullMethod: Identity_Create_FullMethodName,
|
|
||||||
}
|
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
||||||
return srv.(IdentityServer).Create(ctx, req.(*emptypb.Empty))
|
|
||||||
}
|
|
||||||
return interceptor(ctx, in, info, handler)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Identity_ServiceDesc is the grpc.ServiceDesc for Identity service.
|
|
||||||
// It's only intended for direct use with grpc.RegisterService,
|
|
||||||
// and not to be introspected or modified (even as a copy)
|
|
||||||
var Identity_ServiceDesc = grpc.ServiceDesc{
|
|
||||||
ServiceName: "identifier.Identity",
|
|
||||||
HandlerType: (*IdentityServer)(nil),
|
|
||||||
Methods: []grpc.MethodDesc{
|
|
||||||
{
|
|
||||||
MethodName: "Get",
|
|
||||||
Handler: _Identity_Get_Handler,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
MethodName: "Create",
|
|
||||||
Handler: _Identity_Create_Handler,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Streams: []grpc.StreamDesc{},
|
|
||||||
Metadata: "identifier.proto",
|
|
||||||
}
|
|
||||||
237
gen/user.pb.go
Normal file
237
gen/user.pb.go
Normal file
@@ -0,0 +1,237 @@
|
|||||||
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// protoc-gen-go v1.36.11
|
||||||
|
// protoc v6.33.2
|
||||||
|
// source: user.proto
|
||||||
|
|
||||||
|
package gen
|
||||||
|
|
||||||
|
import (
|
||||||
|
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||||
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
|
reflect "reflect"
|
||||||
|
sync "sync"
|
||||||
|
unsafe "unsafe"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// Verify that this generated code is sufficiently up-to-date.
|
||||||
|
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||||
|
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||||
|
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||||
|
)
|
||||||
|
|
||||||
|
type AuthorizationResponse int32
|
||||||
|
|
||||||
|
const (
|
||||||
|
AuthorizationResponse_MESSAGE_TYPE_AUTHORIZED AuthorizationResponse = 0
|
||||||
|
AuthorizationResponse_MESSAGE_TYPE_UNAUTHORIZED AuthorizationResponse = 1
|
||||||
|
)
|
||||||
|
|
||||||
|
// Enum value maps for AuthorizationResponse.
|
||||||
|
var (
|
||||||
|
AuthorizationResponse_name = map[int32]string{
|
||||||
|
0: "MESSAGE_TYPE_AUTHORIZED",
|
||||||
|
1: "MESSAGE_TYPE_UNAUTHORIZED",
|
||||||
|
}
|
||||||
|
AuthorizationResponse_value = map[string]int32{
|
||||||
|
"MESSAGE_TYPE_AUTHORIZED": 0,
|
||||||
|
"MESSAGE_TYPE_UNAUTHORIZED": 1,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
func (x AuthorizationResponse) Enum() *AuthorizationResponse {
|
||||||
|
p := new(AuthorizationResponse)
|
||||||
|
*p = x
|
||||||
|
return p
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x AuthorizationResponse) String() string {
|
||||||
|
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (AuthorizationResponse) Descriptor() protoreflect.EnumDescriptor {
|
||||||
|
return file_user_proto_enumTypes[0].Descriptor()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (AuthorizationResponse) Type() protoreflect.EnumType {
|
||||||
|
return &file_user_proto_enumTypes[0]
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x AuthorizationResponse) Number() protoreflect.EnumNumber {
|
||||||
|
return protoreflect.EnumNumber(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use AuthorizationResponse.Descriptor instead.
|
||||||
|
func (AuthorizationResponse) EnumDescriptor() ([]byte, []int) {
|
||||||
|
return file_user_proto_rawDescGZIP(), []int{0}
|
||||||
|
}
|
||||||
|
|
||||||
|
type CheckRequest struct {
|
||||||
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
|
AuthToken string `protobuf:"bytes,1,opt,name=auth_token,json=authToken,proto3" json:"auth_token,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CheckRequest) Reset() {
|
||||||
|
*x = CheckRequest{}
|
||||||
|
mi := &file_user_proto_msgTypes[0]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CheckRequest) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*CheckRequest) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *CheckRequest) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_user_proto_msgTypes[0]
|
||||||
|
if x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use CheckRequest.ProtoReflect.Descriptor instead.
|
||||||
|
func (*CheckRequest) Descriptor() ([]byte, []int) {
|
||||||
|
return file_user_proto_rawDescGZIP(), []int{0}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CheckRequest) GetAuthToken() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.AuthToken
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
type CheckResponse struct {
|
||||||
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
|
Response AuthorizationResponse `protobuf:"varint,1,opt,name=response,proto3,enum=user.AuthorizationResponse" json:"response,omitempty"`
|
||||||
|
User string `protobuf:"bytes,2,opt,name=user,proto3" json:"user,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CheckResponse) Reset() {
|
||||||
|
*x = CheckResponse{}
|
||||||
|
mi := &file_user_proto_msgTypes[1]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CheckResponse) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*CheckResponse) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *CheckResponse) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_user_proto_msgTypes[1]
|
||||||
|
if x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use CheckResponse.ProtoReflect.Descriptor instead.
|
||||||
|
func (*CheckResponse) Descriptor() ([]byte, []int) {
|
||||||
|
return file_user_proto_rawDescGZIP(), []int{1}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CheckResponse) GetResponse() AuthorizationResponse {
|
||||||
|
if x != nil {
|
||||||
|
return x.Response
|
||||||
|
}
|
||||||
|
return AuthorizationResponse_MESSAGE_TYPE_AUTHORIZED
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CheckResponse) GetUser() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.User
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
var File_user_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
|
const file_user_proto_rawDesc = "" +
|
||||||
|
"\n" +
|
||||||
|
"\n" +
|
||||||
|
"user.proto\x12\x04user\"-\n" +
|
||||||
|
"\fCheckRequest\x12\x1d\n" +
|
||||||
|
"\n" +
|
||||||
|
"auth_token\x18\x01 \x01(\tR\tauthToken\"\\\n" +
|
||||||
|
"\rCheckResponse\x127\n" +
|
||||||
|
"\bresponse\x18\x01 \x01(\x0e2\x1b.user.AuthorizationResponseR\bresponse\x12\x12\n" +
|
||||||
|
"\x04user\x18\x02 \x01(\tR\x04user*S\n" +
|
||||||
|
"\x15AuthorizationResponse\x12\x1b\n" +
|
||||||
|
"\x17MESSAGE_TYPE_AUTHORIZED\x10\x00\x12\x1d\n" +
|
||||||
|
"\x19MESSAGE_TYPE_UNAUTHORIZED\x10\x012?\n" +
|
||||||
|
"\vUserService\x120\n" +
|
||||||
|
"\x05Check\x12\x12.user.CheckRequest\x1a\x13.user.CheckResponseB\aZ\x05./genb\x06proto3"
|
||||||
|
|
||||||
|
var (
|
||||||
|
file_user_proto_rawDescOnce sync.Once
|
||||||
|
file_user_proto_rawDescData []byte
|
||||||
|
)
|
||||||
|
|
||||||
|
func file_user_proto_rawDescGZIP() []byte {
|
||||||
|
file_user_proto_rawDescOnce.Do(func() {
|
||||||
|
file_user_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_user_proto_rawDesc), len(file_user_proto_rawDesc)))
|
||||||
|
})
|
||||||
|
return file_user_proto_rawDescData
|
||||||
|
}
|
||||||
|
|
||||||
|
var file_user_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
|
||||||
|
var file_user_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
|
||||||
|
var file_user_proto_goTypes = []any{
|
||||||
|
(AuthorizationResponse)(0), // 0: user.AuthorizationResponse
|
||||||
|
(*CheckRequest)(nil), // 1: user.CheckRequest
|
||||||
|
(*CheckResponse)(nil), // 2: user.CheckResponse
|
||||||
|
}
|
||||||
|
var file_user_proto_depIdxs = []int32{
|
||||||
|
0, // 0: user.CheckResponse.response:type_name -> user.AuthorizationResponse
|
||||||
|
1, // 1: user.UserService.Check:input_type -> user.CheckRequest
|
||||||
|
2, // 2: user.UserService.Check:output_type -> user.CheckResponse
|
||||||
|
2, // [2:3] is the sub-list for method output_type
|
||||||
|
1, // [1:2] is the sub-list for method input_type
|
||||||
|
1, // [1:1] is the sub-list for extension type_name
|
||||||
|
1, // [1:1] is the sub-list for extension extendee
|
||||||
|
0, // [0:1] is the sub-list for field type_name
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() { file_user_proto_init() }
|
||||||
|
func file_user_proto_init() {
|
||||||
|
if File_user_proto != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
type x struct{}
|
||||||
|
out := protoimpl.TypeBuilder{
|
||||||
|
File: protoimpl.DescBuilder{
|
||||||
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
|
RawDescriptor: unsafe.Slice(unsafe.StringData(file_user_proto_rawDesc), len(file_user_proto_rawDesc)),
|
||||||
|
NumEnums: 1,
|
||||||
|
NumMessages: 2,
|
||||||
|
NumExtensions: 0,
|
||||||
|
NumServices: 1,
|
||||||
|
},
|
||||||
|
GoTypes: file_user_proto_goTypes,
|
||||||
|
DependencyIndexes: file_user_proto_depIdxs,
|
||||||
|
EnumInfos: file_user_proto_enumTypes,
|
||||||
|
MessageInfos: file_user_proto_msgTypes,
|
||||||
|
}.Build()
|
||||||
|
File_user_proto = out.File
|
||||||
|
file_user_proto_goTypes = nil
|
||||||
|
file_user_proto_depIdxs = nil
|
||||||
|
}
|
||||||
121
gen/user_grpc.pb.go
Normal file
121
gen/user_grpc.pb.go
Normal file
@@ -0,0 +1,121 @@
|
|||||||
|
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// - protoc-gen-go-grpc v1.6.0
|
||||||
|
// - protoc v6.33.2
|
||||||
|
// source: user.proto
|
||||||
|
|
||||||
|
package gen
|
||||||
|
|
||||||
|
import (
|
||||||
|
context "context"
|
||||||
|
grpc "google.golang.org/grpc"
|
||||||
|
codes "google.golang.org/grpc/codes"
|
||||||
|
status "google.golang.org/grpc/status"
|
||||||
|
)
|
||||||
|
|
||||||
|
// This is a compile-time assertion to ensure that this generated file
|
||||||
|
// is compatible with the grpc package it is being compiled against.
|
||||||
|
// Requires gRPC-Go v1.64.0 or later.
|
||||||
|
const _ = grpc.SupportPackageIsVersion9
|
||||||
|
|
||||||
|
const (
|
||||||
|
UserService_Check_FullMethodName = "/user.UserService/Check"
|
||||||
|
)
|
||||||
|
|
||||||
|
// UserServiceClient is the client API for UserService service.
|
||||||
|
//
|
||||||
|
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||||
|
type UserServiceClient interface {
|
||||||
|
Check(ctx context.Context, in *CheckRequest, opts ...grpc.CallOption) (*CheckResponse, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
type userServiceClient struct {
|
||||||
|
cc grpc.ClientConnInterface
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewUserServiceClient(cc grpc.ClientConnInterface) UserServiceClient {
|
||||||
|
return &userServiceClient{cc}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *userServiceClient) Check(ctx context.Context, in *CheckRequest, opts ...grpc.CallOption) (*CheckResponse, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
out := new(CheckResponse)
|
||||||
|
err := c.cc.Invoke(ctx, UserService_Check_FullMethodName, in, out, cOpts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// UserServiceServer is the server API for UserService service.
|
||||||
|
// All implementations must embed UnimplementedUserServiceServer
|
||||||
|
// for forward compatibility.
|
||||||
|
type UserServiceServer interface {
|
||||||
|
Check(context.Context, *CheckRequest) (*CheckResponse, error)
|
||||||
|
mustEmbedUnimplementedUserServiceServer()
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnimplementedUserServiceServer must be embedded to have
|
||||||
|
// forward compatible implementations.
|
||||||
|
//
|
||||||
|
// NOTE: this should be embedded by value instead of pointer to avoid a nil
|
||||||
|
// pointer dereference when methods are called.
|
||||||
|
type UnimplementedUserServiceServer struct{}
|
||||||
|
|
||||||
|
func (UnimplementedUserServiceServer) Check(context.Context, *CheckRequest) (*CheckResponse, error) {
|
||||||
|
return nil, status.Error(codes.Unimplemented, "method Check not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedUserServiceServer) mustEmbedUnimplementedUserServiceServer() {}
|
||||||
|
func (UnimplementedUserServiceServer) testEmbeddedByValue() {}
|
||||||
|
|
||||||
|
// UnsafeUserServiceServer may be embedded to opt out of forward compatibility for this service.
|
||||||
|
// Use of this interface is not recommended, as added methods to UserServiceServer will
|
||||||
|
// result in compilation errors.
|
||||||
|
type UnsafeUserServiceServer interface {
|
||||||
|
mustEmbedUnimplementedUserServiceServer()
|
||||||
|
}
|
||||||
|
|
||||||
|
func RegisterUserServiceServer(s grpc.ServiceRegistrar, srv UserServiceServer) {
|
||||||
|
// If the following call panics, it indicates UnimplementedUserServiceServer was
|
||||||
|
// embedded by pointer and is nil. This will cause panics if an
|
||||||
|
// unimplemented method is ever invoked, so we test this at initialization
|
||||||
|
// time to prevent it from happening at runtime later due to I/O.
|
||||||
|
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
|
||||||
|
t.testEmbeddedByValue()
|
||||||
|
}
|
||||||
|
s.RegisterService(&UserService_ServiceDesc, srv)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _UserService_Check_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(CheckRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(UserServiceServer).Check(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: UserService_Check_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(UserServiceServer).Check(ctx, req.(*CheckRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UserService_ServiceDesc is the grpc.ServiceDesc for UserService service.
|
||||||
|
// It's only intended for direct use with grpc.RegisterService,
|
||||||
|
// and not to be introspected or modified (even as a copy)
|
||||||
|
var UserService_ServiceDesc = grpc.ServiceDesc{
|
||||||
|
ServiceName: "user.UserService",
|
||||||
|
HandlerType: (*UserServiceServer)(nil),
|
||||||
|
Methods: []grpc.MethodDesc{
|
||||||
|
{
|
||||||
|
MethodName: "Check",
|
||||||
|
Handler: _UserService_Check_Handler,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Streams: []grpc.StreamDesc{},
|
||||||
|
Metadata: "user.proto",
|
||||||
|
}
|
||||||
69
proto/events.proto
Normal file
69
proto/events.proto
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package events;
|
||||||
|
|
||||||
|
option go_package = "./gen";
|
||||||
|
|
||||||
|
import "google/protobuf/timestamp.proto";
|
||||||
|
|
||||||
|
service EventService {
|
||||||
|
rpc Subscribe(stream Node) returns (stream Events);
|
||||||
|
}
|
||||||
|
|
||||||
|
enum EventType {
|
||||||
|
AUTHENTICATION = 0;
|
||||||
|
SLUG_CHANGE = 1;
|
||||||
|
SLUG_CHANGE_RESPONSE = 2;
|
||||||
|
GET_SESSIONS = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Events {
|
||||||
|
EventType type = 1;
|
||||||
|
|
||||||
|
oneof payload {
|
||||||
|
SlugChangeEvent slug_event = 11;
|
||||||
|
GetSessionsEvent get_sessions_event = 12;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
message Node {
|
||||||
|
EventType type = 1;
|
||||||
|
|
||||||
|
oneof payload {
|
||||||
|
Authentication auth_event = 10;
|
||||||
|
SlugChangeEventResponse slug_event_response = 11;
|
||||||
|
GetSessionsResponse get_sessions_event = 12;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
message Authentication {
|
||||||
|
string auth_token = 1;
|
||||||
|
string identity = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message SlugChangeEvent {
|
||||||
|
string old = 1;
|
||||||
|
string new = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message SlugChangeEventResponse {
|
||||||
|
bool success = 1;
|
||||||
|
string message = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetSessionsEvent {
|
||||||
|
string identity = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetSessionsResponse {
|
||||||
|
repeated Detail details = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Detail {
|
||||||
|
string node = 1;
|
||||||
|
string forwarding_type = 2;
|
||||||
|
string slug = 3;
|
||||||
|
string user_id = 4;
|
||||||
|
bool active = 5;
|
||||||
|
google.protobuf.Timestamp started_at = 6;
|
||||||
|
}
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
syntax = "proto3";
|
|
||||||
|
|
||||||
package identifier;
|
|
||||||
|
|
||||||
option go_package = "./gen";
|
|
||||||
|
|
||||||
import "google/protobuf/empty.proto";
|
|
||||||
|
|
||||||
service Identity {
|
|
||||||
rpc Get(IdentifierRequest) returns (IdentifierResponse);
|
|
||||||
rpc Create(google.protobuf.Empty) returns (IdentifierResponse);
|
|
||||||
}
|
|
||||||
|
|
||||||
message IdentifierRequest {
|
|
||||||
string id = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
message IdentifierResponse {
|
|
||||||
string id = 1;
|
|
||||||
string slug = 2;
|
|
||||||
}
|
|
||||||
23
proto/user.proto
Normal file
23
proto/user.proto
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package user;
|
||||||
|
|
||||||
|
option go_package = "./gen";
|
||||||
|
|
||||||
|
service UserService {
|
||||||
|
rpc Check(CheckRequest) returns (CheckResponse);
|
||||||
|
}
|
||||||
|
|
||||||
|
enum AuthorizationResponse {
|
||||||
|
MESSAGE_TYPE_AUTHORIZED= 0;
|
||||||
|
MESSAGE_TYPE_UNAUTHORIZED = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message CheckRequest {
|
||||||
|
string auth_token = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message CheckResponse {
|
||||||
|
AuthorizationResponse response = 1;
|
||||||
|
string user = 2;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user