Documentation ¶
Index ¶
- Constants
- Variables
- func RegisterChatServiceServer(s grpc.ServiceRegistrar, srv ChatServiceServer)
- type ChatServiceClient
- type ChatServiceServer
- type ChatService_StreamMessagesClient
- type ChatService_StreamMessagesServer
- type EncryptionType
- func (EncryptionType) Descriptor() protoreflect.EnumDescriptor
- func (x EncryptionType) Enum() *EncryptionType
- func (EncryptionType) EnumDescriptor() ([]byte, []int)deprecated
- func (x EncryptionType) Number() protoreflect.EnumNumber
- func (x EncryptionType) String() string
- func (EncryptionType) Type() protoreflect.EnumType
- type MessageRequest
- func (*MessageRequest) Descriptor() ([]byte, []int)deprecated
- func (x *MessageRequest) GetEncryptedMessage() []byte
- func (x *MessageRequest) GetEncryptionType() EncryptionType
- func (x *MessageRequest) GetFileContent() []byte
- func (x *MessageRequest) GetFileName() string
- func (x *MessageRequest) GetFileSize() uint64
- func (x *MessageRequest) GetFileType() string
- func (x *MessageRequest) GetMessageId() string
- func (x *MessageRequest) GetRecipientId() uint32
- func (x *MessageRequest) GetTimestamp() string
- func (*MessageRequest) ProtoMessage()
- func (x *MessageRequest) ProtoReflect() protoreflect.Message
- func (x *MessageRequest) Reset()
- func (x *MessageRequest) String() string
- type MessageResponse
- func (*MessageResponse) Descriptor() ([]byte, []int)deprecated
- func (x *MessageResponse) GetEncryptedMessage() []byte
- func (x *MessageResponse) GetEncryptionType() EncryptionType
- func (x *MessageResponse) GetMessageId() string
- func (x *MessageResponse) GetRecipientId() uint32
- func (x *MessageResponse) GetSenderId() uint32
- func (x *MessageResponse) GetSenderUsername() string
- func (x *MessageResponse) GetStatus() string
- func (x *MessageResponse) GetTimestamp() string
- func (*MessageResponse) ProtoMessage()
- func (x *MessageResponse) ProtoReflect() protoreflect.Message
- func (x *MessageResponse) Reset()
- func (x *MessageResponse) String() string
- type UnimplementedChatServiceServer
- type UnsafeChatServiceServer
Constants ¶
const (
ChatService_StreamMessages_FullMethodName = "/chat.ChatService/StreamMessages"
)
Variables ¶
var ( EncryptionType_name = map[int32]string{ 0: "PLAIN", 1: "SIGNAL", 2: "PREKEY", } EncryptionType_value = map[string]int32{ "PLAIN": 0, "SIGNAL": 1, "PREKEY": 2, } )
Enum value maps for EncryptionType.
var ChatService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "chat.ChatService", HandlerType: (*ChatServiceServer)(nil), Methods: []grpc.MethodDesc{}, Streams: []grpc.StreamDesc{ { StreamName: "StreamMessages", Handler: _ChatService_StreamMessages_Handler, ServerStreams: true, ClientStreams: true, }, }, Metadata: "proto/chat/chat.proto", }
ChatService_ServiceDesc is the grpc.ServiceDesc for ChatService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
var File_proto_chat_chat_proto protoreflect.FileDescriptor
Functions ¶
func RegisterChatServiceServer ¶
func RegisterChatServiceServer(s grpc.ServiceRegistrar, srv ChatServiceServer)
Types ¶
type ChatServiceClient ¶
type ChatServiceClient interface { // Bidirectional streaming RPC for sending and receiving messages StreamMessages(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[MessageRequest, MessageResponse], error) }
ChatServiceClient is the client API for ChatService 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.
Define the gRPC service for the chat application Note only message content and files are encrypted Metadata such as recipient_id and timestamp are not encrypted Store everything in the client's local sqlite database
func NewChatServiceClient ¶
func NewChatServiceClient(cc grpc.ClientConnInterface) ChatServiceClient
type ChatServiceServer ¶
type ChatServiceServer interface { // Bidirectional streaming RPC for sending and receiving messages StreamMessages(grpc.BidiStreamingServer[MessageRequest, MessageResponse]) error // contains filtered or unexported methods }
ChatServiceServer is the server API for ChatService service. All implementations must embed UnimplementedChatServiceServer for forward compatibility.
Define the gRPC service for the chat application Note only message content and files are encrypted Metadata such as recipient_id and timestamp are not encrypted Store everything in the client's local sqlite database
type ChatService_StreamMessagesClient ¶
type ChatService_StreamMessagesClient = grpc.BidiStreamingClient[MessageRequest, MessageResponse]
This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type ChatService_StreamMessagesServer ¶
type ChatService_StreamMessagesServer = grpc.BidiStreamingServer[MessageRequest, MessageResponse]
This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type EncryptionType ¶
type EncryptionType int32
Enum for the type of encryption used for the message
const ( EncryptionType_PLAIN EncryptionType = 0 EncryptionType_SIGNAL EncryptionType = 1 EncryptionType_PREKEY EncryptionType = 2 )
func (EncryptionType) Descriptor ¶
func (EncryptionType) Descriptor() protoreflect.EnumDescriptor
func (EncryptionType) Enum ¶
func (x EncryptionType) Enum() *EncryptionType
func (EncryptionType) EnumDescriptor
deprecated
func (EncryptionType) EnumDescriptor() ([]byte, []int)
Deprecated: Use EncryptionType.Descriptor instead.
func (EncryptionType) Number ¶
func (x EncryptionType) Number() protoreflect.EnumNumber
func (EncryptionType) String ¶
func (x EncryptionType) String() string
func (EncryptionType) Type ¶
func (EncryptionType) Type() protoreflect.EnumType
type MessageRequest ¶
type MessageRequest struct { RecipientId uint32 `protobuf:"varint,1,opt,name=recipient_id,json=recipientId,proto3" json:"recipient_id,omitempty"` // Unique identifier of the recipient (user or group ID) EncryptedMessage []byte `protobuf:"bytes,2,opt,name=encrypted_message,json=encryptedMessage,proto3" json:"encrypted_message,omitempty"` // The message content encrypted with the recipient's public key MessageId string `protobuf:"bytes,3,opt,name=message_id,json=messageId,proto3" json:"message_id,omitempty"` // Unique identifier for this message, generated by the client Timestamp string `protobuf:"bytes,4,opt,name=timestamp,proto3" json:"timestamp,omitempty"` // Timestamp of when the message was sent, in ISO 8601 format FileContent []byte `protobuf:"bytes,5,opt,name=file_content,json=fileContent,proto3" json:"file_content,omitempty"` // (Optional) Encrypted file data being sent (if any) FileName string `protobuf:"bytes,6,opt,name=file_name,json=fileName,proto3" json:"file_name,omitempty"` // (Optional) Original name of the file being sent (if any) FileType string `protobuf:"bytes,7,opt,name=file_type,json=fileType,proto3" json:"file_type,omitempty"` // (Optional) MIME type of the file (e.g., "image/png", "application/pdf") FileSize uint64 `protobuf:"varint,8,opt,name=file_size,json=fileSize,proto3" json:"file_size,omitempty"` // (Optional) Size of the file in bytes EncryptionType EncryptionType `` // Type of encryption (Plain, Signal, or PreKey) /* 129-byte string literal not displayed */ // contains filtered or unexported fields }
MessageRequest is used by the client to send messages or files to another user
func (*MessageRequest) Descriptor
deprecated
func (*MessageRequest) Descriptor() ([]byte, []int)
Deprecated: Use MessageRequest.ProtoReflect.Descriptor instead.
func (*MessageRequest) GetEncryptedMessage ¶
func (x *MessageRequest) GetEncryptedMessage() []byte
func (*MessageRequest) GetEncryptionType ¶
func (x *MessageRequest) GetEncryptionType() EncryptionType
func (*MessageRequest) GetFileContent ¶
func (x *MessageRequest) GetFileContent() []byte
func (*MessageRequest) GetFileName ¶
func (x *MessageRequest) GetFileName() string
func (*MessageRequest) GetFileSize ¶
func (x *MessageRequest) GetFileSize() uint64
func (*MessageRequest) GetFileType ¶
func (x *MessageRequest) GetFileType() string
func (*MessageRequest) GetMessageId ¶
func (x *MessageRequest) GetMessageId() string
func (*MessageRequest) GetRecipientId ¶
func (x *MessageRequest) GetRecipientId() uint32
func (*MessageRequest) GetTimestamp ¶
func (x *MessageRequest) GetTimestamp() string
func (*MessageRequest) ProtoMessage ¶
func (*MessageRequest) ProtoMessage()
func (*MessageRequest) ProtoReflect ¶
func (x *MessageRequest) ProtoReflect() protoreflect.Message
func (*MessageRequest) Reset ¶
func (x *MessageRequest) Reset()
func (*MessageRequest) String ¶
func (x *MessageRequest) String() string
type MessageResponse ¶
type MessageResponse struct { SenderId uint32 `protobuf:"varint,1,opt,name=sender_id,json=senderId,proto3" json:"sender_id,omitempty"` // Unique identifier of the sender SenderUsername string `protobuf:"bytes,2,opt,name=sender_username,json=senderUsername,proto3" json:"sender_username,omitempty"` // Username of the sender RecipientId uint32 `protobuf:"varint,3,opt,name=recipient_id,json=recipientId,proto3" json:"recipient_id,omitempty"` // Unique identifier of the recipient MessageId string `protobuf:"bytes,4,opt,name=message_id,json=messageId,proto3" json:"message_id,omitempty"` // The message ID of the message being acknowledged or delivered EncryptedMessage []byte `protobuf:"bytes,5,opt,name=encrypted_message,json=encryptedMessage,proto3" json:"encrypted_message,omitempty"` // The message content encrypted with the recipient's public key Status string `protobuf:"bytes,6,opt,name=status,proto3" json:"status,omitempty"` // Status of the message (e.g., "delivered", "read", "received") Timestamp string `protobuf:"bytes,7,opt,name=timestamp,proto3" json:"timestamp,omitempty"` // Timestamp of when the server processed or delivered the message EncryptionType EncryptionType `` // Type of encryption (Plain, Signal, or PreKey) /* 129-byte string literal not displayed */ // contains filtered or unexported fields }
MessageResponse is used by the server to deliver messages to the recipient.
func (*MessageResponse) Descriptor
deprecated
func (*MessageResponse) Descriptor() ([]byte, []int)
Deprecated: Use MessageResponse.ProtoReflect.Descriptor instead.
func (*MessageResponse) GetEncryptedMessage ¶
func (x *MessageResponse) GetEncryptedMessage() []byte
func (*MessageResponse) GetEncryptionType ¶
func (x *MessageResponse) GetEncryptionType() EncryptionType
func (*MessageResponse) GetMessageId ¶
func (x *MessageResponse) GetMessageId() string
func (*MessageResponse) GetRecipientId ¶
func (x *MessageResponse) GetRecipientId() uint32
func (*MessageResponse) GetSenderId ¶
func (x *MessageResponse) GetSenderId() uint32
func (*MessageResponse) GetSenderUsername ¶
func (x *MessageResponse) GetSenderUsername() string
func (*MessageResponse) GetStatus ¶
func (x *MessageResponse) GetStatus() string
func (*MessageResponse) GetTimestamp ¶
func (x *MessageResponse) GetTimestamp() string
func (*MessageResponse) ProtoMessage ¶
func (*MessageResponse) ProtoMessage()
func (*MessageResponse) ProtoReflect ¶
func (x *MessageResponse) ProtoReflect() protoreflect.Message
func (*MessageResponse) Reset ¶
func (x *MessageResponse) Reset()
func (*MessageResponse) String ¶
func (x *MessageResponse) String() string
type UnimplementedChatServiceServer ¶
type UnimplementedChatServiceServer struct{}
UnimplementedChatServiceServer 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.
func (UnimplementedChatServiceServer) StreamMessages ¶
func (UnimplementedChatServiceServer) StreamMessages(grpc.BidiStreamingServer[MessageRequest, MessageResponse]) error
type UnsafeChatServiceServer ¶
type UnsafeChatServiceServer interface {
// contains filtered or unexported methods
}
UnsafeChatServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to ChatServiceServer will result in compilation errors.