decouple websocket and RTC nodes, prep for distributed
This commit is contained in:
+98
-96
@@ -45,9 +45,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) (*RoomInfo, error)
|
||||
CreateRoom(context.Context, *CreateRoomRequest) (*Room, error)
|
||||
|
||||
GetRoom(context.Context, *GetRoomRequest) (*RoomInfo, error)
|
||||
ListRooms(context.Context, *ListRoomsRequest) (*ListRoomsResponse, error)
|
||||
|
||||
DeleteRoom(context.Context, *DeleteRoomRequest) (*DeleteRoomResponse, error)
|
||||
}
|
||||
@@ -80,7 +80,7 @@ func NewRoomServiceProtobufClient(baseURL string, client HTTPClient, opts ...twi
|
||||
serviceURL += baseServicePath(clientOpts.PathPrefix(), "livekit", "RoomService")
|
||||
urls := [3]string{
|
||||
serviceURL + "CreateRoom",
|
||||
serviceURL + "GetRoom",
|
||||
serviceURL + "ListRooms",
|
||||
serviceURL + "DeleteRoom",
|
||||
}
|
||||
|
||||
@@ -92,13 +92,13 @@ func NewRoomServiceProtobufClient(baseURL string, client HTTPClient, opts ...twi
|
||||
}
|
||||
}
|
||||
|
||||
func (c *roomServiceProtobufClient) CreateRoom(ctx context.Context, in *CreateRoomRequest) (*RoomInfo, error) {
|
||||
func (c *roomServiceProtobufClient) CreateRoom(ctx context.Context, in *CreateRoomRequest) (*Room, 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) (*RoomInfo, error) {
|
||||
caller = func(ctx context.Context, req *CreateRoomRequest) (*Room, error) {
|
||||
resp, err := c.interceptor(
|
||||
func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
typedReq, ok := req.(*CreateRoomRequest)
|
||||
@@ -109,9 +109,9 @@ func (c *roomServiceProtobufClient) CreateRoom(ctx context.Context, in *CreateRo
|
||||
},
|
||||
)(ctx, req)
|
||||
if resp != nil {
|
||||
typedResp, ok := resp.(*RoomInfo)
|
||||
typedResp, ok := resp.(*Room)
|
||||
if !ok {
|
||||
return nil, twirp.InternalError("failed type assertion resp.(*RoomInfo) when calling interceptor")
|
||||
return nil, twirp.InternalError("failed type assertion resp.(*Room) when calling interceptor")
|
||||
}
|
||||
return typedResp, err
|
||||
}
|
||||
@@ -121,8 +121,8 @@ func (c *roomServiceProtobufClient) CreateRoom(ctx context.Context, in *CreateRo
|
||||
return caller(ctx, in)
|
||||
}
|
||||
|
||||
func (c *roomServiceProtobufClient) callCreateRoom(ctx context.Context, in *CreateRoomRequest) (*RoomInfo, error) {
|
||||
out := new(RoomInfo)
|
||||
func (c *roomServiceProtobufClient) callCreateRoom(ctx context.Context, in *CreateRoomRequest) (*Room, error) {
|
||||
out := new(Room)
|
||||
ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[0], in, out)
|
||||
if err != nil {
|
||||
twerr, ok := err.(twirp.Error)
|
||||
@@ -138,26 +138,26 @@ func (c *roomServiceProtobufClient) callCreateRoom(ctx context.Context, in *Crea
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *roomServiceProtobufClient) GetRoom(ctx context.Context, in *GetRoomRequest) (*RoomInfo, error) {
|
||||
func (c *roomServiceProtobufClient) ListRooms(ctx context.Context, in *ListRoomsRequest) (*ListRoomsResponse, error) {
|
||||
ctx = ctxsetters.WithPackageName(ctx, "livekit")
|
||||
ctx = ctxsetters.WithServiceName(ctx, "RoomService")
|
||||
ctx = ctxsetters.WithMethodName(ctx, "GetRoom")
|
||||
caller := c.callGetRoom
|
||||
ctx = ctxsetters.WithMethodName(ctx, "ListRooms")
|
||||
caller := c.callListRooms
|
||||
if c.interceptor != nil {
|
||||
caller = func(ctx context.Context, req *GetRoomRequest) (*RoomInfo, error) {
|
||||
caller = func(ctx context.Context, req *ListRoomsRequest) (*ListRoomsResponse, error) {
|
||||
resp, err := c.interceptor(
|
||||
func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
typedReq, ok := req.(*GetRoomRequest)
|
||||
typedReq, ok := req.(*ListRoomsRequest)
|
||||
if !ok {
|
||||
return nil, twirp.InternalError("failed type assertion req.(*GetRoomRequest) when calling interceptor")
|
||||
return nil, twirp.InternalError("failed type assertion req.(*ListRoomsRequest) when calling interceptor")
|
||||
}
|
||||
return c.callGetRoom(ctx, typedReq)
|
||||
return c.callListRooms(ctx, typedReq)
|
||||
},
|
||||
)(ctx, req)
|
||||
if resp != nil {
|
||||
typedResp, ok := resp.(*RoomInfo)
|
||||
typedResp, ok := resp.(*ListRoomsResponse)
|
||||
if !ok {
|
||||
return nil, twirp.InternalError("failed type assertion resp.(*RoomInfo) when calling interceptor")
|
||||
return nil, twirp.InternalError("failed type assertion resp.(*ListRoomsResponse) when calling interceptor")
|
||||
}
|
||||
return typedResp, err
|
||||
}
|
||||
@@ -167,8 +167,8 @@ func (c *roomServiceProtobufClient) GetRoom(ctx context.Context, in *GetRoomRequ
|
||||
return caller(ctx, in)
|
||||
}
|
||||
|
||||
func (c *roomServiceProtobufClient) callGetRoom(ctx context.Context, in *GetRoomRequest) (*RoomInfo, error) {
|
||||
out := new(RoomInfo)
|
||||
func (c *roomServiceProtobufClient) callListRooms(ctx context.Context, in *ListRoomsRequest) (*ListRoomsResponse, error) {
|
||||
out := new(ListRoomsResponse)
|
||||
ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[1], in, out)
|
||||
if err != nil {
|
||||
twerr, ok := err.(twirp.Error)
|
||||
@@ -258,7 +258,7 @@ func NewRoomServiceJSONClient(baseURL string, client HTTPClient, opts ...twirp.C
|
||||
serviceURL += baseServicePath(clientOpts.PathPrefix(), "livekit", "RoomService")
|
||||
urls := [3]string{
|
||||
serviceURL + "CreateRoom",
|
||||
serviceURL + "GetRoom",
|
||||
serviceURL + "ListRooms",
|
||||
serviceURL + "DeleteRoom",
|
||||
}
|
||||
|
||||
@@ -270,13 +270,13 @@ func NewRoomServiceJSONClient(baseURL string, client HTTPClient, opts ...twirp.C
|
||||
}
|
||||
}
|
||||
|
||||
func (c *roomServiceJSONClient) CreateRoom(ctx context.Context, in *CreateRoomRequest) (*RoomInfo, error) {
|
||||
func (c *roomServiceJSONClient) CreateRoom(ctx context.Context, in *CreateRoomRequest) (*Room, 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) (*RoomInfo, error) {
|
||||
caller = func(ctx context.Context, req *CreateRoomRequest) (*Room, error) {
|
||||
resp, err := c.interceptor(
|
||||
func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
typedReq, ok := req.(*CreateRoomRequest)
|
||||
@@ -287,9 +287,9 @@ func (c *roomServiceJSONClient) CreateRoom(ctx context.Context, in *CreateRoomRe
|
||||
},
|
||||
)(ctx, req)
|
||||
if resp != nil {
|
||||
typedResp, ok := resp.(*RoomInfo)
|
||||
typedResp, ok := resp.(*Room)
|
||||
if !ok {
|
||||
return nil, twirp.InternalError("failed type assertion resp.(*RoomInfo) when calling interceptor")
|
||||
return nil, twirp.InternalError("failed type assertion resp.(*Room) when calling interceptor")
|
||||
}
|
||||
return typedResp, err
|
||||
}
|
||||
@@ -299,8 +299,8 @@ func (c *roomServiceJSONClient) CreateRoom(ctx context.Context, in *CreateRoomRe
|
||||
return caller(ctx, in)
|
||||
}
|
||||
|
||||
func (c *roomServiceJSONClient) callCreateRoom(ctx context.Context, in *CreateRoomRequest) (*RoomInfo, error) {
|
||||
out := new(RoomInfo)
|
||||
func (c *roomServiceJSONClient) callCreateRoom(ctx context.Context, in *CreateRoomRequest) (*Room, error) {
|
||||
out := new(Room)
|
||||
ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[0], in, out)
|
||||
if err != nil {
|
||||
twerr, ok := err.(twirp.Error)
|
||||
@@ -316,26 +316,26 @@ func (c *roomServiceJSONClient) callCreateRoom(ctx context.Context, in *CreateRo
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *roomServiceJSONClient) GetRoom(ctx context.Context, in *GetRoomRequest) (*RoomInfo, error) {
|
||||
func (c *roomServiceJSONClient) ListRooms(ctx context.Context, in *ListRoomsRequest) (*ListRoomsResponse, error) {
|
||||
ctx = ctxsetters.WithPackageName(ctx, "livekit")
|
||||
ctx = ctxsetters.WithServiceName(ctx, "RoomService")
|
||||
ctx = ctxsetters.WithMethodName(ctx, "GetRoom")
|
||||
caller := c.callGetRoom
|
||||
ctx = ctxsetters.WithMethodName(ctx, "ListRooms")
|
||||
caller := c.callListRooms
|
||||
if c.interceptor != nil {
|
||||
caller = func(ctx context.Context, req *GetRoomRequest) (*RoomInfo, error) {
|
||||
caller = func(ctx context.Context, req *ListRoomsRequest) (*ListRoomsResponse, error) {
|
||||
resp, err := c.interceptor(
|
||||
func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
typedReq, ok := req.(*GetRoomRequest)
|
||||
typedReq, ok := req.(*ListRoomsRequest)
|
||||
if !ok {
|
||||
return nil, twirp.InternalError("failed type assertion req.(*GetRoomRequest) when calling interceptor")
|
||||
return nil, twirp.InternalError("failed type assertion req.(*ListRoomsRequest) when calling interceptor")
|
||||
}
|
||||
return c.callGetRoom(ctx, typedReq)
|
||||
return c.callListRooms(ctx, typedReq)
|
||||
},
|
||||
)(ctx, req)
|
||||
if resp != nil {
|
||||
typedResp, ok := resp.(*RoomInfo)
|
||||
typedResp, ok := resp.(*ListRoomsResponse)
|
||||
if !ok {
|
||||
return nil, twirp.InternalError("failed type assertion resp.(*RoomInfo) when calling interceptor")
|
||||
return nil, twirp.InternalError("failed type assertion resp.(*ListRoomsResponse) when calling interceptor")
|
||||
}
|
||||
return typedResp, err
|
||||
}
|
||||
@@ -345,8 +345,8 @@ func (c *roomServiceJSONClient) GetRoom(ctx context.Context, in *GetRoomRequest)
|
||||
return caller(ctx, in)
|
||||
}
|
||||
|
||||
func (c *roomServiceJSONClient) callGetRoom(ctx context.Context, in *GetRoomRequest) (*RoomInfo, error) {
|
||||
out := new(RoomInfo)
|
||||
func (c *roomServiceJSONClient) callListRooms(ctx context.Context, in *ListRoomsRequest) (*ListRoomsResponse, error) {
|
||||
out := new(ListRoomsResponse)
|
||||
ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[1], in, out)
|
||||
if err != nil {
|
||||
twerr, ok := err.(twirp.Error)
|
||||
@@ -495,8 +495,8 @@ func (s *roomServiceServer) ServeHTTP(resp http.ResponseWriter, req *http.Reques
|
||||
case "CreateRoom":
|
||||
s.serveCreateRoom(ctx, resp, req)
|
||||
return
|
||||
case "GetRoom":
|
||||
s.serveGetRoom(ctx, resp, req)
|
||||
case "ListRooms":
|
||||
s.serveListRooms(ctx, resp, req)
|
||||
return
|
||||
case "DeleteRoom":
|
||||
s.serveDeleteRoom(ctx, resp, req)
|
||||
@@ -544,7 +544,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) (*RoomInfo, error) {
|
||||
handler = func(ctx context.Context, req *CreateRoomRequest) (*Room, error) {
|
||||
resp, err := s.interceptor(
|
||||
func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
typedReq, ok := req.(*CreateRoomRequest)
|
||||
@@ -555,9 +555,9 @@ func (s *roomServiceServer) serveCreateRoomJSON(ctx context.Context, resp http.R
|
||||
},
|
||||
)(ctx, req)
|
||||
if resp != nil {
|
||||
typedResp, ok := resp.(*RoomInfo)
|
||||
typedResp, ok := resp.(*Room)
|
||||
if !ok {
|
||||
return nil, twirp.InternalError("failed type assertion resp.(*RoomInfo) when calling interceptor")
|
||||
return nil, twirp.InternalError("failed type assertion resp.(*Room) when calling interceptor")
|
||||
}
|
||||
return typedResp, err
|
||||
}
|
||||
@@ -566,7 +566,7 @@ func (s *roomServiceServer) serveCreateRoomJSON(ctx context.Context, resp http.R
|
||||
}
|
||||
|
||||
// Call service method
|
||||
var respContent *RoomInfo
|
||||
var respContent *Room
|
||||
func() {
|
||||
defer ensurePanicResponses(ctx, resp, s.hooks)
|
||||
respContent, err = handler(ctx, reqContent)
|
||||
@@ -577,7 +577,7 @@ func (s *roomServiceServer) serveCreateRoomJSON(ctx context.Context, resp http.R
|
||||
return
|
||||
}
|
||||
if respContent == nil {
|
||||
s.writeError(ctx, resp, twirp.InternalError("received a nil *RoomInfo and nil error while calling CreateRoom. nil responses are not supported"))
|
||||
s.writeError(ctx, resp, twirp.InternalError("received a nil *Room and nil error while calling CreateRoom. nil responses are not supported"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -626,7 +626,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) (*RoomInfo, error) {
|
||||
handler = func(ctx context.Context, req *CreateRoomRequest) (*Room, error) {
|
||||
resp, err := s.interceptor(
|
||||
func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
typedReq, ok := req.(*CreateRoomRequest)
|
||||
@@ -637,9 +637,9 @@ func (s *roomServiceServer) serveCreateRoomProtobuf(ctx context.Context, resp ht
|
||||
},
|
||||
)(ctx, req)
|
||||
if resp != nil {
|
||||
typedResp, ok := resp.(*RoomInfo)
|
||||
typedResp, ok := resp.(*Room)
|
||||
if !ok {
|
||||
return nil, twirp.InternalError("failed type assertion resp.(*RoomInfo) when calling interceptor")
|
||||
return nil, twirp.InternalError("failed type assertion resp.(*Room) when calling interceptor")
|
||||
}
|
||||
return typedResp, err
|
||||
}
|
||||
@@ -648,7 +648,7 @@ func (s *roomServiceServer) serveCreateRoomProtobuf(ctx context.Context, resp ht
|
||||
}
|
||||
|
||||
// Call service method
|
||||
var respContent *RoomInfo
|
||||
var respContent *Room
|
||||
func() {
|
||||
defer ensurePanicResponses(ctx, resp, s.hooks)
|
||||
respContent, err = handler(ctx, reqContent)
|
||||
@@ -659,7 +659,7 @@ func (s *roomServiceServer) serveCreateRoomProtobuf(ctx context.Context, resp ht
|
||||
return
|
||||
}
|
||||
if respContent == nil {
|
||||
s.writeError(ctx, resp, twirp.InternalError("received a nil *RoomInfo and nil error while calling CreateRoom. nil responses are not supported"))
|
||||
s.writeError(ctx, resp, twirp.InternalError("received a nil *Room and nil error while calling CreateRoom. nil responses are not supported"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -683,7 +683,7 @@ func (s *roomServiceServer) serveCreateRoomProtobuf(ctx context.Context, resp ht
|
||||
callResponseSent(ctx, s.hooks)
|
||||
}
|
||||
|
||||
func (s *roomServiceServer) serveGetRoom(ctx context.Context, resp http.ResponseWriter, req *http.Request) {
|
||||
func (s *roomServiceServer) serveListRooms(ctx context.Context, resp http.ResponseWriter, req *http.Request) {
|
||||
header := req.Header.Get("Content-Type")
|
||||
i := strings.Index(header, ";")
|
||||
if i == -1 {
|
||||
@@ -691,9 +691,9 @@ func (s *roomServiceServer) serveGetRoom(ctx context.Context, resp http.Response
|
||||
}
|
||||
switch strings.TrimSpace(strings.ToLower(header[:i])) {
|
||||
case "application/json":
|
||||
s.serveGetRoomJSON(ctx, resp, req)
|
||||
s.serveListRoomsJSON(ctx, resp, req)
|
||||
case "application/protobuf":
|
||||
s.serveGetRoomProtobuf(ctx, resp, req)
|
||||
s.serveListRoomsProtobuf(ctx, resp, req)
|
||||
default:
|
||||
msg := fmt.Sprintf("unexpected Content-Type: %q", req.Header.Get("Content-Type"))
|
||||
twerr := badRouteError(msg, req.Method, req.URL.Path)
|
||||
@@ -701,38 +701,38 @@ func (s *roomServiceServer) serveGetRoom(ctx context.Context, resp http.Response
|
||||
}
|
||||
}
|
||||
|
||||
func (s *roomServiceServer) serveGetRoomJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) {
|
||||
func (s *roomServiceServer) serveListRoomsJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) {
|
||||
var err error
|
||||
ctx = ctxsetters.WithMethodName(ctx, "GetRoom")
|
||||
ctx = ctxsetters.WithMethodName(ctx, "ListRooms")
|
||||
ctx, err = callRequestRouted(ctx, s.hooks)
|
||||
if err != nil {
|
||||
s.writeError(ctx, resp, err)
|
||||
return
|
||||
}
|
||||
|
||||
reqContent := new(GetRoomRequest)
|
||||
reqContent := new(ListRoomsRequest)
|
||||
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.GetRoom
|
||||
handler := s.RoomService.ListRooms
|
||||
if s.interceptor != nil {
|
||||
handler = func(ctx context.Context, req *GetRoomRequest) (*RoomInfo, error) {
|
||||
handler = func(ctx context.Context, req *ListRoomsRequest) (*ListRoomsResponse, error) {
|
||||
resp, err := s.interceptor(
|
||||
func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
typedReq, ok := req.(*GetRoomRequest)
|
||||
typedReq, ok := req.(*ListRoomsRequest)
|
||||
if !ok {
|
||||
return nil, twirp.InternalError("failed type assertion req.(*GetRoomRequest) when calling interceptor")
|
||||
return nil, twirp.InternalError("failed type assertion req.(*ListRoomsRequest) when calling interceptor")
|
||||
}
|
||||
return s.RoomService.GetRoom(ctx, typedReq)
|
||||
return s.RoomService.ListRooms(ctx, typedReq)
|
||||
},
|
||||
)(ctx, req)
|
||||
if resp != nil {
|
||||
typedResp, ok := resp.(*RoomInfo)
|
||||
typedResp, ok := resp.(*ListRoomsResponse)
|
||||
if !ok {
|
||||
return nil, twirp.InternalError("failed type assertion resp.(*RoomInfo) when calling interceptor")
|
||||
return nil, twirp.InternalError("failed type assertion resp.(*ListRoomsResponse) when calling interceptor")
|
||||
}
|
||||
return typedResp, err
|
||||
}
|
||||
@@ -741,7 +741,7 @@ func (s *roomServiceServer) serveGetRoomJSON(ctx context.Context, resp http.Resp
|
||||
}
|
||||
|
||||
// Call service method
|
||||
var respContent *RoomInfo
|
||||
var respContent *ListRoomsResponse
|
||||
func() {
|
||||
defer ensurePanicResponses(ctx, resp, s.hooks)
|
||||
respContent, err = handler(ctx, reqContent)
|
||||
@@ -752,7 +752,7 @@ func (s *roomServiceServer) serveGetRoomJSON(ctx context.Context, resp http.Resp
|
||||
return
|
||||
}
|
||||
if respContent == nil {
|
||||
s.writeError(ctx, resp, twirp.InternalError("received a nil *RoomInfo and nil error while calling GetRoom. nil responses are not supported"))
|
||||
s.writeError(ctx, resp, twirp.InternalError("received a nil *ListRoomsResponse and nil error while calling ListRooms. nil responses are not supported"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -779,9 +779,9 @@ func (s *roomServiceServer) serveGetRoomJSON(ctx context.Context, resp http.Resp
|
||||
callResponseSent(ctx, s.hooks)
|
||||
}
|
||||
|
||||
func (s *roomServiceServer) serveGetRoomProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) {
|
||||
func (s *roomServiceServer) serveListRoomsProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) {
|
||||
var err error
|
||||
ctx = ctxsetters.WithMethodName(ctx, "GetRoom")
|
||||
ctx = ctxsetters.WithMethodName(ctx, "ListRooms")
|
||||
ctx, err = callRequestRouted(ctx, s.hooks)
|
||||
if err != nil {
|
||||
s.writeError(ctx, resp, err)
|
||||
@@ -793,28 +793,28 @@ func (s *roomServiceServer) serveGetRoomProtobuf(ctx context.Context, resp http.
|
||||
s.writeError(ctx, resp, wrapInternal(err, "failed to read request body"))
|
||||
return
|
||||
}
|
||||
reqContent := new(GetRoomRequest)
|
||||
reqContent := new(ListRoomsRequest)
|
||||
if err = proto.Unmarshal(buf, reqContent); err != nil {
|
||||
s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded"))
|
||||
return
|
||||
}
|
||||
|
||||
handler := s.RoomService.GetRoom
|
||||
handler := s.RoomService.ListRooms
|
||||
if s.interceptor != nil {
|
||||
handler = func(ctx context.Context, req *GetRoomRequest) (*RoomInfo, error) {
|
||||
handler = func(ctx context.Context, req *ListRoomsRequest) (*ListRoomsResponse, error) {
|
||||
resp, err := s.interceptor(
|
||||
func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
typedReq, ok := req.(*GetRoomRequest)
|
||||
typedReq, ok := req.(*ListRoomsRequest)
|
||||
if !ok {
|
||||
return nil, twirp.InternalError("failed type assertion req.(*GetRoomRequest) when calling interceptor")
|
||||
return nil, twirp.InternalError("failed type assertion req.(*ListRoomsRequest) when calling interceptor")
|
||||
}
|
||||
return s.RoomService.GetRoom(ctx, typedReq)
|
||||
return s.RoomService.ListRooms(ctx, typedReq)
|
||||
},
|
||||
)(ctx, req)
|
||||
if resp != nil {
|
||||
typedResp, ok := resp.(*RoomInfo)
|
||||
typedResp, ok := resp.(*ListRoomsResponse)
|
||||
if !ok {
|
||||
return nil, twirp.InternalError("failed type assertion resp.(*RoomInfo) when calling interceptor")
|
||||
return nil, twirp.InternalError("failed type assertion resp.(*ListRoomsResponse) when calling interceptor")
|
||||
}
|
||||
return typedResp, err
|
||||
}
|
||||
@@ -823,7 +823,7 @@ func (s *roomServiceServer) serveGetRoomProtobuf(ctx context.Context, resp http.
|
||||
}
|
||||
|
||||
// Call service method
|
||||
var respContent *RoomInfo
|
||||
var respContent *ListRoomsResponse
|
||||
func() {
|
||||
defer ensurePanicResponses(ctx, resp, s.hooks)
|
||||
respContent, err = handler(ctx, reqContent)
|
||||
@@ -834,7 +834,7 @@ func (s *roomServiceServer) serveGetRoomProtobuf(ctx context.Context, resp http.
|
||||
return
|
||||
}
|
||||
if respContent == nil {
|
||||
s.writeError(ctx, resp, twirp.InternalError("received a nil *RoomInfo and nil error while calling GetRoom. nil responses are not supported"))
|
||||
s.writeError(ctx, resp, twirp.InternalError("received a nil *ListRoomsResponse and nil error while calling ListRooms. nil responses are not supported"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -1595,23 +1595,25 @@ func callClientError(ctx context.Context, h *twirp.ClientHooks, err twirp.Error)
|
||||
}
|
||||
|
||||
var twirpFileDescriptor0 = []byte{
|
||||
// 288 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x91, 0x4f, 0x4b, 0xc3, 0x40,
|
||||
0x10, 0xc5, 0x89, 0x8a, 0xc5, 0xa9, 0x55, 0xbb, 0x08, 0x86, 0x78, 0x29, 0x51, 0xb0, 0x1e, 0x4c,
|
||||
0x50, 0xf1, 0xe4, 0xcd, 0x3f, 0x88, 0x37, 0x89, 0x9e, 0xbc, 0x94, 0x6d, 0x1c, 0x75, 0x31, 0x9b,
|
||||
0x89, 0x9b, 0x49, 0xac, 0xdf, 0xd0, 0x8f, 0x25, 0xf9, 0xd7, 0x46, 0xd3, 0xd3, 0xce, 0xfe, 0xe6,
|
||||
0x2d, 0xf3, 0xde, 0x2c, 0x80, 0x21, 0xd2, 0x5e, 0x62, 0x88, 0x49, 0xf4, 0x22, 0x95, 0xe3, 0x87,
|
||||
0x62, 0xa7, 0xaf, 0xe9, 0x05, 0xa3, 0x8a, 0xba, 0x5f, 0x30, 0xbc, 0x36, 0x28, 0x19, 0x03, 0x22,
|
||||
0x1d, 0xe0, 0x67, 0x86, 0x29, 0x0b, 0x01, 0x6b, 0xb1, 0xd4, 0x68, 0x5b, 0x23, 0x6b, 0xbc, 0x11,
|
||||
0x94, 0xb5, 0x38, 0x80, 0x01, 0xea, 0x84, 0xbf, 0x27, 0xac, 0x34, 0x52, 0xc6, 0xf6, 0xca, 0xc8,
|
||||
0x1a, 0x0f, 0x82, 0xcd, 0x12, 0x3e, 0x55, 0x4c, 0x1c, 0xc3, 0x8e, 0x96, 0xb3, 0x49, 0x22, 0x0d,
|
||||
0xab, 0x50, 0x25, 0x32, 0xe6, 0xd4, 0x5e, 0x2d, 0x75, 0xdb, 0x5a, 0xce, 0x1e, 0x5a, 0xd8, 0x3d,
|
||||
0x84, 0xad, 0x3b, 0xe4, 0x7f, 0x53, 0x0b, 0xbb, 0xcd, 0xd4, 0xa2, 0x76, 0x8f, 0x60, 0x78, 0x83,
|
||||
0x11, 0x76, 0xec, 0x75, 0x84, 0xbb, 0x20, 0xda, 0xc2, 0x34, 0xa1, 0x38, 0xc5, 0xb3, 0x1f, 0x0b,
|
||||
0xfa, 0x05, 0x78, 0x44, 0x93, 0xab, 0x10, 0xc5, 0x25, 0xc0, 0x22, 0xad, 0x70, 0xbc, 0x7a, 0x25,
|
||||
0x5e, 0x67, 0x05, 0xce, 0x70, 0xde, 0x2b, 0xe8, 0x7d, 0xfc, 0x4a, 0xe2, 0x02, 0x7a, 0xb5, 0x63,
|
||||
0xb1, 0x37, 0xef, 0xfe, 0xcd, 0xb0, 0xec, 0xd9, 0x2d, 0xc0, 0xc2, 0x59, 0x6b, 0x66, 0x27, 0x97,
|
||||
0xb3, 0xbf, 0xb4, 0x57, 0x45, 0xb9, 0x3a, 0x7d, 0xf6, 0xdf, 0x14, 0xbf, 0x67, 0x53, 0x2f, 0x24,
|
||||
0xed, 0xd7, 0xc2, 0xe6, 0x3c, 0x49, 0xd1, 0xe4, 0x68, 0xfc, 0xf2, 0x4f, 0x1b, 0x38, 0x5d, 0x2f,
|
||||
0xaf, 0xe7, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x9f, 0xf2, 0xc7, 0x37, 0x06, 0x02, 0x00, 0x00,
|
||||
// 311 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x92, 0x3f, 0x4f, 0xf3, 0x30,
|
||||
0x10, 0xc6, 0x95, 0xb7, 0x2f, 0xa0, 0x5e, 0xa9, 0x68, 0x2d, 0x86, 0x60, 0x96, 0x2a, 0x0c, 0x94,
|
||||
0x81, 0x54, 0x94, 0x01, 0xe6, 0x02, 0x1b, 0x03, 0x0a, 0x4c, 0x2c, 0x95, 0x1b, 0x4e, 0x60, 0x11,
|
||||
0xc7, 0xc1, 0x76, 0x42, 0xf9, 0x98, 0x7c, 0x23, 0x64, 0xe7, 0x4f, 0x03, 0xe9, 0xe4, 0xf3, 0xf3,
|
||||
0x9c, 0xfc, 0xdc, 0xef, 0x64, 0x00, 0x25, 0xa5, 0x08, 0x33, 0x25, 0x8d, 0x24, 0x7b, 0x09, 0x2f,
|
||||
0xf0, 0x9d, 0x1b, 0x3a, 0x10, 0xf2, 0x05, 0x93, 0x52, 0x0d, 0x3e, 0x61, 0x7c, 0xa3, 0x90, 0x19,
|
||||
0x8c, 0xa4, 0x14, 0x11, 0x7e, 0xe4, 0xa8, 0x0d, 0x21, 0xf0, 0x3f, 0x65, 0x02, 0x7d, 0x6f, 0xe2,
|
||||
0x4d, 0xfb, 0x91, 0xab, 0xc9, 0x09, 0x0c, 0x51, 0x64, 0xe6, 0x6b, 0x69, 0xb8, 0x40, 0x99, 0x1b,
|
||||
0xff, 0xdf, 0xc4, 0x9b, 0x0e, 0xa3, 0x7d, 0x27, 0x3e, 0x95, 0x1a, 0x39, 0x83, 0x91, 0x60, 0xeb,
|
||||
0x65, 0xc6, 0x94, 0xe1, 0x31, 0xcf, 0x58, 0x6a, 0xb4, 0xdf, 0x73, 0x7d, 0x07, 0x82, 0xad, 0x1f,
|
||||
0x5a, 0x72, 0x40, 0x60, 0x74, 0xcf, 0xb5, 0xb1, 0xb1, 0xba, 0xca, 0x0d, 0xae, 0x61, 0xdc, 0xd2,
|
||||
0x74, 0x26, 0x53, 0x6d, 0x83, 0x77, 0x2c, 0x85, 0xf6, 0xbd, 0x49, 0x6f, 0x3a, 0x98, 0x0f, 0xc3,
|
||||
0x8a, 0x23, 0x74, 0x13, 0x97, 0x5e, 0x70, 0x0a, 0xe3, 0x5b, 0x4c, 0xb0, 0x83, 0x61, 0xdd, 0x1a,
|
||||
0xc3, 0xd6, 0xc1, 0x21, 0x90, 0x76, 0x63, 0x99, 0x31, 0xff, 0xf6, 0x60, 0x60, 0x85, 0x47, 0x54,
|
||||
0x05, 0x8f, 0x91, 0x5c, 0x01, 0x6c, 0xb6, 0x42, 0x68, 0x13, 0xd9, 0x59, 0x15, 0xfd, 0x3d, 0x0e,
|
||||
0x59, 0x40, 0xbf, 0x21, 0x20, 0x47, 0x8d, 0xf7, 0x97, 0x94, 0xd2, 0x6d, 0x56, 0x05, 0x7c, 0x07,
|
||||
0xb0, 0x19, 0xb1, 0x15, 0xde, 0x01, 0xa4, 0xc7, 0x5b, 0xbd, 0xf2, 0x99, 0xc5, 0xc5, 0xf3, 0xec,
|
||||
0x95, 0x9b, 0xb7, 0x7c, 0x15, 0xc6, 0x52, 0xcc, 0xaa, 0xc6, 0xfa, 0x3c, 0xd7, 0xa8, 0x0a, 0x54,
|
||||
0x33, 0xf7, 0x09, 0x6a, 0x71, 0xb5, 0xeb, 0xae, 0x97, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xe4,
|
||||
0x3c, 0x6a, 0xb4, 0x37, 0x02, 0x00, 0x00,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user