From 6752c4a91d1cb05a05d5ac606d5917bb74b236b7 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Wed, 7 Oct 2020 23:54:44 -0700 Subject: [PATCH] separated join from creation, room options & token --- Makefile | 5 +- cmd/server/main.go | 14 +- pkg/node/node.go | 6 +- pkg/rooms/rooms.go | 33 ++ pkg/service/rtc.go | 10 +- pkg/service/service.go | 4 +- pkg/service/simpleroom.go | 45 ++- proto/{ => livekit}/model.pb.go | 108 +++++- proto/livekit/service.pb.go | 529 +++++++++++++++++++++++++ proto/{ => livekit}/service.twirp.go | 514 ++++++++++++++++++------ proto/model.proto | 10 +- proto/service.pb.go | 557 --------------------------- proto/service.proto | 49 ++- 13 files changed, 1127 insertions(+), 757 deletions(-) create mode 100644 pkg/rooms/rooms.go rename proto/{ => livekit}/model.pb.go (50%) create mode 100644 proto/livekit/service.pb.go rename proto/{ => livekit}/service.twirp.go (82%) delete mode 100644 proto/service.pb.go diff --git a/Makefile b/Makefile index f7adbbad0..79e938c15 100644 --- a/Makefile +++ b/Makefile @@ -15,11 +15,12 @@ server: generate } generate: wire - go generate + $(WIRE) -GO_TARGET=proto +GO_TARGET=proto/livekit proto: protoc protoc-gen-go twirp-gen @{ \ + mkdir -p $(GO_TARGET) ;\ protoc --go_out=$(GO_TARGET) --twirp_out=$(GO_TARGET) \ --go_opt=paths=source_relative \ --twirp_opt=paths=source_relative \ diff --git a/cmd/server/main.go b/cmd/server/main.go index 104d3fec5..b9de227a6 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -18,7 +18,7 @@ import ( "github.com/livekit/livekit-server/pkg/config" "github.com/livekit/livekit-server/pkg/logger" "github.com/livekit/livekit-server/pkg/service" - "github.com/livekit/livekit-server/proto" + "github.com/livekit/livekit-server/proto/livekit" ) func main() { @@ -74,8 +74,8 @@ func startServer(c *cli.Context) error { type LivekitServer struct { config *config.Config - roomServer proto.TwirpServer - rtcServer proto.TwirpServer + roomServer livekit.TwirpServer + rtcServer livekit.TwirpServer roomHttp *http.Server rtcHttp *http.Server running bool @@ -83,12 +83,12 @@ type LivekitServer struct { } func NewLivekitServer(conf *config.Config, - roomService proto.RoomService, + roomService livekit.RoomService, rtcService *service.RTCService) (s *LivekitServer, err error) { s = &LivekitServer{ config: conf, - roomServer: proto.NewRoomServiceServer(roomService), - rtcServer: proto.NewRTCServiceServer(rtcService), + roomServer: livekit.NewRoomServiceServer(roomService), + rtcServer: livekit.NewRTCServiceServer(rtcService), } roomHandler := configureMiddlewares(conf, s.roomServer) @@ -98,7 +98,7 @@ func NewLivekitServer(conf *config.Config, } rtcMux := http.NewServeMux() - rtcMux.Handle(proto.RTCServicePathPrefix, s.rtcServer) + rtcMux.Handle(livekit.RTCServicePathPrefix, s.rtcServer) rtcMux.HandleFunc("/rtc/Signal", rtcService.Signal) rtcHandler := configureMiddlewares(conf, rtcMux) s.rtcHttp = &http.Server{ diff --git a/pkg/node/node.go b/pkg/node/node.go index 6123a9ece..341590720 100644 --- a/pkg/node/node.go +++ b/pkg/node/node.go @@ -6,7 +6,7 @@ import ( "github.com/pion/stun" "github.com/livekit/livekit-server/pkg/config" - "github.com/livekit/livekit-server/proto" + "github.com/livekit/livekit-server/proto/livekit" ) const ( @@ -16,7 +16,7 @@ const ( var NodeSet = wire.NewSet(NewLocalNode) type Node struct { - proto.Node + livekit.Node } type NodeStats struct { @@ -33,7 +33,7 @@ func NewLocalNode(conf *config.Config) (*Node, error) { return nil, err } n := &Node{ - Node: proto.Node{ + Node: livekit.Node{ Id: id.String(), RtcPort: conf.RTCPort, }, diff --git a/pkg/rooms/rooms.go b/pkg/rooms/rooms.go new file mode 100644 index 000000000..eb52d5795 --- /dev/null +++ b/pkg/rooms/rooms.go @@ -0,0 +1,33 @@ +package rooms + +import ( + "time" + + "github.com/google/uuid" + + "github.com/livekit/livekit-server/proto/livekit" +) + +func NewRoomForRequest(req *livekit.CreateRoomRequest) (*livekit.Room, error) { + id, err := uuid.NewRandom() + if err != nil { + return nil, err + } + return &livekit.Room{ + RoomId: req.RoomId, + EmptyTimeout: req.EmptyTimeout, + MaxParticipants: req.MaxParticipants, + CreationTime: time.Now().Unix(), + Token: id.String(), + }, nil +} + +func ToRoomInfo(node *livekit.Node, room *livekit.Room) *livekit.RoomInfo { + return &livekit.RoomInfo{ + RoomId: room.RoomId, + NodeIp: node.Ip, + NodeRtcPort: node.RtcPort, + CreationTime: room.CreationTime, + Token: room.Token, + } +} diff --git a/pkg/service/rtc.go b/pkg/service/rtc.go index 9450ee269..e3aedfc06 100644 --- a/pkg/service/rtc.go +++ b/pkg/service/rtc.go @@ -4,17 +4,21 @@ import ( "context" "net/http" - "github.com/livekit/livekit-server/proto" + "github.com/livekit/livekit-server/proto/livekit" ) type RTCService struct { } -func (s *RTCService) Offer(ctx context.Context, offer *proto.SessionDescription) (answer *proto.SessionDescription, err error) { +func (s *RTCService) Join(ctx context.Context, req *livekit.JoinRequest) (res *livekit.JoinResponse, err error) { return } -func (s *RTCService) Trickle(ctx context.Context, req *proto.TrickleRequest) (res *proto.TrickleResponse, err error) { +func (s *RTCService) Offer(ctx context.Context, offer *livekit.SessionDescription) (answer *livekit.SessionDescription, err error) { + return +} + +func (s *RTCService) Trickle(ctx context.Context, req *livekit.TrickleRequest) (res *livekit.TrickleResponse, err error) { return } diff --git a/pkg/service/service.go b/pkg/service/service.go index 081a3185b..d0fd3858e 100644 --- a/pkg/service/service.go +++ b/pkg/service/service.go @@ -7,7 +7,7 @@ import ( "github.com/livekit/livekit-server/pkg/config" "github.com/livekit/livekit-server/pkg/node" - "github.com/livekit/livekit-server/proto" + "github.com/livekit/livekit-server/proto/livekit" ) var ServiceSet = wire.NewSet( @@ -15,7 +15,7 @@ var ServiceSet = wire.NewSet( NewRTCService, ) -func NewRoomService(conf *config.Config, localNode *node.Node) (proto.RoomService, error) { +func NewRoomService(conf *config.Config, localNode *node.Node) (livekit.RoomService, error) { if conf.MultiNode { return nil, fmt.Errorf("multinode is not supported") } else { diff --git a/pkg/service/simpleroom.go b/pkg/service/simpleroom.go index 68839b37f..e529ef804 100644 --- a/pkg/service/simpleroom.go +++ b/pkg/service/simpleroom.go @@ -7,60 +7,59 @@ import ( "github.com/twitchtv/twirp" "github.com/livekit/livekit-server/pkg/node" - "github.com/livekit/livekit-server/proto" + "github.com/livekit/livekit-server/pkg/rooms" + "github.com/livekit/livekit-server/proto/livekit" ) -// A room service that supports a single node +// A rooms service that supports a single node type SimpleRoomService struct { localNode *node.Node - rooms map[string]bool + rooms map[string]*livekit.Room roomLock sync.Mutex } func NewSimpleRoomService(localNode *node.Node) (svc *SimpleRoomService, err error) { svc = &SimpleRoomService{ localNode: localNode, - rooms: make(map[string]bool), + rooms: make(map[string]*livekit.Room), roomLock: sync.Mutex{}, } return } -func (s *SimpleRoomService) CreateRoom(ctx context.Context, req *proto.CreateRoomRequest) (res *proto.CreateRoomResponse, err error) { +func (s *SimpleRoomService) CreateRoom(ctx context.Context, req *livekit.CreateRoomRequest) (res *livekit.RoomInfo, err error) { s.roomLock.Lock() defer s.roomLock.Unlock() - if s.rooms[req.Room] { - err = twirp.NewError(twirp.AlreadyExists, "room already exists") + if s.rooms[req.RoomId] != nil { + err = twirp.NewError(twirp.AlreadyExists, "rooms already exists") return } - s.rooms[req.Room] = true - - res = &proto.CreateRoomResponse{ - Room: req.Room, - NodeIp: s.localNode.Ip, - NodeRtcPort: s.localNode.RtcPort, + room, err := rooms.NewRoomForRequest(req) + if err != nil { + return } + s.rooms[req.RoomId] = room + + res = rooms.ToRoomInfo(&s.localNode.Node, room) return } -func (s *SimpleRoomService) JoinRoom(ctx context.Context, req *proto.JoinRoomRequest) (res *proto.JoinRoomResponse, err error) { - if !s.rooms[req.Room] { - err = twirp.NewError(twirp.AlreadyExists, "the room does not exist") +func (s *SimpleRoomService) GetRoom(ctx context.Context, req *livekit.GetRoomRequest) (res *livekit.RoomInfo, err error) { + room := s.rooms[req.RoomId] + if room == nil { + err = twirp.NewError(twirp.NotFound, "the rooms does not exist") return } - res = &proto.JoinRoomResponse{ - NodeIp: s.localNode.Ip, - NodeRtcPort: s.localNode.RtcPort, - } + res = rooms.ToRoomInfo(&s.localNode.Node, room) return } -func (s *SimpleRoomService) DeleteRoom(ctx context.Context, req *proto.DeleteRoomRequest) (res *proto.DeleteRoomResponse, err error) { - delete(s.rooms, req.Room) - res = &proto.DeleteRoomResponse{} +func (s *SimpleRoomService) DeleteRoom(ctx context.Context, req *livekit.DeleteRoomRequest) (res *livekit.DeleteRoomResponse, err error) { + delete(s.rooms, req.RoomId) + res = &livekit.DeleteRoomResponse{} return } diff --git a/proto/model.pb.go b/proto/livekit/model.pb.go similarity index 50% rename from proto/model.pb.go rename to proto/livekit/model.pb.go index 407ef19fd..e82b6955c 100644 --- a/proto/model.pb.go +++ b/proto/livekit/model.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // source: model.proto -package proto +package livekit import ( fmt "fmt" @@ -130,27 +130,103 @@ func (m *NodeStats) GetNumClients() int32 { return 0 } +type Room struct { + RoomId string `protobuf:"bytes,1,opt,name=room_id,json=roomId,proto3" json:"room_id,omitempty"` + EmptyTimeout uint32 `protobuf:"varint,2,opt,name=empty_timeout,json=emptyTimeout,proto3" json:"empty_timeout,omitempty"` + MaxParticipants uint32 `protobuf:"varint,3,opt,name=max_participants,json=maxParticipants,proto3" json:"max_participants,omitempty"` + CreationTime int64 `protobuf:"varint,4,opt,name=creation_time,json=creationTime,proto3" json:"creation_time,omitempty"` + Token string `protobuf:"bytes,5,opt,name=token,proto3" json:"token,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Room) Reset() { *m = Room{} } +func (m *Room) String() string { return proto.CompactTextString(m) } +func (*Room) ProtoMessage() {} +func (*Room) Descriptor() ([]byte, []int) { + return fileDescriptor_4c16552f9fdb66d8, []int{2} +} + +func (m *Room) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Room.Unmarshal(m, b) +} +func (m *Room) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Room.Marshal(b, m, deterministic) +} +func (m *Room) XXX_Merge(src proto.Message) { + xxx_messageInfo_Room.Merge(m, src) +} +func (m *Room) XXX_Size() int { + return xxx_messageInfo_Room.Size(m) +} +func (m *Room) XXX_DiscardUnknown() { + xxx_messageInfo_Room.DiscardUnknown(m) +} + +var xxx_messageInfo_Room proto.InternalMessageInfo + +func (m *Room) GetRoomId() string { + if m != nil { + return m.RoomId + } + return "" +} + +func (m *Room) GetEmptyTimeout() uint32 { + if m != nil { + return m.EmptyTimeout + } + return 0 +} + +func (m *Room) GetMaxParticipants() uint32 { + if m != nil { + return m.MaxParticipants + } + return 0 +} + +func (m *Room) GetCreationTime() int64 { + if m != nil { + return m.CreationTime + } + return 0 +} + +func (m *Room) GetToken() string { + if m != nil { + return m.Token + } + return "" +} + func init() { proto.RegisterType((*Node)(nil), "livekit.Node") proto.RegisterType((*NodeStats)(nil), "livekit.NodeStats") + proto.RegisterType((*Room)(nil), "livekit.Room") } func init() { proto.RegisterFile("model.proto", fileDescriptor_4c16552f9fdb66d8) } var fileDescriptor_4c16552f9fdb66d8 = []byte{ - // 216 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x3c, 0x8f, 0x31, 0x4f, 0xc3, 0x30, - 0x10, 0x85, 0x95, 0xd0, 0xd0, 0xe6, 0x22, 0x18, 0x3c, 0x05, 0x31, 0x10, 0x75, 0x21, 0x0c, 0xa4, - 0x12, 0xfc, 0x03, 0x98, 0x58, 0x10, 0x32, 0x1b, 0x4b, 0x45, 0x63, 0x0b, 0xac, 0xc6, 0x3e, 0xeb, - 0x7c, 0xee, 0xef, 0x47, 0x76, 0x42, 0xa7, 0xa7, 0xef, 0x3d, 0xeb, 0x3d, 0x1f, 0x34, 0x16, 0x95, - 0x9e, 0x06, 0x4f, 0xc8, 0x28, 0xd6, 0x93, 0x39, 0xe9, 0xa3, 0xe1, 0xed, 0x11, 0x56, 0xef, 0xa8, - 0xb4, 0xb8, 0x86, 0xd2, 0xa8, 0xb6, 0xe8, 0x8a, 0xbe, 0x96, 0xa5, 0x51, 0x99, 0x7d, 0x5b, 0x2e, - 0xec, 0xc5, 0x0d, 0x6c, 0x88, 0xc7, 0xbd, 0x47, 0xe2, 0xf6, 0xa2, 0x2b, 0xfa, 0x2b, 0xb9, 0x26, - 0x1e, 0x3f, 0x90, 0x58, 0xf4, 0x50, 0x05, 0xfe, 0xe6, 0xd0, 0xae, 0xba, 0xa2, 0x6f, 0x9e, 0xc4, - 0xb0, 0x74, 0x0f, 0xa9, 0xf8, 0x33, 0x25, 0x72, 0x7e, 0xb0, 0x7d, 0x83, 0xfa, 0xec, 0x89, 0x5b, - 0xa8, 0x5d, 0xb4, 0x7b, 0x42, 0xb4, 0x21, 0x0f, 0x57, 0x72, 0xe3, 0xa2, 0x95, 0x89, 0xc5, 0x1d, - 0x34, 0x29, 0x1c, 0x27, 0xa3, 0x1d, 0x87, 0xfc, 0x8f, 0x4a, 0x82, 0x8b, 0xf6, 0x75, 0x76, 0x5e, - 0x1e, 0xbe, 0xee, 0x7f, 0x0c, 0xff, 0xc6, 0xc3, 0x30, 0xa2, 0xdd, 0x2d, 0x8b, 0xff, 0xfa, 0x18, - 0x34, 0x9d, 0x34, 0xed, 0xf2, 0xad, 0x87, 0xcb, 0x2c, 0xcf, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff, - 0x52, 0x03, 0x38, 0xe7, 0x01, 0x01, 0x00, 0x00, + // 285 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0x90, 0xbd, 0x4e, 0x84, 0x40, + 0x10, 0xc7, 0x03, 0x07, 0xc7, 0x31, 0x1c, 0x6a, 0x36, 0x26, 0x62, 0x2c, 0x24, 0xd8, 0x60, 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0x7e, 0x2c, 0x8c, 0x3c, 0xc2, 0x95, 0x64, 0x87, 0xd6, 0x30, 0x8b, 0xa2, + 0x13, 0x86, 0xb9, 0x61, 0xcb, 0x79, 0x97, 0x92, 0x1d, 0xf6, 0xff, 0xb0, 0xf3, 0x75, 0x96, 0x33, + 0x14, 0x5a, 0x79, 0xa5, 0x3f, 0x77, 0x45, 0xb7, 0x27, 0xe8, 0x94, 0xe4, 0x1a, 0x62, 0xd4, 0x03, + 0x57, 0x45, 0xec, 0x77, 0x59, 0xc2, 0x4b, 0xfa, 0x79, 0xfa, 0xf7, 0xd7, 0xda, 0xff, 0xff, 0xf9, + 0x2f, 0x00, 0x00, 0xff, 0xff, 0x42, 0x21, 0x29, 0xdb, 0x8e, 0x01, 0x00, 0x00, } diff --git a/proto/livekit/service.pb.go b/proto/livekit/service.pb.go new file mode 100644 index 000000000..ab21a80c7 --- /dev/null +++ b/proto/livekit/service.pb.go @@ -0,0 +1,529 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: service.proto + +package livekit + +import ( + fmt "fmt" + proto "github.com/golang/protobuf/proto" + math "math" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package + +type CreateRoomRequest struct { + RoomId string `protobuf:"bytes,1,opt,name=room_id,json=roomId,proto3" json:"room_id,omitempty"` + // number of seconds the room should cleanup after being empty + EmptyTimeout uint32 `protobuf:"varint,2,opt,name=empty_timeout,json=emptyTimeout,proto3" json:"empty_timeout,omitempty"` + MaxParticipants uint32 `protobuf:"varint,3,opt,name=max_participants,json=maxParticipants,proto3" json:"max_participants,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CreateRoomRequest) Reset() { *m = CreateRoomRequest{} } +func (m *CreateRoomRequest) String() string { return proto.CompactTextString(m) } +func (*CreateRoomRequest) ProtoMessage() {} +func (*CreateRoomRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_a0b84a42fa06f626, []int{0} +} + +func (m *CreateRoomRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_CreateRoomRequest.Unmarshal(m, b) +} +func (m *CreateRoomRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_CreateRoomRequest.Marshal(b, m, deterministic) +} +func (m *CreateRoomRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_CreateRoomRequest.Merge(m, src) +} +func (m *CreateRoomRequest) XXX_Size() int { + return xxx_messageInfo_CreateRoomRequest.Size(m) +} +func (m *CreateRoomRequest) XXX_DiscardUnknown() { + xxx_messageInfo_CreateRoomRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_CreateRoomRequest proto.InternalMessageInfo + +func (m *CreateRoomRequest) GetRoomId() string { + if m != nil { + return m.RoomId + } + return "" +} + +func (m *CreateRoomRequest) GetEmptyTimeout() uint32 { + if m != nil { + return m.EmptyTimeout + } + return 0 +} + +func (m *CreateRoomRequest) GetMaxParticipants() uint32 { + if m != nil { + return m.MaxParticipants + } + return 0 +} + +type GetRoomRequest struct { + RoomId string `protobuf:"bytes,1,opt,name=room_id,json=roomId,proto3" json:"room_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetRoomRequest) Reset() { *m = GetRoomRequest{} } +func (m *GetRoomRequest) String() string { return proto.CompactTextString(m) } +func (*GetRoomRequest) ProtoMessage() {} +func (*GetRoomRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_a0b84a42fa06f626, []int{1} +} + +func (m *GetRoomRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetRoomRequest.Unmarshal(m, b) +} +func (m *GetRoomRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetRoomRequest.Marshal(b, m, deterministic) +} +func (m *GetRoomRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetRoomRequest.Merge(m, src) +} +func (m *GetRoomRequest) XXX_Size() int { + return xxx_messageInfo_GetRoomRequest.Size(m) +} +func (m *GetRoomRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetRoomRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetRoomRequest proto.InternalMessageInfo + +func (m *GetRoomRequest) GetRoomId() string { + if m != nil { + return m.RoomId + } + return "" +} + +type RoomInfo struct { + RoomId string `protobuf:"bytes,1,opt,name=room_id,json=roomId,proto3" json:"room_id,omitempty"` + NodeIp string `protobuf:"bytes,2,opt,name=node_ip,json=nodeIp,proto3" json:"node_ip,omitempty"` + NodeRtcPort uint32 `protobuf:"varint,3,opt,name=node_rtc_port,json=nodeRtcPort,proto3" json:"node_rtc_port,omitempty"` + CreationTime int64 `protobuf:"varint,4,opt,name=creation_time,json=creationTime,proto3" json:"creation_time,omitempty"` + Token string `protobuf:"bytes,5,opt,name=token,proto3" json:"token,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RoomInfo) Reset() { *m = RoomInfo{} } +func (m *RoomInfo) String() string { return proto.CompactTextString(m) } +func (*RoomInfo) ProtoMessage() {} +func (*RoomInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_a0b84a42fa06f626, []int{2} +} + +func (m *RoomInfo) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_RoomInfo.Unmarshal(m, b) +} +func (m *RoomInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_RoomInfo.Marshal(b, m, deterministic) +} +func (m *RoomInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_RoomInfo.Merge(m, src) +} +func (m *RoomInfo) XXX_Size() int { + return xxx_messageInfo_RoomInfo.Size(m) +} +func (m *RoomInfo) XXX_DiscardUnknown() { + xxx_messageInfo_RoomInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_RoomInfo proto.InternalMessageInfo + +func (m *RoomInfo) GetRoomId() string { + if m != nil { + return m.RoomId + } + return "" +} + +func (m *RoomInfo) GetNodeIp() string { + if m != nil { + return m.NodeIp + } + return "" +} + +func (m *RoomInfo) GetNodeRtcPort() uint32 { + if m != nil { + return m.NodeRtcPort + } + return 0 +} + +func (m *RoomInfo) GetCreationTime() int64 { + if m != nil { + return m.CreationTime + } + return 0 +} + +func (m *RoomInfo) GetToken() string { + if m != nil { + return m.Token + } + return "" +} + +type DeleteRoomRequest struct { + RoomId string `protobuf:"bytes,1,opt,name=room_id,json=roomId,proto3" json:"room_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DeleteRoomRequest) Reset() { *m = DeleteRoomRequest{} } +func (m *DeleteRoomRequest) String() string { return proto.CompactTextString(m) } +func (*DeleteRoomRequest) ProtoMessage() {} +func (*DeleteRoomRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_a0b84a42fa06f626, []int{3} +} + +func (m *DeleteRoomRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DeleteRoomRequest.Unmarshal(m, b) +} +func (m *DeleteRoomRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DeleteRoomRequest.Marshal(b, m, deterministic) +} +func (m *DeleteRoomRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_DeleteRoomRequest.Merge(m, src) +} +func (m *DeleteRoomRequest) XXX_Size() int { + return xxx_messageInfo_DeleteRoomRequest.Size(m) +} +func (m *DeleteRoomRequest) XXX_DiscardUnknown() { + xxx_messageInfo_DeleteRoomRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_DeleteRoomRequest proto.InternalMessageInfo + +func (m *DeleteRoomRequest) GetRoomId() string { + if m != nil { + return m.RoomId + } + return "" +} + +type DeleteRoomResponse struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DeleteRoomResponse) Reset() { *m = DeleteRoomResponse{} } +func (m *DeleteRoomResponse) String() string { return proto.CompactTextString(m) } +func (*DeleteRoomResponse) ProtoMessage() {} +func (*DeleteRoomResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_a0b84a42fa06f626, []int{4} +} + +func (m *DeleteRoomResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DeleteRoomResponse.Unmarshal(m, b) +} +func (m *DeleteRoomResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DeleteRoomResponse.Marshal(b, m, deterministic) +} +func (m *DeleteRoomResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_DeleteRoomResponse.Merge(m, src) +} +func (m *DeleteRoomResponse) XXX_Size() int { + return xxx_messageInfo_DeleteRoomResponse.Size(m) +} +func (m *DeleteRoomResponse) XXX_DiscardUnknown() { + xxx_messageInfo_DeleteRoomResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_DeleteRoomResponse proto.InternalMessageInfo + +type JoinRequest struct { + RoomId string `protobuf:"bytes,1,opt,name=room_id,json=roomId,proto3" json:"room_id,omitempty"` + Token string `protobuf:"bytes,2,opt,name=token,proto3" json:"token,omitempty"` + SessionId string `protobuf:"bytes,3,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"` + Offer *SessionDescription `protobuf:"bytes,4,opt,name=offer,proto3" json:"offer,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *JoinRequest) Reset() { *m = JoinRequest{} } +func (m *JoinRequest) String() string { return proto.CompactTextString(m) } +func (*JoinRequest) ProtoMessage() {} +func (*JoinRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_a0b84a42fa06f626, []int{5} +} + +func (m *JoinRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_JoinRequest.Unmarshal(m, b) +} +func (m *JoinRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_JoinRequest.Marshal(b, m, deterministic) +} +func (m *JoinRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_JoinRequest.Merge(m, src) +} +func (m *JoinRequest) XXX_Size() int { + return xxx_messageInfo_JoinRequest.Size(m) +} +func (m *JoinRequest) XXX_DiscardUnknown() { + xxx_messageInfo_JoinRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_JoinRequest proto.InternalMessageInfo + +func (m *JoinRequest) GetRoomId() string { + if m != nil { + return m.RoomId + } + return "" +} + +func (m *JoinRequest) GetToken() string { + if m != nil { + return m.Token + } + return "" +} + +func (m *JoinRequest) GetSessionId() string { + if m != nil { + return m.SessionId + } + return "" +} + +func (m *JoinRequest) GetOffer() *SessionDescription { + if m != nil { + return m.Offer + } + return nil +} + +type JoinResponse struct { + Answer *SessionDescription `protobuf:"bytes,1,opt,name=answer,proto3" json:"answer,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *JoinResponse) Reset() { *m = JoinResponse{} } +func (m *JoinResponse) String() string { return proto.CompactTextString(m) } +func (*JoinResponse) ProtoMessage() {} +func (*JoinResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_a0b84a42fa06f626, []int{6} +} + +func (m *JoinResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_JoinResponse.Unmarshal(m, b) +} +func (m *JoinResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_JoinResponse.Marshal(b, m, deterministic) +} +func (m *JoinResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_JoinResponse.Merge(m, src) +} +func (m *JoinResponse) XXX_Size() int { + return xxx_messageInfo_JoinResponse.Size(m) +} +func (m *JoinResponse) XXX_DiscardUnknown() { + xxx_messageInfo_JoinResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_JoinResponse proto.InternalMessageInfo + +func (m *JoinResponse) GetAnswer() *SessionDescription { + if m != nil { + return m.Answer + } + return nil +} + +type TrickleRequest struct { + Candidate string `protobuf:"bytes,1,opt,name=candidate,proto3" json:"candidate,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TrickleRequest) Reset() { *m = TrickleRequest{} } +func (m *TrickleRequest) String() string { return proto.CompactTextString(m) } +func (*TrickleRequest) ProtoMessage() {} +func (*TrickleRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_a0b84a42fa06f626, []int{7} +} + +func (m *TrickleRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TrickleRequest.Unmarshal(m, b) +} +func (m *TrickleRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TrickleRequest.Marshal(b, m, deterministic) +} +func (m *TrickleRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_TrickleRequest.Merge(m, src) +} +func (m *TrickleRequest) XXX_Size() int { + return xxx_messageInfo_TrickleRequest.Size(m) +} +func (m *TrickleRequest) XXX_DiscardUnknown() { + xxx_messageInfo_TrickleRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_TrickleRequest proto.InternalMessageInfo + +func (m *TrickleRequest) GetCandidate() string { + if m != nil { + return m.Candidate + } + return "" +} + +type TrickleResponse struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TrickleResponse) Reset() { *m = TrickleResponse{} } +func (m *TrickleResponse) String() string { return proto.CompactTextString(m) } +func (*TrickleResponse) ProtoMessage() {} +func (*TrickleResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_a0b84a42fa06f626, []int{8} +} + +func (m *TrickleResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TrickleResponse.Unmarshal(m, b) +} +func (m *TrickleResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TrickleResponse.Marshal(b, m, deterministic) +} +func (m *TrickleResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_TrickleResponse.Merge(m, src) +} +func (m *TrickleResponse) XXX_Size() int { + return xxx_messageInfo_TrickleResponse.Size(m) +} +func (m *TrickleResponse) XXX_DiscardUnknown() { + xxx_messageInfo_TrickleResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_TrickleResponse proto.InternalMessageInfo + +type SessionDescription struct { + Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` + Sdp []byte `protobuf:"bytes,2,opt,name=sdp,proto3" json:"sdp,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SessionDescription) Reset() { *m = SessionDescription{} } +func (m *SessionDescription) String() string { return proto.CompactTextString(m) } +func (*SessionDescription) ProtoMessage() {} +func (*SessionDescription) Descriptor() ([]byte, []int) { + return fileDescriptor_a0b84a42fa06f626, []int{9} +} + +func (m *SessionDescription) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SessionDescription.Unmarshal(m, b) +} +func (m *SessionDescription) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SessionDescription.Marshal(b, m, deterministic) +} +func (m *SessionDescription) XXX_Merge(src proto.Message) { + xxx_messageInfo_SessionDescription.Merge(m, src) +} +func (m *SessionDescription) XXX_Size() int { + return xxx_messageInfo_SessionDescription.Size(m) +} +func (m *SessionDescription) XXX_DiscardUnknown() { + xxx_messageInfo_SessionDescription.DiscardUnknown(m) +} + +var xxx_messageInfo_SessionDescription proto.InternalMessageInfo + +func (m *SessionDescription) GetType() string { + if m != nil { + return m.Type + } + return "" +} + +func (m *SessionDescription) GetSdp() []byte { + if m != nil { + return m.Sdp + } + return nil +} + +func init() { + proto.RegisterType((*CreateRoomRequest)(nil), "livekit.CreateRoomRequest") + proto.RegisterType((*GetRoomRequest)(nil), "livekit.GetRoomRequest") + proto.RegisterType((*RoomInfo)(nil), "livekit.RoomInfo") + proto.RegisterType((*DeleteRoomRequest)(nil), "livekit.DeleteRoomRequest") + proto.RegisterType((*DeleteRoomResponse)(nil), "livekit.DeleteRoomResponse") + proto.RegisterType((*JoinRequest)(nil), "livekit.JoinRequest") + proto.RegisterType((*JoinResponse)(nil), "livekit.JoinResponse") + proto.RegisterType((*TrickleRequest)(nil), "livekit.TrickleRequest") + proto.RegisterType((*TrickleResponse)(nil), "livekit.TrickleResponse") + proto.RegisterType((*SessionDescription)(nil), "livekit.SessionDescription") +} + +func init() { proto.RegisterFile("service.proto", fileDescriptor_a0b84a42fa06f626) } + +var fileDescriptor_a0b84a42fa06f626 = []byte{ + // 532 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0xcd, 0x6e, 0xd3, 0x4c, + 0x14, 0x95, 0x9b, 0xbf, 0xcf, 0x37, 0x49, 0xdb, 0x5c, 0xe5, 0x53, 0x2c, 0x17, 0xa4, 0xc8, 0x6c, + 0x52, 0x09, 0x45, 0x22, 0x11, 0x1b, 0x60, 0x03, 0x29, 0x42, 0x61, 0x43, 0x35, 0xcd, 0x8a, 0x4d, + 0x64, 0xec, 0x1b, 0x69, 0x94, 0xd8, 0x63, 0x66, 0xa6, 0xa5, 0x95, 0x78, 0x06, 0x5e, 0x80, 0xb7, + 0x61, 0xc5, 0x63, 0xa1, 0x19, 0x3b, 0x8e, 0x4b, 0x4a, 0xdb, 0x9d, 0xe7, 0xdc, 0x3b, 0x33, 0xe7, + 0xdc, 0x73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bb, 0x2b, + 0x77, 0xee, 0x25, 0xc6, 0x3f, 0xb9, 0xb3, 0x96, 0x8f, 0x61, 0xf2, 0xcb, 0x01, 0x60, 0x8b, 0xd9, + 0x56, 0xc9, 0x14, 0xea, 0xc6, 0x1d, 0xec, 0x97, 0x7b, 0x2a, 0xe1, 0xf1, 0xff, 0xff, 0x0b, 0x2d, + 0x2c, 0x7c, 0x0b, 0x8d, 0x4f, 0xc6, 0x5b, 0xbc, 0xcf, 0x3b, 0xff, 0xbe, 0x22, 0xbe, 0x81, 0x56, + 0x61, 0x50, 0x65, 0x08, 0xb7, 0x2d, 0xf6, 0xbd, 0xfd, 0x42, 0x4e, 0xe0, 0x9d, 0xfb, 0x79, 0xfb, + 0xf4, 0x7c, 0x69, 0xda, 0xa7, 0x68, 0xfa, 0x27, 0x00, 0x00, 0xff, 0xff, 0xa0, 0x72, 0x68, 0xb2, + 0x9b, 0x04, 0x00, 0x00, +} diff --git a/proto/service.twirp.go b/proto/livekit/service.twirp.go similarity index 82% rename from proto/service.twirp.go rename to proto/livekit/service.twirp.go index 309c02309..bb4bb19ba 100644 --- a/proto/service.twirp.go +++ b/proto/livekit/service.twirp.go @@ -2,14 +2,14 @@ // source: service.proto /* -Package proto is a generated twirp stub package. +Package livekit is a generated twirp stub package. This code was generated with github.com/twitchtv/twirp/protoc-gen-twirp v7.1.0. It is generated from these files: model.proto service.proto */ -package proto +package livekit import bytes "bytes" import strings "strings" @@ -44,9 +44,9 @@ const _ = twirp.TwirpPackageIsVersion7 type RoomService interface { // TODO: how do we secure room service? // should be accessible to only internal servers, not external - CreateRoom(context.Context, *CreateRoomRequest) (*CreateRoomResponse, error) + CreateRoom(context.Context, *CreateRoomRequest) (*RoomInfo, error) - JoinRoom(context.Context, *JoinRoomRequest) (*JoinRoomResponse, error) + GetRoom(context.Context, *GetRoomRequest) (*RoomInfo, error) DeleteRoom(context.Context, *DeleteRoomRequest) (*DeleteRoomResponse, error) } @@ -79,7 +79,7 @@ func NewRoomServiceProtobufClient(baseURL string, client HTTPClient, opts ...twi serviceURL += baseServicePath(clientOpts.PathPrefix(), "livekit", "RoomService") urls := [3]string{ serviceURL + "CreateRoom", - serviceURL + "JoinRoom", + serviceURL + "GetRoom", serviceURL + "DeleteRoom", } @@ -91,13 +91,13 @@ func NewRoomServiceProtobufClient(baseURL string, client HTTPClient, opts ...twi } } -func (c *roomServiceProtobufClient) CreateRoom(ctx context.Context, in *CreateRoomRequest) (*CreateRoomResponse, error) { +func (c *roomServiceProtobufClient) CreateRoom(ctx context.Context, in *CreateRoomRequest) (*RoomInfo, error) { ctx = ctxsetters.WithPackageName(ctx, "livekit") ctx = ctxsetters.WithServiceName(ctx, "RoomService") ctx = ctxsetters.WithMethodName(ctx, "CreateRoom") caller := c.callCreateRoom if c.interceptor != nil { - caller = func(ctx context.Context, req *CreateRoomRequest) (*CreateRoomResponse, error) { + caller = func(ctx context.Context, req *CreateRoomRequest) (*RoomInfo, error) { resp, err := c.interceptor( func(ctx context.Context, req interface{}) (interface{}, error) { typedReq, ok := req.(*CreateRoomRequest) @@ -108,9 +108,9 @@ func (c *roomServiceProtobufClient) CreateRoom(ctx context.Context, in *CreateRo }, )(ctx, req) if resp != nil { - typedResp, ok := resp.(*CreateRoomResponse) + typedResp, ok := resp.(*RoomInfo) if !ok { - return nil, twirp.InternalError("failed type assertion resp.(*CreateRoomResponse) when calling interceptor") + return nil, twirp.InternalError("failed type assertion resp.(*RoomInfo) when calling interceptor") } return typedResp, err } @@ -120,8 +120,8 @@ func (c *roomServiceProtobufClient) CreateRoom(ctx context.Context, in *CreateRo return caller(ctx, in) } -func (c *roomServiceProtobufClient) callCreateRoom(ctx context.Context, in *CreateRoomRequest) (*CreateRoomResponse, error) { - out := new(CreateRoomResponse) +func (c *roomServiceProtobufClient) callCreateRoom(ctx context.Context, in *CreateRoomRequest) (*RoomInfo, error) { + out := new(RoomInfo) ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[0], in, out) if err != nil { twerr, ok := err.(twirp.Error) @@ -137,26 +137,26 @@ func (c *roomServiceProtobufClient) callCreateRoom(ctx context.Context, in *Crea return out, nil } -func (c *roomServiceProtobufClient) JoinRoom(ctx context.Context, in *JoinRoomRequest) (*JoinRoomResponse, error) { +func (c *roomServiceProtobufClient) GetRoom(ctx context.Context, in *GetRoomRequest) (*RoomInfo, error) { ctx = ctxsetters.WithPackageName(ctx, "livekit") ctx = ctxsetters.WithServiceName(ctx, "RoomService") - ctx = ctxsetters.WithMethodName(ctx, "JoinRoom") - caller := c.callJoinRoom + ctx = ctxsetters.WithMethodName(ctx, "GetRoom") + caller := c.callGetRoom if c.interceptor != nil { - caller = func(ctx context.Context, req *JoinRoomRequest) (*JoinRoomResponse, error) { + caller = func(ctx context.Context, req *GetRoomRequest) (*RoomInfo, error) { resp, err := c.interceptor( func(ctx context.Context, req interface{}) (interface{}, error) { - typedReq, ok := req.(*JoinRoomRequest) + typedReq, ok := req.(*GetRoomRequest) if !ok { - return nil, twirp.InternalError("failed type assertion req.(*JoinRoomRequest) when calling interceptor") + return nil, twirp.InternalError("failed type assertion req.(*GetRoomRequest) when calling interceptor") } - return c.callJoinRoom(ctx, typedReq) + return c.callGetRoom(ctx, typedReq) }, )(ctx, req) if resp != nil { - typedResp, ok := resp.(*JoinRoomResponse) + typedResp, ok := resp.(*RoomInfo) if !ok { - return nil, twirp.InternalError("failed type assertion resp.(*JoinRoomResponse) when calling interceptor") + return nil, twirp.InternalError("failed type assertion resp.(*RoomInfo) when calling interceptor") } return typedResp, err } @@ -166,8 +166,8 @@ func (c *roomServiceProtobufClient) JoinRoom(ctx context.Context, in *JoinRoomRe return caller(ctx, in) } -func (c *roomServiceProtobufClient) callJoinRoom(ctx context.Context, in *JoinRoomRequest) (*JoinRoomResponse, error) { - out := new(JoinRoomResponse) +func (c *roomServiceProtobufClient) callGetRoom(ctx context.Context, in *GetRoomRequest) (*RoomInfo, error) { + out := new(RoomInfo) ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[1], in, out) if err != nil { twerr, ok := err.(twirp.Error) @@ -257,7 +257,7 @@ func NewRoomServiceJSONClient(baseURL string, client HTTPClient, opts ...twirp.C serviceURL += baseServicePath(clientOpts.PathPrefix(), "livekit", "RoomService") urls := [3]string{ serviceURL + "CreateRoom", - serviceURL + "JoinRoom", + serviceURL + "GetRoom", serviceURL + "DeleteRoom", } @@ -269,13 +269,13 @@ func NewRoomServiceJSONClient(baseURL string, client HTTPClient, opts ...twirp.C } } -func (c *roomServiceJSONClient) CreateRoom(ctx context.Context, in *CreateRoomRequest) (*CreateRoomResponse, error) { +func (c *roomServiceJSONClient) CreateRoom(ctx context.Context, in *CreateRoomRequest) (*RoomInfo, error) { ctx = ctxsetters.WithPackageName(ctx, "livekit") ctx = ctxsetters.WithServiceName(ctx, "RoomService") ctx = ctxsetters.WithMethodName(ctx, "CreateRoom") caller := c.callCreateRoom if c.interceptor != nil { - caller = func(ctx context.Context, req *CreateRoomRequest) (*CreateRoomResponse, error) { + caller = func(ctx context.Context, req *CreateRoomRequest) (*RoomInfo, error) { resp, err := c.interceptor( func(ctx context.Context, req interface{}) (interface{}, error) { typedReq, ok := req.(*CreateRoomRequest) @@ -286,9 +286,9 @@ func (c *roomServiceJSONClient) CreateRoom(ctx context.Context, in *CreateRoomRe }, )(ctx, req) if resp != nil { - typedResp, ok := resp.(*CreateRoomResponse) + typedResp, ok := resp.(*RoomInfo) if !ok { - return nil, twirp.InternalError("failed type assertion resp.(*CreateRoomResponse) when calling interceptor") + return nil, twirp.InternalError("failed type assertion resp.(*RoomInfo) when calling interceptor") } return typedResp, err } @@ -298,8 +298,8 @@ func (c *roomServiceJSONClient) CreateRoom(ctx context.Context, in *CreateRoomRe return caller(ctx, in) } -func (c *roomServiceJSONClient) callCreateRoom(ctx context.Context, in *CreateRoomRequest) (*CreateRoomResponse, error) { - out := new(CreateRoomResponse) +func (c *roomServiceJSONClient) callCreateRoom(ctx context.Context, in *CreateRoomRequest) (*RoomInfo, error) { + out := new(RoomInfo) ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[0], in, out) if err != nil { twerr, ok := err.(twirp.Error) @@ -315,26 +315,26 @@ func (c *roomServiceJSONClient) callCreateRoom(ctx context.Context, in *CreateRo return out, nil } -func (c *roomServiceJSONClient) JoinRoom(ctx context.Context, in *JoinRoomRequest) (*JoinRoomResponse, error) { +func (c *roomServiceJSONClient) GetRoom(ctx context.Context, in *GetRoomRequest) (*RoomInfo, error) { ctx = ctxsetters.WithPackageName(ctx, "livekit") ctx = ctxsetters.WithServiceName(ctx, "RoomService") - ctx = ctxsetters.WithMethodName(ctx, "JoinRoom") - caller := c.callJoinRoom + ctx = ctxsetters.WithMethodName(ctx, "GetRoom") + caller := c.callGetRoom if c.interceptor != nil { - caller = func(ctx context.Context, req *JoinRoomRequest) (*JoinRoomResponse, error) { + caller = func(ctx context.Context, req *GetRoomRequest) (*RoomInfo, error) { resp, err := c.interceptor( func(ctx context.Context, req interface{}) (interface{}, error) { - typedReq, ok := req.(*JoinRoomRequest) + typedReq, ok := req.(*GetRoomRequest) if !ok { - return nil, twirp.InternalError("failed type assertion req.(*JoinRoomRequest) when calling interceptor") + return nil, twirp.InternalError("failed type assertion req.(*GetRoomRequest) when calling interceptor") } - return c.callJoinRoom(ctx, typedReq) + return c.callGetRoom(ctx, typedReq) }, )(ctx, req) if resp != nil { - typedResp, ok := resp.(*JoinRoomResponse) + typedResp, ok := resp.(*RoomInfo) if !ok { - return nil, twirp.InternalError("failed type assertion resp.(*JoinRoomResponse) when calling interceptor") + return nil, twirp.InternalError("failed type assertion resp.(*RoomInfo) when calling interceptor") } return typedResp, err } @@ -344,8 +344,8 @@ func (c *roomServiceJSONClient) JoinRoom(ctx context.Context, in *JoinRoomReques return caller(ctx, in) } -func (c *roomServiceJSONClient) callJoinRoom(ctx context.Context, in *JoinRoomRequest) (*JoinRoomResponse, error) { - out := new(JoinRoomResponse) +func (c *roomServiceJSONClient) callGetRoom(ctx context.Context, in *GetRoomRequest) (*RoomInfo, error) { + out := new(RoomInfo) ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[1], in, out) if err != nil { twerr, ok := err.(twirp.Error) @@ -494,8 +494,8 @@ func (s *roomServiceServer) ServeHTTP(resp http.ResponseWriter, req *http.Reques case "CreateRoom": s.serveCreateRoom(ctx, resp, req) return - case "JoinRoom": - s.serveJoinRoom(ctx, resp, req) + case "GetRoom": + s.serveGetRoom(ctx, resp, req) return case "DeleteRoom": s.serveDeleteRoom(ctx, resp, req) @@ -543,7 +543,7 @@ func (s *roomServiceServer) serveCreateRoomJSON(ctx context.Context, resp http.R handler := s.RoomService.CreateRoom if s.interceptor != nil { - handler = func(ctx context.Context, req *CreateRoomRequest) (*CreateRoomResponse, error) { + handler = func(ctx context.Context, req *CreateRoomRequest) (*RoomInfo, error) { resp, err := s.interceptor( func(ctx context.Context, req interface{}) (interface{}, error) { typedReq, ok := req.(*CreateRoomRequest) @@ -554,9 +554,9 @@ func (s *roomServiceServer) serveCreateRoomJSON(ctx context.Context, resp http.R }, )(ctx, req) if resp != nil { - typedResp, ok := resp.(*CreateRoomResponse) + typedResp, ok := resp.(*RoomInfo) if !ok { - return nil, twirp.InternalError("failed type assertion resp.(*CreateRoomResponse) when calling interceptor") + return nil, twirp.InternalError("failed type assertion resp.(*RoomInfo) when calling interceptor") } return typedResp, err } @@ -565,7 +565,7 @@ func (s *roomServiceServer) serveCreateRoomJSON(ctx context.Context, resp http.R } // Call service method - var respContent *CreateRoomResponse + var respContent *RoomInfo func() { defer ensurePanicResponses(ctx, resp, s.hooks) respContent, err = handler(ctx, reqContent) @@ -576,7 +576,7 @@ func (s *roomServiceServer) serveCreateRoomJSON(ctx context.Context, resp http.R return } if respContent == nil { - s.writeError(ctx, resp, twirp.InternalError("received a nil *CreateRoomResponse and nil error while calling CreateRoom. nil responses are not supported")) + s.writeError(ctx, resp, twirp.InternalError("received a nil *RoomInfo and nil error while calling CreateRoom. nil responses are not supported")) return } @@ -625,7 +625,7 @@ func (s *roomServiceServer) serveCreateRoomProtobuf(ctx context.Context, resp ht handler := s.RoomService.CreateRoom if s.interceptor != nil { - handler = func(ctx context.Context, req *CreateRoomRequest) (*CreateRoomResponse, error) { + handler = func(ctx context.Context, req *CreateRoomRequest) (*RoomInfo, error) { resp, err := s.interceptor( func(ctx context.Context, req interface{}) (interface{}, error) { typedReq, ok := req.(*CreateRoomRequest) @@ -636,9 +636,9 @@ func (s *roomServiceServer) serveCreateRoomProtobuf(ctx context.Context, resp ht }, )(ctx, req) if resp != nil { - typedResp, ok := resp.(*CreateRoomResponse) + typedResp, ok := resp.(*RoomInfo) if !ok { - return nil, twirp.InternalError("failed type assertion resp.(*CreateRoomResponse) when calling interceptor") + return nil, twirp.InternalError("failed type assertion resp.(*RoomInfo) when calling interceptor") } return typedResp, err } @@ -647,7 +647,7 @@ func (s *roomServiceServer) serveCreateRoomProtobuf(ctx context.Context, resp ht } // Call service method - var respContent *CreateRoomResponse + var respContent *RoomInfo func() { defer ensurePanicResponses(ctx, resp, s.hooks) respContent, err = handler(ctx, reqContent) @@ -658,7 +658,7 @@ func (s *roomServiceServer) serveCreateRoomProtobuf(ctx context.Context, resp ht return } if respContent == nil { - s.writeError(ctx, resp, twirp.InternalError("received a nil *CreateRoomResponse and nil error while calling CreateRoom. nil responses are not supported")) + s.writeError(ctx, resp, twirp.InternalError("received a nil *RoomInfo and nil error while calling CreateRoom. nil responses are not supported")) return } @@ -682,7 +682,7 @@ func (s *roomServiceServer) serveCreateRoomProtobuf(ctx context.Context, resp ht callResponseSent(ctx, s.hooks) } -func (s *roomServiceServer) serveJoinRoom(ctx context.Context, resp http.ResponseWriter, req *http.Request) { +func (s *roomServiceServer) serveGetRoom(ctx context.Context, resp http.ResponseWriter, req *http.Request) { header := req.Header.Get("Content-Type") i := strings.Index(header, ";") if i == -1 { @@ -690,9 +690,9 @@ func (s *roomServiceServer) serveJoinRoom(ctx context.Context, resp http.Respons } switch strings.TrimSpace(strings.ToLower(header[:i])) { case "application/json": - s.serveJoinRoomJSON(ctx, resp, req) + s.serveGetRoomJSON(ctx, resp, req) case "application/protobuf": - s.serveJoinRoomProtobuf(ctx, resp, req) + s.serveGetRoomProtobuf(ctx, resp, req) default: msg := fmt.Sprintf("unexpected Content-Type: %q", req.Header.Get("Content-Type")) twerr := badRouteError(msg, req.Method, req.URL.Path) @@ -700,38 +700,38 @@ func (s *roomServiceServer) serveJoinRoom(ctx context.Context, resp http.Respons } } -func (s *roomServiceServer) serveJoinRoomJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { +func (s *roomServiceServer) serveGetRoomJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { var err error - ctx = ctxsetters.WithMethodName(ctx, "JoinRoom") + ctx = ctxsetters.WithMethodName(ctx, "GetRoom") ctx, err = callRequestRouted(ctx, s.hooks) if err != nil { s.writeError(ctx, resp, err) return } - reqContent := new(JoinRoomRequest) + reqContent := new(GetRoomRequest) unmarshaler := jsonpb.Unmarshaler{AllowUnknownFields: true} if err = unmarshaler.Unmarshal(req.Body, reqContent); err != nil { s.writeError(ctx, resp, malformedRequestError("the json request could not be decoded")) return } - handler := s.RoomService.JoinRoom + handler := s.RoomService.GetRoom if s.interceptor != nil { - handler = func(ctx context.Context, req *JoinRoomRequest) (*JoinRoomResponse, error) { + handler = func(ctx context.Context, req *GetRoomRequest) (*RoomInfo, error) { resp, err := s.interceptor( func(ctx context.Context, req interface{}) (interface{}, error) { - typedReq, ok := req.(*JoinRoomRequest) + typedReq, ok := req.(*GetRoomRequest) if !ok { - return nil, twirp.InternalError("failed type assertion req.(*JoinRoomRequest) when calling interceptor") + return nil, twirp.InternalError("failed type assertion req.(*GetRoomRequest) when calling interceptor") } - return s.RoomService.JoinRoom(ctx, typedReq) + return s.RoomService.GetRoom(ctx, typedReq) }, )(ctx, req) if resp != nil { - typedResp, ok := resp.(*JoinRoomResponse) + typedResp, ok := resp.(*RoomInfo) if !ok { - return nil, twirp.InternalError("failed type assertion resp.(*JoinRoomResponse) when calling interceptor") + return nil, twirp.InternalError("failed type assertion resp.(*RoomInfo) when calling interceptor") } return typedResp, err } @@ -740,7 +740,7 @@ func (s *roomServiceServer) serveJoinRoomJSON(ctx context.Context, resp http.Res } // Call service method - var respContent *JoinRoomResponse + var respContent *RoomInfo func() { defer ensurePanicResponses(ctx, resp, s.hooks) respContent, err = handler(ctx, reqContent) @@ -751,7 +751,7 @@ func (s *roomServiceServer) serveJoinRoomJSON(ctx context.Context, resp http.Res return } if respContent == nil { - s.writeError(ctx, resp, twirp.InternalError("received a nil *JoinRoomResponse and nil error while calling JoinRoom. nil responses are not supported")) + s.writeError(ctx, resp, twirp.InternalError("received a nil *RoomInfo and nil error while calling GetRoom. nil responses are not supported")) return } @@ -778,9 +778,9 @@ func (s *roomServiceServer) serveJoinRoomJSON(ctx context.Context, resp http.Res callResponseSent(ctx, s.hooks) } -func (s *roomServiceServer) serveJoinRoomProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { +func (s *roomServiceServer) serveGetRoomProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { var err error - ctx = ctxsetters.WithMethodName(ctx, "JoinRoom") + ctx = ctxsetters.WithMethodName(ctx, "GetRoom") ctx, err = callRequestRouted(ctx, s.hooks) if err != nil { s.writeError(ctx, resp, err) @@ -792,28 +792,28 @@ func (s *roomServiceServer) serveJoinRoomProtobuf(ctx context.Context, resp http s.writeError(ctx, resp, wrapInternal(err, "failed to read request body")) return } - reqContent := new(JoinRoomRequest) + reqContent := new(GetRoomRequest) if err = proto.Unmarshal(buf, reqContent); err != nil { s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded")) return } - handler := s.RoomService.JoinRoom + handler := s.RoomService.GetRoom if s.interceptor != nil { - handler = func(ctx context.Context, req *JoinRoomRequest) (*JoinRoomResponse, error) { + handler = func(ctx context.Context, req *GetRoomRequest) (*RoomInfo, error) { resp, err := s.interceptor( func(ctx context.Context, req interface{}) (interface{}, error) { - typedReq, ok := req.(*JoinRoomRequest) + typedReq, ok := req.(*GetRoomRequest) if !ok { - return nil, twirp.InternalError("failed type assertion req.(*JoinRoomRequest) when calling interceptor") + return nil, twirp.InternalError("failed type assertion req.(*GetRoomRequest) when calling interceptor") } - return s.RoomService.JoinRoom(ctx, typedReq) + return s.RoomService.GetRoom(ctx, typedReq) }, )(ctx, req) if resp != nil { - typedResp, ok := resp.(*JoinRoomResponse) + typedResp, ok := resp.(*RoomInfo) if !ok { - return nil, twirp.InternalError("failed type assertion resp.(*JoinRoomResponse) when calling interceptor") + return nil, twirp.InternalError("failed type assertion resp.(*RoomInfo) when calling interceptor") } return typedResp, err } @@ -822,7 +822,7 @@ func (s *roomServiceServer) serveJoinRoomProtobuf(ctx context.Context, resp http } // Call service method - var respContent *JoinRoomResponse + var respContent *RoomInfo func() { defer ensurePanicResponses(ctx, resp, s.hooks) respContent, err = handler(ctx, reqContent) @@ -833,7 +833,7 @@ func (s *roomServiceServer) serveJoinRoomProtobuf(ctx context.Context, resp http return } if respContent == nil { - s.writeError(ctx, resp, twirp.InternalError("received a nil *JoinRoomResponse and nil error while calling JoinRoom. nil responses are not supported")) + s.writeError(ctx, resp, twirp.InternalError("received a nil *RoomInfo and nil error while calling GetRoom. nil responses are not supported")) return } @@ -1053,6 +1053,8 @@ func (s *roomServiceServer) PathPrefix() string { // RTC methods performed on target node type RTCService interface { + Join(context.Context, *JoinRequest) (*JoinResponse, error) + // offer allows client to initiate a RTC session Offer(context.Context, *SessionDescription) (*SessionDescription, error) @@ -1066,7 +1068,7 @@ type RTCService interface { type rTCServiceProtobufClient struct { client HTTPClient - urls [2]string + urls [3]string interceptor twirp.Interceptor opts twirp.ClientOptions } @@ -1086,7 +1088,8 @@ func NewRTCServiceProtobufClient(baseURL string, client HTTPClient, opts ...twir // Build method URLs: []/./ serviceURL := sanitizeBaseURL(baseURL) serviceURL += baseServicePath(clientOpts.PathPrefix(), "livekit", "RTCService") - urls := [2]string{ + urls := [3]string{ + serviceURL + "Join", serviceURL + "Offer", serviceURL + "Trickle", } @@ -1099,6 +1102,52 @@ func NewRTCServiceProtobufClient(baseURL string, client HTTPClient, opts ...twir } } +func (c *rTCServiceProtobufClient) Join(ctx context.Context, in *JoinRequest) (*JoinResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "RTCService") + ctx = ctxsetters.WithMethodName(ctx, "Join") + caller := c.callJoin + if c.interceptor != nil { + caller = func(ctx context.Context, req *JoinRequest) (*JoinResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*JoinRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*JoinRequest) when calling interceptor") + } + return c.callJoin(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*JoinResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*JoinResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *rTCServiceProtobufClient) callJoin(ctx context.Context, in *JoinRequest) (*JoinResponse, error) { + out := new(JoinResponse) + ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[0], in, out) + if err != nil { + twerr, ok := err.(twirp.Error) + if !ok { + twerr = twirp.InternalErrorWith(err) + } + callClientError(ctx, c.opts.Hooks, twerr) + return nil, err + } + + callClientResponseReceived(ctx, c.opts.Hooks) + + return out, nil +} + func (c *rTCServiceProtobufClient) Offer(ctx context.Context, in *SessionDescription) (*SessionDescription, error) { ctx = ctxsetters.WithPackageName(ctx, "livekit") ctx = ctxsetters.WithServiceName(ctx, "RTCService") @@ -1130,7 +1179,7 @@ func (c *rTCServiceProtobufClient) Offer(ctx context.Context, in *SessionDescrip func (c *rTCServiceProtobufClient) callOffer(ctx context.Context, in *SessionDescription) (*SessionDescription, error) { out := new(SessionDescription) - ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[0], in, out) + ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[1], in, out) if err != nil { twerr, ok := err.(twirp.Error) if !ok { @@ -1176,7 +1225,7 @@ func (c *rTCServiceProtobufClient) Trickle(ctx context.Context, in *TrickleReque func (c *rTCServiceProtobufClient) callTrickle(ctx context.Context, in *TrickleRequest) (*TrickleResponse, error) { out := new(TrickleResponse) - ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[1], in, out) + ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[2], in, out) if err != nil { twerr, ok := err.(twirp.Error) if !ok { @@ -1197,7 +1246,7 @@ func (c *rTCServiceProtobufClient) callTrickle(ctx context.Context, in *TrickleR type rTCServiceJSONClient struct { client HTTPClient - urls [2]string + urls [3]string interceptor twirp.Interceptor opts twirp.ClientOptions } @@ -1217,7 +1266,8 @@ func NewRTCServiceJSONClient(baseURL string, client HTTPClient, opts ...twirp.Cl // Build method URLs: []/./ serviceURL := sanitizeBaseURL(baseURL) serviceURL += baseServicePath(clientOpts.PathPrefix(), "livekit", "RTCService") - urls := [2]string{ + urls := [3]string{ + serviceURL + "Join", serviceURL + "Offer", serviceURL + "Trickle", } @@ -1230,6 +1280,52 @@ func NewRTCServiceJSONClient(baseURL string, client HTTPClient, opts ...twirp.Cl } } +func (c *rTCServiceJSONClient) Join(ctx context.Context, in *JoinRequest) (*JoinResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "RTCService") + ctx = ctxsetters.WithMethodName(ctx, "Join") + caller := c.callJoin + if c.interceptor != nil { + caller = func(ctx context.Context, req *JoinRequest) (*JoinResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*JoinRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*JoinRequest) when calling interceptor") + } + return c.callJoin(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*JoinResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*JoinResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *rTCServiceJSONClient) callJoin(ctx context.Context, in *JoinRequest) (*JoinResponse, error) { + out := new(JoinResponse) + ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[0], in, out) + if err != nil { + twerr, ok := err.(twirp.Error) + if !ok { + twerr = twirp.InternalErrorWith(err) + } + callClientError(ctx, c.opts.Hooks, twerr) + return nil, err + } + + callClientResponseReceived(ctx, c.opts.Hooks) + + return out, nil +} + func (c *rTCServiceJSONClient) Offer(ctx context.Context, in *SessionDescription) (*SessionDescription, error) { ctx = ctxsetters.WithPackageName(ctx, "livekit") ctx = ctxsetters.WithServiceName(ctx, "RTCService") @@ -1261,7 +1357,7 @@ func (c *rTCServiceJSONClient) Offer(ctx context.Context, in *SessionDescription func (c *rTCServiceJSONClient) callOffer(ctx context.Context, in *SessionDescription) (*SessionDescription, error) { out := new(SessionDescription) - ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[0], in, out) + ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[1], in, out) if err != nil { twerr, ok := err.(twirp.Error) if !ok { @@ -1307,7 +1403,7 @@ func (c *rTCServiceJSONClient) Trickle(ctx context.Context, in *TrickleRequest) func (c *rTCServiceJSONClient) callTrickle(ctx context.Context, in *TrickleRequest) (*TrickleResponse, error) { out := new(TrickleResponse) - ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[1], in, out) + ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[2], in, out) if err != nil { twerr, ok := err.(twirp.Error) if !ok { @@ -1406,6 +1502,9 @@ func (s *rTCServiceServer) ServeHTTP(resp http.ResponseWriter, req *http.Request } switch method { + case "Join": + s.serveJoin(ctx, resp, req) + return case "Offer": s.serveOffer(ctx, resp, req) return @@ -1419,6 +1518,181 @@ func (s *rTCServiceServer) ServeHTTP(resp http.ResponseWriter, req *http.Request } } +func (s *rTCServiceServer) serveJoin(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + header := req.Header.Get("Content-Type") + i := strings.Index(header, ";") + if i == -1 { + i = len(header) + } + switch strings.TrimSpace(strings.ToLower(header[:i])) { + case "application/json": + s.serveJoinJSON(ctx, resp, req) + case "application/protobuf": + s.serveJoinProtobuf(ctx, resp, req) + default: + msg := fmt.Sprintf("unexpected Content-Type: %q", req.Header.Get("Content-Type")) + twerr := badRouteError(msg, req.Method, req.URL.Path) + s.writeError(ctx, resp, twerr) + } +} + +func (s *rTCServiceServer) serveJoinJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "Join") + ctx, err = callRequestRouted(ctx, s.hooks) + if err != nil { + s.writeError(ctx, resp, err) + return + } + + reqContent := new(JoinRequest) + unmarshaler := jsonpb.Unmarshaler{AllowUnknownFields: true} + if err = unmarshaler.Unmarshal(req.Body, reqContent); err != nil { + s.writeError(ctx, resp, malformedRequestError("the json request could not be decoded")) + return + } + + handler := s.RTCService.Join + if s.interceptor != nil { + handler = func(ctx context.Context, req *JoinRequest) (*JoinResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*JoinRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*JoinRequest) when calling interceptor") + } + return s.RTCService.Join(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*JoinResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*JoinResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *JoinResponse + func() { + defer ensurePanicResponses(ctx, resp, s.hooks) + respContent, err = handler(ctx, reqContent) + }() + + if err != nil { + s.writeError(ctx, resp, err) + return + } + if respContent == nil { + s.writeError(ctx, resp, twirp.InternalError("received a nil *JoinResponse and nil error while calling Join. nil responses are not supported")) + return + } + + ctx = callResponsePrepared(ctx, s.hooks) + + var buf bytes.Buffer + marshaler := &jsonpb.Marshaler{OrigName: true, EmitDefaults: !s.jsonSkipDefaults} + if err = marshaler.Marshal(&buf, respContent); err != nil { + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal json response")) + return + } + + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) + respBytes := buf.Bytes() + resp.Header().Set("Content-Type", "application/json") + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) + resp.WriteHeader(http.StatusOK) + + if n, err := resp.Write(respBytes); err != nil { + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) + twerr := twirp.NewError(twirp.Unknown, msg) + ctx = callError(ctx, s.hooks, twerr) + } + callResponseSent(ctx, s.hooks) +} + +func (s *rTCServiceServer) serveJoinProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "Join") + ctx, err = callRequestRouted(ctx, s.hooks) + if err != nil { + s.writeError(ctx, resp, err) + return + } + + buf, err := ioutil.ReadAll(req.Body) + if err != nil { + s.writeError(ctx, resp, wrapInternal(err, "failed to read request body")) + return + } + reqContent := new(JoinRequest) + if err = proto.Unmarshal(buf, reqContent); err != nil { + s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded")) + return + } + + handler := s.RTCService.Join + if s.interceptor != nil { + handler = func(ctx context.Context, req *JoinRequest) (*JoinResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*JoinRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*JoinRequest) when calling interceptor") + } + return s.RTCService.Join(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*JoinResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*JoinResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *JoinResponse + func() { + defer ensurePanicResponses(ctx, resp, s.hooks) + respContent, err = handler(ctx, reqContent) + }() + + if err != nil { + s.writeError(ctx, resp, err) + return + } + if respContent == nil { + s.writeError(ctx, resp, twirp.InternalError("received a nil *JoinResponse and nil error while calling Join. nil responses are not supported")) + return + } + + ctx = callResponsePrepared(ctx, s.hooks) + + respBytes, err := proto.Marshal(respContent) + if err != nil { + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal proto response")) + return + } + + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) + resp.Header().Set("Content-Type", "application/protobuf") + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) + resp.WriteHeader(http.StatusOK) + if n, err := resp.Write(respBytes); err != nil { + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) + twerr := twirp.NewError(twirp.Unknown, msg) + ctx = callError(ctx, s.hooks, twerr) + } + callResponseSent(ctx, s.hooks) +} + func (s *rTCServiceServer) serveOffer(ctx context.Context, resp http.ResponseWriter, req *http.Request) { header := req.Header.Get("Content-Type") i := strings.Index(header, ";") @@ -2331,35 +2605,39 @@ func callClientError(ctx context.Context, h *twirp.ClientHooks, err twirp.Error) } var twirpFileDescriptor0 = []byte{ - // 475 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x54, 0xc1, 0x4e, 0xdb, 0x40, - 0x10, 0xc5, 0x40, 0x31, 0x99, 0x34, 0x84, 0x8c, 0x2a, 0xe1, 0x3a, 0x3d, 0x20, 0x5f, 0x42, 0x0f, - 0x35, 0x6a, 0xb8, 0x55, 0x95, 0xaa, 0x06, 0x90, 0xa0, 0x17, 0xaa, 0x0d, 0xa7, 0x5e, 0x22, 0xb3, - 0x1e, 0xe8, 0x0a, 0xc7, 0xeb, 0xee, 0x2e, 0x48, 0x9c, 0x7b, 0xee, 0x1f, 0xf6, 0x63, 0x2a, 0xaf, - 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, 0xd0, 0x4e, 0x54, 0x7c, - 0x26, 0x6f, 0xbf, 0x8d, 0xee, 0x84, 0xf9, 0xfe, 0x70, 0x13, 0x73, 0x39, 0x3f, 0x76, 0xa8, 0xfa, - 0xfb, 0xae, 0x7c, 0x1d, 0x48, 0x1d, 0xdb, 0xc7, 0xe1, 0x66, 0xc7, 0x7e, 0x4e, 0xfe, 0x04, 0x00, - 0x00, 0xff, 0xff, 0x3b, 0x56, 0x68, 0x37, 0x34, 0x04, 0x00, 0x00, + // 532 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0xcd, 0x6e, 0xd3, 0x4c, + 0x14, 0x95, 0x9b, 0xbf, 0xcf, 0x37, 0x49, 0xdb, 0x5c, 0xe5, 0x53, 0x2c, 0x17, 0xa4, 0xc8, 0x6c, + 0x52, 0x09, 0x45, 0x22, 0x11, 0x1b, 0x60, 0x03, 0x29, 0x42, 0x61, 0x43, 0x35, 0xcd, 0x8a, 0x4d, + 0x64, 0xec, 0x1b, 0x69, 0x94, 0xd8, 0x63, 0x66, 0xa6, 0xa5, 0x95, 0x78, 0x06, 0x5e, 0x80, 0xb7, + 0x61, 0xc5, 0x63, 0xa1, 0x19, 0x3b, 0x8e, 0x4b, 0x4a, 0xdb, 0x9d, 0xe7, 0xdc, 0x3b, 0x33, 0xe7, + 0xdc, 0x73, 0x3c, 0xd0, 0x55, 0x24, 0xaf, 0x78, 0x44, 0xe3, 0x4c, 0x0a, 0x2d, 0xb0, 0xb5, 0xe1, + 0x57, 0xb4, 0xe6, 0x3a, 0xf8, 0x0e, 0xbd, 0x99, 0xa4, 0x50, 0x13, 0x13, 0x22, 0x61, 0xf4, 0xf5, + 0x92, 0x94, 0xc6, 0x01, 0xb4, 0xa4, 0x10, 0xc9, 0x92, 0xc7, 0x9e, 0x33, 0x74, 0x46, 0x2e, 0x6b, + 0x9a, 0xe5, 0x3c, 0xc6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0x61, 0x50, 0x65, 0x08, 0xb7, 0x2d, 0xf6, 0xbd, 0xfd, 0x42, 0x4e, 0xe0, 0x9d, 0xfb, 0x79, 0xfb, + 0xf4, 0x7c, 0x69, 0xda, 0xa7, 0x68, 0xfa, 0x27, 0x00, 0x00, 0xff, 0xff, 0xa0, 0x72, 0x68, 0xb2, + 0x9b, 0x04, 0x00, 0x00, } diff --git a/proto/model.proto b/proto/model.proto index 924fab0be..605955fcd 100644 --- a/proto/model.proto +++ b/proto/model.proto @@ -15,4 +15,12 @@ message Node { message NodeStats { int32 num_rooms = 1; int32 num_clients = 2; -} \ No newline at end of file +} + +message Room { + string room_id = 1; + uint32 empty_timeout = 2; + uint32 max_participants = 3; + int64 creation_time = 4; + string token = 5; +} diff --git a/proto/service.pb.go b/proto/service.pb.go deleted file mode 100644 index d9157eb3d..000000000 --- a/proto/service.pb.go +++ /dev/null @@ -1,557 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: service.proto - -package proto - -import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package - -type CreateRoomRequest struct { - Room string `protobuf:"bytes,1,opt,name=room,proto3" json:"room,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *CreateRoomRequest) Reset() { *m = CreateRoomRequest{} } -func (m *CreateRoomRequest) String() string { return proto.CompactTextString(m) } -func (*CreateRoomRequest) ProtoMessage() {} -func (*CreateRoomRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a0b84a42fa06f626, []int{0} -} - -func (m *CreateRoomRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_CreateRoomRequest.Unmarshal(m, b) -} -func (m *CreateRoomRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_CreateRoomRequest.Marshal(b, m, deterministic) -} -func (m *CreateRoomRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_CreateRoomRequest.Merge(m, src) -} -func (m *CreateRoomRequest) XXX_Size() int { - return xxx_messageInfo_CreateRoomRequest.Size(m) -} -func (m *CreateRoomRequest) XXX_DiscardUnknown() { - xxx_messageInfo_CreateRoomRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_CreateRoomRequest proto.InternalMessageInfo - -func (m *CreateRoomRequest) GetRoom() string { - if m != nil { - return m.Room - } - return "" -} - -type CreateRoomResponse struct { - Room string `protobuf:"bytes,1,opt,name=room,proto3" json:"room,omitempty"` - NodeIp string `protobuf:"bytes,2,opt,name=node_ip,json=nodeIp,proto3" json:"node_ip,omitempty"` - NodeRtcPort uint32 `protobuf:"varint,3,opt,name=node_rtc_port,json=nodeRtcPort,proto3" json:"node_rtc_port,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *CreateRoomResponse) Reset() { *m = CreateRoomResponse{} } -func (m *CreateRoomResponse) String() string { return proto.CompactTextString(m) } -func (*CreateRoomResponse) ProtoMessage() {} -func (*CreateRoomResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a0b84a42fa06f626, []int{1} -} - -func (m *CreateRoomResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_CreateRoomResponse.Unmarshal(m, b) -} -func (m *CreateRoomResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_CreateRoomResponse.Marshal(b, m, deterministic) -} -func (m *CreateRoomResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_CreateRoomResponse.Merge(m, src) -} -func (m *CreateRoomResponse) XXX_Size() int { - return xxx_messageInfo_CreateRoomResponse.Size(m) -} -func (m *CreateRoomResponse) XXX_DiscardUnknown() { - xxx_messageInfo_CreateRoomResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_CreateRoomResponse proto.InternalMessageInfo - -func (m *CreateRoomResponse) GetRoom() string { - if m != nil { - return m.Room - } - return "" -} - -func (m *CreateRoomResponse) GetNodeIp() string { - if m != nil { - return m.NodeIp - } - return "" -} - -func (m *CreateRoomResponse) GetNodeRtcPort() uint32 { - if m != nil { - return m.NodeRtcPort - } - return 0 -} - -type JoinRoomRequest struct { - Room string `protobuf:"bytes,1,opt,name=room,proto3" json:"room,omitempty"` - ClientId string `protobuf:"bytes,2,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *JoinRoomRequest) Reset() { *m = JoinRoomRequest{} } -func (m *JoinRoomRequest) String() string { return proto.CompactTextString(m) } -func (*JoinRoomRequest) ProtoMessage() {} -func (*JoinRoomRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a0b84a42fa06f626, []int{2} -} - -func (m *JoinRoomRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_JoinRoomRequest.Unmarshal(m, b) -} -func (m *JoinRoomRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_JoinRoomRequest.Marshal(b, m, deterministic) -} -func (m *JoinRoomRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_JoinRoomRequest.Merge(m, src) -} -func (m *JoinRoomRequest) XXX_Size() int { - return xxx_messageInfo_JoinRoomRequest.Size(m) -} -func (m *JoinRoomRequest) XXX_DiscardUnknown() { - xxx_messageInfo_JoinRoomRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_JoinRoomRequest proto.InternalMessageInfo - -func (m *JoinRoomRequest) GetRoom() string { - if m != nil { - return m.Room - } - return "" -} - -func (m *JoinRoomRequest) GetClientId() string { - if m != nil { - return m.ClientId - } - return "" -} - -type JoinRoomResponse struct { - NodeIp string `protobuf:"bytes,1,opt,name=node_ip,json=nodeIp,proto3" json:"node_ip,omitempty"` - NodeRtcPort uint32 `protobuf:"varint,2,opt,name=node_rtc_port,json=nodeRtcPort,proto3" json:"node_rtc_port,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *JoinRoomResponse) Reset() { *m = JoinRoomResponse{} } -func (m *JoinRoomResponse) String() string { return proto.CompactTextString(m) } -func (*JoinRoomResponse) ProtoMessage() {} -func (*JoinRoomResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a0b84a42fa06f626, []int{3} -} - -func (m *JoinRoomResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_JoinRoomResponse.Unmarshal(m, b) -} -func (m *JoinRoomResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_JoinRoomResponse.Marshal(b, m, deterministic) -} -func (m *JoinRoomResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_JoinRoomResponse.Merge(m, src) -} -func (m *JoinRoomResponse) XXX_Size() int { - return xxx_messageInfo_JoinRoomResponse.Size(m) -} -func (m *JoinRoomResponse) XXX_DiscardUnknown() { - xxx_messageInfo_JoinRoomResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_JoinRoomResponse proto.InternalMessageInfo - -func (m *JoinRoomResponse) GetNodeIp() string { - if m != nil { - return m.NodeIp - } - return "" -} - -func (m *JoinRoomResponse) GetNodeRtcPort() uint32 { - if m != nil { - return m.NodeRtcPort - } - return 0 -} - -type DeleteRoomRequest struct { - Room string `protobuf:"bytes,1,opt,name=room,proto3" json:"room,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *DeleteRoomRequest) Reset() { *m = DeleteRoomRequest{} } -func (m *DeleteRoomRequest) String() string { return proto.CompactTextString(m) } -func (*DeleteRoomRequest) ProtoMessage() {} -func (*DeleteRoomRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a0b84a42fa06f626, []int{4} -} - -func (m *DeleteRoomRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DeleteRoomRequest.Unmarshal(m, b) -} -func (m *DeleteRoomRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DeleteRoomRequest.Marshal(b, m, deterministic) -} -func (m *DeleteRoomRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_DeleteRoomRequest.Merge(m, src) -} -func (m *DeleteRoomRequest) XXX_Size() int { - return xxx_messageInfo_DeleteRoomRequest.Size(m) -} -func (m *DeleteRoomRequest) XXX_DiscardUnknown() { - xxx_messageInfo_DeleteRoomRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_DeleteRoomRequest proto.InternalMessageInfo - -func (m *DeleteRoomRequest) GetRoom() string { - if m != nil { - return m.Room - } - return "" -} - -type DeleteRoomResponse struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *DeleteRoomResponse) Reset() { *m = DeleteRoomResponse{} } -func (m *DeleteRoomResponse) String() string { return proto.CompactTextString(m) } -func (*DeleteRoomResponse) ProtoMessage() {} -func (*DeleteRoomResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a0b84a42fa06f626, []int{5} -} - -func (m *DeleteRoomResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DeleteRoomResponse.Unmarshal(m, b) -} -func (m *DeleteRoomResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DeleteRoomResponse.Marshal(b, m, deterministic) -} -func (m *DeleteRoomResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_DeleteRoomResponse.Merge(m, src) -} -func (m *DeleteRoomResponse) XXX_Size() int { - return xxx_messageInfo_DeleteRoomResponse.Size(m) -} -func (m *DeleteRoomResponse) XXX_DiscardUnknown() { - xxx_messageInfo_DeleteRoomResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_DeleteRoomResponse proto.InternalMessageInfo - -type SignalRequest struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SignalRequest) Reset() { *m = SignalRequest{} } -func (m *SignalRequest) String() string { return proto.CompactTextString(m) } -func (*SignalRequest) ProtoMessage() {} -func (*SignalRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a0b84a42fa06f626, []int{6} -} - -func (m *SignalRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SignalRequest.Unmarshal(m, b) -} -func (m *SignalRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SignalRequest.Marshal(b, m, deterministic) -} -func (m *SignalRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_SignalRequest.Merge(m, src) -} -func (m *SignalRequest) XXX_Size() int { - return xxx_messageInfo_SignalRequest.Size(m) -} -func (m *SignalRequest) XXX_DiscardUnknown() { - xxx_messageInfo_SignalRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_SignalRequest proto.InternalMessageInfo - -type SignalResponse struct { - // Types that are valid to be assigned to Payload: - // *SignalResponse_Desc - // *SignalResponse_Trickle - Payload isSignalResponse_Payload `protobuf_oneof:"payload"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SignalResponse) Reset() { *m = SignalResponse{} } -func (m *SignalResponse) String() string { return proto.CompactTextString(m) } -func (*SignalResponse) ProtoMessage() {} -func (*SignalResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a0b84a42fa06f626, []int{7} -} - -func (m *SignalResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SignalResponse.Unmarshal(m, b) -} -func (m *SignalResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SignalResponse.Marshal(b, m, deterministic) -} -func (m *SignalResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_SignalResponse.Merge(m, src) -} -func (m *SignalResponse) XXX_Size() int { - return xxx_messageInfo_SignalResponse.Size(m) -} -func (m *SignalResponse) XXX_DiscardUnknown() { - xxx_messageInfo_SignalResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_SignalResponse proto.InternalMessageInfo - -type isSignalResponse_Payload interface { - isSignalResponse_Payload() -} - -type SignalResponse_Desc struct { - Desc *SessionDescription `protobuf:"bytes,1,opt,name=desc,proto3,oneof"` -} - -type SignalResponse_Trickle struct { - Trickle *TrickleRequest `protobuf:"bytes,2,opt,name=trickle,proto3,oneof"` -} - -func (*SignalResponse_Desc) isSignalResponse_Payload() {} - -func (*SignalResponse_Trickle) isSignalResponse_Payload() {} - -func (m *SignalResponse) GetPayload() isSignalResponse_Payload { - if m != nil { - return m.Payload - } - return nil -} - -func (m *SignalResponse) GetDesc() *SessionDescription { - if x, ok := m.GetPayload().(*SignalResponse_Desc); ok { - return x.Desc - } - return nil -} - -func (m *SignalResponse) GetTrickle() *TrickleRequest { - if x, ok := m.GetPayload().(*SignalResponse_Trickle); ok { - return x.Trickle - } - return nil -} - -// XXX_OneofWrappers is for the internal use of the proto package. -func (*SignalResponse) XXX_OneofWrappers() []interface{} { - return []interface{}{ - (*SignalResponse_Desc)(nil), - (*SignalResponse_Trickle)(nil), - } -} - -type TrickleRequest struct { - Candidate string `protobuf:"bytes,1,opt,name=candidate,proto3" json:"candidate,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *TrickleRequest) Reset() { *m = TrickleRequest{} } -func (m *TrickleRequest) String() string { return proto.CompactTextString(m) } -func (*TrickleRequest) ProtoMessage() {} -func (*TrickleRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a0b84a42fa06f626, []int{8} -} - -func (m *TrickleRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_TrickleRequest.Unmarshal(m, b) -} -func (m *TrickleRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_TrickleRequest.Marshal(b, m, deterministic) -} -func (m *TrickleRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_TrickleRequest.Merge(m, src) -} -func (m *TrickleRequest) XXX_Size() int { - return xxx_messageInfo_TrickleRequest.Size(m) -} -func (m *TrickleRequest) XXX_DiscardUnknown() { - xxx_messageInfo_TrickleRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_TrickleRequest proto.InternalMessageInfo - -func (m *TrickleRequest) GetCandidate() string { - if m != nil { - return m.Candidate - } - return "" -} - -type TrickleResponse struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *TrickleResponse) Reset() { *m = TrickleResponse{} } -func (m *TrickleResponse) String() string { return proto.CompactTextString(m) } -func (*TrickleResponse) ProtoMessage() {} -func (*TrickleResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a0b84a42fa06f626, []int{9} -} - -func (m *TrickleResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_TrickleResponse.Unmarshal(m, b) -} -func (m *TrickleResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_TrickleResponse.Marshal(b, m, deterministic) -} -func (m *TrickleResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_TrickleResponse.Merge(m, src) -} -func (m *TrickleResponse) XXX_Size() int { - return xxx_messageInfo_TrickleResponse.Size(m) -} -func (m *TrickleResponse) XXX_DiscardUnknown() { - xxx_messageInfo_TrickleResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_TrickleResponse proto.InternalMessageInfo - -type SessionDescription struct { - Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` - Sdp []byte `protobuf:"bytes,2,opt,name=sdp,proto3" json:"sdp,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *SessionDescription) Reset() { *m = SessionDescription{} } -func (m *SessionDescription) String() string { return proto.CompactTextString(m) } -func (*SessionDescription) ProtoMessage() {} -func (*SessionDescription) Descriptor() ([]byte, []int) { - return fileDescriptor_a0b84a42fa06f626, []int{10} -} - -func (m *SessionDescription) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SessionDescription.Unmarshal(m, b) -} -func (m *SessionDescription) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SessionDescription.Marshal(b, m, deterministic) -} -func (m *SessionDescription) XXX_Merge(src proto.Message) { - xxx_messageInfo_SessionDescription.Merge(m, src) -} -func (m *SessionDescription) XXX_Size() int { - return xxx_messageInfo_SessionDescription.Size(m) -} -func (m *SessionDescription) XXX_DiscardUnknown() { - xxx_messageInfo_SessionDescription.DiscardUnknown(m) -} - -var xxx_messageInfo_SessionDescription proto.InternalMessageInfo - -func (m *SessionDescription) GetType() string { - if m != nil { - return m.Type - } - return "" -} - -func (m *SessionDescription) GetSdp() []byte { - if m != nil { - return m.Sdp - } - return nil -} - -func init() { - proto.RegisterType((*CreateRoomRequest)(nil), "livekit.CreateRoomRequest") - proto.RegisterType((*CreateRoomResponse)(nil), "livekit.CreateRoomResponse") - proto.RegisterType((*JoinRoomRequest)(nil), "livekit.JoinRoomRequest") - proto.RegisterType((*JoinRoomResponse)(nil), "livekit.JoinRoomResponse") - proto.RegisterType((*DeleteRoomRequest)(nil), "livekit.DeleteRoomRequest") - proto.RegisterType((*DeleteRoomResponse)(nil), "livekit.DeleteRoomResponse") - proto.RegisterType((*SignalRequest)(nil), "livekit.SignalRequest") - proto.RegisterType((*SignalResponse)(nil), "livekit.SignalResponse") - proto.RegisterType((*TrickleRequest)(nil), "livekit.TrickleRequest") - proto.RegisterType((*TrickleResponse)(nil), "livekit.TrickleResponse") - proto.RegisterType((*SessionDescription)(nil), "livekit.SessionDescription") -} - -func init() { proto.RegisterFile("service.proto", fileDescriptor_a0b84a42fa06f626) } - -var fileDescriptor_a0b84a42fa06f626 = []byte{ - // 475 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x54, 0xc1, 0x4e, 0xdb, 0x40, - 0x10, 0xc5, 0x40, 0x31, 0x99, 0x34, 0x84, 0x8c, 0x2a, 0xe1, 0x3a, 0x3d, 0x20, 0x5f, 0x42, 0x0f, - 0x35, 0x6a, 0xb8, 0x55, 0x95, 0xaa, 0x06, 0x90, 0xa0, 0x17, 0xaa, 0x0d, 0xa7, 0x5e, 0x22, 0xb3, - 0x1e, 0xe8, 0x0a, 0xc7, 0xeb, 0xee, 0x2e, 0x48, 0x9c, 0x7b, 0xee, 0x1f, 0xf6, 0x63, 0x2a, 0xaf, - 0xd7, 0x89, 0x5b, 0xa7, 0xe1, 0xe4, 0xf5, 0xcc, 0xdb, 0x99, 0x37, 0xf3, 0x9e, 0x16, 0x7a, 0x9a, - 0xd4, 0xa3, 0xe0, 0x14, 0x17, 0x4a, 0x1a, 0x89, 0x7e, 0x26, 0x1e, 0xe9, 0x5e, 0x98, 0x68, 0x04, - 0x83, 0x53, 0x45, 0x89, 0x21, 0x26, 0xe5, 0x9c, 0xd1, 0x8f, 0x07, 0xd2, 0x06, 0x11, 0xb6, 0x95, - 0x94, 0xf3, 0xc0, 0x3b, 0xf4, 0x8e, 0x3a, 0xcc, 0x9e, 0x23, 0x02, 0x6c, 0x02, 0x75, 0x21, 0x73, - 0x4d, 0xab, 0x90, 0x78, 0x00, 0x7e, 0x2e, 0x53, 0x9a, 0x89, 0x22, 0xd8, 0xb4, 0xe1, 0x9d, 0xf2, - 0xf7, 0xb2, 0x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19, 0xf3, 0x54, 0xd4, 0x15, 0xec, 0x19, 0xf7, - 0x61, 0x4b, 0xa7, 0x95, 0x21, 0x5e, 0xb2, 0xf2, 0x38, 0xfe, 0xed, 0x41, 0xb7, 0x5c, 0xd3, 0xb4, - 0x32, 0x26, 0x9e, 0x03, 0x2c, 0x0d, 0x86, 0xe1, 0x62, 0x96, 0x96, 0x3d, 0xc3, 0xe1, 0xca, 0x9c, - 0x5b, 0xe4, 0x27, 0xd8, 0xad, 0xc5, 0xc7, 0x60, 0x01, 0xfc, 0xc7, 0x53, 0xe1, 0xeb, 0x15, 0x19, - 0x57, 0xe0, 0x1c, 0x60, 0xa9, 0x61, 0x83, 0x47, 0xcb, 0x01, 0x0d, 0x1e, 0x6d, 0xd1, 0xc7, 0xbf, - 0x3c, 0x00, 0x76, 0x7d, 0x5a, 0x4f, 0xf7, 0x19, 0x5e, 0x5c, 0xdd, 0xde, 0x92, 0xc2, 0x75, 0xd2, - 0x86, 0xeb, 0x92, 0xf8, 0x11, 0x7c, 0xb7, 0x7f, 0xfc, 0x9f, 0xd2, 0x61, 0xd0, 0x4e, 0x54, 0x7c, - 0x26, 0x6f, 0xbf, 0x8d, 0xee, 0x84, 0xf9, 0xfe, 0x70, 0x13, 0x73, 0x39, 0x3f, 0x76, 0xa8, 0xfa, - 0xfb, 0xae, 0x7c, 0x1d, 0x48, 0x1d, 0xdb, 0xc7, 0xe1, 0x66, 0xc7, 0x7e, 0x4e, 0xfe, 0x04, 0x00, - 0x00, 0xff, 0xff, 0x3b, 0x56, 0x68, 0x37, 0x34, 0x04, 0x00, 0x00, -} diff --git a/proto/service.proto b/proto/service.proto index bf6bcbe82..f1e6cffde 100644 --- a/proto/service.proto +++ b/proto/service.proto @@ -8,33 +8,32 @@ option go_package = "livekit"; service RoomService { // TODO: how do we secure room service? // should be accessible to only internal servers, not external - rpc CreateRoom(CreateRoomRequest) returns (CreateRoomResponse); - rpc JoinRoom(JoinRoomRequest) returns (JoinRoomResponse); + rpc CreateRoom(CreateRoomRequest) returns (RoomInfo); + rpc GetRoom(GetRoomRequest) returns (RoomInfo); rpc DeleteRoom(DeleteRoomRequest) returns (DeleteRoomResponse); } message CreateRoomRequest { - string room = 1; + string room_id = 1; + // number of seconds the room should cleanup after being empty + uint32 empty_timeout = 2; + uint32 max_participants = 3; } -message CreateRoomResponse { - string room = 1; +message GetRoomRequest { + string room_id = 1; +} + +message RoomInfo { + string room_id = 1; string node_ip = 2; uint32 node_rtc_port = 3; -} - -message JoinRoomRequest { - string room = 1; - string client_id = 2; -} - -message JoinRoomResponse { - string node_ip = 1; - uint32 node_rtc_port = 2; + int64 creation_time = 4; + string token = 5; } message DeleteRoomRequest { - string room = 1; + string room_id = 1; } message DeleteRoomResponse { @@ -42,24 +41,24 @@ message DeleteRoomResponse { // RTC methods performed on target node service RTCService { + rpc Join(JoinRequest) returns (JoinResponse); + // offer allows client to initiate a RTC session rpc Offer(SessionDescription) returns (SessionDescription); - // push channel to allow server to push commands to client -// rpc Signal(SignalRequest) returns (stream SignalResponse); - // trickle sends more ICE candidates to server rpc Trickle(TrickleRequest) returns (TrickleResponse); } -message SignalRequest { +message JoinRequest { + string room_id = 1; + string token = 2; + string session_id = 3; + SessionDescription offer = 4; } -message SignalResponse { - oneof payload { - SessionDescription desc = 1; - TrickleRequest trickle = 2; - } +message JoinResponse { + SessionDescription answer = 1; } message TrickleRequest {