From 9ebfebe2ddc41460c1fdac8fbf4b438b39a72efd Mon Sep 17 00:00:00 2001 From: David Zhao Date: Tue, 3 Nov 2020 22:01:54 -0800 Subject: [PATCH] simple cli with room APIs --- Makefile | 13 +- cmd/cli/commands/print.go | 11 + cmd/cli/commands/room.go | 98 ++++++++ cmd/cli/main.go | 22 ++ pkg/rtc/errors.go | 1 + pkg/rtc/room.go | 4 + pkg/service/simpleroom.go | 5 +- proto/livekit/rtc.pb.go | 476 ++++++++++++++++++++++++++++++++++++++ 8 files changed, 626 insertions(+), 4 deletions(-) create mode 100644 cmd/cli/commands/print.go create mode 100644 cmd/cli/commands/room.go create mode 100644 proto/livekit/rtc.pb.go diff --git a/Makefile b/Makefile index 62eac5d5d..b5449f7c0 100644 --- a/Makefile +++ b/Makefile @@ -6,9 +6,20 @@ else GOBIN=$(shell go env GOBIN) endif + +build: server client + +client: generate + @{ \ + echo "building client" ;\ + mkdir -p bin ;\ + cd cmd/cli ;\ + go build -i -o ../../bin/livekit-cli ;\ + } + server: generate @{ \ - echo "building" ;\ + echo "building server" ;\ mkdir -p bin ;\ cd cmd/server ;\ go build -i -o ../../bin/livekit-server ;\ diff --git a/cmd/cli/commands/print.go b/cmd/cli/commands/print.go new file mode 100644 index 000000000..684f98d90 --- /dev/null +++ b/cmd/cli/commands/print.go @@ -0,0 +1,11 @@ +package commands + +import ( + "encoding/json" + "fmt" +) + +func PrintJSON(obj interface{}) { + txt, _ := json.Marshal(obj) + fmt.Println(string(txt)) +} diff --git a/cmd/cli/commands/room.go b/cmd/cli/commands/room.go new file mode 100644 index 000000000..57739afee --- /dev/null +++ b/cmd/cli/commands/room.go @@ -0,0 +1,98 @@ +package commands + +import ( + "context" + "fmt" + "net/http" + + "github.com/urfave/cli/v2" + + "github.com/livekit/livekit-server/proto/livekit" +) + +var ( + roomFlag = &cli.StringFlag{ + Name: "room-id", + Required: true, + } + hostFlag = &cli.StringFlag{ + Name: "host", + Value: "http://localhost:7880", + } + RoomCommands = []*cli.Command{ + { + Name: "create-room", + Before: createClient, + Action: createRoom, + Flags: []cli.Flag{ + roomFlag, + hostFlag, + }, + }, + { + Name: "get-room", + Before: createClient, + Action: getRoom, + Flags: []cli.Flag{ + roomFlag, + hostFlag, + }, + }, + { + Name: "delete-room", + Before: createClient, + Action: deleteRoom, + Flags: []cli.Flag{ + roomFlag, + hostFlag, + }, + }, + } + + roomClient livekit.RoomService +) + +func createClient(c *cli.Context) error { + host := c.String("host") + roomClient = livekit.NewRoomServiceJSONClient(host, &http.Client{}) + return nil +} + +func createRoom(c *cli.Context) error { + roomId := c.String("room-id") + room, err := roomClient.CreateRoom(context.Background(), &livekit.CreateRoomRequest{ + RoomId: roomId, + }) + if err != nil { + return err + } + + PrintJSON(room) + return nil +} + +func getRoom(c *cli.Context) error { + roomId := c.String("room-id") + room, err := roomClient.GetRoom(context.Background(), &livekit.GetRoomRequest{ + RoomId: roomId, + }) + if err != nil { + return err + } + + PrintJSON(room) + return nil +} + +func deleteRoom(c *cli.Context) error { + roomId := c.String("room-id") + _, err := roomClient.DeleteRoom(context.Background(), &livekit.DeleteRoomRequest{ + RoomId: roomId, + }) + if err != nil { + return err + } + + fmt.Println("deleted room", roomId) + return nil +} diff --git a/cmd/cli/main.go b/cmd/cli/main.go index 5face46d2..386ffdd58 100644 --- a/cmd/cli/main.go +++ b/cmd/cli/main.go @@ -1,3 +1,25 @@ package main +import ( + "fmt" + "os" + + "github.com/urfave/cli/v2" + + "github.com/livekit/livekit-server/cmd/cli/commands" + "github.com/livekit/livekit-server/pkg/logger" +) + // command line util that tests server +func main() { + app := &cli.App{ + Name: "livekit-cli", + } + + app.Commands = append(app.Commands, commands.RoomCommands...) + + logger.InitDevelopment() + if err := app.Run(os.Args); err != nil { + fmt.Println(err) + } +} diff --git a/pkg/rtc/errors.go b/pkg/rtc/errors.go index 6b92d8875..ca3f17380 100644 --- a/pkg/rtc/errors.go +++ b/pkg/rtc/errors.go @@ -3,6 +3,7 @@ package rtc import "errors" var ( + ErrRoomIdMissing = errors.New("roomId is not set") ErrPeerExists = errors.New("peer already exists") ErrPeerNotConnected = errors.New("peer has not been connected") ErrUnsupportedPayloadType = errors.New("peer does not support payload type") diff --git a/pkg/rtc/room.go b/pkg/rtc/room.go index 72fe451cd..9611ef618 100644 --- a/pkg/rtc/room.go +++ b/pkg/rtc/room.go @@ -28,6 +28,10 @@ func NewRoomForRequest(req *livekit.CreateRoomRequest, config *WebRTCConfig) (*R return nil, err } + if req.RoomId == "" { + return nil, ErrRoomIdMissing + } + return &Room{ Room: livekit.Room{ RoomId: req.RoomId, diff --git a/pkg/service/simpleroom.go b/pkg/service/simpleroom.go index 297f3123b..313a8a3db 100644 --- a/pkg/service/simpleroom.go +++ b/pkg/service/simpleroom.go @@ -35,7 +35,6 @@ func (s *SimpleRoomService) CreateRoom(ctx context.Context, req *livekit.CreateR room, err = s.manager.CreateRoom(req) if err != nil { - err = twirp.WrapError(twirp.InternalError("could not create room"), err) return } @@ -45,8 +44,8 @@ func (s *SimpleRoomService) CreateRoom(ctx context.Context, req *livekit.CreateR func (s *SimpleRoomService) GetRoom(ctx context.Context, req *livekit.GetRoomRequest) (res *livekit.RoomInfo, err error) { room := s.manager.GetRoom(req.RoomId) - if room != nil { - err = twirp.NewError(twirp.NotFound, "rooms already exists") + if room == nil { + err = twirp.NewError(twirp.NotFound, "room does not exist") return } diff --git a/proto/livekit/rtc.pb.go b/proto/livekit/rtc.pb.go new file mode 100644 index 000000000..cb9aa28a4 --- /dev/null +++ b/proto/livekit/rtc.pb.go @@ -0,0 +1,476 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.25.0 +// protoc v3.13.0 +// source: rtc.proto + +package livekit + +import ( + proto "github.com/golang/protobuf/proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +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) +) + +// This is a compile-time assertion that a sufficiently up-to-date version +// of the legacy proto package is being used. +const _ = proto.ProtoPackageIsVersion4 + +type SignalRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to Message: + // *SignalRequest_Offer + // *SignalRequest_Negotiate + // *SignalRequest_Trickle + Message isSignalRequest_Message `protobuf_oneof:"message"` +} + +func (x *SignalRequest) Reset() { + *x = SignalRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_rtc_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SignalRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SignalRequest) ProtoMessage() {} + +func (x *SignalRequest) ProtoReflect() protoreflect.Message { + mi := &file_rtc_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SignalRequest.ProtoReflect.Descriptor instead. +func (*SignalRequest) Descriptor() ([]byte, []int) { + return file_rtc_proto_rawDescGZIP(), []int{0} +} + +func (m *SignalRequest) GetMessage() isSignalRequest_Message { + if m != nil { + return m.Message + } + return nil +} + +func (x *SignalRequest) GetOffer() *SessionDescription { + if x, ok := x.GetMessage().(*SignalRequest_Offer); ok { + return x.Offer + } + return nil +} + +func (x *SignalRequest) GetNegotiate() *SessionDescription { + if x, ok := x.GetMessage().(*SignalRequest_Negotiate); ok { + return x.Negotiate + } + return nil +} + +func (x *SignalRequest) GetTrickle() *Trickle { + if x, ok := x.GetMessage().(*SignalRequest_Trickle); ok { + return x.Trickle + } + return nil +} + +type isSignalRequest_Message interface { + isSignalRequest_Message() +} + +type SignalRequest_Offer struct { + Offer *SessionDescription `protobuf:"bytes,1,opt,name=offer,proto3,oneof"` +} + +type SignalRequest_Negotiate struct { + Negotiate *SessionDescription `protobuf:"bytes,2,opt,name=negotiate,proto3,oneof"` +} + +type SignalRequest_Trickle struct { + Trickle *Trickle `protobuf:"bytes,3,opt,name=trickle,proto3,oneof"` +} + +func (*SignalRequest_Offer) isSignalRequest_Message() {} + +func (*SignalRequest_Negotiate) isSignalRequest_Message() {} + +func (*SignalRequest_Trickle) isSignalRequest_Message() {} + +type SignalResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to Message: + // *SignalResponse_Answer + // *SignalResponse_Negotiate + // *SignalResponse_Trickle + Message isSignalResponse_Message `protobuf_oneof:"message"` +} + +func (x *SignalResponse) Reset() { + *x = SignalResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_rtc_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SignalResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SignalResponse) ProtoMessage() {} + +func (x *SignalResponse) ProtoReflect() protoreflect.Message { + mi := &file_rtc_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SignalResponse.ProtoReflect.Descriptor instead. +func (*SignalResponse) Descriptor() ([]byte, []int) { + return file_rtc_proto_rawDescGZIP(), []int{1} +} + +func (m *SignalResponse) GetMessage() isSignalResponse_Message { + if m != nil { + return m.Message + } + return nil +} + +func (x *SignalResponse) GetAnswer() *SessionDescription { + if x, ok := x.GetMessage().(*SignalResponse_Answer); ok { + return x.Answer + } + return nil +} + +func (x *SignalResponse) GetNegotiate() *SessionDescription { + if x, ok := x.GetMessage().(*SignalResponse_Negotiate); ok { + return x.Negotiate + } + return nil +} + +func (x *SignalResponse) GetTrickle() *Trickle { + if x, ok := x.GetMessage().(*SignalResponse_Trickle); ok { + return x.Trickle + } + return nil +} + +type isSignalResponse_Message interface { + isSignalResponse_Message() +} + +type SignalResponse_Answer struct { + Answer *SessionDescription `protobuf:"bytes,1,opt,name=answer,proto3,oneof"` +} + +type SignalResponse_Negotiate struct { + Negotiate *SessionDescription `protobuf:"bytes,2,opt,name=negotiate,proto3,oneof"` +} + +type SignalResponse_Trickle struct { + Trickle *Trickle `protobuf:"bytes,3,opt,name=trickle,proto3,oneof"` +} + +func (*SignalResponse_Answer) isSignalResponse_Message() {} + +func (*SignalResponse_Negotiate) isSignalResponse_Message() {} + +func (*SignalResponse_Trickle) isSignalResponse_Message() {} + +type Trickle struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // serialized JSON structure of candidate init + CandidateInit string `protobuf:"bytes,1,opt,name=candidate_init,json=candidateInit,proto3" json:"candidate_init,omitempty"` +} + +func (x *Trickle) Reset() { + *x = Trickle{} + if protoimpl.UnsafeEnabled { + mi := &file_rtc_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Trickle) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Trickle) ProtoMessage() {} + +func (x *Trickle) ProtoReflect() protoreflect.Message { + mi := &file_rtc_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Trickle.ProtoReflect.Descriptor instead. +func (*Trickle) Descriptor() ([]byte, []int) { + return file_rtc_proto_rawDescGZIP(), []int{2} +} + +func (x *Trickle) GetCandidateInit() string { + if x != nil { + return x.CandidateInit + } + return "" +} + +type SessionDescription struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` // "answer" | "offer" | "pranswer" | "rollback" + Sdp string `protobuf:"bytes,2,opt,name=sdp,proto3" json:"sdp,omitempty"` +} + +func (x *SessionDescription) Reset() { + *x = SessionDescription{} + if protoimpl.UnsafeEnabled { + mi := &file_rtc_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SessionDescription) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SessionDescription) ProtoMessage() {} + +func (x *SessionDescription) ProtoReflect() protoreflect.Message { + mi := &file_rtc_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SessionDescription.ProtoReflect.Descriptor instead. +func (*SessionDescription) Descriptor() ([]byte, []int) { + return file_rtc_proto_rawDescGZIP(), []int{3} +} + +func (x *SessionDescription) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *SessionDescription) GetSdp() string { + if x != nil { + return x.Sdp + } + return "" +} + +var File_rtc_proto protoreflect.FileDescriptor + +var file_rtc_proto_rawDesc = []byte{ + 0x0a, 0x09, 0x72, 0x74, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x07, 0x6c, 0x69, 0x76, + 0x65, 0x6b, 0x69, 0x74, 0x22, 0xba, 0x01, 0x0a, 0x0d, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x33, 0x0a, 0x05, 0x6f, 0x66, 0x66, 0x65, 0x72, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, + 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x05, 0x6f, 0x66, 0x66, 0x65, 0x72, 0x12, 0x3b, 0x0a, 0x09, 0x6e, + 0x65, 0x67, 0x6f, 0x74, 0x69, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, + 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x09, 0x6e, + 0x65, 0x67, 0x6f, 0x74, 0x69, 0x61, 0x74, 0x65, 0x12, 0x2c, 0x0a, 0x07, 0x74, 0x72, 0x69, 0x63, + 0x6b, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6c, 0x69, 0x76, 0x65, + 0x6b, 0x69, 0x74, 0x2e, 0x54, 0x72, 0x69, 0x63, 0x6b, 0x6c, 0x65, 0x48, 0x00, 0x52, 0x07, 0x74, + 0x72, 0x69, 0x63, 0x6b, 0x6c, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x22, 0xbd, 0x01, 0x0a, 0x0e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x35, 0x0a, 0x06, 0x61, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x53, + 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x48, 0x00, 0x52, 0x06, 0x61, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x12, 0x3b, 0x0a, 0x09, 0x6e, + 0x65, 0x67, 0x6f, 0x74, 0x69, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, + 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x09, 0x6e, + 0x65, 0x67, 0x6f, 0x74, 0x69, 0x61, 0x74, 0x65, 0x12, 0x2c, 0x0a, 0x07, 0x74, 0x72, 0x69, 0x63, + 0x6b, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6c, 0x69, 0x76, 0x65, + 0x6b, 0x69, 0x74, 0x2e, 0x54, 0x72, 0x69, 0x63, 0x6b, 0x6c, 0x65, 0x48, 0x00, 0x52, 0x07, 0x74, + 0x72, 0x69, 0x63, 0x6b, 0x6c, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x22, 0x30, 0x0a, 0x07, 0x54, 0x72, 0x69, 0x63, 0x6b, 0x6c, 0x65, 0x12, 0x25, 0x0a, 0x0e, + 0x63, 0x61, 0x6e, 0x64, 0x69, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x69, 0x6e, 0x69, 0x74, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x63, 0x61, 0x6e, 0x64, 0x69, 0x64, 0x61, 0x74, 0x65, 0x49, + 0x6e, 0x69, 0x74, 0x22, 0x3a, 0x0a, 0x12, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x44, 0x65, + 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x10, 0x0a, + 0x03, 0x73, 0x64, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x73, 0x64, 0x70, 0x42, + 0x31, 0x5a, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6c, 0x69, + 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2f, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2d, 0x73, 0x65, + 0x72, 0x76, 0x65, 0x72, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6c, 0x69, 0x76, 0x65, 0x6b, + 0x69, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_rtc_proto_rawDescOnce sync.Once + file_rtc_proto_rawDescData = file_rtc_proto_rawDesc +) + +func file_rtc_proto_rawDescGZIP() []byte { + file_rtc_proto_rawDescOnce.Do(func() { + file_rtc_proto_rawDescData = protoimpl.X.CompressGZIP(file_rtc_proto_rawDescData) + }) + return file_rtc_proto_rawDescData +} + +var file_rtc_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_rtc_proto_goTypes = []interface{}{ + (*SignalRequest)(nil), // 0: livekit.SignalRequest + (*SignalResponse)(nil), // 1: livekit.SignalResponse + (*Trickle)(nil), // 2: livekit.Trickle + (*SessionDescription)(nil), // 3: livekit.SessionDescription +} +var file_rtc_proto_depIdxs = []int32{ + 3, // 0: livekit.SignalRequest.offer:type_name -> livekit.SessionDescription + 3, // 1: livekit.SignalRequest.negotiate:type_name -> livekit.SessionDescription + 2, // 2: livekit.SignalRequest.trickle:type_name -> livekit.Trickle + 3, // 3: livekit.SignalResponse.answer:type_name -> livekit.SessionDescription + 3, // 4: livekit.SignalResponse.negotiate:type_name -> livekit.SessionDescription + 2, // 5: livekit.SignalResponse.trickle:type_name -> livekit.Trickle + 6, // [6:6] is the sub-list for method output_type + 6, // [6:6] 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 extendee + 0, // [0:6] is the sub-list for field type_name +} + +func init() { file_rtc_proto_init() } +func file_rtc_proto_init() { + if File_rtc_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_rtc_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SignalRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rtc_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SignalResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rtc_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Trickle); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rtc_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SessionDescription); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_rtc_proto_msgTypes[0].OneofWrappers = []interface{}{ + (*SignalRequest_Offer)(nil), + (*SignalRequest_Negotiate)(nil), + (*SignalRequest_Trickle)(nil), + } + file_rtc_proto_msgTypes[1].OneofWrappers = []interface{}{ + (*SignalResponse_Answer)(nil), + (*SignalResponse_Negotiate)(nil), + (*SignalResponse_Trickle)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_rtc_proto_rawDesc, + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_rtc_proto_goTypes, + DependencyIndexes: file_rtc_proto_depIdxs, + MessageInfos: file_rtc_proto_msgTypes, + }.Build() + File_rtc_proto = out.File + file_rtc_proto_rawDesc = nil + file_rtc_proto_goTypes = nil + file_rtc_proto_depIdxs = nil +}