WIP: refactor/api #1

Draft
rob wants to merge 26 commits from refactor/api into main
4 changed files with 131 additions and 133 deletions
Showing only changes of commit f006187894 - Show all commits

View File

@ -115,17 +115,16 @@ func (a *App) Run(ctx context.Context) error {
}
func (a *App) doHandshake(stream pb.InternalAPI_CommunicateClient) error {
if err := stream.Send(&pb.Envelope{Payload: &pb.Envelope_Command{Command: &pb.Command{CommandType: &pb.Command_StartHandshake{}}}}); err != nil {
return fmt.Errorf("send start handshake command: %w", err)
}
env, err := stream.Recv()
if err != nil {
return fmt.Errorf("receive ready event: %w", err)
return fmt.Errorf("receive handshake completed event: %w", err)
}
if evt := env.GetEvent(); evt == nil || evt.GetInternalApiReady() == nil {
return fmt.Errorf("expected ready event but got: %T", env)
}
if err = stream.Send(&pb.Envelope{Payload: &pb.Envelope_Command{Command: &pb.Command{CommandType: &pb.Command_StartInternalStream{}}}}); err != nil {
return fmt.Errorf("send start command: %w", err)
if evt := env.GetEvent(); evt == nil || evt.GetHandshakeCompleted() == nil {
return fmt.Errorf("expected handshake completed event but got: %T", env)
}
return nil

View File

@ -164,7 +164,7 @@ type Command struct {
// *Command_StopDestination
// *Command_CloseOtherInstances
// *Command_Quit
// *Command_StartInternalStream
// *Command_StartHandshake
CommandType isCommand_CommandType `protobuf_oneof:"command_type"`
}
@ -249,9 +249,9 @@ func (x *Command) GetQuit() *QuitCommand {
return nil
}
func (x *Command) GetStartInternalStream() *StartInternalStreamCommand {
if x, ok := x.GetCommandType().(*Command_StartInternalStream); ok {
return x.StartInternalStream
func (x *Command) GetStartHandshake() *StartHandshakeCommand {
if x, ok := x.GetCommandType().(*Command_StartHandshake); ok {
return x.StartHandshake
}
return nil
}
@ -284,8 +284,8 @@ type Command_Quit struct {
Quit *QuitCommand `protobuf:"bytes,6,opt,name=quit,proto3,oneof"`
}
type Command_StartInternalStream struct {
StartInternalStream *StartInternalStreamCommand `protobuf:"bytes,7,opt,name=start_internal_stream,json=startInternalStream,proto3,oneof"`
type Command_StartHandshake struct {
StartHandshake *StartHandshakeCommand `protobuf:"bytes,7,opt,name=start_handshake,json=startHandshake,proto3,oneof"`
}
func (*Command_AddDestination) isCommand_CommandType() {}
@ -300,7 +300,7 @@ func (*Command_CloseOtherInstances) isCommand_CommandType() {}
func (*Command_Quit) isCommand_CommandType() {}
func (*Command_StartInternalStream) isCommand_CommandType() {}
func (*Command_StartHandshake) isCommand_CommandType() {}
type AddDestinationCommand struct {
state protoimpl.MessageState
@ -574,14 +574,14 @@ func (*QuitCommand) Descriptor() ([]byte, []int) {
return file_api_proto_rawDescGZIP(), []int{7}
}
type StartInternalStreamCommand struct {
type StartHandshakeCommand struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *StartInternalStreamCommand) Reset() {
*x = StartInternalStreamCommand{}
func (x *StartHandshakeCommand) Reset() {
*x = StartHandshakeCommand{}
if protoimpl.UnsafeEnabled {
mi := &file_api_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -589,13 +589,13 @@ func (x *StartInternalStreamCommand) Reset() {
}
}
func (x *StartInternalStreamCommand) String() string {
func (x *StartHandshakeCommand) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*StartInternalStreamCommand) ProtoMessage() {}
func (*StartHandshakeCommand) ProtoMessage() {}
func (x *StartInternalStreamCommand) ProtoReflect() protoreflect.Message {
func (x *StartHandshakeCommand) ProtoReflect() protoreflect.Message {
mi := &file_api_proto_msgTypes[8]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -607,8 +607,8 @@ func (x *StartInternalStreamCommand) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use StartInternalStreamCommand.ProtoReflect.Descriptor instead.
func (*StartInternalStreamCommand) Descriptor() ([]byte, []int) {
// Deprecated: Use StartHandshakeCommand.ProtoReflect.Descriptor instead.
func (*StartHandshakeCommand) Descriptor() ([]byte, []int) {
return file_api_proto_rawDescGZIP(), []int{8}
}
@ -629,7 +629,7 @@ type Event struct {
// *Event_MediaServerStarted
// *Event_OtherInstanceDetected
// *Event_FatalError
// *Event_InternalApiReady
// *Event_HandshakeCompleted
EventType isEvent_EventType `protobuf_oneof:"event_type"`
}
@ -742,9 +742,9 @@ func (x *Event) GetFatalError() *FatalErrorEvent {
return nil
}
func (x *Event) GetInternalApiReady() *InternalAPIReadyEvent {
if x, ok := x.GetEventType().(*Event_InternalApiReady); ok {
return x.InternalApiReady
func (x *Event) GetHandshakeCompleted() *HandshakeCompletedEvent {
if x, ok := x.GetEventType().(*Event_HandshakeCompleted); ok {
return x.HandshakeCompleted
}
return nil
}
@ -793,8 +793,8 @@ type Event_FatalError struct {
FatalError *FatalErrorEvent `protobuf:"bytes,10,opt,name=fatal_error,json=fatalError,proto3,oneof"`
}
type Event_InternalApiReady struct {
InternalApiReady *InternalAPIReadyEvent `protobuf:"bytes,11,opt,name=internal_api_ready,json=internalApiReady,proto3,oneof"`
type Event_HandshakeCompleted struct {
HandshakeCompleted *HandshakeCompletedEvent `protobuf:"bytes,11,opt,name=handshake_completed,json=handshakeCompleted,proto3,oneof"`
}
func (*Event_AppStateChanged) isEvent_EventType() {}
@ -817,7 +817,7 @@ func (*Event_OtherInstanceDetected) isEvent_EventType() {}
func (*Event_FatalError) isEvent_EventType() {}
func (*Event_InternalApiReady) isEvent_EventType() {}
func (*Event_HandshakeCompleted) isEvent_EventType() {}
type Container struct {
state protoimpl.MessageState
@ -1763,14 +1763,14 @@ func (x *FatalErrorEvent) GetMessage() string {
return ""
}
type InternalAPIReadyEvent struct {
type HandshakeCompletedEvent struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *InternalAPIReadyEvent) Reset() {
*x = InternalAPIReadyEvent{}
func (x *HandshakeCompletedEvent) Reset() {
*x = HandshakeCompletedEvent{}
if protoimpl.UnsafeEnabled {
mi := &file_api_proto_msgTypes[25]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -1778,13 +1778,13 @@ func (x *InternalAPIReadyEvent) Reset() {
}
}
func (x *InternalAPIReadyEvent) String() string {
func (x *HandshakeCompletedEvent) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*InternalAPIReadyEvent) ProtoMessage() {}
func (*HandshakeCompletedEvent) ProtoMessage() {}
func (x *InternalAPIReadyEvent) ProtoReflect() protoreflect.Message {
func (x *HandshakeCompletedEvent) ProtoReflect() protoreflect.Message {
mi := &file_api_proto_msgTypes[25]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -1796,8 +1796,8 @@ func (x *InternalAPIReadyEvent) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use InternalAPIReadyEvent.ProtoReflect.Descriptor instead.
func (*InternalAPIReadyEvent) Descriptor() ([]byte, []int) {
// Deprecated: Use HandshakeCompletedEvent.ProtoReflect.Descriptor instead.
func (*HandshakeCompletedEvent) Descriptor() ([]byte, []int) {
return file_api_proto_rawDescGZIP(), []int{25}
}
@ -1813,7 +1813,7 @@ var file_api_proto_rawDesc = []byte{
0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x12, 0x22, 0x0a, 0x05, 0x65, 0x76, 0x65, 0x6e, 0x74,
0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x45, 0x76, 0x65,
0x6e, 0x74, 0x48, 0x00, 0x52, 0x05, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x70,
0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x22, 0x9d, 0x04, 0x0a, 0x07, 0x43, 0x6f, 0x6d, 0x6d, 0x61,
0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x22, 0x8d, 0x04, 0x0a, 0x07, 0x43, 0x6f, 0x6d, 0x6d, 0x61,
0x6e, 0x64, 0x12, 0x45, 0x0a, 0x0f, 0x61, 0x64, 0x64, 0x5f, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e,
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x61, 0x70,
0x69, 0x2e, 0x41, 0x64, 0x64, 0x44, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e,
@ -1841,12 +1841,11 @@ var file_api_proto_rawDesc = []byte{
0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x73, 0x12, 0x26, 0x0a, 0x04, 0x71, 0x75, 0x69, 0x74, 0x18,
0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x51, 0x75, 0x69, 0x74,
0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x48, 0x00, 0x52, 0x04, 0x71, 0x75, 0x69, 0x74, 0x12,
0x55, 0x0a, 0x15, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61,
0x6c, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f,
0x2e, 0x61, 0x70, 0x69, 0x2e, 0x53, 0x74, 0x61, 0x72, 0x74, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e,
0x61, 0x6c, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x48,
0x00, 0x52, 0x13, 0x73, 0x74, 0x61, 0x72, 0x74, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c,
0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x42, 0x0e, 0x0a, 0x0c, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e,
0x45, 0x0a, 0x0f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x68, 0x61, 0x6e, 0x64, 0x73, 0x68, 0x61,
0x6b, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x53,
0x74, 0x61, 0x72, 0x74, 0x48, 0x61, 0x6e, 0x64, 0x73, 0x68, 0x61, 0x6b, 0x65, 0x43, 0x6f, 0x6d,
0x6d, 0x61, 0x6e, 0x64, 0x48, 0x00, 0x52, 0x0e, 0x73, 0x74, 0x61, 0x72, 0x74, 0x48, 0x61, 0x6e,
0x64, 0x73, 0x68, 0x61, 0x6b, 0x65, 0x42, 0x0e, 0x0a, 0x0c, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e,
0x64, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3d, 0x0a, 0x15, 0x41, 0x64, 0x64, 0x44, 0x65, 0x73,
0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x12,
0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e,
@ -1862,66 +1861,66 @@ var file_api_proto_rawDesc = []byte{
0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x22, 0x1c, 0x0a, 0x1a,
0x43, 0x6c, 0x6f, 0x73, 0x65, 0x4f, 0x74, 0x68, 0x65, 0x72, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e,
0x63, 0x65, 0x73, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x22, 0x0d, 0x0a, 0x0b, 0x51, 0x75,
0x69, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x22, 0x1c, 0x0a, 0x1a, 0x53, 0x74, 0x61,
0x72, 0x74, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d,
0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x22, 0xa4, 0x07, 0x0a, 0x05, 0x45, 0x76, 0x65, 0x6e,
0x74, 0x12, 0x47, 0x0a, 0x11, 0x61, 0x70, 0x70, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x5f, 0x63,
0x68, 0x61, 0x6e, 0x67, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x61,
0x70, 0x69, 0x2e, 0x41, 0x70, 0x70, 0x53, 0x74, 0x61, 0x74, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x67,
0x65, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x48, 0x00, 0x52, 0x0f, 0x61, 0x70, 0x70, 0x53, 0x74,
0x61, 0x74, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x64, 0x12, 0x5f, 0x0a, 0x19, 0x64, 0x65,
0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d,
0x5f, 0x65, 0x78, 0x69, 0x74, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e,
0x61, 0x70, 0x69, 0x2e, 0x44, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53,
0x74, 0x72, 0x65, 0x61, 0x6d, 0x45, 0x78, 0x69, 0x74, 0x65, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74,
0x48, 0x00, 0x52, 0x17, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53,
0x74, 0x72, 0x65, 0x61, 0x6d, 0x45, 0x78, 0x69, 0x74, 0x65, 0x64, 0x12, 0x49, 0x0a, 0x11, 0x64,
0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x61, 0x64, 0x64, 0x65, 0x64,
0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x44, 0x65, 0x73,
0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x64, 0x64, 0x65, 0x64, 0x45, 0x76, 0x65,
0x6e, 0x74, 0x48, 0x00, 0x52, 0x10, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f,
0x6e, 0x41, 0x64, 0x64, 0x65, 0x64, 0x12, 0x56, 0x0a, 0x16, 0x61, 0x64, 0x64, 0x5f, 0x64, 0x65,
0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x66, 0x61, 0x69, 0x6c, 0x65, 0x64,
0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x41, 0x64, 0x64,
0x44, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x61, 0x69, 0x6c, 0x65,
0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x48, 0x00, 0x52, 0x14, 0x61, 0x64, 0x64, 0x44, 0x65, 0x73,
0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x12, 0x4f,
0x0a, 0x13, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x72, 0x65,
0x6d, 0x6f, 0x76, 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x61, 0x70,
0x69, 0x2e, 0x44, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x6d,
0x6f, 0x76, 0x65, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x48, 0x00, 0x52, 0x12, 0x64, 0x65, 0x73,
0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x12,
0x5f, 0x0a, 0x19, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x5f, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e,
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x66, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x18, 0x06, 0x20, 0x01,
0x28, 0x0b, 0x32, 0x21, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x44,
0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64,
0x45, 0x76, 0x65, 0x6e, 0x74, 0x48, 0x00, 0x52, 0x17, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x44,
0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64,
0x12, 0x5c, 0x0a, 0x18, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e,
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x66, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x18, 0x07, 0x20, 0x01,
0x28, 0x0b, 0x32, 0x20, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x53, 0x74, 0x61, 0x72, 0x74, 0x44, 0x65,
0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x45,
0x76, 0x65, 0x6e, 0x74, 0x48, 0x00, 0x52, 0x16, 0x73, 0x74, 0x61, 0x72, 0x74, 0x44, 0x65, 0x73,
0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x12, 0x50,
0x0a, 0x14, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x73,
0x74, 0x61, 0x72, 0x74, 0x65, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x61,
0x70, 0x69, 0x2e, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x74,
0x61, 0x72, 0x74, 0x65, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x48, 0x00, 0x52, 0x12, 0x6d, 0x65,
0x69, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x22, 0x17, 0x0a, 0x15, 0x53, 0x74, 0x61,
0x72, 0x74, 0x48, 0x61, 0x6e, 0x64, 0x73, 0x68, 0x61, 0x6b, 0x65, 0x43, 0x6f, 0x6d, 0x6d, 0x61,
0x6e, 0x64, 0x22, 0xa9, 0x07, 0x0a, 0x05, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x47, 0x0a, 0x11,
0x61, 0x70, 0x70, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x5f, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65,
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x41, 0x70,
0x70, 0x53, 0x74, 0x61, 0x74, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x64, 0x45, 0x76, 0x65,
0x6e, 0x74, 0x48, 0x00, 0x52, 0x0f, 0x61, 0x70, 0x70, 0x53, 0x74, 0x61, 0x74, 0x65, 0x43, 0x68,
0x61, 0x6e, 0x67, 0x65, 0x64, 0x12, 0x5f, 0x0a, 0x19, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61,
0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x5f, 0x65, 0x78, 0x69, 0x74,
0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x44,
0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d,
0x45, 0x78, 0x69, 0x74, 0x65, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x48, 0x00, 0x52, 0x17, 0x64,
0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d,
0x45, 0x78, 0x69, 0x74, 0x65, 0x64, 0x12, 0x49, 0x0a, 0x11, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e,
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x61, 0x64, 0x64, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28,
0x0b, 0x32, 0x1a, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x44, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74,
0x69, 0x6f, 0x6e, 0x41, 0x64, 0x64, 0x65, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x48, 0x00, 0x52,
0x10, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x64, 0x64, 0x65,
0x64, 0x12, 0x56, 0x0a, 0x16, 0x61, 0x64, 0x64, 0x5f, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61,
0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x66, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28,
0x0b, 0x32, 0x1e, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x41, 0x64, 0x64, 0x44, 0x65, 0x73, 0x74, 0x69,
0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x45, 0x76, 0x65, 0x6e,
0x74, 0x48, 0x00, 0x52, 0x14, 0x61, 0x64, 0x64, 0x44, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74,
0x69, 0x6f, 0x6e, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x12, 0x4f, 0x0a, 0x13, 0x64, 0x65, 0x73,
0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x64,
0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x44, 0x65, 0x73,
0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x45,
0x76, 0x65, 0x6e, 0x74, 0x48, 0x00, 0x52, 0x12, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74,
0x69, 0x6f, 0x6e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x12, 0x5f, 0x0a, 0x19, 0x72, 0x65,
0x6d, 0x6f, 0x76, 0x65, 0x5f, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x5f, 0x66, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e,
0x61, 0x70, 0x69, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x44, 0x65, 0x73, 0x74, 0x69, 0x6e,
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74,
0x48, 0x00, 0x52, 0x17, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x44, 0x65, 0x73, 0x74, 0x69, 0x6e,
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x12, 0x5c, 0x0a, 0x18, 0x73,
0x74, 0x61, 0x72, 0x74, 0x5f, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x5f, 0x66, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e,
0x61, 0x70, 0x69, 0x2e, 0x53, 0x74, 0x61, 0x72, 0x74, 0x44, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61,
0x74, 0x69, 0x6f, 0x6e, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x48,
0x00, 0x52, 0x16, 0x73, 0x74, 0x61, 0x72, 0x74, 0x44, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74,
0x69, 0x6f, 0x6e, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x12, 0x50, 0x0a, 0x14, 0x6d, 0x65, 0x64,
0x69, 0x61, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x65,
0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4d, 0x65,
0x64, 0x69, 0x61, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x74, 0x61, 0x72, 0x74, 0x65, 0x64,
0x12, 0x59, 0x0a, 0x17, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x5f, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e,
0x63, 0x65, 0x5f, 0x64, 0x65, 0x74, 0x65, 0x63, 0x74, 0x65, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28,
0x0b, 0x32, 0x1f, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4f, 0x74, 0x68, 0x65, 0x72, 0x49, 0x6e, 0x73,
0x74, 0x61, 0x6e, 0x63, 0x65, 0x44, 0x65, 0x74, 0x65, 0x63, 0x74, 0x65, 0x64, 0x45, 0x76, 0x65,
0x6e, 0x74, 0x48, 0x00, 0x52, 0x15, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x49, 0x6e, 0x73, 0x74, 0x61,
0x6e, 0x63, 0x65, 0x44, 0x65, 0x74, 0x65, 0x63, 0x74, 0x65, 0x64, 0x12, 0x37, 0x0a, 0x0b, 0x66,
0x61, 0x74, 0x61, 0x6c, 0x5f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x14, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x46, 0x61, 0x74, 0x61, 0x6c, 0x45, 0x72, 0x72, 0x6f,
0x72, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x48, 0x00, 0x52, 0x0a, 0x66, 0x61, 0x74, 0x61, 0x6c, 0x45,
0x72, 0x72, 0x6f, 0x72, 0x12, 0x4a, 0x0a, 0x12, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c,
0x5f, 0x61, 0x70, 0x69, 0x5f, 0x72, 0x65, 0x61, 0x64, 0x79, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x1a, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x41,
0x50, 0x49, 0x52, 0x65, 0x61, 0x64, 0x79, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x48, 0x00, 0x52, 0x10,
0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x41, 0x70, 0x69, 0x52, 0x65, 0x61, 0x64, 0x79,
0x45, 0x76, 0x65, 0x6e, 0x74, 0x48, 0x00, 0x52, 0x12, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x53, 0x65,
0x72, 0x76, 0x65, 0x72, 0x53, 0x74, 0x61, 0x72, 0x74, 0x65, 0x64, 0x12, 0x59, 0x0a, 0x17, 0x6f,
0x74, 0x68, 0x65, 0x72, 0x5f, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x64, 0x65,
0x74, 0x65, 0x63, 0x74, 0x65, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x61,
0x70, 0x69, 0x2e, 0x4f, 0x74, 0x68, 0x65, 0x72, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65,
0x44, 0x65, 0x74, 0x65, 0x63, 0x74, 0x65, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x48, 0x00, 0x52,
0x15, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x44, 0x65,
0x74, 0x65, 0x63, 0x74, 0x65, 0x64, 0x12, 0x37, 0x0a, 0x0b, 0x66, 0x61, 0x74, 0x61, 0x6c, 0x5f,
0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x61, 0x70,
0x69, 0x2e, 0x46, 0x61, 0x74, 0x61, 0x6c, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x45, 0x76, 0x65, 0x6e,
0x74, 0x48, 0x00, 0x52, 0x0a, 0x66, 0x61, 0x74, 0x61, 0x6c, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12,
0x4f, 0x0a, 0x13, 0x68, 0x61, 0x6e, 0x64, 0x73, 0x68, 0x61, 0x6b, 0x65, 0x5f, 0x63, 0x6f, 0x6d,
0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x61,
0x70, 0x69, 0x2e, 0x48, 0x61, 0x6e, 0x64, 0x73, 0x68, 0x61, 0x6b, 0x65, 0x43, 0x6f, 0x6d, 0x70,
0x6c, 0x65, 0x74, 0x65, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x48, 0x00, 0x52, 0x12, 0x68, 0x61,
0x6e, 0x64, 0x73, 0x68, 0x61, 0x6b, 0x65, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64,
0x42, 0x0c, 0x0a, 0x0a, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x22, 0xfd,
0x03, 0x0a, 0x09, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02,
0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06,
@ -2035,16 +2034,16 @@ var file_api_proto_rawDesc = []byte{
0x63, 0x74, 0x65, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x22, 0x2b, 0x0a, 0x0f, 0x46, 0x61, 0x74,
0x61, 0x6c, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x18, 0x0a, 0x07,
0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d,
0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x17, 0x0a, 0x15, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e,
0x61, 0x6c, 0x41, 0x50, 0x49, 0x52, 0x65, 0x61, 0x64, 0x79, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x32,
0x3e, 0x0a, 0x0b, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x41, 0x50, 0x49, 0x12, 0x2f,
0x0a, 0x0b, 0x43, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x63, 0x61, 0x74, 0x65, 0x12, 0x0d, 0x2e,
0x61, 0x70, 0x69, 0x2e, 0x45, 0x6e, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x1a, 0x0d, 0x2e, 0x61,
0x70, 0x69, 0x2e, 0x45, 0x6e, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x28, 0x01, 0x30, 0x01, 0x42,
0x35, 0x5a, 0x33, 0x67, 0x69, 0x74, 0x2e, 0x6e, 0x65, 0x74, 0x66, 0x6c, 0x75, 0x78, 0x2e, 0x69,
0x6f, 0x2f, 0x72, 0x6f, 0x62, 0x2f, 0x6f, 0x63, 0x74, 0x6f, 0x70, 0x6c, 0x65, 0x78, 0x2f, 0x69,
0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65,
0x64, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x19, 0x0a, 0x17, 0x48, 0x61, 0x6e, 0x64, 0x73, 0x68,
0x61, 0x6b, 0x65, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x45, 0x76, 0x65, 0x6e,
0x74, 0x32, 0x3e, 0x0a, 0x0b, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x41, 0x50, 0x49,
0x12, 0x2f, 0x0a, 0x0b, 0x43, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x63, 0x61, 0x74, 0x65, 0x12,
0x0d, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x45, 0x6e, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x1a, 0x0d,
0x2e, 0x61, 0x70, 0x69, 0x2e, 0x45, 0x6e, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x28, 0x01, 0x30,
0x01, 0x42, 0x35, 0x5a, 0x33, 0x67, 0x69, 0x74, 0x2e, 0x6e, 0x65, 0x74, 0x66, 0x6c, 0x75, 0x78,
0x2e, 0x69, 0x6f, 0x2f, 0x72, 0x6f, 0x62, 0x2f, 0x6f, 0x63, 0x74, 0x6f, 0x70, 0x6c, 0x65, 0x78,
0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61,
0x74, 0x65, 0x64, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@ -2071,7 +2070,7 @@ var file_api_proto_goTypes = []interface{}{
(*StopDestinationCommand)(nil), // 6: api.StopDestinationCommand
(*CloseOtherInstancesCommand)(nil), // 7: api.CloseOtherInstancesCommand
(*QuitCommand)(nil), // 8: api.QuitCommand
(*StartInternalStreamCommand)(nil), // 9: api.StartInternalStreamCommand
(*StartHandshakeCommand)(nil), // 9: api.StartHandshakeCommand
(*Event)(nil), // 10: api.Event
(*Container)(nil), // 11: api.Container
(*Source)(nil), // 12: api.Source
@ -2088,7 +2087,7 @@ var file_api_proto_goTypes = []interface{}{
(*MediaServerStartedEvent)(nil), // 23: api.MediaServerStartedEvent
(*OtherInstanceDetectedEvent)(nil), // 24: api.OtherInstanceDetectedEvent
(*FatalErrorEvent)(nil), // 25: api.FatalErrorEvent
(*InternalAPIReadyEvent)(nil), // 26: api.InternalAPIReadyEvent
(*HandshakeCompletedEvent)(nil), // 26: api.HandshakeCompletedEvent
(*timestamppb.Timestamp)(nil), // 27: google.protobuf.Timestamp
}
var file_api_proto_depIdxs = []int32{
@ -2100,7 +2099,7 @@ var file_api_proto_depIdxs = []int32{
6, // 5: api.Command.stop_destination:type_name -> api.StopDestinationCommand
7, // 6: api.Command.close_other_instances:type_name -> api.CloseOtherInstancesCommand
8, // 7: api.Command.quit:type_name -> api.QuitCommand
9, // 8: api.Command.start_internal_stream:type_name -> api.StartInternalStreamCommand
9, // 8: api.Command.start_handshake:type_name -> api.StartHandshakeCommand
16, // 9: api.Event.app_state_changed:type_name -> api.AppStateChangedEvent
17, // 10: api.Event.destination_stream_exited:type_name -> api.DestinationStreamExitedEvent
18, // 11: api.Event.destination_added:type_name -> api.DestinationAddedEvent
@ -2111,7 +2110,7 @@ var file_api_proto_depIdxs = []int32{
23, // 16: api.Event.media_server_started:type_name -> api.MediaServerStartedEvent
24, // 17: api.Event.other_instance_detected:type_name -> api.OtherInstanceDetectedEvent
25, // 18: api.Event.fatal_error:type_name -> api.FatalErrorEvent
26, // 19: api.Event.internal_api_ready:type_name -> api.InternalAPIReadyEvent
26, // 19: api.Event.handshake_completed:type_name -> api.HandshakeCompletedEvent
27, // 20: api.Container.rx_since:type_name -> google.protobuf.Timestamp
11, // 21: api.Source.container:type_name -> api.Container
27, // 22: api.Source.live_changed_at:type_name -> google.protobuf.Timestamp
@ -2233,7 +2232,7 @@ func file_api_proto_init() {
}
}
file_api_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*StartInternalStreamCommand); i {
switch v := v.(*StartHandshakeCommand); i {
case 0:
return &v.state
case 1:
@ -2437,7 +2436,7 @@ func file_api_proto_init() {
}
}
file_api_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*InternalAPIReadyEvent); i {
switch v := v.(*HandshakeCompletedEvent); i {
case 0:
return &v.state
case 1:
@ -2460,7 +2459,7 @@ func file_api_proto_init() {
(*Command_StopDestination)(nil),
(*Command_CloseOtherInstances)(nil),
(*Command_Quit)(nil),
(*Command_StartInternalStream)(nil),
(*Command_StartHandshake)(nil),
}
file_api_proto_msgTypes[9].OneofWrappers = []interface{}{
(*Event_AppStateChanged)(nil),
@ -2473,7 +2472,7 @@ func file_api_proto_init() {
(*Event_MediaServerStarted)(nil),
(*Event_OtherInstanceDetected)(nil),
(*Event_FatalError)(nil),
(*Event_InternalApiReady)(nil),
(*Event_HandshakeCompleted)(nil),
}
file_api_proto_msgTypes[10].OneofWrappers = []interface{}{}
type x struct{}

View File

@ -51,15 +51,15 @@ func (s *Server) Communicate(stream pb.InternalAPI_CommunicateServer) error {
g, ctx := errgroup.WithContext(stream.Context())
// perform handshake:
if err := stream.Send(&pb.Envelope{Payload: &pb.Envelope_Event{Event: &pb.Event{EventType: &pb.Event_InternalApiReady{}}}}); err != nil {
return fmt.Errorf("send ready event: %w", err)
}
startStreamCmd, err := stream.Recv()
startHandshakeCmd, err := stream.Recv()
if err != nil {
return fmt.Errorf("receive start stream command: %w", err)
return fmt.Errorf("receive start handshake command: %w", err)
}
if startStreamCmd.GetCommand() == nil || startStreamCmd.GetCommand().GetStartInternalStream() == nil {
return fmt.Errorf("expected start stream command but got: %T", startStreamCmd)
if startHandshakeCmd.GetCommand() == nil || startHandshakeCmd.GetCommand().GetStartHandshake() == nil {
return fmt.Errorf("expected start handshake command but got: %T", startHandshakeCmd)
}
if err := stream.Send(&pb.Envelope{Payload: &pb.Envelope_Event{Event: &pb.Event{EventType: &pb.Event_HandshakeCompleted{}}}}); err != nil {
return fmt.Errorf("send handshake completed event: %w", err)
}
// Notify that a client has connected and completed the handshake.

View File

@ -25,7 +25,7 @@ message Command {
StopDestinationCommand stop_destination = 4;
CloseOtherInstancesCommand close_other_instances = 5;
QuitCommand quit = 6;
StartInternalStreamCommand start_internal_stream = 7;
StartHandshakeCommand start_handshake = 7;
}
}
@ -50,7 +50,7 @@ message CloseOtherInstancesCommand {}
message QuitCommand {}
message StartInternalStreamCommand {}
message StartHandshakeCommand {};
message Event {
oneof event_type {
@ -64,7 +64,7 @@ message Event {
MediaServerStartedEvent media_server_started = 8;
OtherInstanceDetectedEvent other_instance_detected = 9;
FatalErrorEvent fatal_error = 10;
InternalAPIReadyEvent internal_api_ready = 11;
HandshakeCompletedEvent handshake_completed = 11;
}
}
@ -163,4 +163,4 @@ message FatalErrorEvent {
string message = 1;
}
message InternalAPIReadyEvent {}
message HandshakeCompletedEvent {}