From b47e40d794742cbe88865f7bc4a5266b15c83aaa Mon Sep 17 00:00:00 2001 From: guochao Date: Fri, 28 Apr 2023 00:20:36 +0800 Subject: [PATCH] change package of proto and method name of service to comply with tonic, grpc implementation in rust --- cmd/demo-signal-client/main.go | 15 +-- pkg/impl/signal-server/signaling.go | 6 +- pkg/proto/signaling/codegen.go | 3 - pkg/proto/signaling/signaling.pb.go | 123 ++++++++++++----------- pkg/proto/signaling/signaling.proto | 4 +- pkg/proto/signaling/signaling_grpc.pb.go | 42 ++++---- 6 files changed, 99 insertions(+), 94 deletions(-) delete mode 100644 pkg/proto/signaling/codegen.go diff --git a/cmd/demo-signal-client/main.go b/cmd/demo-signal-client/main.go index be77326..19976fd 100644 --- a/cmd/demo-signal-client/main.go +++ b/cmd/demo-signal-client/main.go @@ -197,7 +197,7 @@ func (client *SignalClient) ConnectServer(ctx context.Context) { client.Program.Send(systemMsg("Connecting to room...")) signal_server := proto.NewSignalingClient(grpcClient) - stream, err := signal_server.Connect(context.Background()) + stream, err := signal_server.Biu(context.Background()) if err != nil { panic(err) } @@ -206,7 +206,7 @@ func (client *SignalClient) ConnectServer(ctx context.Context) { go client.HandleConnection(ctx, grpcClient, stream) } -func (client *SignalClient) HandleConnection(ctx context.Context, grpcClient *grpc.ClientConn, stream proto.Signaling_ConnectClient) { +func (client *SignalClient) HandleConnection(ctx context.Context, grpcClient *grpc.ClientConn, stream proto.Signaling_BiuClient) { defer grpcClient.Close() room := client.Room clientId := client.Name @@ -226,6 +226,9 @@ func (client *SignalClient) HandleConnection(ctx context.Context, grpcClient *gr if err == io.EOF { break } + if err != nil { + panic(err) + } switch inner := msg.Message.(type) { case *proto.SignalingMessage_Bootstrap: client.OnBootstrapReady(ctx, stream, room, clientId) @@ -241,7 +244,7 @@ func (client *SignalClient) HandleConnection(ctx context.Context, grpcClient *gr } } -func (client *SignalClient) OnBootstrapReady(ctx context.Context, stream proto.Signaling_ConnectClient, room, name string) { +func (client *SignalClient) OnBootstrapReady(ctx context.Context, stream proto.Signaling_BiuClient, room, name string) { client.Program.Send(systemMsg("Server ready!")) stream.Send(&proto.SignalingMessage{ Room: room, @@ -250,7 +253,7 @@ func (client *SignalClient) OnBootstrapReady(ctx context.Context, stream proto.S }) } -func (client *SignalClient) OnDiscoverRequest(ctx context.Context, stream proto.Signaling_ConnectClient, room, name, sender string) { +func (client *SignalClient) OnDiscoverRequest(ctx context.Context, stream proto.Signaling_BiuClient, room, name, sender string) { client.Program.Send(systemMsg("Client " + sender + " is joining into the room " + room)) stream.Send(&proto.SignalingMessage{ Room: room, @@ -260,7 +263,7 @@ func (client *SignalClient) OnDiscoverRequest(ctx context.Context, stream proto. }) } -func (client *SignalClient) OnDiscoverResponse(ctx context.Context, stream proto.Signaling_ConnectClient, room, name, sender string) { +func (client *SignalClient) OnDiscoverResponse(ctx context.Context, stream proto.Signaling_BiuClient, room, name, sender string) { client.Program.Send(systemMsg("Client " + sender + " ponged")) peerConnection, err := client.GetOrCreatePeerConnection(sender) @@ -306,7 +309,7 @@ func (client *SignalClient) OnDiscoverResponse(ctx context.Context, stream proto }) } -func (client *SignalClient) OnOffer(ctx context.Context, stream proto.Signaling_ConnectClient, room, name, sender, sdp string) { +func (client *SignalClient) OnOffer(ctx context.Context, stream proto.Signaling_BiuClient, room, name, sender, sdp string) { client.Program.Send(systemMsg("Client " + sender + " is offering")) peerConnection, err := client.GetOrCreatePeerConnection(sender) diff --git a/pkg/impl/signal-server/signaling.go b/pkg/impl/signal-server/signaling.go index b3b3208..9fddd21 100644 --- a/pkg/impl/signal-server/signaling.go +++ b/pkg/impl/signal-server/signaling.go @@ -46,7 +46,7 @@ func New(options Options) (*SignalingServer, error) { }, nil } -func (signalingServer SignalingServer) handleStream(ctx context.Context, errGroup *errgroup.Group, stream proto.Signaling_ConnectServer) func() error { +func (signalingServer SignalingServer) handleStream(ctx context.Context, errGroup *errgroup.Group, stream proto.Signaling_BiuServer) func() error { return func() error { for { msg, err := stream.Recv() @@ -99,7 +99,7 @@ func (signalingServer SignalingServer) handleStream(ctx context.Context, errGrou } } -func (signalingServer SignalingServer) handleRedisPubSub(ctx context.Context, name, room string, stream proto.Signaling_ConnectServer) func() error { +func (signalingServer SignalingServer) handleRedisPubSub(ctx context.Context, name, room string, stream proto.Signaling_BiuServer) func() error { return func() error { pubsub := signalingServer.redis.Subscribe(ctx, signalingServer.redisKeyPrefix+":"+room+":discover", @@ -180,7 +180,7 @@ func (signalingServer SignalingServer) handleRedisPubSub(ctx context.Context, na } } -func (signalingServer SignalingServer) Connect(stream proto.Signaling_ConnectServer) error { +func (signalingServer SignalingServer) Connect(stream proto.Signaling_BiuServer) error { ctx, cancel := context.WithCancel(stream.Context()) defer cancel() diff --git a/pkg/proto/signaling/codegen.go b/pkg/proto/signaling/codegen.go deleted file mode 100644 index 9345dcb..0000000 --- a/pkg/proto/signaling/codegen.go +++ /dev/null @@ -1,3 +0,0 @@ -package signaling - -//go:generate protoc --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative *.proto diff --git a/pkg/proto/signaling/signaling.pb.go b/pkg/proto/signaling/signaling.pb.go index 33f5c5f..3f354ae 100644 --- a/pkg/proto/signaling/signaling.pb.go +++ b/pkg/proto/signaling/signaling.pb.go @@ -79,7 +79,7 @@ type SDPMessage struct { unknownFields protoimpl.UnknownFields SDP string `protobuf:"bytes,1,opt,name=SDP,proto3" json:"SDP,omitempty"` - Type SDPMessageType `protobuf:"varint,2,opt,name=Type,proto3,enum=SDPMessageType" json:"Type,omitempty"` + Type SDPMessageType `protobuf:"varint,2,opt,name=Type,proto3,enum=signaling.SDPMessageType" json:"Type,omitempty"` Sender string `protobuf:"bytes,3,opt,name=Sender,proto3" json:"Sender,omitempty"` } @@ -288,55 +288,58 @@ var File_pkg_proto_signaling_signaling_proto protoreflect.FileDescriptor var file_pkg_proto_signaling_signaling_proto_rawDesc = []byte{ 0x0a, 0x23, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x69, 0x6e, 0x67, 0x2f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x69, 0x6e, 0x67, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x22, 0x5b, 0x0a, 0x0a, 0x53, 0x44, 0x50, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x12, 0x10, 0x0a, 0x03, 0x53, 0x44, 0x50, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x53, - 0x44, 0x50, 0x12, 0x23, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, - 0x32, 0x0f, 0x2e, 0x53, 0x44, 0x50, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x54, 0x79, 0x70, - 0x65, 0x52, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x53, 0x65, 0x6e, 0x64, 0x65, - 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x22, - 0xa1, 0x03, 0x0a, 0x10, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x69, 0x6e, 0x67, 0x4d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x52, 0x6f, 0x6f, 0x6d, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x04, 0x52, 0x6f, 0x6f, 0x6d, 0x12, 0x16, 0x0a, 0x06, 0x53, 0x65, 0x6e, 0x64, - 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, - 0x12, 0x1f, 0x0a, 0x08, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x09, 0x48, 0x01, 0x52, 0x08, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x72, 0x88, 0x01, - 0x01, 0x12, 0x36, 0x0a, 0x09, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x18, 0x0a, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x48, 0x00, 0x52, 0x09, - 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x12, 0x42, 0x0a, 0x0f, 0x44, 0x69, 0x73, - 0x63, 0x6f, 0x76, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x0b, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x48, 0x00, 0x52, 0x0f, 0x44, 0x69, - 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x44, 0x0a, - 0x10, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x69, 0x6e, 0x67, + 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x65, 0x0a, + 0x0a, 0x53, 0x44, 0x50, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x53, + 0x44, 0x50, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x53, 0x44, 0x50, 0x12, 0x2d, 0x0a, + 0x04, 0x54, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x19, 0x2e, 0x73, 0x69, + 0x67, 0x6e, 0x61, 0x6c, 0x69, 0x6e, 0x67, 0x2e, 0x53, 0x44, 0x50, 0x4d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, + 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x53, 0x65, + 0x6e, 0x64, 0x65, 0x72, 0x22, 0xb5, 0x03, 0x0a, 0x10, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x69, + 0x6e, 0x67, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x52, 0x6f, 0x6f, + 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x52, 0x6f, 0x6f, 0x6d, 0x12, 0x16, 0x0a, + 0x06, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x53, + 0x65, 0x6e, 0x64, 0x65, 0x72, 0x12, 0x1f, 0x0a, 0x08, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, + 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x08, 0x52, 0x65, 0x63, 0x65, 0x69, + 0x76, 0x65, 0x72, 0x88, 0x01, 0x01, 0x12, 0x36, 0x0a, 0x09, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, + 0x72, 0x61, 0x70, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, + 0x79, 0x48, 0x00, 0x52, 0x09, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x12, 0x42, + 0x0a, 0x0f, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x48, - 0x00, 0x52, 0x10, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x31, 0x0a, 0x0c, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x4f, 0x66, - 0x66, 0x65, 0x72, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x53, 0x44, 0x50, 0x4d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x48, 0x00, 0x52, 0x0c, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, - 0x6e, 0x4f, 0x66, 0x66, 0x65, 0x72, 0x12, 0x33, 0x0a, 0x0d, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, - 0x6e, 0x41, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, - 0x53, 0x44, 0x50, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x48, 0x00, 0x52, 0x0d, 0x53, 0x65, - 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x41, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x42, 0x09, 0x0a, 0x07, 0x4d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x52, 0x65, 0x63, 0x65, 0x69, - 0x76, 0x65, 0x72, 0x2a, 0x40, 0x0a, 0x0e, 0x53, 0x44, 0x50, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x09, 0x0a, 0x05, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x10, 0x00, - 0x12, 0x09, 0x0a, 0x05, 0x41, 0x75, 0x64, 0x69, 0x6f, 0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x56, - 0x69, 0x64, 0x65, 0x6f, 0x41, 0x75, 0x64, 0x69, 0x6f, 0x10, 0x02, 0x12, 0x08, 0x0a, 0x04, 0x44, - 0x61, 0x74, 0x61, 0x10, 0x03, 0x32, 0x40, 0x0a, 0x09, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x69, - 0x6e, 0x67, 0x12, 0x33, 0x0a, 0x07, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x12, 0x11, 0x2e, - 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x69, 0x6e, 0x67, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x1a, 0x11, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x69, 0x6e, 0x67, 0x4d, 0x65, 0x73, 0x73, - 0x61, 0x67, 0x65, 0x28, 0x01, 0x30, 0x01, 0x42, 0x52, 0x5a, 0x50, 0x67, 0x69, 0x74, 0x2e, 0x6a, - 0x65, 0x66, 0x66, 0x74, 0x68, 0x65, 0x63, 0x6f, 0x64, 0x65, 0x72, 0x2e, 0x78, 0x79, 0x7a, 0x2f, - 0x67, 0x75, 0x6f, 0x63, 0x68, 0x61, 0x6f, 0x2f, 0x6d, 0x65, 0x6f, 0x77, 0x2d, 0x73, 0x69, 0x67, - 0x6e, 0x61, 0x6c, 0x69, 0x6e, 0x67, 0x2e, 0x6a, 0x65, 0x66, 0x66, 0x74, 0x68, 0x65, 0x63, 0x6f, - 0x64, 0x65, 0x72, 0x2e, 0x78, 0x79, 0x7a, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x2f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x69, 0x6e, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, + 0x00, 0x52, 0x0f, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x44, 0x0a, 0x10, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, + 0x6d, 0x70, 0x74, 0x79, 0x48, 0x00, 0x52, 0x10, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3b, 0x0a, 0x0c, 0x53, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x4f, 0x66, 0x66, 0x65, 0x72, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, + 0x2e, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x69, 0x6e, 0x67, 0x2e, 0x53, 0x44, 0x50, 0x4d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x48, 0x00, 0x52, 0x0c, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x4f, 0x66, 0x66, 0x65, 0x72, 0x12, 0x3d, 0x0a, 0x0d, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x41, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x73, + 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x69, 0x6e, 0x67, 0x2e, 0x53, 0x44, 0x50, 0x4d, 0x65, 0x73, 0x73, + 0x61, 0x67, 0x65, 0x48, 0x00, 0x52, 0x0d, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x41, 0x6e, + 0x73, 0x77, 0x65, 0x72, 0x42, 0x09, 0x0a, 0x07, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x42, + 0x0b, 0x0a, 0x09, 0x5f, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x72, 0x2a, 0x40, 0x0a, 0x0e, + 0x53, 0x44, 0x50, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x09, + 0x0a, 0x05, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x41, 0x75, 0x64, + 0x69, 0x6f, 0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x41, 0x75, 0x64, + 0x69, 0x6f, 0x10, 0x02, 0x12, 0x08, 0x0a, 0x04, 0x44, 0x61, 0x74, 0x61, 0x10, 0x03, 0x32, 0x50, + 0x0a, 0x09, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x69, 0x6e, 0x67, 0x12, 0x43, 0x0a, 0x03, 0x42, + 0x69, 0x75, 0x12, 0x1b, 0x2e, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x69, 0x6e, 0x67, 0x2e, 0x53, + 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x69, 0x6e, 0x67, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a, + 0x1b, 0x2e, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x69, 0x6e, 0x67, 0x2e, 0x53, 0x69, 0x67, 0x6e, + 0x61, 0x6c, 0x69, 0x6e, 0x67, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x28, 0x01, 0x30, 0x01, + 0x42, 0x52, 0x5a, 0x50, 0x67, 0x69, 0x74, 0x2e, 0x6a, 0x65, 0x66, 0x66, 0x74, 0x68, 0x65, 0x63, + 0x6f, 0x64, 0x65, 0x72, 0x2e, 0x78, 0x79, 0x7a, 0x2f, 0x67, 0x75, 0x6f, 0x63, 0x68, 0x61, 0x6f, + 0x2f, 0x6d, 0x65, 0x6f, 0x77, 0x2d, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x69, 0x6e, 0x67, 0x2e, + 0x6a, 0x65, 0x66, 0x66, 0x74, 0x68, 0x65, 0x63, 0x6f, 0x64, 0x65, 0x72, 0x2e, 0x78, 0x79, 0x7a, + 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x69, 0x67, 0x6e, 0x61, + 0x6c, 0x69, 0x6e, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -354,20 +357,20 @@ func file_pkg_proto_signaling_signaling_proto_rawDescGZIP() []byte { var file_pkg_proto_signaling_signaling_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_pkg_proto_signaling_signaling_proto_msgTypes = make([]protoimpl.MessageInfo, 2) var file_pkg_proto_signaling_signaling_proto_goTypes = []interface{}{ - (SDPMessageType)(0), // 0: SDPMessageType - (*SDPMessage)(nil), // 1: SDPMessage - (*SignalingMessage)(nil), // 2: SignalingMessage + (SDPMessageType)(0), // 0: signaling.SDPMessageType + (*SDPMessage)(nil), // 1: signaling.SDPMessage + (*SignalingMessage)(nil), // 2: signaling.SignalingMessage (*emptypb.Empty)(nil), // 3: google.protobuf.Empty } var file_pkg_proto_signaling_signaling_proto_depIdxs = []int32{ - 0, // 0: SDPMessage.Type:type_name -> SDPMessageType - 3, // 1: SignalingMessage.Bootstrap:type_name -> google.protobuf.Empty - 3, // 2: SignalingMessage.DiscoverRequest:type_name -> google.protobuf.Empty - 3, // 3: SignalingMessage.DiscoverResponse:type_name -> google.protobuf.Empty - 1, // 4: SignalingMessage.SessionOffer:type_name -> SDPMessage - 1, // 5: SignalingMessage.SessionAnswer:type_name -> SDPMessage - 2, // 6: Signaling.Connect:input_type -> SignalingMessage - 2, // 7: Signaling.Connect:output_type -> SignalingMessage + 0, // 0: signaling.SDPMessage.Type:type_name -> signaling.SDPMessageType + 3, // 1: signaling.SignalingMessage.Bootstrap:type_name -> google.protobuf.Empty + 3, // 2: signaling.SignalingMessage.DiscoverRequest:type_name -> google.protobuf.Empty + 3, // 3: signaling.SignalingMessage.DiscoverResponse:type_name -> google.protobuf.Empty + 1, // 4: signaling.SignalingMessage.SessionOffer:type_name -> signaling.SDPMessage + 1, // 5: signaling.SignalingMessage.SessionAnswer:type_name -> signaling.SDPMessage + 2, // 6: signaling.Signaling.Biu:input_type -> signaling.SignalingMessage + 2, // 7: signaling.Signaling.Biu:output_type -> signaling.SignalingMessage 7, // [7:8] is the sub-list for method output_type 6, // [6:7] is the sub-list for method input_type 6, // [6:6] is the sub-list for extension type_name diff --git a/pkg/proto/signaling/signaling.proto b/pkg/proto/signaling/signaling.proto index 12ebbba..0258df5 100644 --- a/pkg/proto/signaling/signaling.proto +++ b/pkg/proto/signaling/signaling.proto @@ -1,5 +1,7 @@ syntax = "proto3"; +package signaling; + option go_package = "git.jeffthecoder.xyz/guochao/meow-signaling.jeffthecoder.xyz/pkg/proto/signaling"; import "google/protobuf/empty.proto"; @@ -32,5 +34,5 @@ message SignalingMessage { } service Signaling { - rpc Connect(stream SignalingMessage) returns (stream SignalingMessage); + rpc Biu(stream SignalingMessage) returns (stream SignalingMessage); } \ No newline at end of file diff --git a/pkg/proto/signaling/signaling_grpc.pb.go b/pkg/proto/signaling/signaling_grpc.pb.go index bff1b08..4c6e428 100644 --- a/pkg/proto/signaling/signaling_grpc.pb.go +++ b/pkg/proto/signaling/signaling_grpc.pb.go @@ -19,14 +19,14 @@ import ( const _ = grpc.SupportPackageIsVersion7 const ( - Signaling_Connect_FullMethodName = "/Signaling/Connect" + Signaling_Biu_FullMethodName = "/signaling.Signaling/Biu" ) // SignalingClient is the client API for Signaling 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 SignalingClient interface { - Connect(ctx context.Context, opts ...grpc.CallOption) (Signaling_ConnectClient, error) + Biu(ctx context.Context, opts ...grpc.CallOption) (Signaling_BiuClient, error) } type signalingClient struct { @@ -37,30 +37,30 @@ func NewSignalingClient(cc grpc.ClientConnInterface) SignalingClient { return &signalingClient{cc} } -func (c *signalingClient) Connect(ctx context.Context, opts ...grpc.CallOption) (Signaling_ConnectClient, error) { - stream, err := c.cc.NewStream(ctx, &Signaling_ServiceDesc.Streams[0], Signaling_Connect_FullMethodName, opts...) +func (c *signalingClient) Biu(ctx context.Context, opts ...grpc.CallOption) (Signaling_BiuClient, error) { + stream, err := c.cc.NewStream(ctx, &Signaling_ServiceDesc.Streams[0], Signaling_Biu_FullMethodName, opts...) if err != nil { return nil, err } - x := &signalingConnectClient{stream} + x := &signalingBiuClient{stream} return x, nil } -type Signaling_ConnectClient interface { +type Signaling_BiuClient interface { Send(*SignalingMessage) error Recv() (*SignalingMessage, error) grpc.ClientStream } -type signalingConnectClient struct { +type signalingBiuClient struct { grpc.ClientStream } -func (x *signalingConnectClient) Send(m *SignalingMessage) error { +func (x *signalingBiuClient) Send(m *SignalingMessage) error { return x.ClientStream.SendMsg(m) } -func (x *signalingConnectClient) Recv() (*SignalingMessage, error) { +func (x *signalingBiuClient) Recv() (*SignalingMessage, error) { m := new(SignalingMessage) if err := x.ClientStream.RecvMsg(m); err != nil { return nil, err @@ -72,7 +72,7 @@ func (x *signalingConnectClient) Recv() (*SignalingMessage, error) { // All implementations must embed UnimplementedSignalingServer // for forward compatibility type SignalingServer interface { - Connect(Signaling_ConnectServer) error + Biu(Signaling_BiuServer) error mustEmbedUnimplementedSignalingServer() } @@ -80,8 +80,8 @@ type SignalingServer interface { type UnimplementedSignalingServer struct { } -func (UnimplementedSignalingServer) Connect(Signaling_ConnectServer) error { - return status.Errorf(codes.Unimplemented, "method Connect not implemented") +func (UnimplementedSignalingServer) Biu(Signaling_BiuServer) error { + return status.Errorf(codes.Unimplemented, "method Biu not implemented") } func (UnimplementedSignalingServer) mustEmbedUnimplementedSignalingServer() {} @@ -96,25 +96,25 @@ func RegisterSignalingServer(s grpc.ServiceRegistrar, srv SignalingServer) { s.RegisterService(&Signaling_ServiceDesc, srv) } -func _Signaling_Connect_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(SignalingServer).Connect(&signalingConnectServer{stream}) +func _Signaling_Biu_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(SignalingServer).Biu(&signalingBiuServer{stream}) } -type Signaling_ConnectServer interface { +type Signaling_BiuServer interface { Send(*SignalingMessage) error Recv() (*SignalingMessage, error) grpc.ServerStream } -type signalingConnectServer struct { +type signalingBiuServer struct { grpc.ServerStream } -func (x *signalingConnectServer) Send(m *SignalingMessage) error { +func (x *signalingBiuServer) Send(m *SignalingMessage) error { return x.ServerStream.SendMsg(m) } -func (x *signalingConnectServer) Recv() (*SignalingMessage, error) { +func (x *signalingBiuServer) Recv() (*SignalingMessage, error) { m := new(SignalingMessage) if err := x.ServerStream.RecvMsg(m); err != nil { return nil, err @@ -126,13 +126,13 @@ func (x *signalingConnectServer) Recv() (*SignalingMessage, error) { // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) var Signaling_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "Signaling", + ServiceName: "signaling.Signaling", HandlerType: (*SignalingServer)(nil), Methods: []grpc.MethodDesc{}, Streams: []grpc.StreamDesc{ { - StreamName: "Connect", - Handler: _Signaling_Connect_Handler, + StreamName: "Biu", + Handler: _Signaling_Biu_Handler, ServerStreams: true, ClientStreams: true, },