change package of proto and method name of service

to comply with tonic, grpc implementation in rust
This commit is contained in:
2023-04-28 00:20:36 +08:00
parent f235fb3680
commit b47e40d794
6 changed files with 99 additions and 94 deletions

View File

@ -197,7 +197,7 @@ func (client *SignalClient) ConnectServer(ctx context.Context) {
client.Program.Send(systemMsg("Connecting to room...")) client.Program.Send(systemMsg("Connecting to room..."))
signal_server := proto.NewSignalingClient(grpcClient) signal_server := proto.NewSignalingClient(grpcClient)
stream, err := signal_server.Connect(context.Background()) stream, err := signal_server.Biu(context.Background())
if err != nil { if err != nil {
panic(err) panic(err)
} }
@ -206,7 +206,7 @@ func (client *SignalClient) ConnectServer(ctx context.Context) {
go client.HandleConnection(ctx, grpcClient, stream) 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() defer grpcClient.Close()
room := client.Room room := client.Room
clientId := client.Name clientId := client.Name
@ -226,6 +226,9 @@ func (client *SignalClient) HandleConnection(ctx context.Context, grpcClient *gr
if err == io.EOF { if err == io.EOF {
break break
} }
if err != nil {
panic(err)
}
switch inner := msg.Message.(type) { switch inner := msg.Message.(type) {
case *proto.SignalingMessage_Bootstrap: case *proto.SignalingMessage_Bootstrap:
client.OnBootstrapReady(ctx, stream, room, clientId) 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!")) client.Program.Send(systemMsg("Server ready!"))
stream.Send(&proto.SignalingMessage{ stream.Send(&proto.SignalingMessage{
Room: room, 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)) client.Program.Send(systemMsg("Client " + sender + " is joining into the room " + room))
stream.Send(&proto.SignalingMessage{ stream.Send(&proto.SignalingMessage{
Room: room, 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")) client.Program.Send(systemMsg("Client " + sender + " ponged"))
peerConnection, err := client.GetOrCreatePeerConnection(sender) 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")) client.Program.Send(systemMsg("Client " + sender + " is offering"))
peerConnection, err := client.GetOrCreatePeerConnection(sender) peerConnection, err := client.GetOrCreatePeerConnection(sender)

View File

@ -46,7 +46,7 @@ func New(options Options) (*SignalingServer, error) {
}, nil }, 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 { return func() error {
for { for {
msg, err := stream.Recv() 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 { return func() error {
pubsub := signalingServer.redis.Subscribe(ctx, pubsub := signalingServer.redis.Subscribe(ctx,
signalingServer.redisKeyPrefix+":"+room+":discover", 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()) ctx, cancel := context.WithCancel(stream.Context())
defer cancel() defer cancel()

View File

@ -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

View File

@ -79,7 +79,7 @@ type SDPMessage struct {
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
SDP string `protobuf:"bytes,1,opt,name=SDP,proto3" json:"SDP,omitempty"` 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"` 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{ 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, 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, 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, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x69, 0x6e, 0x67,
0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,
0x74, 0x6f, 0x22, 0x5b, 0x0a, 0x0a, 0x53, 0x44, 0x50, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x65, 0x0a,
0x12, 0x10, 0x0a, 0x03, 0x53, 0x44, 0x50, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x53, 0x0a, 0x53, 0x44, 0x50, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x53,
0x44, 0x50, 0x12, 0x23, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x44, 0x50, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x53, 0x44, 0x50, 0x12, 0x2d, 0x0a,
0x32, 0x0f, 0x2e, 0x53, 0x44, 0x50, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x54, 0x79, 0x70, 0x04, 0x54, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x19, 0x2e, 0x73, 0x69,
0x65, 0x52, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x67, 0x6e, 0x61, 0x6c, 0x69, 0x6e, 0x67, 0x2e, 0x53, 0x44, 0x50, 0x4d, 0x65, 0x73, 0x73, 0x61,
0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x22, 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06,
0xa1, 0x03, 0x0a, 0x10, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x69, 0x6e, 0x67, 0x4d, 0x65, 0x73, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x53, 0x65,
0x73, 0x61, 0x67, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x52, 0x6f, 0x6f, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x6e, 0x64, 0x65, 0x72, 0x22, 0xb5, 0x03, 0x0a, 0x10, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x69,
0x28, 0x09, 0x52, 0x04, 0x52, 0x6f, 0x6f, 0x6d, 0x12, 0x16, 0x0a, 0x06, 0x53, 0x65, 0x6e, 0x64, 0x6e, 0x67, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x52, 0x6f, 0x6f,
0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x52, 0x6f, 0x6f, 0x6d, 0x12, 0x16, 0x0a,
0x12, 0x1f, 0x0a, 0x08, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x06, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x53,
0x28, 0x09, 0x48, 0x01, 0x52, 0x08, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x72, 0x88, 0x01, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x12, 0x1f, 0x0a, 0x08, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65,
0x01, 0x12, 0x36, 0x0a, 0x09, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x18, 0x0a, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x08, 0x52, 0x65, 0x63, 0x65, 0x69,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x76, 0x65, 0x72, 0x88, 0x01, 0x01, 0x12, 0x36, 0x0a, 0x09, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74,
0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x48, 0x00, 0x52, 0x09, 0x72, 0x61, 0x70, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67,
0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x12, 0x42, 0x0a, 0x0f, 0x44, 0x69, 0x73, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74,
0x63, 0x6f, 0x76, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x79, 0x48, 0x00, 0x52, 0x09, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x12, 0x42,
0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x0a, 0x0f, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x48, 0x00, 0x52, 0x0f, 0x44, 0x69, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,
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, 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, 0x00, 0x52, 0x0f, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65,
0x6e, 0x73, 0x65, 0x12, 0x31, 0x0a, 0x0c, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x4f, 0x66, 0x73, 0x74, 0x12, 0x44, 0x0a, 0x10, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x52, 0x65,
0x66, 0x65, 0x72, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x53, 0x44, 0x50, 0x4d, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67,
0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x48, 0x00, 0x52, 0x0c, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45,
0x6e, 0x4f, 0x66, 0x66, 0x65, 0x72, 0x12, 0x33, 0x0a, 0x0d, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6d, 0x70, 0x74, 0x79, 0x48, 0x00, 0x52, 0x10, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72,
0x6e, 0x41, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3b, 0x0a, 0x0c, 0x53, 0x65, 0x73, 0x73,
0x53, 0x44, 0x50, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x48, 0x00, 0x52, 0x0d, 0x53, 0x65, 0x69, 0x6f, 0x6e, 0x4f, 0x66, 0x66, 0x65, 0x72, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15,
0x73, 0x73, 0x69, 0x6f, 0x6e, 0x41, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x42, 0x09, 0x0a, 0x07, 0x4d, 0x2e, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x69, 0x6e, 0x67, 0x2e, 0x53, 0x44, 0x50, 0x4d, 0x65,
0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x52, 0x65, 0x63, 0x65, 0x69, 0x73, 0x73, 0x61, 0x67, 0x65, 0x48, 0x00, 0x52, 0x0c, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e,
0x76, 0x65, 0x72, 0x2a, 0x40, 0x0a, 0x0e, 0x53, 0x44, 0x50, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x4f, 0x66, 0x66, 0x65, 0x72, 0x12, 0x3d, 0x0a, 0x0d, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e,
0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x09, 0x0a, 0x05, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x10, 0x00, 0x41, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x73,
0x12, 0x09, 0x0a, 0x05, 0x41, 0x75, 0x64, 0x69, 0x6f, 0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x56, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x69, 0x6e, 0x67, 0x2e, 0x53, 0x44, 0x50, 0x4d, 0x65, 0x73, 0x73,
0x69, 0x64, 0x65, 0x6f, 0x41, 0x75, 0x64, 0x69, 0x6f, 0x10, 0x02, 0x12, 0x08, 0x0a, 0x04, 0x44, 0x61, 0x67, 0x65, 0x48, 0x00, 0x52, 0x0d, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x41, 0x6e,
0x61, 0x74, 0x61, 0x10, 0x03, 0x32, 0x40, 0x0a, 0x09, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x69, 0x73, 0x77, 0x65, 0x72, 0x42, 0x09, 0x0a, 0x07, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x42,
0x6e, 0x67, 0x12, 0x33, 0x0a, 0x07, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x12, 0x11, 0x2e, 0x0b, 0x0a, 0x09, 0x5f, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x72, 0x2a, 0x40, 0x0a, 0x0e,
0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x69, 0x6e, 0x67, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x44, 0x50, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x09,
0x1a, 0x11, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x69, 0x6e, 0x67, 0x4d, 0x65, 0x73, 0x73, 0x0a, 0x05, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x41, 0x75, 0x64,
0x61, 0x67, 0x65, 0x28, 0x01, 0x30, 0x01, 0x42, 0x52, 0x5a, 0x50, 0x67, 0x69, 0x74, 0x2e, 0x6a, 0x69, 0x6f, 0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x41, 0x75, 0x64,
0x65, 0x66, 0x66, 0x74, 0x68, 0x65, 0x63, 0x6f, 0x64, 0x65, 0x72, 0x2e, 0x78, 0x79, 0x7a, 0x2f, 0x69, 0x6f, 0x10, 0x02, 0x12, 0x08, 0x0a, 0x04, 0x44, 0x61, 0x74, 0x61, 0x10, 0x03, 0x32, 0x50,
0x67, 0x75, 0x6f, 0x63, 0x68, 0x61, 0x6f, 0x2f, 0x6d, 0x65, 0x6f, 0x77, 0x2d, 0x73, 0x69, 0x67, 0x0a, 0x09, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x69, 0x6e, 0x67, 0x12, 0x43, 0x0a, 0x03, 0x42,
0x6e, 0x61, 0x6c, 0x69, 0x6e, 0x67, 0x2e, 0x6a, 0x65, 0x66, 0x66, 0x74, 0x68, 0x65, 0x63, 0x6f, 0x69, 0x75, 0x12, 0x1b, 0x2e, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x69, 0x6e, 0x67, 0x2e, 0x53,
0x64, 0x65, 0x72, 0x2e, 0x78, 0x79, 0x7a, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x69, 0x6e, 0x67, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a,
0x6f, 0x2f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x69, 0x6e, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x1b, 0x2e, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x69, 0x6e, 0x67, 0x2e, 0x53, 0x69, 0x67, 0x6e,
0x74, 0x6f, 0x33, 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 ( 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_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_pkg_proto_signaling_signaling_proto_msgTypes = make([]protoimpl.MessageInfo, 2) var file_pkg_proto_signaling_signaling_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_pkg_proto_signaling_signaling_proto_goTypes = []interface{}{ var file_pkg_proto_signaling_signaling_proto_goTypes = []interface{}{
(SDPMessageType)(0), // 0: SDPMessageType (SDPMessageType)(0), // 0: signaling.SDPMessageType
(*SDPMessage)(nil), // 1: SDPMessage (*SDPMessage)(nil), // 1: signaling.SDPMessage
(*SignalingMessage)(nil), // 2: SignalingMessage (*SignalingMessage)(nil), // 2: signaling.SignalingMessage
(*emptypb.Empty)(nil), // 3: google.protobuf.Empty (*emptypb.Empty)(nil), // 3: google.protobuf.Empty
} }
var file_pkg_proto_signaling_signaling_proto_depIdxs = []int32{ var file_pkg_proto_signaling_signaling_proto_depIdxs = []int32{
0, // 0: SDPMessage.Type:type_name -> SDPMessageType 0, // 0: signaling.SDPMessage.Type:type_name -> signaling.SDPMessageType
3, // 1: SignalingMessage.Bootstrap:type_name -> google.protobuf.Empty 3, // 1: signaling.SignalingMessage.Bootstrap:type_name -> google.protobuf.Empty
3, // 2: SignalingMessage.DiscoverRequest:type_name -> google.protobuf.Empty 3, // 2: signaling.SignalingMessage.DiscoverRequest:type_name -> google.protobuf.Empty
3, // 3: SignalingMessage.DiscoverResponse:type_name -> google.protobuf.Empty 3, // 3: signaling.SignalingMessage.DiscoverResponse:type_name -> google.protobuf.Empty
1, // 4: SignalingMessage.SessionOffer:type_name -> SDPMessage 1, // 4: signaling.SignalingMessage.SessionOffer:type_name -> signaling.SDPMessage
1, // 5: SignalingMessage.SessionAnswer:type_name -> SDPMessage 1, // 5: signaling.SignalingMessage.SessionAnswer:type_name -> signaling.SDPMessage
2, // 6: Signaling.Connect:input_type -> SignalingMessage 2, // 6: signaling.Signaling.Biu:input_type -> signaling.SignalingMessage
2, // 7: Signaling.Connect:output_type -> SignalingMessage 2, // 7: signaling.Signaling.Biu:output_type -> signaling.SignalingMessage
7, // [7:8] is the sub-list for method output_type 7, // [7:8] is the sub-list for method output_type
6, // [6:7] is the sub-list for method input_type 6, // [6:7] is the sub-list for method input_type
6, // [6:6] is the sub-list for extension type_name 6, // [6:6] is the sub-list for extension type_name

View File

@ -1,5 +1,7 @@
syntax = "proto3"; syntax = "proto3";
package signaling;
option go_package = "git.jeffthecoder.xyz/guochao/meow-signaling.jeffthecoder.xyz/pkg/proto/signaling"; option go_package = "git.jeffthecoder.xyz/guochao/meow-signaling.jeffthecoder.xyz/pkg/proto/signaling";
import "google/protobuf/empty.proto"; import "google/protobuf/empty.proto";
@ -32,5 +34,5 @@ message SignalingMessage {
} }
service Signaling { service Signaling {
rpc Connect(stream SignalingMessage) returns (stream SignalingMessage); rpc Biu(stream SignalingMessage) returns (stream SignalingMessage);
} }

View File

@ -19,14 +19,14 @@ import (
const _ = grpc.SupportPackageIsVersion7 const _ = grpc.SupportPackageIsVersion7
const ( const (
Signaling_Connect_FullMethodName = "/Signaling/Connect" Signaling_Biu_FullMethodName = "/signaling.Signaling/Biu"
) )
// SignalingClient is the client API for Signaling service. // 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. // 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 { 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 { type signalingClient struct {
@ -37,30 +37,30 @@ func NewSignalingClient(cc grpc.ClientConnInterface) SignalingClient {
return &signalingClient{cc} return &signalingClient{cc}
} }
func (c *signalingClient) Connect(ctx context.Context, opts ...grpc.CallOption) (Signaling_ConnectClient, error) { func (c *signalingClient) Biu(ctx context.Context, opts ...grpc.CallOption) (Signaling_BiuClient, error) {
stream, err := c.cc.NewStream(ctx, &Signaling_ServiceDesc.Streams[0], Signaling_Connect_FullMethodName, opts...) stream, err := c.cc.NewStream(ctx, &Signaling_ServiceDesc.Streams[0], Signaling_Biu_FullMethodName, opts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
x := &signalingConnectClient{stream} x := &signalingBiuClient{stream}
return x, nil return x, nil
} }
type Signaling_ConnectClient interface { type Signaling_BiuClient interface {
Send(*SignalingMessage) error Send(*SignalingMessage) error
Recv() (*SignalingMessage, error) Recv() (*SignalingMessage, error)
grpc.ClientStream grpc.ClientStream
} }
type signalingConnectClient struct { type signalingBiuClient struct {
grpc.ClientStream grpc.ClientStream
} }
func (x *signalingConnectClient) Send(m *SignalingMessage) error { func (x *signalingBiuClient) Send(m *SignalingMessage) error {
return x.ClientStream.SendMsg(m) return x.ClientStream.SendMsg(m)
} }
func (x *signalingConnectClient) Recv() (*SignalingMessage, error) { func (x *signalingBiuClient) Recv() (*SignalingMessage, error) {
m := new(SignalingMessage) m := new(SignalingMessage)
if err := x.ClientStream.RecvMsg(m); err != nil { if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err return nil, err
@ -72,7 +72,7 @@ func (x *signalingConnectClient) Recv() (*SignalingMessage, error) {
// All implementations must embed UnimplementedSignalingServer // All implementations must embed UnimplementedSignalingServer
// for forward compatibility // for forward compatibility
type SignalingServer interface { type SignalingServer interface {
Connect(Signaling_ConnectServer) error Biu(Signaling_BiuServer) error
mustEmbedUnimplementedSignalingServer() mustEmbedUnimplementedSignalingServer()
} }
@ -80,8 +80,8 @@ type SignalingServer interface {
type UnimplementedSignalingServer struct { type UnimplementedSignalingServer struct {
} }
func (UnimplementedSignalingServer) Connect(Signaling_ConnectServer) error { func (UnimplementedSignalingServer) Biu(Signaling_BiuServer) error {
return status.Errorf(codes.Unimplemented, "method Connect not implemented") return status.Errorf(codes.Unimplemented, "method Biu not implemented")
} }
func (UnimplementedSignalingServer) mustEmbedUnimplementedSignalingServer() {} func (UnimplementedSignalingServer) mustEmbedUnimplementedSignalingServer() {}
@ -96,25 +96,25 @@ func RegisterSignalingServer(s grpc.ServiceRegistrar, srv SignalingServer) {
s.RegisterService(&Signaling_ServiceDesc, srv) s.RegisterService(&Signaling_ServiceDesc, srv)
} }
func _Signaling_Connect_Handler(srv interface{}, stream grpc.ServerStream) error { func _Signaling_Biu_Handler(srv interface{}, stream grpc.ServerStream) error {
return srv.(SignalingServer).Connect(&signalingConnectServer{stream}) return srv.(SignalingServer).Biu(&signalingBiuServer{stream})
} }
type Signaling_ConnectServer interface { type Signaling_BiuServer interface {
Send(*SignalingMessage) error Send(*SignalingMessage) error
Recv() (*SignalingMessage, error) Recv() (*SignalingMessage, error)
grpc.ServerStream grpc.ServerStream
} }
type signalingConnectServer struct { type signalingBiuServer struct {
grpc.ServerStream grpc.ServerStream
} }
func (x *signalingConnectServer) Send(m *SignalingMessage) error { func (x *signalingBiuServer) Send(m *SignalingMessage) error {
return x.ServerStream.SendMsg(m) return x.ServerStream.SendMsg(m)
} }
func (x *signalingConnectServer) Recv() (*SignalingMessage, error) { func (x *signalingBiuServer) Recv() (*SignalingMessage, error) {
m := new(SignalingMessage) m := new(SignalingMessage)
if err := x.ServerStream.RecvMsg(m); err != nil { if err := x.ServerStream.RecvMsg(m); err != nil {
return nil, err return nil, err
@ -126,13 +126,13 @@ func (x *signalingConnectServer) Recv() (*SignalingMessage, error) {
// It's only intended for direct use with grpc.RegisterService, // It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy) // and not to be introspected or modified (even as a copy)
var Signaling_ServiceDesc = grpc.ServiceDesc{ var Signaling_ServiceDesc = grpc.ServiceDesc{
ServiceName: "Signaling", ServiceName: "signaling.Signaling",
HandlerType: (*SignalingServer)(nil), HandlerType: (*SignalingServer)(nil),
Methods: []grpc.MethodDesc{}, Methods: []grpc.MethodDesc{},
Streams: []grpc.StreamDesc{ Streams: []grpc.StreamDesc{
{ {
StreamName: "Connect", StreamName: "Biu",
Handler: _Signaling_Connect_Handler, Handler: _Signaling_Biu_Handler,
ServerStreams: true, ServerStreams: true,
ClientStreams: true, ClientStreams: true,
}, },