diff --git a/egress/notify_options.go b/egress/notify_options.go index 6bdfddfab..ea63e4c62 100644 --- a/egress/notify_options.go +++ b/egress/notify_options.go @@ -31,10 +31,10 @@ func GetEgressNotifyOptions(egressInfo *livekit.EgressInfo) []webhook.NotifyOpti var whs []*livekit.WebhookConfig switch req := egressInfo.Request.(type) { - case *livekit.EgressInfo_Egress: - if req.Egress != nil { - whs = req.Egress.Webhooks - } + // case *livekit.EgressInfo_Egress: + // if req.Egress != nil { + // whs = req.Egress.Webhooks + // } case *livekit.EgressInfo_Replay: if req.Replay != nil { whs = req.Replay.Webhooks diff --git a/replay/cloud_replay.pb.go b/livekit/cloud_replay.pb.go similarity index 80% rename from replay/cloud_replay.pb.go rename to livekit/cloud_replay.pb.go index 524493318..43d2c6b44 100644 --- a/replay/cloud_replay.pb.go +++ b/livekit/cloud_replay.pb.go @@ -18,10 +18,9 @@ // protoc v4.23.4 // source: cloud_replay.proto -package replay +package livekit import ( - livekit "github.com/livekit/protocol/livekit" _ "github.com/livekit/protocol/livekit/logger" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" @@ -39,9 +38,9 @@ const ( ) type ListReplaysRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - RoomName string `protobuf:"bytes,1,opt,name=room_name,json=roomName,proto3" json:"room_name,omitempty"` // optional - PageToken *livekit.TokenPagination `protobuf:"bytes,2,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + RoomName string `protobuf:"bytes,1,opt,name=room_name,json=roomName,proto3" json:"room_name,omitempty"` // optional + PageToken *TokenPagination `protobuf:"bytes,2,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -83,7 +82,7 @@ func (x *ListReplaysRequest) GetRoomName() string { return "" } -func (x *ListReplaysRequest) GetPageToken() *livekit.TokenPagination { +func (x *ListReplaysRequest) GetPageToken() *TokenPagination { if x != nil { return x.PageToken } @@ -91,9 +90,9 @@ func (x *ListReplaysRequest) GetPageToken() *livekit.TokenPagination { } type ListReplaysResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - Replays []*ReplayInfo `protobuf:"bytes,1,rep,name=replays,proto3" json:"replays,omitempty"` - NextPageToken *livekit.TokenPagination `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + Replays []*ReplayInfo `protobuf:"bytes,1,rep,name=replays,proto3" json:"replays,omitempty"` + NextPageToken *TokenPagination `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -135,7 +134,7 @@ func (x *ListReplaysResponse) GetReplays() []*ReplayInfo { return nil } -func (x *ListReplaysResponse) GetNextPageToken() *livekit.TokenPagination { +func (x *ListReplaysResponse) GetNextPageToken() *TokenPagination { if x != nil { return x.NextPageToken } @@ -458,13 +457,13 @@ var File_cloud_replay_proto protoreflect.FileDescriptor const file_cloud_replay_proto_rawDesc = "" + "\n" + - "\x12cloud_replay.proto\x12\x06replay\x1a\x1bgoogle/protobuf/empty.proto\x1a\x14livekit_egress.proto\x1a\x14livekit_models.proto\x1a\x14logger/options.proto\"j\n" + + "\x12cloud_replay.proto\x12\alivekit\x1a\x1bgoogle/protobuf/empty.proto\x1a\x14livekit_egress.proto\x1a\x14livekit_models.proto\x1a\x14logger/options.proto\"j\n" + "\x12ListReplaysRequest\x12\x1b\n" + "\troom_name\x18\x01 \x01(\tR\broomName\x127\n" + "\n" + - "page_token\x18\x02 \x01(\v2\x18.livekit.TokenPaginationR\tpageToken\"\x85\x01\n" + - "\x13ListReplaysResponse\x12,\n" + - "\areplays\x18\x01 \x03(\v2\x12.replay.ReplayInfoR\areplays\x12@\n" + + "page_token\x18\x02 \x01(\v2\x18.livekit.TokenPaginationR\tpageToken\"\x86\x01\n" + + "\x13ListReplaysResponse\x12-\n" + + "\areplays\x18\x01 \x03(\v2\x13.livekit.ReplayInfoR\areplays\x12@\n" + "\x0fnext_page_token\x18\x02 \x01(\v2\x18.livekit.TokenPaginationR\rnextPageToken\"\x94\x01\n" + "\n" + "ReplayInfo\x12)\n" + @@ -492,14 +491,14 @@ const file_cloud_replay_proto_rawDesc = "" + "playbackIDR\n" + "playbackId\"@\n" + "\x13DeleteReplayRequest\x12)\n" + - "\treplay_id\x18\x01 \x01(\tB\f\x9a\xec,\breplayIDR\breplayId2\x85\x03\n" + - "\x06Replay\x12F\n" + - "\vListReplays\x12\x1a.replay.ListReplaysRequest\x1a\x1b.replay.ListReplaysResponse\x12=\n" + - "\bPlayback\x12\x17.replay.PlaybackRequest\x1a\x18.replay.PlaybackResponse\x123\n" + - "\x04Seek\x12\x13.replay.SeekRequest\x1a\x16.google.protobuf.Empty\x12=\n" + - "\x05Close\x12\x1c.replay.ClosePlaybackRequest\x1a\x16.google.protobuf.Empty\x12;\n" + - "\x06Export\x12\x1c.livekit.ExportReplayRequest\x1a\x13.livekit.EgressInfo\x12C\n" + - "\fDeleteReplay\x12\x1b.replay.DeleteReplayRequest\x1a\x16.google.protobuf.EmptyBEZ\"github.com/livekit/protocol/replay\xaa\x02\rLiveKit.Proto\xea\x02\x0eLiveKit::Protob\x06proto3" + "\treplay_id\x18\x01 \x01(\tB\f\x9a\xec,\breplayIDR\breplayId2\x8c\x03\n" + + "\x06Replay\x12H\n" + + "\vListReplays\x12\x1b.livekit.ListReplaysRequest\x1a\x1c.livekit.ListReplaysResponse\x12?\n" + + "\bPlayback\x12\x18.livekit.PlaybackRequest\x1a\x19.livekit.PlaybackResponse\x124\n" + + "\x04Seek\x12\x14.livekit.SeekRequest\x1a\x16.google.protobuf.Empty\x12>\n" + + "\x05Close\x12\x1d.livekit.ClosePlaybackRequest\x1a\x16.google.protobuf.Empty\x12;\n" + + "\x06Export\x12\x1c.livekit.ExportReplayRequest\x1a\x13.livekit.EgressInfo\x12D\n" + + "\fDeleteReplay\x12\x1c.livekit.DeleteReplayRequest\x1a\x16.google.protobuf.EmptyBFZ#github.com/livekit/protocol/livekit\xaa\x02\rLiveKit.Proto\xea\x02\x0eLiveKit::Protob\x06proto3" var ( file_cloud_replay_proto_rawDescOnce sync.Once @@ -515,35 +514,35 @@ func file_cloud_replay_proto_rawDescGZIP() []byte { var file_cloud_replay_proto_msgTypes = make([]protoimpl.MessageInfo, 8) var file_cloud_replay_proto_goTypes = []any{ - (*ListReplaysRequest)(nil), // 0: replay.ListReplaysRequest - (*ListReplaysResponse)(nil), // 1: replay.ListReplaysResponse - (*ReplayInfo)(nil), // 2: replay.ReplayInfo - (*PlaybackRequest)(nil), // 3: replay.PlaybackRequest - (*PlaybackResponse)(nil), // 4: replay.PlaybackResponse - (*SeekRequest)(nil), // 5: replay.SeekRequest - (*ClosePlaybackRequest)(nil), // 6: replay.ClosePlaybackRequest - (*DeleteReplayRequest)(nil), // 7: replay.DeleteReplayRequest - (*livekit.TokenPagination)(nil), // 8: livekit.TokenPagination - (*livekit.ExportReplayRequest)(nil), // 9: livekit.ExportReplayRequest - (*emptypb.Empty)(nil), // 10: google.protobuf.Empty - (*livekit.EgressInfo)(nil), // 11: livekit.EgressInfo + (*ListReplaysRequest)(nil), // 0: livekit.ListReplaysRequest + (*ListReplaysResponse)(nil), // 1: livekit.ListReplaysResponse + (*ReplayInfo)(nil), // 2: livekit.ReplayInfo + (*PlaybackRequest)(nil), // 3: livekit.PlaybackRequest + (*PlaybackResponse)(nil), // 4: livekit.PlaybackResponse + (*SeekRequest)(nil), // 5: livekit.SeekRequest + (*ClosePlaybackRequest)(nil), // 6: livekit.ClosePlaybackRequest + (*DeleteReplayRequest)(nil), // 7: livekit.DeleteReplayRequest + (*TokenPagination)(nil), // 8: livekit.TokenPagination + (*ExportReplayRequest)(nil), // 9: livekit.ExportReplayRequest + (*emptypb.Empty)(nil), // 10: google.protobuf.Empty + (*EgressInfo)(nil), // 11: livekit.EgressInfo } var file_cloud_replay_proto_depIdxs = []int32{ - 8, // 0: replay.ListReplaysRequest.page_token:type_name -> livekit.TokenPagination - 2, // 1: replay.ListReplaysResponse.replays:type_name -> replay.ReplayInfo - 8, // 2: replay.ListReplaysResponse.next_page_token:type_name -> livekit.TokenPagination - 0, // 3: replay.Replay.ListReplays:input_type -> replay.ListReplaysRequest - 3, // 4: replay.Replay.Playback:input_type -> replay.PlaybackRequest - 5, // 5: replay.Replay.Seek:input_type -> replay.SeekRequest - 6, // 6: replay.Replay.Close:input_type -> replay.ClosePlaybackRequest - 9, // 7: replay.Replay.Export:input_type -> livekit.ExportReplayRequest - 7, // 8: replay.Replay.DeleteReplay:input_type -> replay.DeleteReplayRequest - 1, // 9: replay.Replay.ListReplays:output_type -> replay.ListReplaysResponse - 4, // 10: replay.Replay.Playback:output_type -> replay.PlaybackResponse - 10, // 11: replay.Replay.Seek:output_type -> google.protobuf.Empty - 10, // 12: replay.Replay.Close:output_type -> google.protobuf.Empty - 11, // 13: replay.Replay.Export:output_type -> livekit.EgressInfo - 10, // 14: replay.Replay.DeleteReplay:output_type -> google.protobuf.Empty + 8, // 0: livekit.ListReplaysRequest.page_token:type_name -> livekit.TokenPagination + 2, // 1: livekit.ListReplaysResponse.replays:type_name -> livekit.ReplayInfo + 8, // 2: livekit.ListReplaysResponse.next_page_token:type_name -> livekit.TokenPagination + 0, // 3: livekit.Replay.ListReplays:input_type -> livekit.ListReplaysRequest + 3, // 4: livekit.Replay.Playback:input_type -> livekit.PlaybackRequest + 5, // 5: livekit.Replay.Seek:input_type -> livekit.SeekRequest + 6, // 6: livekit.Replay.Close:input_type -> livekit.ClosePlaybackRequest + 9, // 7: livekit.Replay.Export:input_type -> livekit.ExportReplayRequest + 7, // 8: livekit.Replay.DeleteReplay:input_type -> livekit.DeleteReplayRequest + 1, // 9: livekit.Replay.ListReplays:output_type -> livekit.ListReplaysResponse + 4, // 10: livekit.Replay.Playback:output_type -> livekit.PlaybackResponse + 10, // 11: livekit.Replay.Seek:output_type -> google.protobuf.Empty + 10, // 12: livekit.Replay.Close:output_type -> google.protobuf.Empty + 11, // 13: livekit.Replay.Export:output_type -> livekit.EgressInfo + 10, // 14: livekit.Replay.DeleteReplay:output_type -> google.protobuf.Empty 9, // [9:15] is the sub-list for method output_type 3, // [3:9] is the sub-list for method input_type 3, // [3:3] is the sub-list for extension type_name @@ -556,6 +555,8 @@ func file_cloud_replay_proto_init() { if File_cloud_replay_proto != nil { return } + file_livekit_egress_proto_init() + file_livekit_models_proto_init() type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ diff --git a/replay/cloud_replay.twirp.go b/livekit/cloud_replay.twirp.go similarity index 91% rename from replay/cloud_replay.twirp.go rename to livekit/cloud_replay.twirp.go index f9ed64b36..230f641f3 100644 --- a/replay/cloud_replay.twirp.go +++ b/livekit/cloud_replay.twirp.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-twirp v8.1.3, DO NOT EDIT. // source: cloud_replay.proto -package replay +package livekit import context "context" import fmt "fmt" @@ -17,7 +17,6 @@ import twirp "github.com/twitchtv/twirp" import ctxsetters "github.com/twitchtv/twirp/ctxsetters" import google_protobuf "google.golang.org/protobuf/types/known/emptypb" -import livekit2 "github.com/livekit/protocol/livekit" import bytes "bytes" import errors "errors" @@ -34,7 +33,6 @@ const _ = twirp.TwirpPackageMinVersion_8_1_0 // Replay Interface // ================ -// Experimental (not currently available) type Replay interface { // List replays ListReplays(context.Context, *ListReplaysRequest) (*ListReplaysResponse, error) @@ -47,7 +45,7 @@ type Replay interface { Close(context.Context, *ClosePlaybackRequest) (*google_protobuf.Empty, error) // Export a stored replay using egress - Export(context.Context, *livekit2.ExportReplayRequest) (*livekit2.EgressInfo, error) + Export(context.Context, *ExportReplayRequest) (*EgressInfo, error) // Delete all stored data DeleteReplay(context.Context, *DeleteReplayRequest) (*google_protobuf.Empty, error) @@ -86,7 +84,7 @@ func NewReplayProtobufClient(baseURL string, client HTTPClient, opts ...twirp.Cl // Build method URLs: []/./ serviceURL := sanitizeBaseURL(baseURL) - serviceURL += baseServicePath(pathPrefix, "replay", "Replay") + serviceURL += baseServicePath(pathPrefix, "livekit", "Replay") urls := [6]string{ serviceURL + "ListReplays", serviceURL + "Playback", @@ -105,7 +103,7 @@ func NewReplayProtobufClient(baseURL string, client HTTPClient, opts ...twirp.Cl } func (c *replayProtobufClient) ListReplays(ctx context.Context, in *ListReplaysRequest) (*ListReplaysResponse, error) { - ctx = ctxsetters.WithPackageName(ctx, "replay") + ctx = ctxsetters.WithPackageName(ctx, "livekit") ctx = ctxsetters.WithServiceName(ctx, "Replay") ctx = ctxsetters.WithMethodName(ctx, "ListReplays") caller := c.callListReplays @@ -151,7 +149,7 @@ func (c *replayProtobufClient) callListReplays(ctx context.Context, in *ListRepl } func (c *replayProtobufClient) Playback(ctx context.Context, in *PlaybackRequest) (*PlaybackResponse, error) { - ctx = ctxsetters.WithPackageName(ctx, "replay") + ctx = ctxsetters.WithPackageName(ctx, "livekit") ctx = ctxsetters.WithServiceName(ctx, "Replay") ctx = ctxsetters.WithMethodName(ctx, "Playback") caller := c.callPlayback @@ -197,7 +195,7 @@ func (c *replayProtobufClient) callPlayback(ctx context.Context, in *PlaybackReq } func (c *replayProtobufClient) Seek(ctx context.Context, in *SeekRequest) (*google_protobuf.Empty, error) { - ctx = ctxsetters.WithPackageName(ctx, "replay") + ctx = ctxsetters.WithPackageName(ctx, "livekit") ctx = ctxsetters.WithServiceName(ctx, "Replay") ctx = ctxsetters.WithMethodName(ctx, "Seek") caller := c.callSeek @@ -243,7 +241,7 @@ func (c *replayProtobufClient) callSeek(ctx context.Context, in *SeekRequest) (* } func (c *replayProtobufClient) Close(ctx context.Context, in *ClosePlaybackRequest) (*google_protobuf.Empty, error) { - ctx = ctxsetters.WithPackageName(ctx, "replay") + ctx = ctxsetters.WithPackageName(ctx, "livekit") ctx = ctxsetters.WithServiceName(ctx, "Replay") ctx = ctxsetters.WithMethodName(ctx, "Close") caller := c.callClose @@ -288,26 +286,26 @@ func (c *replayProtobufClient) callClose(ctx context.Context, in *ClosePlaybackR return out, nil } -func (c *replayProtobufClient) Export(ctx context.Context, in *livekit2.ExportReplayRequest) (*livekit2.EgressInfo, error) { - ctx = ctxsetters.WithPackageName(ctx, "replay") +func (c *replayProtobufClient) Export(ctx context.Context, in *ExportReplayRequest) (*EgressInfo, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") ctx = ctxsetters.WithServiceName(ctx, "Replay") ctx = ctxsetters.WithMethodName(ctx, "Export") caller := c.callExport if c.interceptor != nil { - caller = func(ctx context.Context, req *livekit2.ExportReplayRequest) (*livekit2.EgressInfo, error) { + caller = func(ctx context.Context, req *ExportReplayRequest) (*EgressInfo, error) { resp, err := c.interceptor( func(ctx context.Context, req interface{}) (interface{}, error) { - typedReq, ok := req.(*livekit2.ExportReplayRequest) + typedReq, ok := req.(*ExportReplayRequest) if !ok { - return nil, twirp.InternalError("failed type assertion req.(*livekit2.ExportReplayRequest) when calling interceptor") + return nil, twirp.InternalError("failed type assertion req.(*ExportReplayRequest) when calling interceptor") } return c.callExport(ctx, typedReq) }, )(ctx, req) if resp != nil { - typedResp, ok := resp.(*livekit2.EgressInfo) + typedResp, ok := resp.(*EgressInfo) if !ok { - return nil, twirp.InternalError("failed type assertion resp.(*livekit2.EgressInfo) when calling interceptor") + return nil, twirp.InternalError("failed type assertion resp.(*EgressInfo) when calling interceptor") } return typedResp, err } @@ -317,8 +315,8 @@ func (c *replayProtobufClient) Export(ctx context.Context, in *livekit2.ExportRe return caller(ctx, in) } -func (c *replayProtobufClient) callExport(ctx context.Context, in *livekit2.ExportReplayRequest) (*livekit2.EgressInfo, error) { - out := new(livekit2.EgressInfo) +func (c *replayProtobufClient) callExport(ctx context.Context, in *ExportReplayRequest) (*EgressInfo, error) { + out := new(EgressInfo) ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[4], in, out) if err != nil { twerr, ok := err.(twirp.Error) @@ -335,7 +333,7 @@ func (c *replayProtobufClient) callExport(ctx context.Context, in *livekit2.Expo } func (c *replayProtobufClient) DeleteReplay(ctx context.Context, in *DeleteReplayRequest) (*google_protobuf.Empty, error) { - ctx = ctxsetters.WithPackageName(ctx, "replay") + ctx = ctxsetters.WithPackageName(ctx, "livekit") ctx = ctxsetters.WithServiceName(ctx, "Replay") ctx = ctxsetters.WithMethodName(ctx, "DeleteReplay") caller := c.callDeleteReplay @@ -413,7 +411,7 @@ func NewReplayJSONClient(baseURL string, client HTTPClient, opts ...twirp.Client // Build method URLs: []/./ serviceURL := sanitizeBaseURL(baseURL) - serviceURL += baseServicePath(pathPrefix, "replay", "Replay") + serviceURL += baseServicePath(pathPrefix, "livekit", "Replay") urls := [6]string{ serviceURL + "ListReplays", serviceURL + "Playback", @@ -432,7 +430,7 @@ func NewReplayJSONClient(baseURL string, client HTTPClient, opts ...twirp.Client } func (c *replayJSONClient) ListReplays(ctx context.Context, in *ListReplaysRequest) (*ListReplaysResponse, error) { - ctx = ctxsetters.WithPackageName(ctx, "replay") + ctx = ctxsetters.WithPackageName(ctx, "livekit") ctx = ctxsetters.WithServiceName(ctx, "Replay") ctx = ctxsetters.WithMethodName(ctx, "ListReplays") caller := c.callListReplays @@ -478,7 +476,7 @@ func (c *replayJSONClient) callListReplays(ctx context.Context, in *ListReplaysR } func (c *replayJSONClient) Playback(ctx context.Context, in *PlaybackRequest) (*PlaybackResponse, error) { - ctx = ctxsetters.WithPackageName(ctx, "replay") + ctx = ctxsetters.WithPackageName(ctx, "livekit") ctx = ctxsetters.WithServiceName(ctx, "Replay") ctx = ctxsetters.WithMethodName(ctx, "Playback") caller := c.callPlayback @@ -524,7 +522,7 @@ func (c *replayJSONClient) callPlayback(ctx context.Context, in *PlaybackRequest } func (c *replayJSONClient) Seek(ctx context.Context, in *SeekRequest) (*google_protobuf.Empty, error) { - ctx = ctxsetters.WithPackageName(ctx, "replay") + ctx = ctxsetters.WithPackageName(ctx, "livekit") ctx = ctxsetters.WithServiceName(ctx, "Replay") ctx = ctxsetters.WithMethodName(ctx, "Seek") caller := c.callSeek @@ -570,7 +568,7 @@ func (c *replayJSONClient) callSeek(ctx context.Context, in *SeekRequest) (*goog } func (c *replayJSONClient) Close(ctx context.Context, in *ClosePlaybackRequest) (*google_protobuf.Empty, error) { - ctx = ctxsetters.WithPackageName(ctx, "replay") + ctx = ctxsetters.WithPackageName(ctx, "livekit") ctx = ctxsetters.WithServiceName(ctx, "Replay") ctx = ctxsetters.WithMethodName(ctx, "Close") caller := c.callClose @@ -615,26 +613,26 @@ func (c *replayJSONClient) callClose(ctx context.Context, in *ClosePlaybackReque return out, nil } -func (c *replayJSONClient) Export(ctx context.Context, in *livekit2.ExportReplayRequest) (*livekit2.EgressInfo, error) { - ctx = ctxsetters.WithPackageName(ctx, "replay") +func (c *replayJSONClient) Export(ctx context.Context, in *ExportReplayRequest) (*EgressInfo, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") ctx = ctxsetters.WithServiceName(ctx, "Replay") ctx = ctxsetters.WithMethodName(ctx, "Export") caller := c.callExport if c.interceptor != nil { - caller = func(ctx context.Context, req *livekit2.ExportReplayRequest) (*livekit2.EgressInfo, error) { + caller = func(ctx context.Context, req *ExportReplayRequest) (*EgressInfo, error) { resp, err := c.interceptor( func(ctx context.Context, req interface{}) (interface{}, error) { - typedReq, ok := req.(*livekit2.ExportReplayRequest) + typedReq, ok := req.(*ExportReplayRequest) if !ok { - return nil, twirp.InternalError("failed type assertion req.(*livekit2.ExportReplayRequest) when calling interceptor") + return nil, twirp.InternalError("failed type assertion req.(*ExportReplayRequest) when calling interceptor") } return c.callExport(ctx, typedReq) }, )(ctx, req) if resp != nil { - typedResp, ok := resp.(*livekit2.EgressInfo) + typedResp, ok := resp.(*EgressInfo) if !ok { - return nil, twirp.InternalError("failed type assertion resp.(*livekit2.EgressInfo) when calling interceptor") + return nil, twirp.InternalError("failed type assertion resp.(*EgressInfo) when calling interceptor") } return typedResp, err } @@ -644,8 +642,8 @@ func (c *replayJSONClient) Export(ctx context.Context, in *livekit2.ExportReplay return caller(ctx, in) } -func (c *replayJSONClient) callExport(ctx context.Context, in *livekit2.ExportReplayRequest) (*livekit2.EgressInfo, error) { - out := new(livekit2.EgressInfo) +func (c *replayJSONClient) callExport(ctx context.Context, in *ExportReplayRequest) (*EgressInfo, error) { + out := new(EgressInfo) ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[4], in, out) if err != nil { twerr, ok := err.(twirp.Error) @@ -662,7 +660,7 @@ func (c *replayJSONClient) callExport(ctx context.Context, in *livekit2.ExportRe } func (c *replayJSONClient) DeleteReplay(ctx context.Context, in *DeleteReplayRequest) (*google_protobuf.Empty, error) { - ctx = ctxsetters.WithPackageName(ctx, "replay") + ctx = ctxsetters.WithPackageName(ctx, "livekit") ctx = ctxsetters.WithServiceName(ctx, "Replay") ctx = ctxsetters.WithMethodName(ctx, "DeleteReplay") caller := c.callDeleteReplay @@ -769,11 +767,11 @@ func (s *replayServer) handleRequestBodyError(ctx context.Context, resp http.Res // Should be used with caution, it only matches routes generated by Twirp Go clients, // with the default "/twirp" prefix and default CamelCase service and method names. // More info: https://twitchtv.github.io/twirp/docs/routing.html -const ReplayPathPrefix = "/twirp/replay.Replay/" +const ReplayPathPrefix = "/twirp/livekit.Replay/" func (s *replayServer) ServeHTTP(resp http.ResponseWriter, req *http.Request) { ctx := req.Context() - ctx = ctxsetters.WithPackageName(ctx, "replay") + ctx = ctxsetters.WithPackageName(ctx, "livekit") ctx = ctxsetters.WithServiceName(ctx, "Replay") ctx = ctxsetters.WithResponseWriter(ctx, resp) @@ -792,7 +790,7 @@ func (s *replayServer) ServeHTTP(resp http.ResponseWriter, req *http.Request) { // Verify path format: []/./ prefix, pkgService, method := parseTwirpPath(req.URL.Path) - if pkgService != "replay.Replay" { + if pkgService != "livekit.Replay" { msg := fmt.Sprintf("no handler for path %q", req.URL.Path) s.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path)) return @@ -1582,7 +1580,7 @@ func (s *replayServer) serveExportJSON(ctx context.Context, resp http.ResponseWr s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) return } - reqContent := new(livekit2.ExportReplayRequest) + reqContent := new(ExportReplayRequest) unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true} if err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil { s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) @@ -1591,20 +1589,20 @@ func (s *replayServer) serveExportJSON(ctx context.Context, resp http.ResponseWr handler := s.Replay.Export if s.interceptor != nil { - handler = func(ctx context.Context, req *livekit2.ExportReplayRequest) (*livekit2.EgressInfo, error) { + handler = func(ctx context.Context, req *ExportReplayRequest) (*EgressInfo, error) { resp, err := s.interceptor( func(ctx context.Context, req interface{}) (interface{}, error) { - typedReq, ok := req.(*livekit2.ExportReplayRequest) + typedReq, ok := req.(*ExportReplayRequest) if !ok { - return nil, twirp.InternalError("failed type assertion req.(*livekit2.ExportReplayRequest) when calling interceptor") + return nil, twirp.InternalError("failed type assertion req.(*ExportReplayRequest) when calling interceptor") } return s.Replay.Export(ctx, typedReq) }, )(ctx, req) if resp != nil { - typedResp, ok := resp.(*livekit2.EgressInfo) + typedResp, ok := resp.(*EgressInfo) if !ok { - return nil, twirp.InternalError("failed type assertion resp.(*livekit2.EgressInfo) when calling interceptor") + return nil, twirp.InternalError("failed type assertion resp.(*EgressInfo) when calling interceptor") } return typedResp, err } @@ -1613,7 +1611,7 @@ func (s *replayServer) serveExportJSON(ctx context.Context, resp http.ResponseWr } // Call service method - var respContent *livekit2.EgressInfo + var respContent *EgressInfo func() { defer ensurePanicResponses(ctx, resp, s.hooks) respContent, err = handler(ctx, reqContent) @@ -1624,7 +1622,7 @@ func (s *replayServer) serveExportJSON(ctx context.Context, resp http.ResponseWr return } if respContent == nil { - s.writeError(ctx, resp, twirp.InternalError("received a nil *livekit2.EgressInfo and nil error while calling Export. nil responses are not supported")) + s.writeError(ctx, resp, twirp.InternalError("received a nil *EgressInfo and nil error while calling Export. nil responses are not supported")) return } @@ -1664,7 +1662,7 @@ func (s *replayServer) serveExportProtobuf(ctx context.Context, resp http.Respon s.handleRequestBodyError(ctx, resp, "failed to read request body", err) return } - reqContent := new(livekit2.ExportReplayRequest) + reqContent := new(ExportReplayRequest) if err = proto.Unmarshal(buf, reqContent); err != nil { s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded")) return @@ -1672,20 +1670,20 @@ func (s *replayServer) serveExportProtobuf(ctx context.Context, resp http.Respon handler := s.Replay.Export if s.interceptor != nil { - handler = func(ctx context.Context, req *livekit2.ExportReplayRequest) (*livekit2.EgressInfo, error) { + handler = func(ctx context.Context, req *ExportReplayRequest) (*EgressInfo, error) { resp, err := s.interceptor( func(ctx context.Context, req interface{}) (interface{}, error) { - typedReq, ok := req.(*livekit2.ExportReplayRequest) + typedReq, ok := req.(*ExportReplayRequest) if !ok { - return nil, twirp.InternalError("failed type assertion req.(*livekit2.ExportReplayRequest) when calling interceptor") + return nil, twirp.InternalError("failed type assertion req.(*ExportReplayRequest) when calling interceptor") } return s.Replay.Export(ctx, typedReq) }, )(ctx, req) if resp != nil { - typedResp, ok := resp.(*livekit2.EgressInfo) + typedResp, ok := resp.(*EgressInfo) if !ok { - return nil, twirp.InternalError("failed type assertion resp.(*livekit2.EgressInfo) when calling interceptor") + return nil, twirp.InternalError("failed type assertion resp.(*EgressInfo) when calling interceptor") } return typedResp, err } @@ -1694,7 +1692,7 @@ func (s *replayServer) serveExportProtobuf(ctx context.Context, resp http.Respon } // Call service method - var respContent *livekit2.EgressInfo + var respContent *EgressInfo func() { defer ensurePanicResponses(ctx, resp, s.hooks) respContent, err = handler(ctx, reqContent) @@ -1705,7 +1703,7 @@ func (s *replayServer) serveExportProtobuf(ctx context.Context, resp http.Respon return } if respContent == nil { - s.writeError(ctx, resp, twirp.InternalError("received a nil *livekit2.EgressInfo and nil error while calling Export. nil responses are not supported")) + s.writeError(ctx, resp, twirp.InternalError("received a nil *EgressInfo and nil error while calling Export. nil responses are not supported")) return } @@ -1921,7 +1919,7 @@ func (s *replayServer) ProtocGenTwirpVersion() string { // that is everything in a Twirp route except for the . This can be used for routing, // for example to identify the requests that are targeted to this service in a mux. func (s *replayServer) PathPrefix() string { - return baseServicePath(s.pathPrefix, "replay", "Replay") + return baseServicePath(s.pathPrefix, "livekit", "Replay") } // ===== @@ -2490,44 +2488,43 @@ func callClientError(ctx context.Context, h *twirp.ClientHooks, err twirp.Error) } var twirpFileDescriptor0 = []byte{ - // 611 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0xdd, 0x4e, 0xdb, 0x4c, - 0x10, 0x95, 0x13, 0xbe, 0x7c, 0x64, 0x1c, 0xa0, 0xda, 0xa0, 0xd6, 0x32, 0x54, 0x8d, 0xdc, 0x5e, - 0xa4, 0x12, 0xb2, 0x25, 0xb8, 0xa8, 0x44, 0x85, 0x84, 0xf8, 0x69, 0x15, 0x15, 0xda, 0xc8, 0xe5, - 0xaa, 0x37, 0x96, 0x13, 0x4f, 0x5c, 0x37, 0xb6, 0xd7, 0xf5, 0x6e, 0x10, 0x3c, 0x00, 0xea, 0x0b, - 0xf4, 0x8a, 0x47, 0xe8, 0xa3, 0x55, 0x3c, 0x44, 0xe5, 0x5d, 0xaf, 0xf3, 0x43, 0xb8, 0xc8, 0x9d, - 0x7d, 0x66, 0xce, 0xce, 0x99, 0x33, 0xbb, 0x03, 0x64, 0x18, 0xd3, 0x49, 0xe0, 0xe5, 0x98, 0xc5, - 0xfe, 0xad, 0x9d, 0xe5, 0x94, 0x53, 0xd2, 0x90, 0x7f, 0xe6, 0x4e, 0x48, 0x69, 0x18, 0xa3, 0x23, - 0xd0, 0xc1, 0x64, 0xe4, 0x60, 0x92, 0xf1, 0x32, 0xc9, 0xdc, 0x8e, 0xa3, 0x6b, 0x1c, 0x47, 0xdc, - 0xc3, 0x30, 0x47, 0xc6, 0x16, 0xd1, 0x84, 0x06, 0x18, 0x4f, 0x51, 0x1a, 0x86, 0x98, 0x3b, 0x34, - 0xe3, 0x11, 0x4d, 0x4b, 0xd4, 0xfa, 0x01, 0xe4, 0x22, 0x62, 0xdc, 0x15, 0xc5, 0x98, 0x8b, 0x3f, - 0x27, 0xc8, 0x38, 0xd9, 0x81, 0x66, 0x4e, 0x69, 0xe2, 0xa5, 0x7e, 0x82, 0x86, 0xd6, 0xd1, 0xba, - 0x4d, 0x77, 0xbd, 0x00, 0x3e, 0xfb, 0x09, 0x92, 0x77, 0x00, 0x99, 0x1f, 0xa2, 0xc7, 0xe9, 0x18, - 0x53, 0xa3, 0xd6, 0xd1, 0xba, 0xfa, 0xbe, 0x61, 0x97, 0x35, 0xed, 0xab, 0x02, 0xed, 0xfb, 0x61, - 0x94, 0xfa, 0x45, 0x1d, 0xb7, 0x59, 0xe4, 0x0a, 0xd0, 0xba, 0xd3, 0xa0, 0x3d, 0x57, 0x8c, 0x65, - 0x34, 0x65, 0x48, 0xf6, 0xe0, 0x7f, 0xd9, 0x2c, 0x33, 0xb4, 0x4e, 0xbd, 0xab, 0xef, 0x13, 0xbb, - 0xb4, 0x42, 0x66, 0xf6, 0xd2, 0x11, 0x75, 0x55, 0x0a, 0x39, 0x86, 0xad, 0x14, 0x6f, 0xb8, 0xb7, - 0x82, 0x86, 0x8d, 0x82, 0xd0, 0xaf, 0x74, 0xfc, 0xd6, 0x00, 0xa6, 0x27, 0x93, 0xb7, 0xd0, 0x94, - 0x67, 0x7b, 0x51, 0x20, 0x9b, 0x3d, 0x69, 0xdd, 0x3f, 0xec, 0xad, 0x4b, 0xb0, 0x77, 0xe6, 0xaa, - 0xaf, 0x60, 0xde, 0x97, 0xda, 0x82, 0x2f, 0x2f, 0x01, 0x18, 0xf7, 0x73, 0xee, 0xf1, 0x28, 0x41, - 0xa3, 0xde, 0xd1, 0xba, 0x75, 0xb7, 0x29, 0x90, 0xab, 0x28, 0x41, 0xf2, 0x0a, 0xf4, 0x60, 0x92, - 0x0b, 0x41, 0x5e, 0xc2, 0x8c, 0x35, 0x11, 0x07, 0x05, 0x5d, 0x32, 0xeb, 0x97, 0x06, 0x5b, 0xfd, - 0xd8, 0xbf, 0x1d, 0xf8, 0xc3, 0xb1, 0x1a, 0xc4, 0x0a, 0xda, 0x5e, 0xc3, 0x46, 0x56, 0xb2, 0xbd, - 0x42, 0x53, 0xa9, 0xaf, 0xa5, 0x40, 0x97, 0xd2, 0x84, 0xbc, 0x81, 0x4d, 0x86, 0x38, 0xf6, 0xe8, - 0x68, 0xc4, 0x90, 0x17, 0x3a, 0xa4, 0xce, 0x56, 0x81, 0x7e, 0x11, 0xe0, 0x25, 0xb3, 0x4e, 0xe1, - 0xd9, 0x54, 0x48, 0x39, 0x24, 0x07, 0xf4, 0xea, 0xf8, 0x4a, 0xcb, 0xe6, 0xfd, 0xc3, 0x1e, 0x28, - 0xb8, 0x77, 0xe6, 0x4e, 0xbf, 0x03, 0x2b, 0x00, 0xfd, 0x2b, 0x62, 0xd5, 0xc9, 0xaa, 0xfc, 0x25, - 0x52, 0x6b, 0x4b, 0xa4, 0x7e, 0x84, 0xed, 0xd3, 0x98, 0x32, 0x5c, 0x34, 0x6e, 0x65, 0xb9, 0xc7, - 0xd0, 0x3e, 0xc3, 0x18, 0x39, 0xca, 0x9b, 0xb1, 0xfa, 0x00, 0xf6, 0xef, 0xea, 0xd0, 0x90, 0x64, - 0xf2, 0x01, 0xf4, 0x99, 0x8b, 0x4e, 0x4c, 0x75, 0x9f, 0x1f, 0x3f, 0x35, 0x73, 0x67, 0x69, 0xac, - 0x34, 0xfd, 0x08, 0xd6, 0x55, 0x63, 0xe4, 0x85, 0x4a, 0x5c, 0x68, 0xd5, 0x34, 0x1e, 0x07, 0x4a, - 0xfa, 0x01, 0xac, 0x15, 0x23, 0x20, 0x6d, 0x95, 0x31, 0x33, 0x10, 0xf3, 0xb9, 0x2d, 0x37, 0x8b, - 0xad, 0x36, 0x8b, 0x7d, 0x5e, 0x6c, 0x16, 0x72, 0x04, 0xff, 0x09, 0x47, 0xc9, 0xae, 0x62, 0x2d, - 0x33, 0xf8, 0x49, 0xfa, 0x7b, 0x68, 0x9c, 0xdf, 0x64, 0x34, 0xe7, 0x64, 0xb7, 0x7a, 0x8f, 0x12, - 0x98, 0x33, 0xd6, 0x6c, 0x4f, 0xa3, 0x62, 0x77, 0x89, 0xa7, 0x78, 0x0a, 0xad, 0xd9, 0x21, 0x90, - 0xca, 0x9c, 0x25, 0xa3, 0x79, 0x4a, 0xc1, 0xc9, 0xf9, 0x37, 0x2b, 0x8c, 0xf8, 0xf7, 0xc9, 0xc0, - 0x1e, 0xd2, 0xc4, 0x29, 0xab, 0xc8, 0xfd, 0x39, 0xa4, 0xb1, 0x23, 0x4f, 0xfc, 0x53, 0xdb, 0xb8, - 0x88, 0xae, 0xf1, 0x53, 0xc4, 0xed, 0x7e, 0x11, 0xf9, 0x5b, 0xdb, 0x2c, 0xff, 0x0f, 0x0f, 0x05, - 0x30, 0x68, 0x08, 0xc6, 0xc1, 0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xdc, 0x5e, 0xa3, 0x2b, 0x9d, - 0x05, 0x00, 0x00, + // 607 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x94, 0xcd, 0x6e, 0xd3, 0x40, + 0x10, 0xc7, 0xe5, 0xa4, 0xb4, 0xcd, 0x38, 0x6d, 0xd1, 0xb6, 0x42, 0xc6, 0xa1, 0x22, 0x4a, 0x39, + 0x04, 0xa9, 0x38, 0x52, 0x40, 0x42, 0x2a, 0x12, 0x54, 0x6d, 0x02, 0x44, 0xb4, 0x10, 0x99, 0x9e, + 0xb8, 0x58, 0x4e, 0x3c, 0x31, 0x26, 0xb6, 0xd7, 0x78, 0x37, 0x55, 0xfb, 0x02, 0x70, 0xe1, 0xc8, + 0xa9, 0x8f, 0xc0, 0xa3, 0xa1, 0x3e, 0x04, 0xda, 0xf5, 0x57, 0x12, 0xdc, 0x43, 0x6e, 0xf6, 0x6f, + 0x67, 0x66, 0xff, 0xf3, 0xb1, 0x03, 0x64, 0xec, 0xd3, 0x99, 0x63, 0xc5, 0x18, 0xf9, 0xf6, 0xb5, + 0x11, 0xc5, 0x94, 0x53, 0xb2, 0xe1, 0x7b, 0x97, 0x38, 0xf5, 0xb8, 0xde, 0x70, 0x29, 0x75, 0x7d, + 0xec, 0x48, 0x3c, 0x9a, 0x4d, 0x3a, 0x18, 0x44, 0x3c, 0xb5, 0xd2, 0xf7, 0x52, 0x2b, 0x0b, 0xdd, + 0x18, 0x19, 0x5b, 0xa6, 0x01, 0x75, 0xd0, 0x2f, 0x28, 0x75, 0x5d, 0x8c, 0x3b, 0x34, 0xe2, 0x1e, + 0x0d, 0x53, 0xda, 0xfa, 0x06, 0xe4, 0xcc, 0x63, 0xdc, 0x94, 0x77, 0x33, 0x13, 0xbf, 0xcf, 0x90, + 0x71, 0xd2, 0x80, 0x5a, 0x4c, 0x69, 0x60, 0x85, 0x76, 0x80, 0x9a, 0xd2, 0x54, 0xda, 0x35, 0x73, + 0x53, 0x80, 0x8f, 0x76, 0x80, 0xe4, 0x25, 0x40, 0x64, 0xbb, 0x68, 0x71, 0x3a, 0xc5, 0x50, 0xab, + 0x34, 0x95, 0xb6, 0xda, 0xd5, 0x8c, 0xf4, 0x4e, 0xe3, 0x42, 0xd0, 0xa1, 0xed, 0x7a, 0xa1, 0x2d, + 0xee, 0x31, 0x6b, 0xc2, 0x56, 0xc2, 0xd6, 0x0f, 0x05, 0x76, 0x17, 0x2e, 0x63, 0x11, 0x0d, 0x19, + 0x92, 0x67, 0xb0, 0x91, 0xe4, 0xce, 0x34, 0xa5, 0x59, 0x6d, 0xab, 0xdd, 0xdd, 0x3c, 0x5a, 0x62, + 0x3a, 0x08, 0x27, 0xd4, 0xcc, 0x6c, 0xc8, 0x31, 0xec, 0x84, 0x78, 0xc5, 0xad, 0x15, 0x44, 0x6c, + 0x09, 0x87, 0x61, 0x2e, 0xe4, 0xb7, 0x02, 0x50, 0x44, 0x26, 0x4f, 0xa1, 0x96, 0xc4, 0xb6, 0x3c, + 0x27, 0xc9, 0xf6, 0xa4, 0x7e, 0x73, 0x7b, 0xb8, 0x99, 0xc0, 0x41, 0xcf, 0xcc, 0xbe, 0x9c, 0xc5, + 0xc2, 0x54, 0x96, 0x0a, 0xb3, 0x0f, 0xc0, 0xb8, 0x1d, 0x73, 0x8b, 0x7b, 0x01, 0x6a, 0xd5, 0xa6, + 0xd2, 0xae, 0x9a, 0x35, 0x49, 0x2e, 0xbc, 0x00, 0xc9, 0x63, 0x50, 0x9d, 0x59, 0x2c, 0x05, 0x59, + 0x01, 0xd3, 0xd6, 0xe4, 0x39, 0x64, 0xe8, 0x9c, 0xb5, 0x7e, 0x2a, 0xb0, 0x33, 0xf4, 0xed, 0xeb, + 0x91, 0x3d, 0x9e, 0x66, 0x9d, 0x58, 0x41, 0xdb, 0x01, 0x6c, 0x45, 0xa9, 0xb7, 0x25, 0x34, 0xa5, + 0xfa, 0xea, 0x19, 0x34, 0x29, 0x0d, 0xc8, 0x13, 0xd8, 0x66, 0x88, 0x53, 0x8b, 0x4e, 0x26, 0x0c, + 0xb9, 0xd0, 0x91, 0xe8, 0xac, 0x0b, 0xfa, 0x49, 0xc2, 0x73, 0xd6, 0x3a, 0x85, 0xfb, 0x85, 0x90, + 0xb4, 0x4b, 0x1d, 0x50, 0xf3, 0xf0, 0xb9, 0x96, 0xed, 0x9b, 0xdb, 0x43, 0xc8, 0xf0, 0xa0, 0x67, + 0x16, 0xdf, 0x4e, 0xcb, 0x01, 0xf5, 0x33, 0x62, 0x9e, 0xc9, 0xaa, 0xfe, 0x25, 0x52, 0x2b, 0x25, + 0x52, 0xdf, 0xc1, 0xde, 0xa9, 0x4f, 0x19, 0x2e, 0x17, 0x6e, 0x65, 0xb9, 0xc7, 0xb0, 0xdb, 0x43, + 0x1f, 0x39, 0x26, 0x93, 0xb1, 0x7a, 0x03, 0xba, 0xbf, 0xaa, 0xb0, 0x9e, 0x38, 0x93, 0xf7, 0xa0, + 0xce, 0x4d, 0x3a, 0x69, 0xe4, 0x93, 0xf9, 0xff, 0x63, 0xd3, 0x1f, 0x95, 0x1f, 0xa6, 0x65, 0x7f, + 0x03, 0x9b, 0x59, 0x6a, 0xa4, 0x18, 0xf0, 0xa5, 0x6c, 0xf5, 0x87, 0x25, 0x27, 0x69, 0x80, 0x17, + 0xb0, 0x26, 0xda, 0x40, 0xf6, 0x72, 0x93, 0xb9, 0xae, 0xe8, 0x0f, 0x8c, 0x64, 0xbf, 0x18, 0xd9, + 0x7e, 0x31, 0xfa, 0x62, 0xbf, 0x90, 0xd7, 0x70, 0x4f, 0x96, 0x95, 0xec, 0xe7, 0x6e, 0x65, 0x65, + 0xbe, 0xd3, 0xff, 0x15, 0xac, 0xf7, 0xaf, 0x22, 0x1a, 0x73, 0x52, 0xa4, 0x97, 0x80, 0x85, 0xf2, + 0xea, 0xc5, 0x53, 0xef, 0xcb, 0x15, 0x26, 0x1f, 0x64, 0x0f, 0xea, 0xf3, 0xad, 0x98, 0x0b, 0x51, + 0xd2, 0xa1, 0xbb, 0x24, 0x9c, 0xbc, 0xfd, 0x72, 0xe0, 0x7a, 0xfc, 0xeb, 0x6c, 0x64, 0x8c, 0x69, + 0xd0, 0x49, 0x23, 0x24, 0x7b, 0x74, 0x4c, 0xfd, 0x0c, 0xfc, 0xa9, 0x6c, 0x9d, 0x79, 0x97, 0xf8, + 0x41, 0x94, 0x4e, 0x1c, 0xfd, 0xad, 0x6c, 0xa7, 0xff, 0x47, 0x47, 0x12, 0x8c, 0xd6, 0xa5, 0xcb, + 0xf3, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xbe, 0x41, 0xfd, 0xa2, 0xa7, 0x05, 0x00, 0x00, } diff --git a/livekit/livekit_agent_dispatch.twirp.go b/livekit/livekit_agent_dispatch.twirp.go index 9b8e92365..bc79324a1 100644 --- a/livekit/livekit_agent_dispatch.twirp.go +++ b/livekit/livekit_agent_dispatch.twirp.go @@ -16,11 +16,6 @@ import proto "google.golang.org/protobuf/proto" import twirp "github.com/twitchtv/twirp" import ctxsetters "github.com/twitchtv/twirp/ctxsetters" -import bytes "bytes" -import errors "errors" -import path "path" -import url "net/url" - // Version compatibility assertion. // If the constant is not defined in the package, that likely means // the package needs to be updated to work with this generated code. @@ -1065,7 +1060,7 @@ func (s *agentDispatchServiceServer) serveListDispatchProtobuf(ctx context.Conte } func (s *agentDispatchServiceServer) ServiceDescriptor() ([]byte, int) { - return twirpFileDescriptor0, 0 + return twirpFileDescriptor1, 0 } func (s *agentDispatchServiceServer) ProtocGenTwirpVersion() string { @@ -1079,572 +1074,7 @@ func (s *agentDispatchServiceServer) PathPrefix() string { return baseServicePath(s.pathPrefix, "livekit", "AgentDispatchService") } -// ===== -// Utils -// ===== - -// HTTPClient is the interface used by generated clients to send HTTP requests. -// It is fulfilled by *(net/http).Client, which is sufficient for most users. -// Users can provide their own implementation for special retry policies. -// -// HTTPClient implementations should not follow redirects. Redirects are -// automatically disabled if *(net/http).Client is passed to client -// constructors. See the withoutRedirects function in this file for more -// details. -type HTTPClient interface { - Do(req *http.Request) (*http.Response, error) -} - -// TwirpServer is the interface generated server structs will support: they're -// HTTP handlers with additional methods for accessing metadata about the -// service. Those accessors are a low-level API for building reflection tools. -// Most people can think of TwirpServers as just http.Handlers. -type TwirpServer interface { - http.Handler - - // ServiceDescriptor returns gzipped bytes describing the .proto file that - // this service was generated from. Once unzipped, the bytes can be - // unmarshalled as a - // google.golang.org/protobuf/types/descriptorpb.FileDescriptorProto. - // - // The returned integer is the index of this particular service within that - // FileDescriptorProto's 'Service' slice of ServiceDescriptorProtos. This is a - // low-level field, expected to be used for reflection. - ServiceDescriptor() ([]byte, int) - - // ProtocGenTwirpVersion is the semantic version string of the version of - // twirp used to generate this file. - ProtocGenTwirpVersion() string - - // PathPrefix returns the HTTP URL path prefix for all methods handled by this - // service. This can be used with an HTTP mux to route Twirp requests. - // The path prefix is in the form: "//./" - // that is, everything in a Twirp route except for the at the end. - PathPrefix() string -} - -func newServerOpts(opts []interface{}) *twirp.ServerOptions { - serverOpts := &twirp.ServerOptions{} - for _, opt := range opts { - switch o := opt.(type) { - case twirp.ServerOption: - o(serverOpts) - case *twirp.ServerHooks: // backwards compatibility, allow to specify hooks as an argument - twirp.WithServerHooks(o)(serverOpts) - case nil: // backwards compatibility, allow nil value for the argument - continue - default: - panic(fmt.Sprintf("Invalid option type %T, please use a twirp.ServerOption", o)) - } - } - return serverOpts -} - -// WriteError writes an HTTP response with a valid Twirp error format (code, msg, meta). -// Useful outside of the Twirp server (e.g. http middleware), but does not trigger hooks. -// If err is not a twirp.Error, it will get wrapped with twirp.InternalErrorWith(err) -func WriteError(resp http.ResponseWriter, err error) { - writeError(context.Background(), resp, err, nil) -} - -// writeError writes Twirp errors in the response and triggers hooks. -func writeError(ctx context.Context, resp http.ResponseWriter, err error, hooks *twirp.ServerHooks) { - // Convert to a twirp.Error. Non-twirp errors are converted to internal errors. - var twerr twirp.Error - if !errors.As(err, &twerr) { - twerr = twirp.InternalErrorWith(err) - } - - statusCode := twirp.ServerHTTPStatusFromErrorCode(twerr.Code()) - ctx = ctxsetters.WithStatusCode(ctx, statusCode) - ctx = callError(ctx, hooks, twerr) - - respBody := marshalErrorToJSON(twerr) - - resp.Header().Set("Content-Type", "application/json") // Error responses are always JSON - resp.Header().Set("Content-Length", strconv.Itoa(len(respBody))) - resp.WriteHeader(statusCode) // set HTTP status code and send response - - _, writeErr := resp.Write(respBody) - if writeErr != nil { - // We have three options here. We could log the error, call the Error - // hook, or just silently ignore the error. - // - // Logging is unacceptable because we don't have a user-controlled - // logger; writing out to stderr without permission is too rude. - // - // Calling the Error hook would confuse users: it would mean the Error - // hook got called twice for one request, which is likely to lead to - // duplicated log messages and metrics, no matter how well we document - // the behavior. - // - // Silently ignoring the error is our least-bad option. It's highly - // likely that the connection is broken and the original 'err' says - // so anyway. - _ = writeErr - } - - callResponseSent(ctx, hooks) -} - -// sanitizeBaseURL parses the the baseURL, and adds the "http" scheme if needed. -// If the URL is unparsable, the baseURL is returned unchanged. -func sanitizeBaseURL(baseURL string) string { - u, err := url.Parse(baseURL) - if err != nil { - return baseURL // invalid URL will fail later when making requests - } - if u.Scheme == "" { - u.Scheme = "http" - } - return u.String() -} - -// baseServicePath composes the path prefix for the service (without ). -// e.g.: baseServicePath("/twirp", "my.pkg", "MyService") -// -// returns => "/twirp/my.pkg.MyService/" -// -// e.g.: baseServicePath("", "", "MyService") -// -// returns => "/MyService/" -func baseServicePath(prefix, pkg, service string) string { - fullServiceName := service - if pkg != "" { - fullServiceName = pkg + "." + service - } - return path.Join("/", prefix, fullServiceName) + "/" -} - -// parseTwirpPath extracts path components form a valid Twirp route. -// Expected format: "[]/./" -// e.g.: prefix, pkgService, method := parseTwirpPath("/twirp/pkg.Svc/MakeHat") -func parseTwirpPath(path string) (string, string, string) { - parts := strings.Split(path, "/") - if len(parts) < 2 { - return "", "", "" - } - method := parts[len(parts)-1] - pkgService := parts[len(parts)-2] - prefix := strings.Join(parts[0:len(parts)-2], "/") - return prefix, pkgService, method -} - -// getCustomHTTPReqHeaders retrieves a copy of any headers that are set in -// a context through the twirp.WithHTTPRequestHeaders function. -// If there are no headers set, or if they have the wrong type, nil is returned. -func getCustomHTTPReqHeaders(ctx context.Context) http.Header { - header, ok := twirp.HTTPRequestHeaders(ctx) - if !ok || header == nil { - return nil - } - copied := make(http.Header) - for k, vv := range header { - if vv == nil { - copied[k] = nil - continue - } - copied[k] = make([]string, len(vv)) - copy(copied[k], vv) - } - return copied -} - -// newRequest makes an http.Request from a client, adding common headers. -func newRequest(ctx context.Context, url string, reqBody io.Reader, contentType string) (*http.Request, error) { - req, err := http.NewRequest("POST", url, reqBody) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if customHeader := getCustomHTTPReqHeaders(ctx); customHeader != nil { - req.Header = customHeader - } - req.Header.Set("Accept", contentType) - req.Header.Set("Content-Type", contentType) - req.Header.Set("Twirp-Version", "v8.1.3") - return req, nil -} - -// JSON serialization for errors -type twerrJSON struct { - Code string `json:"code"` - Msg string `json:"msg"` - Meta map[string]string `json:"meta,omitempty"` -} - -// marshalErrorToJSON returns JSON from a twirp.Error, that can be used as HTTP error response body. -// If serialization fails, it will use a descriptive Internal error instead. -func marshalErrorToJSON(twerr twirp.Error) []byte { - // make sure that msg is not too large - msg := twerr.Msg() - if len(msg) > 1e6 { - msg = msg[:1e6] - } - - tj := twerrJSON{ - Code: string(twerr.Code()), - Msg: msg, - Meta: twerr.MetaMap(), - } - - buf, err := json.Marshal(&tj) - if err != nil { - buf = []byte("{\"type\": \"" + twirp.Internal + "\", \"msg\": \"There was an error but it could not be serialized into JSON\"}") // fallback - } - - return buf -} - -// errorFromResponse builds a twirp.Error from a non-200 HTTP response. -// If the response has a valid serialized Twirp error, then it's returned. -// If not, the response status code is used to generate a similar twirp -// error. See twirpErrorFromIntermediary for more info on intermediary errors. -func errorFromResponse(resp *http.Response) twirp.Error { - statusCode := resp.StatusCode - statusText := http.StatusText(statusCode) - - if isHTTPRedirect(statusCode) { - // Unexpected redirect: it must be an error from an intermediary. - // Twirp clients don't follow redirects automatically, Twirp only handles - // POST requests, redirects should only happen on GET and HEAD requests. - location := resp.Header.Get("Location") - msg := fmt.Sprintf("unexpected HTTP status code %d %q received, Location=%q", statusCode, statusText, location) - return twirpErrorFromIntermediary(statusCode, msg, location) - } - - respBodyBytes, err := io.ReadAll(resp.Body) - if err != nil { - return wrapInternal(err, "failed to read server error response body") - } - - var tj twerrJSON - dec := json.NewDecoder(bytes.NewReader(respBodyBytes)) - dec.DisallowUnknownFields() - if err := dec.Decode(&tj); err != nil || tj.Code == "" { - // Invalid JSON response; it must be an error from an intermediary. - msg := fmt.Sprintf("Error from intermediary with HTTP status code %d %q", statusCode, statusText) - return twirpErrorFromIntermediary(statusCode, msg, string(respBodyBytes)) - } - - errorCode := twirp.ErrorCode(tj.Code) - if !twirp.IsValidErrorCode(errorCode) { - msg := "invalid type returned from server error response: " + tj.Code - return twirp.InternalError(msg).WithMeta("body", string(respBodyBytes)) - } - - twerr := twirp.NewError(errorCode, tj.Msg) - for k, v := range tj.Meta { - twerr = twerr.WithMeta(k, v) - } - return twerr -} - -// twirpErrorFromIntermediary maps HTTP errors from non-twirp sources to twirp errors. -// The mapping is similar to gRPC: https://github.com/grpc/grpc/blob/master/doc/http-grpc-status-mapping.md. -// Returned twirp Errors have some additional metadata for inspection. -func twirpErrorFromIntermediary(status int, msg string, bodyOrLocation string) twirp.Error { - var code twirp.ErrorCode - if isHTTPRedirect(status) { // 3xx - code = twirp.Internal - } else { - switch status { - case 400: // Bad Request - code = twirp.Internal - case 401: // Unauthorized - code = twirp.Unauthenticated - case 403: // Forbidden - code = twirp.PermissionDenied - case 404: // Not Found - code = twirp.BadRoute - case 429: // Too Many Requests - code = twirp.ResourceExhausted - case 502, 503, 504: // Bad Gateway, Service Unavailable, Gateway Timeout - code = twirp.Unavailable - default: // All other codes - code = twirp.Unknown - } - } - - twerr := twirp.NewError(code, msg) - twerr = twerr.WithMeta("http_error_from_intermediary", "true") // to easily know if this error was from intermediary - twerr = twerr.WithMeta("status_code", strconv.Itoa(status)) - if isHTTPRedirect(status) { - twerr = twerr.WithMeta("location", bodyOrLocation) - } else { - twerr = twerr.WithMeta("body", bodyOrLocation) - } - return twerr -} - -func isHTTPRedirect(status int) bool { - return status >= 300 && status <= 399 -} - -// wrapInternal wraps an error with a prefix as an Internal error. -// The original error cause is accessible by github.com/pkg/errors.Cause. -func wrapInternal(err error, prefix string) twirp.Error { - return twirp.InternalErrorWith(&wrappedError{prefix: prefix, cause: err}) -} - -type wrappedError struct { - prefix string - cause error -} - -func (e *wrappedError) Error() string { return e.prefix + ": " + e.cause.Error() } -func (e *wrappedError) Unwrap() error { return e.cause } // for go1.13 + errors.Is/As -func (e *wrappedError) Cause() error { return e.cause } // for github.com/pkg/errors - -// ensurePanicResponses makes sure that rpc methods causing a panic still result in a Twirp Internal -// error response (status 500), and error hooks are properly called with the panic wrapped as an error. -// The panic is re-raised so it can be handled normally with middleware. -func ensurePanicResponses(ctx context.Context, resp http.ResponseWriter, hooks *twirp.ServerHooks) { - if r := recover(); r != nil { - // Wrap the panic as an error so it can be passed to error hooks. - // The original error is accessible from error hooks, but not visible in the response. - err := errFromPanic(r) - twerr := &internalWithCause{msg: "Internal service panic", cause: err} - // Actually write the error - writeError(ctx, resp, twerr, hooks) - // If possible, flush the error to the wire. - f, ok := resp.(http.Flusher) - if ok { - f.Flush() - } - - panic(r) - } -} - -// errFromPanic returns the typed error if the recovered panic is an error, otherwise formats as error. -func errFromPanic(p interface{}) error { - if err, ok := p.(error); ok { - return err - } - return fmt.Errorf("panic: %v", p) -} - -// internalWithCause is a Twirp Internal error wrapping an original error cause, -// but the original error message is not exposed on Msg(). The original error -// can be checked with go1.13+ errors.Is/As, and also by (github.com/pkg/errors).Unwrap -type internalWithCause struct { - msg string - cause error -} - -func (e *internalWithCause) Unwrap() error { return e.cause } // for go1.13 + errors.Is/As -func (e *internalWithCause) Cause() error { return e.cause } // for github.com/pkg/errors -func (e *internalWithCause) Error() string { return e.msg + ": " + e.cause.Error() } -func (e *internalWithCause) Code() twirp.ErrorCode { return twirp.Internal } -func (e *internalWithCause) Msg() string { return e.msg } -func (e *internalWithCause) Meta(key string) string { return "" } -func (e *internalWithCause) MetaMap() map[string]string { return nil } -func (e *internalWithCause) WithMeta(key string, val string) twirp.Error { return e } - -// malformedRequestError is used when the twirp server cannot unmarshal a request -func malformedRequestError(msg string) twirp.Error { - return twirp.NewError(twirp.Malformed, msg) -} - -// badRouteError is used when the twirp server cannot route a request -func badRouteError(msg string, method, url string) twirp.Error { - err := twirp.NewError(twirp.BadRoute, msg) - err = err.WithMeta("twirp_invalid_route", method+" "+url) - return err -} - -// withoutRedirects makes sure that the POST request can not be redirected. -// The standard library will, by default, redirect requests (including POSTs) if it gets a 302 or -// 303 response, and also 301s in go1.8. It redirects by making a second request, changing the -// method to GET and removing the body. This produces very confusing error messages, so instead we -// set a redirect policy that always errors. This stops Go from executing the redirect. -// -// We have to be a little careful in case the user-provided http.Client has its own CheckRedirect -// policy - if so, we'll run through that policy first. -// -// Because this requires modifying the http.Client, we make a new copy of the client and return it. -func withoutRedirects(in *http.Client) *http.Client { - copy := *in - copy.CheckRedirect = func(req *http.Request, via []*http.Request) error { - if in.CheckRedirect != nil { - // Run the input's redirect if it exists, in case it has side effects, but ignore any error it - // returns, since we want to use ErrUseLastResponse. - err := in.CheckRedirect(req, via) - _ = err // Silly, but this makes sure generated code passes errcheck -blank, which some people use. - } - return http.ErrUseLastResponse - } - return © -} - -// doProtobufRequest makes a Protobuf request to the remote Twirp service. -func doProtobufRequest(ctx context.Context, client HTTPClient, hooks *twirp.ClientHooks, url string, in, out proto.Message) (_ context.Context, err error) { - reqBodyBytes, err := proto.Marshal(in) - if err != nil { - return ctx, wrapInternal(err, "failed to marshal proto request") - } - reqBody := bytes.NewBuffer(reqBodyBytes) - if err = ctx.Err(); err != nil { - return ctx, wrapInternal(err, "aborted because context was done") - } - - req, err := newRequest(ctx, url, reqBody, "application/protobuf") - if err != nil { - return ctx, wrapInternal(err, "could not build request") - } - ctx, err = callClientRequestPrepared(ctx, hooks, req) - if err != nil { - return ctx, err - } - - req = req.WithContext(ctx) - resp, err := client.Do(req) - if err != nil { - return ctx, wrapInternal(err, "failed to do request") - } - defer func() { _ = resp.Body.Close() }() - - if err = ctx.Err(); err != nil { - return ctx, wrapInternal(err, "aborted because context was done") - } - - if resp.StatusCode != 200 { - return ctx, errorFromResponse(resp) - } - - respBodyBytes, err := io.ReadAll(resp.Body) - if err != nil { - return ctx, wrapInternal(err, "failed to read response body") - } - if err = ctx.Err(); err != nil { - return ctx, wrapInternal(err, "aborted because context was done") - } - - if err = proto.Unmarshal(respBodyBytes, out); err != nil { - return ctx, wrapInternal(err, "failed to unmarshal proto response") - } - return ctx, nil -} - -// doJSONRequest makes a JSON request to the remote Twirp service. -func doJSONRequest(ctx context.Context, client HTTPClient, hooks *twirp.ClientHooks, url string, in, out proto.Message) (_ context.Context, err error) { - marshaler := &protojson.MarshalOptions{UseProtoNames: true} - reqBytes, err := marshaler.Marshal(in) - if err != nil { - return ctx, wrapInternal(err, "failed to marshal json request") - } - if err = ctx.Err(); err != nil { - return ctx, wrapInternal(err, "aborted because context was done") - } - - req, err := newRequest(ctx, url, bytes.NewReader(reqBytes), "application/json") - if err != nil { - return ctx, wrapInternal(err, "could not build request") - } - ctx, err = callClientRequestPrepared(ctx, hooks, req) - if err != nil { - return ctx, err - } - - req = req.WithContext(ctx) - resp, err := client.Do(req) - if err != nil { - return ctx, wrapInternal(err, "failed to do request") - } - - defer func() { - cerr := resp.Body.Close() - if err == nil && cerr != nil { - err = wrapInternal(cerr, "failed to close response body") - } - }() - - if err = ctx.Err(); err != nil { - return ctx, wrapInternal(err, "aborted because context was done") - } - - if resp.StatusCode != 200 { - return ctx, errorFromResponse(resp) - } - - d := json.NewDecoder(resp.Body) - rawRespBody := json.RawMessage{} - if err := d.Decode(&rawRespBody); err != nil { - return ctx, wrapInternal(err, "failed to unmarshal json response") - } - unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true} - if err = unmarshaler.Unmarshal(rawRespBody, out); err != nil { - return ctx, wrapInternal(err, "failed to unmarshal json response") - } - if err = ctx.Err(); err != nil { - return ctx, wrapInternal(err, "aborted because context was done") - } - return ctx, nil -} - -// Call twirp.ServerHooks.RequestReceived if the hook is available -func callRequestReceived(ctx context.Context, h *twirp.ServerHooks) (context.Context, error) { - if h == nil || h.RequestReceived == nil { - return ctx, nil - } - return h.RequestReceived(ctx) -} - -// Call twirp.ServerHooks.RequestRouted if the hook is available -func callRequestRouted(ctx context.Context, h *twirp.ServerHooks) (context.Context, error) { - if h == nil || h.RequestRouted == nil { - return ctx, nil - } - return h.RequestRouted(ctx) -} - -// Call twirp.ServerHooks.ResponsePrepared if the hook is available -func callResponsePrepared(ctx context.Context, h *twirp.ServerHooks) context.Context { - if h == nil || h.ResponsePrepared == nil { - return ctx - } - return h.ResponsePrepared(ctx) -} - -// Call twirp.ServerHooks.ResponseSent if the hook is available -func callResponseSent(ctx context.Context, h *twirp.ServerHooks) { - if h == nil || h.ResponseSent == nil { - return - } - h.ResponseSent(ctx) -} - -// Call twirp.ServerHooks.Error if the hook is available -func callError(ctx context.Context, h *twirp.ServerHooks, err twirp.Error) context.Context { - if h == nil || h.Error == nil { - return ctx - } - return h.Error(ctx, err) -} - -func callClientResponseReceived(ctx context.Context, h *twirp.ClientHooks) { - if h == nil || h.ResponseReceived == nil { - return - } - h.ResponseReceived(ctx) -} - -func callClientRequestPrepared(ctx context.Context, h *twirp.ClientHooks, req *http.Request) (context.Context, error) { - if h == nil || h.RequestPrepared == nil { - return ctx, nil - } - return h.RequestPrepared(ctx, req) -} - -func callClientError(ctx context.Context, h *twirp.ClientHooks, err twirp.Error) { - if h == nil || h.Error == nil { - return - } - h.Error(ctx, err) -} - -var twirpFileDescriptor0 = []byte{ +var twirpFileDescriptor1 = []byte{ // 479 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x54, 0xc1, 0x6e, 0xd3, 0x40, 0x10, 0x95, 0xed, 0x14, 0xc8, 0xa4, 0x0d, 0xb0, 0x54, 0xc8, 0x18, 0x90, 0x8c, 0x7b, 0xc9, 0xa1, diff --git a/livekit/livekit_agent_simulation.twirp.go b/livekit/livekit_agent_simulation.twirp.go index 85648310c..8226a9bc1 100644 --- a/livekit/livekit_agent_simulation.twirp.go +++ b/livekit/livekit_agent_simulation.twirp.go @@ -3850,7 +3850,7 @@ func (s *agentSimulationServer) serveListScenariosProtobuf(ctx context.Context, } func (s *agentSimulationServer) ServiceDescriptor() ([]byte, int) { - return twirpFileDescriptor8, 0 + return twirpFileDescriptor9, 0 } func (s *agentSimulationServer) ProtocGenTwirpVersion() string { @@ -3864,7 +3864,7 @@ func (s *agentSimulationServer) PathPrefix() string { return baseServicePath(s.pathPrefix, "livekit", "AgentSimulation") } -var twirpFileDescriptor8 = []byte{ +var twirpFileDescriptor9 = []byte{ // 1852 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x59, 0x4f, 0x6f, 0xdb, 0xc8, 0x15, 0x37, 0xa9, 0x7f, 0xd6, 0x53, 0x24, 0xcb, 0xb3, 0xde, 0x54, 0x66, 0xe1, 0xc4, 0x51, 0x76, diff --git a/livekit/livekit_cloud_agent.twirp.go b/livekit/livekit_cloud_agent.twirp.go index f9650615d..ae643b077 100644 --- a/livekit/livekit_cloud_agent.twirp.go +++ b/livekit/livekit_cloud_agent.twirp.go @@ -4408,7 +4408,7 @@ func (s *cloudAgentServer) serveGetPrivateLinkStatusProtobuf(ctx context.Context } func (s *cloudAgentServer) ServiceDescriptor() ([]byte, int) { - return twirpFileDescriptor5, 0 + return twirpFileDescriptor6, 0 } func (s *cloudAgentServer) ProtocGenTwirpVersion() string { @@ -4422,7 +4422,7 @@ func (s *cloudAgentServer) PathPrefix() string { return baseServicePath(s.pathPrefix, "livekit", "CloudAgent") } -var twirpFileDescriptor5 = []byte{ +var twirpFileDescriptor6 = []byte{ // 2161 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x59, 0xcb, 0x73, 0x1b, 0x49, 0x19, 0xf7, 0xe8, 0x65, 0xe9, 0x93, 0xed, 0xd8, 0x6d, 0xc7, 0x19, 0xcb, 0x76, 0x62, 0x4f, 0x36, diff --git a/livekit/livekit_connector.twirp.go b/livekit/livekit_connector.twirp.go index c2906fc4b..d88f01c00 100644 --- a/livekit/livekit_connector.twirp.go +++ b/livekit/livekit_connector.twirp.go @@ -1618,7 +1618,7 @@ func (s *connectorServer) serveConnectTwilioCallProtobuf(ctx context.Context, re } func (s *connectorServer) ServiceDescriptor() ([]byte, int) { - return twirpFileDescriptor7, 0 + return twirpFileDescriptor8, 0 } func (s *connectorServer) ProtocGenTwirpVersion() string { @@ -1632,7 +1632,7 @@ func (s *connectorServer) PathPrefix() string { return baseServicePath(s.pathPrefix, "livekit", "Connector") } -var twirpFileDescriptor7 = []byte{ +var twirpFileDescriptor8 = []byte{ // 313 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x92, 0x41, 0x4b, 0xf3, 0x30, 0x1c, 0xc6, 0xdf, 0xb7, 0xc2, 0xd4, 0xbf, 0x4e, 0x6b, 0x04, 0x85, 0x1e, 0x64, 0x5b, 0x45, 0xc1, diff --git a/livekit/livekit_egress.twirp.go b/livekit/livekit_egress.twirp.go index 60cb8cd53..fa529aab1 100644 --- a/livekit/livekit_egress.twirp.go +++ b/livekit/livekit_egress.twirp.go @@ -2740,7 +2740,7 @@ func (s *egressServer) serveStopEgressProtobuf(ctx context.Context, resp http.Re } func (s *egressServer) ServiceDescriptor() ([]byte, int) { - return twirpFileDescriptor1, 0 + return twirpFileDescriptor2, 0 } func (s *egressServer) ProtocGenTwirpVersion() string { @@ -2754,7 +2754,7 @@ func (s *egressServer) PathPrefix() string { return baseServicePath(s.pathPrefix, "livekit", "Egress") } -var twirpFileDescriptor1 = []byte{ +var twirpFileDescriptor2 = []byte{ // 4193 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x3b, 0x4b, 0x6f, 0x1b, 0x49, 0x7a, 0x6a, 0xbe, 0xf9, 0xf1, 0xd5, 0x2a, 0x3d, 0x4c, 0xcb, 0x33, 0x63, 0x2f, 0x9d, 0xf1, 0x43, diff --git a/livekit/livekit_ingress.twirp.go b/livekit/livekit_ingress.twirp.go index dbfd09517..44b610cc6 100644 --- a/livekit/livekit_ingress.twirp.go +++ b/livekit/livekit_ingress.twirp.go @@ -1341,7 +1341,7 @@ func (s *ingressServer) serveDeleteIngressProtobuf(ctx context.Context, resp htt } func (s *ingressServer) ServiceDescriptor() ([]byte, int) { - return twirpFileDescriptor2, 0 + return twirpFileDescriptor3, 0 } func (s *ingressServer) ProtocGenTwirpVersion() string { @@ -1355,7 +1355,7 @@ func (s *ingressServer) PathPrefix() string { return baseServicePath(s.pathPrefix, "livekit", "Ingress") } -var twirpFileDescriptor2 = []byte{ +var twirpFileDescriptor3 = []byte{ // 1623 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x58, 0xcf, 0x6f, 0xdb, 0xca, 0x11, 0x36, 0xf5, 0x5b, 0xa3, 0x48, 0x56, 0xd6, 0xf2, 0x7b, 0x7a, 0xfe, 0xd1, 0x0a, 0xf2, 0x6b, diff --git a/livekit/livekit_phone_number.twirp.go b/livekit/livekit_phone_number.twirp.go index 60bf1d5fa..a7fee3b07 100644 --- a/livekit/livekit_phone_number.twirp.go +++ b/livekit/livekit_phone_number.twirp.go @@ -1904,7 +1904,7 @@ func (s *phoneNumberServiceServer) serveReleasePhoneNumbersProtobuf(ctx context. } func (s *phoneNumberServiceServer) ServiceDescriptor() ([]byte, int) { - return twirpFileDescriptor6, 0 + return twirpFileDescriptor7, 0 } func (s *phoneNumberServiceServer) ProtocGenTwirpVersion() string { @@ -1918,7 +1918,7 @@ func (s *phoneNumberServiceServer) PathPrefix() string { return baseServicePath(s.pathPrefix, "livekit", "PhoneNumberService") } -var twirpFileDescriptor6 = []byte{ +var twirpFileDescriptor7 = []byte{ // 1243 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x57, 0xe1, 0x6e, 0xdb, 0x54, 0x14, 0xce, 0x75, 0xda, 0xae, 0x39, 0x49, 0xdb, 0xec, 0x6e, 0x5d, 0x5d, 0x77, 0x5b, 0x33, 0x17, diff --git a/livekit/livekit_room.twirp.go b/livekit/livekit_room.twirp.go index 7b930d639..fa806f563 100644 --- a/livekit/livekit_room.twirp.go +++ b/livekit/livekit_room.twirp.go @@ -4152,7 +4152,7 @@ func (s *roomServiceServer) servePerformRpcProtobuf(ctx context.Context, resp ht } func (s *roomServiceServer) ServiceDescriptor() ([]byte, int) { - return twirpFileDescriptor3, 0 + return twirpFileDescriptor4, 0 } func (s *roomServiceServer) ProtocGenTwirpVersion() string { @@ -4166,7 +4166,7 @@ func (s *roomServiceServer) PathPrefix() string { return baseServicePath(s.pathPrefix, "livekit", "RoomService") } -var twirpFileDescriptor3 = []byte{ +var twirpFileDescriptor4 = []byte{ // 1579 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x58, 0xcb, 0x6e, 0x1b, 0xc7, 0x12, 0xbd, 0x94, 0x28, 0x8a, 0x2c, 0xea, 0xc5, 0x96, 0x6c, 0x8f, 0x46, 0x7e, 0xd0, 0x23, 0xdf, diff --git a/livekit/livekit_sip.twirp.go b/livekit/livekit_sip.twirp.go index 0690adfbd..f6550bba1 100644 --- a/livekit/livekit_sip.twirp.go +++ b/livekit/livekit_sip.twirp.go @@ -16,7 +16,7 @@ import proto "google.golang.org/protobuf/proto" import twirp "github.com/twitchtv/twirp" import ctxsetters "github.com/twitchtv/twirp/ctxsetters" -import google_protobuf4 "google.golang.org/protobuf/types/known/emptypb" +import google_protobuf "google.golang.org/protobuf/types/known/emptypb" // Version compatibility assertion. // If the constant is not defined in the package, that likely means @@ -59,7 +59,7 @@ type SIP interface { CreateSIPParticipant(context.Context, *CreateSIPParticipantRequest) (*SIPParticipantInfo, error) - TransferSIPParticipant(context.Context, *TransferSIPParticipantRequest) (*google_protobuf4.Empty, error) + TransferSIPParticipant(context.Context, *TransferSIPParticipantRequest) (*google_protobuf.Empty, error) } // =================== @@ -813,13 +813,13 @@ func (c *sIPProtobufClient) callCreateSIPParticipant(ctx context.Context, in *Cr return out, nil } -func (c *sIPProtobufClient) TransferSIPParticipant(ctx context.Context, in *TransferSIPParticipantRequest) (*google_protobuf4.Empty, error) { +func (c *sIPProtobufClient) TransferSIPParticipant(ctx context.Context, in *TransferSIPParticipantRequest) (*google_protobuf.Empty, error) { ctx = ctxsetters.WithPackageName(ctx, "livekit") ctx = ctxsetters.WithServiceName(ctx, "SIP") ctx = ctxsetters.WithMethodName(ctx, "TransferSIPParticipant") caller := c.callTransferSIPParticipant if c.interceptor != nil { - caller = func(ctx context.Context, req *TransferSIPParticipantRequest) (*google_protobuf4.Empty, error) { + caller = func(ctx context.Context, req *TransferSIPParticipantRequest) (*google_protobuf.Empty, error) { resp, err := c.interceptor( func(ctx context.Context, req interface{}) (interface{}, error) { typedReq, ok := req.(*TransferSIPParticipantRequest) @@ -830,9 +830,9 @@ func (c *sIPProtobufClient) TransferSIPParticipant(ctx context.Context, in *Tran }, )(ctx, req) if resp != nil { - typedResp, ok := resp.(*google_protobuf4.Empty) + typedResp, ok := resp.(*google_protobuf.Empty) if !ok { - return nil, twirp.InternalError("failed type assertion resp.(*google_protobuf4.Empty) when calling interceptor") + return nil, twirp.InternalError("failed type assertion resp.(*google_protobuf.Empty) when calling interceptor") } return typedResp, err } @@ -842,8 +842,8 @@ func (c *sIPProtobufClient) TransferSIPParticipant(ctx context.Context, in *Tran return caller(ctx, in) } -func (c *sIPProtobufClient) callTransferSIPParticipant(ctx context.Context, in *TransferSIPParticipantRequest) (*google_protobuf4.Empty, error) { - out := new(google_protobuf4.Empty) +func (c *sIPProtobufClient) callTransferSIPParticipant(ctx context.Context, in *TransferSIPParticipantRequest) (*google_protobuf.Empty, error) { + out := new(google_protobuf.Empty) ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[15], in, out) if err != nil { twerr, ok := err.(twirp.Error) @@ -1610,13 +1610,13 @@ func (c *sIPJSONClient) callCreateSIPParticipant(ctx context.Context, in *Create return out, nil } -func (c *sIPJSONClient) TransferSIPParticipant(ctx context.Context, in *TransferSIPParticipantRequest) (*google_protobuf4.Empty, error) { +func (c *sIPJSONClient) TransferSIPParticipant(ctx context.Context, in *TransferSIPParticipantRequest) (*google_protobuf.Empty, error) { ctx = ctxsetters.WithPackageName(ctx, "livekit") ctx = ctxsetters.WithServiceName(ctx, "SIP") ctx = ctxsetters.WithMethodName(ctx, "TransferSIPParticipant") caller := c.callTransferSIPParticipant if c.interceptor != nil { - caller = func(ctx context.Context, req *TransferSIPParticipantRequest) (*google_protobuf4.Empty, error) { + caller = func(ctx context.Context, req *TransferSIPParticipantRequest) (*google_protobuf.Empty, error) { resp, err := c.interceptor( func(ctx context.Context, req interface{}) (interface{}, error) { typedReq, ok := req.(*TransferSIPParticipantRequest) @@ -1627,9 +1627,9 @@ func (c *sIPJSONClient) TransferSIPParticipant(ctx context.Context, in *Transfer }, )(ctx, req) if resp != nil { - typedResp, ok := resp.(*google_protobuf4.Empty) + typedResp, ok := resp.(*google_protobuf.Empty) if !ok { - return nil, twirp.InternalError("failed type assertion resp.(*google_protobuf4.Empty) when calling interceptor") + return nil, twirp.InternalError("failed type assertion resp.(*google_protobuf.Empty) when calling interceptor") } return typedResp, err } @@ -1639,8 +1639,8 @@ func (c *sIPJSONClient) TransferSIPParticipant(ctx context.Context, in *Transfer return caller(ctx, in) } -func (c *sIPJSONClient) callTransferSIPParticipant(ctx context.Context, in *TransferSIPParticipantRequest) (*google_protobuf4.Empty, error) { - out := new(google_protobuf4.Empty) +func (c *sIPJSONClient) callTransferSIPParticipant(ctx context.Context, in *TransferSIPParticipantRequest) (*google_protobuf.Empty, error) { + out := new(google_protobuf.Empty) ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[15], in, out) if err != nil { twerr, ok := err.(twirp.Error) @@ -4550,7 +4550,7 @@ func (s *sIPServer) serveTransferSIPParticipantJSON(ctx context.Context, resp ht handler := s.SIP.TransferSIPParticipant if s.interceptor != nil { - handler = func(ctx context.Context, req *TransferSIPParticipantRequest) (*google_protobuf4.Empty, error) { + handler = func(ctx context.Context, req *TransferSIPParticipantRequest) (*google_protobuf.Empty, error) { resp, err := s.interceptor( func(ctx context.Context, req interface{}) (interface{}, error) { typedReq, ok := req.(*TransferSIPParticipantRequest) @@ -4561,9 +4561,9 @@ func (s *sIPServer) serveTransferSIPParticipantJSON(ctx context.Context, resp ht }, )(ctx, req) if resp != nil { - typedResp, ok := resp.(*google_protobuf4.Empty) + typedResp, ok := resp.(*google_protobuf.Empty) if !ok { - return nil, twirp.InternalError("failed type assertion resp.(*google_protobuf4.Empty) when calling interceptor") + return nil, twirp.InternalError("failed type assertion resp.(*google_protobuf.Empty) when calling interceptor") } return typedResp, err } @@ -4572,7 +4572,7 @@ func (s *sIPServer) serveTransferSIPParticipantJSON(ctx context.Context, resp ht } // Call service method - var respContent *google_protobuf4.Empty + var respContent *google_protobuf.Empty func() { defer ensurePanicResponses(ctx, resp, s.hooks) respContent, err = handler(ctx, reqContent) @@ -4583,7 +4583,7 @@ func (s *sIPServer) serveTransferSIPParticipantJSON(ctx context.Context, resp ht return } if respContent == nil { - s.writeError(ctx, resp, twirp.InternalError("received a nil *google_protobuf4.Empty and nil error while calling TransferSIPParticipant. nil responses are not supported")) + s.writeError(ctx, resp, twirp.InternalError("received a nil *google_protobuf.Empty and nil error while calling TransferSIPParticipant. nil responses are not supported")) return } @@ -4631,7 +4631,7 @@ func (s *sIPServer) serveTransferSIPParticipantProtobuf(ctx context.Context, res handler := s.SIP.TransferSIPParticipant if s.interceptor != nil { - handler = func(ctx context.Context, req *TransferSIPParticipantRequest) (*google_protobuf4.Empty, error) { + handler = func(ctx context.Context, req *TransferSIPParticipantRequest) (*google_protobuf.Empty, error) { resp, err := s.interceptor( func(ctx context.Context, req interface{}) (interface{}, error) { typedReq, ok := req.(*TransferSIPParticipantRequest) @@ -4642,9 +4642,9 @@ func (s *sIPServer) serveTransferSIPParticipantProtobuf(ctx context.Context, res }, )(ctx, req) if resp != nil { - typedResp, ok := resp.(*google_protobuf4.Empty) + typedResp, ok := resp.(*google_protobuf.Empty) if !ok { - return nil, twirp.InternalError("failed type assertion resp.(*google_protobuf4.Empty) when calling interceptor") + return nil, twirp.InternalError("failed type assertion resp.(*google_protobuf.Empty) when calling interceptor") } return typedResp, err } @@ -4653,7 +4653,7 @@ func (s *sIPServer) serveTransferSIPParticipantProtobuf(ctx context.Context, res } // Call service method - var respContent *google_protobuf4.Empty + var respContent *google_protobuf.Empty func() { defer ensurePanicResponses(ctx, resp, s.hooks) respContent, err = handler(ctx, reqContent) @@ -4664,7 +4664,7 @@ func (s *sIPServer) serveTransferSIPParticipantProtobuf(ctx context.Context, res return } if respContent == nil { - s.writeError(ctx, resp, twirp.InternalError("received a nil *google_protobuf4.Empty and nil error while calling TransferSIPParticipant. nil responses are not supported")) + s.writeError(ctx, resp, twirp.InternalError("received a nil *google_protobuf.Empty and nil error while calling TransferSIPParticipant. nil responses are not supported")) return } @@ -4689,7 +4689,7 @@ func (s *sIPServer) serveTransferSIPParticipantProtobuf(ctx context.Context, res } func (s *sIPServer) ServiceDescriptor() ([]byte, int) { - return twirpFileDescriptor4, 0 + return twirpFileDescriptor5, 0 } func (s *sIPServer) ProtocGenTwirpVersion() string { @@ -4703,7 +4703,7 @@ func (s *sIPServer) PathPrefix() string { return baseServicePath(s.pathPrefix, "livekit", "SIP") } -var twirpFileDescriptor4 = []byte{ +var twirpFileDescriptor5 = []byte{ // 5455 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x3c, 0x5d, 0x90, 0x1b, 0xc9, 0x59, 0x96, 0x46, 0xfb, 0xd7, 0xda, 0xd5, 0xce, 0xf6, 0xfe, 0x9c, 0xbc, 0xfe, 0xdb, 0x93, 0xef, diff --git a/magefile.go b/magefile.go index 677301b69..d0744f7f9 100644 --- a/magefile.go +++ b/magefile.go @@ -43,6 +43,7 @@ func Bootstrap() error { // regenerate protobuf func Proto() error { twirpProtoFiles := []string{ + "cloud_replay.proto", "livekit_agent_dispatch.proto", "livekit_egress.proto", "livekit_ingress.proto", @@ -130,23 +131,6 @@ func Proto() error { return err } - fmt.Println("generating replay twirp protobuf") - replayTarget := "replay" - args = append([]string{ - "--go_out", replayTarget, - "--twirp_out", replayTarget, - "--go_opt=paths=source_relative", - "--twirp_opt=paths=source_relative", - "--plugin=go=" + protocGoPath, - "--plugin=twirp=" + twirpPath, - "-I=./protobufs", - }, "cloud_replay.proto") - cmd = exec.Command(protoc, args...) - connectStd(cmd) - if err := cmd.Run(); err != nil { - return err - } - fmt.Println("generating protobuf") args = append([]string{ "--go_out", target, diff --git a/protobufs/cloud_replay.proto b/protobufs/cloud_replay.proto index 7de062ed3..d07e135cd 100644 --- a/protobufs/cloud_replay.proto +++ b/protobufs/cloud_replay.proto @@ -14,9 +14,9 @@ syntax = "proto3"; -package replay; +package livekit; -option go_package = "github.com/livekit/protocol/replay"; +option go_package = "github.com/livekit/protocol/livekit"; option csharp_namespace = "LiveKit.Proto"; option ruby_package = "LiveKit::Proto"; @@ -25,7 +25,6 @@ import "livekit_egress.proto"; import "livekit_models.proto"; import "logger/options.proto"; -// Experimental (not currently available) service Replay { // List replays rpc ListReplays(ListReplaysRequest) returns (ListReplaysResponse); @@ -36,7 +35,7 @@ service Replay { rpc Close(ClosePlaybackRequest) returns (google.protobuf.Empty); // Export a stored replay using egress - rpc Export(livekit.ExportReplayRequest) returns (livekit.EgressInfo); + rpc Export(ExportReplayRequest) returns (EgressInfo); // Delete all stored data rpc DeleteReplay(DeleteReplayRequest) returns (google.protobuf.Empty);