Compare commits
7 Commits
@livekit/p
...
whep
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a71cf35d58 | ||
|
|
5a1d432adc | ||
|
|
b32524a0fe | ||
|
|
fcc943cef4 | ||
|
|
b43a4f9eaf | ||
|
|
331f246754 | ||
|
|
bc70a7d7ec |
2
go.mod
2
go.mod
@@ -19,7 +19,7 @@ require (
|
||||
github.com/mackerelio/go-osstat v0.2.4
|
||||
github.com/maxbrunsfeld/counterfeiter/v6 v6.8.1
|
||||
github.com/pion/logging v0.2.2
|
||||
github.com/pion/sdp/v3 v3.0.6
|
||||
github.com/pion/sdp/v3 v3.0.9
|
||||
github.com/pion/webrtc/v3 v3.2.28
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/prometheus/client_golang v1.19.0
|
||||
|
||||
4
go.sum
4
go.sum
@@ -138,8 +138,9 @@ github.com/pion/rtp v1.8.3/go.mod h1:pBGHaFt/yW7bf1jjWAoUjpSNoDnw98KTMg+jWWvziqU
|
||||
github.com/pion/sctp v1.8.5/go.mod h1:SUFFfDpViyKejTAdwD1d/HQsCu+V/40cCs2nZIvC3s0=
|
||||
github.com/pion/sctp v1.8.12 h1:2VX50pedElH+is6FI+OKyRTeN5oy4mrk2HjnGa3UCmY=
|
||||
github.com/pion/sctp v1.8.12/go.mod h1:cMLT45jqw3+jiJCrtHVwfQLnfR0MGZ4rgOJwUOIqLkI=
|
||||
github.com/pion/sdp/v3 v3.0.6 h1:WuDLhtuFUUVpTfus9ILC4HRyHsW6TdugjEX/QY9OiUw=
|
||||
github.com/pion/sdp/v3 v3.0.6/go.mod h1:iiFWFpQO8Fy3S5ldclBkpXqmWy02ns78NOKoLLL0YQw=
|
||||
github.com/pion/sdp/v3 v3.0.9 h1:pX++dCHoHUwq43kuwf3PyJfHlwIj4hXA7Vrifiq0IJY=
|
||||
github.com/pion/sdp/v3 v3.0.9/go.mod h1:B5xmvENq5IXJimIO4zfp6LAe1fD9N+kFv+V/1lOdz8M=
|
||||
github.com/pion/srtp/v2 v2.0.18 h1:vKpAXfawO9RtTRKZJbG4y0v1b11NZxQnxRl85kGuUlo=
|
||||
github.com/pion/srtp/v2 v2.0.18/go.mod h1:0KJQjA99A6/a0DOVTu1PhDSw0CXF2jTkqOoMg3ODqdA=
|
||||
github.com/pion/stun v0.6.1 h1:8lp6YejULeHBF8NmV8e2787BogQhduZugh5PdhDyyN4=
|
||||
@@ -182,6 +183,7 @@ github.com/stoewer/go-strcase v1.3.0/go.mod h1:fAH5hQ5pehh+j3nZfvwdk2RgEgQjAoM8w
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
||||
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
|
||||
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
|
||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
|
||||
@@ -71,6 +71,7 @@ func Proto() error {
|
||||
"rpc/room.proto",
|
||||
"rpc/signal.proto",
|
||||
"rpc/sip.proto",
|
||||
"rpc/whep.proto",
|
||||
}
|
||||
|
||||
fmt.Println("generating protobuf")
|
||||
|
||||
66
protobufs/rpc/whep.proto
Normal file
66
protobufs/rpc/whep.proto
Normal file
@@ -0,0 +1,66 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package rpc;
|
||||
|
||||
option go_package = "github.com/livekit/protocol/rpc";
|
||||
|
||||
import "options.proto";
|
||||
import "rpc/ingress.proto";
|
||||
import "google/protobuf/empty.proto";
|
||||
|
||||
service WHEPInternal {
|
||||
rpc StartWHEP(StartWHEPRequest) returns (StartWHEPResponse) {
|
||||
option (psrpc.options).affinity_func = true;
|
||||
};
|
||||
}
|
||||
|
||||
service WHEPHandler {
|
||||
rpc ICETrickle(ICETrickleRequest) returns(google.protobuf.Empty) {
|
||||
option (psrpc.options) = {
|
||||
topics: true
|
||||
topic_params: {
|
||||
group: "Resource"
|
||||
};
|
||||
};
|
||||
};
|
||||
rpc ICERestart(ICERestartWHIPResourceRequest) returns (ICERestartWHIPResourceResponse){
|
||||
option (psrpc.options) = {
|
||||
topics: true
|
||||
topic_params: {
|
||||
group: "Resource"
|
||||
};
|
||||
};
|
||||
}
|
||||
rpc DeleteWHEP(DeleteWHEPRequest) returns (google.protobuf.Empty) {
|
||||
option (psrpc.options) = {
|
||||
topics: true
|
||||
topic_params: {
|
||||
group: "Resource"
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
message StartWHEPRequest {
|
||||
string token = 1;
|
||||
string ws_url = 2;
|
||||
string participant = 3;
|
||||
string offer = 4;
|
||||
}
|
||||
|
||||
message StartWHEPResponse {
|
||||
string resource_id = 1;
|
||||
string answer = 2;
|
||||
}
|
||||
|
||||
message ICETrickleRequest {
|
||||
string resource_id = 1;
|
||||
string user_fragment = 2;
|
||||
string password = 3;
|
||||
repeated string candidates = 4;
|
||||
}
|
||||
|
||||
message DeleteWHEPRequest {
|
||||
string resource_id = 1;
|
||||
}
|
||||
443
rpc/whep.pb.go
Normal file
443
rpc/whep.pb.go
Normal file
@@ -0,0 +1,443 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.34.2
|
||||
// protoc v4.23.4
|
||||
// source: rpc/whep.proto
|
||||
|
||||
package rpc
|
||||
|
||||
import (
|
||||
_ "github.com/livekit/psrpc/protoc-gen-psrpc/options"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
emptypb "google.golang.org/protobuf/types/known/emptypb"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
type StartWHEPRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"`
|
||||
WsUrl string `protobuf:"bytes,2,opt,name=ws_url,json=wsUrl,proto3" json:"ws_url,omitempty"`
|
||||
Participant string `protobuf:"bytes,3,opt,name=participant,proto3" json:"participant,omitempty"`
|
||||
Offer string `protobuf:"bytes,4,opt,name=offer,proto3" json:"offer,omitempty"`
|
||||
}
|
||||
|
||||
func (x *StartWHEPRequest) Reset() {
|
||||
*x = StartWHEPRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_rpc_whep_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *StartWHEPRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*StartWHEPRequest) ProtoMessage() {}
|
||||
|
||||
func (x *StartWHEPRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_rpc_whep_proto_msgTypes[0]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use StartWHEPRequest.ProtoReflect.Descriptor instead.
|
||||
func (*StartWHEPRequest) Descriptor() ([]byte, []int) {
|
||||
return file_rpc_whep_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *StartWHEPRequest) GetToken() string {
|
||||
if x != nil {
|
||||
return x.Token
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *StartWHEPRequest) GetWsUrl() string {
|
||||
if x != nil {
|
||||
return x.WsUrl
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *StartWHEPRequest) GetParticipant() string {
|
||||
if x != nil {
|
||||
return x.Participant
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *StartWHEPRequest) GetOffer() string {
|
||||
if x != nil {
|
||||
return x.Offer
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type StartWHEPResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
ResourceId string `protobuf:"bytes,1,opt,name=resource_id,json=resourceId,proto3" json:"resource_id,omitempty"`
|
||||
Answer string `protobuf:"bytes,2,opt,name=answer,proto3" json:"answer,omitempty"`
|
||||
}
|
||||
|
||||
func (x *StartWHEPResponse) Reset() {
|
||||
*x = StartWHEPResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_rpc_whep_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *StartWHEPResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*StartWHEPResponse) ProtoMessage() {}
|
||||
|
||||
func (x *StartWHEPResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_rpc_whep_proto_msgTypes[1]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use StartWHEPResponse.ProtoReflect.Descriptor instead.
|
||||
func (*StartWHEPResponse) Descriptor() ([]byte, []int) {
|
||||
return file_rpc_whep_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *StartWHEPResponse) GetResourceId() string {
|
||||
if x != nil {
|
||||
return x.ResourceId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *StartWHEPResponse) GetAnswer() string {
|
||||
if x != nil {
|
||||
return x.Answer
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type ICETrickleRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
ResourceId string `protobuf:"bytes,1,opt,name=resource_id,json=resourceId,proto3" json:"resource_id,omitempty"`
|
||||
UserFragment string `protobuf:"bytes,2,opt,name=user_fragment,json=userFragment,proto3" json:"user_fragment,omitempty"`
|
||||
Password string `protobuf:"bytes,3,opt,name=password,proto3" json:"password,omitempty"`
|
||||
Candidates []string `protobuf:"bytes,4,rep,name=candidates,proto3" json:"candidates,omitempty"`
|
||||
}
|
||||
|
||||
func (x *ICETrickleRequest) Reset() {
|
||||
*x = ICETrickleRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_rpc_whep_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *ICETrickleRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ICETrickleRequest) ProtoMessage() {}
|
||||
|
||||
func (x *ICETrickleRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_rpc_whep_proto_msgTypes[2]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ICETrickleRequest.ProtoReflect.Descriptor instead.
|
||||
func (*ICETrickleRequest) Descriptor() ([]byte, []int) {
|
||||
return file_rpc_whep_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *ICETrickleRequest) GetResourceId() string {
|
||||
if x != nil {
|
||||
return x.ResourceId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ICETrickleRequest) GetUserFragment() string {
|
||||
if x != nil {
|
||||
return x.UserFragment
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ICETrickleRequest) GetPassword() string {
|
||||
if x != nil {
|
||||
return x.Password
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ICETrickleRequest) GetCandidates() []string {
|
||||
if x != nil {
|
||||
return x.Candidates
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type DeleteWHEPRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
ResourceId string `protobuf:"bytes,1,opt,name=resource_id,json=resourceId,proto3" json:"resource_id,omitempty"`
|
||||
}
|
||||
|
||||
func (x *DeleteWHEPRequest) Reset() {
|
||||
*x = DeleteWHEPRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_rpc_whep_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *DeleteWHEPRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*DeleteWHEPRequest) ProtoMessage() {}
|
||||
|
||||
func (x *DeleteWHEPRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_rpc_whep_proto_msgTypes[3]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use DeleteWHEPRequest.ProtoReflect.Descriptor instead.
|
||||
func (*DeleteWHEPRequest) Descriptor() ([]byte, []int) {
|
||||
return file_rpc_whep_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *DeleteWHEPRequest) GetResourceId() string {
|
||||
if x != nil {
|
||||
return x.ResourceId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
var File_rpc_whep_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_rpc_whep_proto_rawDesc = []byte{
|
||||
0x0a, 0x0e, 0x72, 0x70, 0x63, 0x2f, 0x77, 0x68, 0x65, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x12, 0x03, 0x72, 0x70, 0x63, 0x1a, 0x0d, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x11, 0x72, 0x70, 0x63, 0x2f, 0x69, 0x6e, 0x67, 0x72, 0x65, 0x73,
|
||||
0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x22, 0x77, 0x0a, 0x10, 0x53, 0x74, 0x61, 0x72, 0x74, 0x57, 0x48, 0x45,
|
||||
0x50, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65,
|
||||
0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x15,
|
||||
0x0a, 0x06, 0x77, 0x73, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05,
|
||||
0x77, 0x73, 0x55, 0x72, 0x6c, 0x12, 0x20, 0x0a, 0x0b, 0x70, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69,
|
||||
0x70, 0x61, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x61, 0x72, 0x74,
|
||||
0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x66, 0x66, 0x65, 0x72,
|
||||
0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6f, 0x66, 0x66, 0x65, 0x72, 0x22, 0x4c, 0x0a,
|
||||
0x11, 0x53, 0x74, 0x61, 0x72, 0x74, 0x57, 0x48, 0x45, 0x50, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
|
||||
0x73, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x69,
|
||||
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63,
|
||||
0x65, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x18, 0x02, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x22, 0x95, 0x01, 0x0a, 0x11,
|
||||
0x49, 0x43, 0x45, 0x54, 0x72, 0x69, 0x63, 0x6b, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
|
||||
0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x69, 0x64,
|
||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65,
|
||||
0x49, 0x64, 0x12, 0x23, 0x0a, 0x0d, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x66, 0x72, 0x61, 0x67, 0x6d,
|
||||
0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x75, 0x73, 0x65, 0x72, 0x46,
|
||||
0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77,
|
||||
0x6f, 0x72, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77,
|
||||
0x6f, 0x72, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x61, 0x6e, 0x64, 0x69, 0x64, 0x61, 0x74, 0x65,
|
||||
0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x61, 0x6e, 0x64, 0x69, 0x64, 0x61,
|
||||
0x74, 0x65, 0x73, 0x22, 0x34, 0x0a, 0x11, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x57, 0x48, 0x45,
|
||||
0x50, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x72, 0x65, 0x73, 0x6f,
|
||||
0x75, 0x72, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x72,
|
||||
0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x64, 0x32, 0x52, 0x0a, 0x0c, 0x57, 0x48, 0x45,
|
||||
0x50, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x12, 0x42, 0x0a, 0x09, 0x53, 0x74, 0x61,
|
||||
0x72, 0x74, 0x57, 0x48, 0x45, 0x50, 0x12, 0x15, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x74, 0x61,
|
||||
0x72, 0x74, 0x57, 0x48, 0x45, 0x50, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e,
|
||||
0x72, 0x70, 0x63, 0x2e, 0x53, 0x74, 0x61, 0x72, 0x74, 0x57, 0x48, 0x45, 0x50, 0x52, 0x65, 0x73,
|
||||
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x06, 0xb2, 0x89, 0x01, 0x02, 0x30, 0x01, 0x32, 0x9c, 0x02,
|
||||
0x0a, 0x0b, 0x57, 0x48, 0x45, 0x50, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x12, 0x50, 0x0a,
|
||||
0x0a, 0x49, 0x43, 0x45, 0x54, 0x72, 0x69, 0x63, 0x6b, 0x6c, 0x65, 0x12, 0x16, 0x2e, 0x72, 0x70,
|
||||
0x63, 0x2e, 0x49, 0x43, 0x45, 0x54, 0x72, 0x69, 0x63, 0x6b, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75,
|
||||
0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x12, 0xb2, 0x89, 0x01,
|
||||
0x0e, 0x10, 0x01, 0x1a, 0x0a, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12,
|
||||
0x69, 0x0a, 0x0a, 0x49, 0x43, 0x45, 0x52, 0x65, 0x73, 0x74, 0x61, 0x72, 0x74, 0x12, 0x22, 0x2e,
|
||||
0x72, 0x70, 0x63, 0x2e, 0x49, 0x43, 0x45, 0x52, 0x65, 0x73, 0x74, 0x61, 0x72, 0x74, 0x57, 0x48,
|
||||
0x49, 0x50, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
|
||||
0x74, 0x1a, 0x23, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x49, 0x43, 0x45, 0x52, 0x65, 0x73, 0x74, 0x61,
|
||||
0x72, 0x74, 0x57, 0x48, 0x49, 0x50, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65,
|
||||
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x12, 0xb2, 0x89, 0x01, 0x0e, 0x10, 0x01, 0x1a, 0x0a,
|
||||
0x0a, 0x08, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x50, 0x0a, 0x0a, 0x44, 0x65,
|
||||
0x6c, 0x65, 0x74, 0x65, 0x57, 0x48, 0x45, 0x50, 0x12, 0x16, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x44,
|
||||
0x65, 0x6c, 0x65, 0x74, 0x65, 0x57, 0x48, 0x45, 0x50, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
||||
0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,
|
||||
0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x12, 0xb2, 0x89, 0x01, 0x0e, 0x10, 0x01,
|
||||
0x1a, 0x0a, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x42, 0x21, 0x5a, 0x1f,
|
||||
0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6c, 0x69, 0x76, 0x65, 0x6b,
|
||||
0x69, 0x74, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x72, 0x70, 0x63, 0x62,
|
||||
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_rpc_whep_proto_rawDescOnce sync.Once
|
||||
file_rpc_whep_proto_rawDescData = file_rpc_whep_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_rpc_whep_proto_rawDescGZIP() []byte {
|
||||
file_rpc_whep_proto_rawDescOnce.Do(func() {
|
||||
file_rpc_whep_proto_rawDescData = protoimpl.X.CompressGZIP(file_rpc_whep_proto_rawDescData)
|
||||
})
|
||||
return file_rpc_whep_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_rpc_whep_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
|
||||
var file_rpc_whep_proto_goTypes = []any{
|
||||
(*StartWHEPRequest)(nil), // 0: rpc.StartWHEPRequest
|
||||
(*StartWHEPResponse)(nil), // 1: rpc.StartWHEPResponse
|
||||
(*ICETrickleRequest)(nil), // 2: rpc.ICETrickleRequest
|
||||
(*DeleteWHEPRequest)(nil), // 3: rpc.DeleteWHEPRequest
|
||||
(*ICERestartWHIPResourceRequest)(nil), // 4: rpc.ICERestartWHIPResourceRequest
|
||||
(*emptypb.Empty)(nil), // 5: google.protobuf.Empty
|
||||
(*ICERestartWHIPResourceResponse)(nil), // 6: rpc.ICERestartWHIPResourceResponse
|
||||
}
|
||||
var file_rpc_whep_proto_depIdxs = []int32{
|
||||
0, // 0: rpc.WHEPInternal.StartWHEP:input_type -> rpc.StartWHEPRequest
|
||||
2, // 1: rpc.WHEPHandler.ICETrickle:input_type -> rpc.ICETrickleRequest
|
||||
4, // 2: rpc.WHEPHandler.ICERestart:input_type -> rpc.ICERestartWHIPResourceRequest
|
||||
3, // 3: rpc.WHEPHandler.DeleteWHEP:input_type -> rpc.DeleteWHEPRequest
|
||||
1, // 4: rpc.WHEPInternal.StartWHEP:output_type -> rpc.StartWHEPResponse
|
||||
5, // 5: rpc.WHEPHandler.ICETrickle:output_type -> google.protobuf.Empty
|
||||
6, // 6: rpc.WHEPHandler.ICERestart:output_type -> rpc.ICERestartWHIPResourceResponse
|
||||
5, // 7: rpc.WHEPHandler.DeleteWHEP:output_type -> google.protobuf.Empty
|
||||
4, // [4:8] is the sub-list for method output_type
|
||||
0, // [0:4] is the sub-list for method input_type
|
||||
0, // [0:0] is the sub-list for extension type_name
|
||||
0, // [0:0] is the sub-list for extension extendee
|
||||
0, // [0:0] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_rpc_whep_proto_init() }
|
||||
func file_rpc_whep_proto_init() {
|
||||
if File_rpc_whep_proto != nil {
|
||||
return
|
||||
}
|
||||
file_rpc_ingress_proto_init()
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_rpc_whep_proto_msgTypes[0].Exporter = func(v any, i int) any {
|
||||
switch v := v.(*StartWHEPRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_rpc_whep_proto_msgTypes[1].Exporter = func(v any, i int) any {
|
||||
switch v := v.(*StartWHEPResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_rpc_whep_proto_msgTypes[2].Exporter = func(v any, i int) any {
|
||||
switch v := v.(*ICETrickleRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_rpc_whep_proto_msgTypes[3].Exporter = func(v any, i int) any {
|
||||
switch v := v.(*DeleteWHEPRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_rpc_whep_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 4,
|
||||
NumExtensions: 0,
|
||||
NumServices: 2,
|
||||
},
|
||||
GoTypes: file_rpc_whep_proto_goTypes,
|
||||
DependencyIndexes: file_rpc_whep_proto_depIdxs,
|
||||
MessageInfos: file_rpc_whep_proto_msgTypes,
|
||||
}.Build()
|
||||
File_rpc_whep_proto = out.File
|
||||
file_rpc_whep_proto_rawDesc = nil
|
||||
file_rpc_whep_proto_goTypes = nil
|
||||
file_rpc_whep_proto_depIdxs = nil
|
||||
}
|
||||
315
rpc/whep.psrpc.go
Normal file
315
rpc/whep.psrpc.go
Normal file
@@ -0,0 +1,315 @@
|
||||
// Code generated by protoc-gen-psrpc v0.5.1, DO NOT EDIT.
|
||||
// source: rpc/whep.proto
|
||||
|
||||
package rpc
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/livekit/psrpc"
|
||||
"github.com/livekit/psrpc/pkg/client"
|
||||
"github.com/livekit/psrpc/pkg/info"
|
||||
"github.com/livekit/psrpc/pkg/rand"
|
||||
"github.com/livekit/psrpc/pkg/server"
|
||||
"github.com/livekit/psrpc/version"
|
||||
)
|
||||
import google_protobuf "google.golang.org/protobuf/types/known/emptypb"
|
||||
|
||||
var _ = version.PsrpcVersion_0_5
|
||||
|
||||
// =============================
|
||||
// WHEPInternal Client Interface
|
||||
// =============================
|
||||
|
||||
type WHEPInternalClient interface {
|
||||
StartWHEP(ctx context.Context, req *StartWHEPRequest, opts ...psrpc.RequestOption) (*StartWHEPResponse, error)
|
||||
}
|
||||
|
||||
// =================================
|
||||
// WHEPInternal ServerImpl Interface
|
||||
// =================================
|
||||
|
||||
type WHEPInternalServerImpl interface {
|
||||
StartWHEP(context.Context, *StartWHEPRequest) (*StartWHEPResponse, error)
|
||||
StartWHEPAffinity(context.Context, *StartWHEPRequest) float32
|
||||
}
|
||||
|
||||
// =============================
|
||||
// WHEPInternal Server Interface
|
||||
// =============================
|
||||
|
||||
type WHEPInternalServer interface {
|
||||
|
||||
// Close and wait for pending RPCs to complete
|
||||
Shutdown()
|
||||
|
||||
// Close immediately, without waiting for pending RPCs
|
||||
Kill()
|
||||
}
|
||||
|
||||
// ===================
|
||||
// WHEPInternal Client
|
||||
// ===================
|
||||
|
||||
type wHEPInternalClient struct {
|
||||
client *client.RPCClient
|
||||
}
|
||||
|
||||
// NewWHEPInternalClient creates a psrpc client that implements the WHEPInternalClient interface.
|
||||
func NewWHEPInternalClient(bus psrpc.MessageBus, opts ...psrpc.ClientOption) (WHEPInternalClient, error) {
|
||||
sd := &info.ServiceDefinition{
|
||||
Name: "WHEPInternal",
|
||||
ID: rand.NewClientID(),
|
||||
}
|
||||
|
||||
sd.RegisterMethod("StartWHEP", true, false, true, false)
|
||||
|
||||
rpcClient, err := client.NewRPCClient(sd, bus, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &wHEPInternalClient{
|
||||
client: rpcClient,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (c *wHEPInternalClient) StartWHEP(ctx context.Context, req *StartWHEPRequest, opts ...psrpc.RequestOption) (*StartWHEPResponse, error) {
|
||||
return client.RequestSingle[*StartWHEPResponse](ctx, c.client, "StartWHEP", nil, req, opts...)
|
||||
}
|
||||
|
||||
// ===================
|
||||
// WHEPInternal Server
|
||||
// ===================
|
||||
|
||||
type wHEPInternalServer struct {
|
||||
svc WHEPInternalServerImpl
|
||||
rpc *server.RPCServer
|
||||
}
|
||||
|
||||
// NewWHEPInternalServer builds a RPCServer that will route requests
|
||||
// to the corresponding method in the provided svc implementation.
|
||||
func NewWHEPInternalServer(svc WHEPInternalServerImpl, bus psrpc.MessageBus, opts ...psrpc.ServerOption) (WHEPInternalServer, error) {
|
||||
sd := &info.ServiceDefinition{
|
||||
Name: "WHEPInternal",
|
||||
ID: rand.NewServerID(),
|
||||
}
|
||||
|
||||
s := server.NewRPCServer(sd, bus, opts...)
|
||||
|
||||
sd.RegisterMethod("StartWHEP", true, false, true, false)
|
||||
var err error
|
||||
err = server.RegisterHandler(s, "StartWHEP", nil, svc.StartWHEP, svc.StartWHEPAffinity)
|
||||
if err != nil {
|
||||
s.Close(false)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &wHEPInternalServer{
|
||||
svc: svc,
|
||||
rpc: s,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s *wHEPInternalServer) Shutdown() {
|
||||
s.rpc.Close(false)
|
||||
}
|
||||
|
||||
func (s *wHEPInternalServer) Kill() {
|
||||
s.rpc.Close(true)
|
||||
}
|
||||
|
||||
// ============================
|
||||
// WHEPHandler Client Interface
|
||||
// ============================
|
||||
|
||||
type WHEPHandlerClient interface {
|
||||
ICETrickle(ctx context.Context, topic string, req *ICETrickleRequest, opts ...psrpc.RequestOption) (*google_protobuf.Empty, error)
|
||||
|
||||
ICERestart(ctx context.Context, topic string, req *ICERestartWHIPResourceRequest, opts ...psrpc.RequestOption) (*ICERestartWHIPResourceResponse, error)
|
||||
|
||||
DeleteWHEP(ctx context.Context, topic string, req *DeleteWHEPRequest, opts ...psrpc.RequestOption) (*google_protobuf.Empty, error)
|
||||
}
|
||||
|
||||
// ================================
|
||||
// WHEPHandler ServerImpl Interface
|
||||
// ================================
|
||||
|
||||
type WHEPHandlerServerImpl interface {
|
||||
ICETrickle(context.Context, *ICETrickleRequest) (*google_protobuf.Empty, error)
|
||||
|
||||
ICERestart(context.Context, *ICERestartWHIPResourceRequest) (*ICERestartWHIPResourceResponse, error)
|
||||
|
||||
DeleteWHEP(context.Context, *DeleteWHEPRequest) (*google_protobuf.Empty, error)
|
||||
}
|
||||
|
||||
// ============================
|
||||
// WHEPHandler Server Interface
|
||||
// ============================
|
||||
|
||||
type WHEPHandlerServer interface {
|
||||
RegisterICETrickleTopic(topic string) error
|
||||
DeregisterICETrickleTopic(topic string)
|
||||
RegisterICERestartTopic(topic string) error
|
||||
DeregisterICERestartTopic(topic string)
|
||||
RegisterDeleteWHEPTopic(topic string) error
|
||||
DeregisterDeleteWHEPTopic(topic string)
|
||||
RegisterAllResourceTopics(topic string) error
|
||||
DeregisterAllResourceTopics(topic string)
|
||||
|
||||
// Close and wait for pending RPCs to complete
|
||||
Shutdown()
|
||||
|
||||
// Close immediately, without waiting for pending RPCs
|
||||
Kill()
|
||||
}
|
||||
|
||||
// ==================
|
||||
// WHEPHandler Client
|
||||
// ==================
|
||||
|
||||
type wHEPHandlerClient struct {
|
||||
client *client.RPCClient
|
||||
}
|
||||
|
||||
// NewWHEPHandlerClient creates a psrpc client that implements the WHEPHandlerClient interface.
|
||||
func NewWHEPHandlerClient(bus psrpc.MessageBus, opts ...psrpc.ClientOption) (WHEPHandlerClient, error) {
|
||||
sd := &info.ServiceDefinition{
|
||||
Name: "WHEPHandler",
|
||||
ID: rand.NewClientID(),
|
||||
}
|
||||
|
||||
sd.RegisterMethod("ICETrickle", false, false, true, true)
|
||||
sd.RegisterMethod("ICERestart", false, false, true, true)
|
||||
sd.RegisterMethod("DeleteWHEP", false, false, true, true)
|
||||
|
||||
rpcClient, err := client.NewRPCClient(sd, bus, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &wHEPHandlerClient{
|
||||
client: rpcClient,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (c *wHEPHandlerClient) ICETrickle(ctx context.Context, topic string, req *ICETrickleRequest, opts ...psrpc.RequestOption) (*google_protobuf.Empty, error) {
|
||||
return client.RequestSingle[*google_protobuf.Empty](ctx, c.client, "ICETrickle", []string{topic}, req, opts...)
|
||||
}
|
||||
|
||||
func (c *wHEPHandlerClient) ICERestart(ctx context.Context, topic string, req *ICERestartWHIPResourceRequest, opts ...psrpc.RequestOption) (*ICERestartWHIPResourceResponse, error) {
|
||||
return client.RequestSingle[*ICERestartWHIPResourceResponse](ctx, c.client, "ICERestart", []string{topic}, req, opts...)
|
||||
}
|
||||
|
||||
func (c *wHEPHandlerClient) DeleteWHEP(ctx context.Context, topic string, req *DeleteWHEPRequest, opts ...psrpc.RequestOption) (*google_protobuf.Empty, error) {
|
||||
return client.RequestSingle[*google_protobuf.Empty](ctx, c.client, "DeleteWHEP", []string{topic}, req, opts...)
|
||||
}
|
||||
|
||||
// ==================
|
||||
// WHEPHandler Server
|
||||
// ==================
|
||||
|
||||
type wHEPHandlerServer struct {
|
||||
svc WHEPHandlerServerImpl
|
||||
rpc *server.RPCServer
|
||||
}
|
||||
|
||||
// NewWHEPHandlerServer builds a RPCServer that will route requests
|
||||
// to the corresponding method in the provided svc implementation.
|
||||
func NewWHEPHandlerServer(svc WHEPHandlerServerImpl, bus psrpc.MessageBus, opts ...psrpc.ServerOption) (WHEPHandlerServer, error) {
|
||||
sd := &info.ServiceDefinition{
|
||||
Name: "WHEPHandler",
|
||||
ID: rand.NewServerID(),
|
||||
}
|
||||
|
||||
s := server.NewRPCServer(sd, bus, opts...)
|
||||
|
||||
sd.RegisterMethod("ICETrickle", false, false, true, true)
|
||||
sd.RegisterMethod("ICERestart", false, false, true, true)
|
||||
sd.RegisterMethod("DeleteWHEP", false, false, true, true)
|
||||
return &wHEPHandlerServer{
|
||||
svc: svc,
|
||||
rpc: s,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s *wHEPHandlerServer) RegisterICETrickleTopic(topic string) error {
|
||||
return server.RegisterHandler(s.rpc, "ICETrickle", []string{topic}, s.svc.ICETrickle, nil)
|
||||
}
|
||||
|
||||
func (s *wHEPHandlerServer) DeregisterICETrickleTopic(topic string) {
|
||||
s.rpc.DeregisterHandler("ICETrickle", []string{topic})
|
||||
}
|
||||
|
||||
func (s *wHEPHandlerServer) RegisterICERestartTopic(topic string) error {
|
||||
return server.RegisterHandler(s.rpc, "ICERestart", []string{topic}, s.svc.ICERestart, nil)
|
||||
}
|
||||
|
||||
func (s *wHEPHandlerServer) DeregisterICERestartTopic(topic string) {
|
||||
s.rpc.DeregisterHandler("ICERestart", []string{topic})
|
||||
}
|
||||
|
||||
func (s *wHEPHandlerServer) RegisterDeleteWHEPTopic(topic string) error {
|
||||
return server.RegisterHandler(s.rpc, "DeleteWHEP", []string{topic}, s.svc.DeleteWHEP, nil)
|
||||
}
|
||||
|
||||
func (s *wHEPHandlerServer) DeregisterDeleteWHEPTopic(topic string) {
|
||||
s.rpc.DeregisterHandler("DeleteWHEP", []string{topic})
|
||||
}
|
||||
|
||||
func (s *wHEPHandlerServer) allResourceTopicRegisterers() server.RegistererSlice {
|
||||
return server.RegistererSlice{
|
||||
server.NewRegisterer(s.RegisterICETrickleTopic, s.DeregisterICETrickleTopic),
|
||||
server.NewRegisterer(s.RegisterICERestartTopic, s.DeregisterICERestartTopic),
|
||||
server.NewRegisterer(s.RegisterDeleteWHEPTopic, s.DeregisterDeleteWHEPTopic),
|
||||
}
|
||||
}
|
||||
|
||||
func (s *wHEPHandlerServer) RegisterAllResourceTopics(topic string) error {
|
||||
return s.allResourceTopicRegisterers().Register(topic)
|
||||
}
|
||||
|
||||
func (s *wHEPHandlerServer) DeregisterAllResourceTopics(topic string) {
|
||||
s.allResourceTopicRegisterers().Deregister(topic)
|
||||
}
|
||||
|
||||
func (s *wHEPHandlerServer) Shutdown() {
|
||||
s.rpc.Close(false)
|
||||
}
|
||||
|
||||
func (s *wHEPHandlerServer) Kill() {
|
||||
s.rpc.Close(true)
|
||||
}
|
||||
|
||||
var psrpcFileDescriptor9 = []byte{
|
||||
// 464 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x53, 0xc1, 0x6e, 0xd3, 0x40,
|
||||
0x10, 0x95, 0xdb, 0x10, 0xa5, 0x93, 0xb6, 0x6a, 0x56, 0x34, 0x8a, 0x8c, 0x44, 0x83, 0x7b, 0xe1,
|
||||
0xe4, 0xa0, 0xc2, 0x07, 0x20, 0x68, 0x50, 0x22, 0x71, 0x88, 0x42, 0x51, 0x25, 0x2e, 0xd1, 0x66,
|
||||
0x3d, 0x71, 0x57, 0x71, 0x76, 0x97, 0xd9, 0x35, 0x16, 0x9f, 0xd0, 0x0f, 0xe0, 0xc6, 0x57, 0xf4,
|
||||
0x0b, 0x91, 0xed, 0x75, 0x13, 0xb5, 0x88, 0x8a, 0xe3, 0x7b, 0x33, 0xfb, 0xe6, 0xcd, 0xf3, 0x18,
|
||||
0x8e, 0xc9, 0x88, 0x51, 0x71, 0x83, 0x26, 0x36, 0xa4, 0x9d, 0x66, 0xfb, 0x64, 0x44, 0x78, 0xa4,
|
||||
0x8d, 0x93, 0x5a, 0xd9, 0x9a, 0x0b, 0x7b, 0x65, 0x8f, 0x54, 0x29, 0xa1, 0x6d, 0xa8, 0x17, 0xa9,
|
||||
0xd6, 0x69, 0x86, 0xa3, 0x0a, 0x2d, 0xf3, 0xd5, 0x08, 0x37, 0xc6, 0xfd, 0xac, 0x8b, 0x51, 0x01,
|
||||
0x27, 0x5f, 0x1c, 0x27, 0x77, 0x3d, 0x19, 0xcf, 0xe6, 0xf8, 0x3d, 0x47, 0xeb, 0xd8, 0x73, 0x78,
|
||||
0xe6, 0xf4, 0x1a, 0xd5, 0x20, 0x18, 0x06, 0xaf, 0x0f, 0xe6, 0x35, 0x60, 0xa7, 0xd0, 0x2e, 0xec,
|
||||
0x22, 0xa7, 0x6c, 0xb0, 0x57, 0xd3, 0x85, 0xfd, 0x4a, 0x19, 0x1b, 0x42, 0xd7, 0x70, 0x72, 0x52,
|
||||
0x48, 0xc3, 0x95, 0x1b, 0xec, 0x57, 0xb5, 0x5d, 0xaa, 0x94, 0xd3, 0xab, 0x15, 0xd2, 0xa0, 0x55,
|
||||
0xbf, 0xab, 0x40, 0xf4, 0x19, 0x7a, 0x3b, 0x83, 0xad, 0xd1, 0xca, 0x22, 0x3b, 0x83, 0x2e, 0xa1,
|
||||
0xd5, 0x39, 0x09, 0x5c, 0xc8, 0xc4, 0xcf, 0x87, 0x86, 0x9a, 0x26, 0xac, 0x0f, 0x6d, 0xae, 0x6c,
|
||||
0x81, 0xe4, 0x4d, 0x78, 0x14, 0xfd, 0x0a, 0xa0, 0x37, 0xfd, 0x38, 0xbe, 0x22, 0x29, 0xd6, 0x19,
|
||||
0x36, 0x8b, 0x3c, 0x29, 0x77, 0x0e, 0x47, 0xb9, 0x45, 0x5a, 0xac, 0x88, 0xa7, 0x1b, 0x54, 0xce,
|
||||
0xab, 0x1e, 0x96, 0xe4, 0x27, 0xcf, 0xb1, 0x10, 0x3a, 0x86, 0x5b, 0x5b, 0x68, 0x4a, 0xfc, 0x7a,
|
||||
0xf7, 0x98, 0xbd, 0x04, 0x10, 0x5c, 0x25, 0x32, 0xe1, 0x0e, 0xed, 0xa0, 0x35, 0xdc, 0x2f, 0x07,
|
||||
0x6c, 0x99, 0xe8, 0x1d, 0xf4, 0x2e, 0x31, 0x43, 0x87, 0xbb, 0xf9, 0x3e, 0x65, 0xeb, 0xe2, 0x0a,
|
||||
0x0e, 0xcb, 0xfe, 0xa9, 0x72, 0x48, 0x8a, 0x67, 0xec, 0x12, 0x0e, 0xee, 0xb3, 0x62, 0xa7, 0x31,
|
||||
0x19, 0x11, 0x3f, 0xfc, 0x68, 0x61, 0xff, 0x21, 0x5d, 0x47, 0x1a, 0x75, 0xee, 0x6e, 0x83, 0xd6,
|
||||
0xfb, 0xe0, 0x4d, 0x70, 0xf1, 0x7b, 0x0f, 0xba, 0x65, 0x69, 0xc2, 0x55, 0x92, 0x21, 0xb1, 0x19,
|
||||
0xc0, 0x36, 0x32, 0x56, 0xbf, 0x7f, 0x94, 0x61, 0xd8, 0x8f, 0xeb, 0xf3, 0x89, 0x9b, 0xf3, 0x89,
|
||||
0xc7, 0xe5, 0xf9, 0x44, 0xec, 0xee, 0x36, 0x38, 0x3e, 0x09, 0x42, 0x80, 0xce, 0xdc, 0x3b, 0x67,
|
||||
0xb2, 0x52, 0x9c, 0xa3, 0x2d, 0x5d, 0xb0, 0xa8, 0x51, 0xf4, 0xc4, 0xf5, 0x64, 0x3a, 0x6b, 0x5a,
|
||||
0x1b, 0xf5, 0xf3, 0x7f, 0xf6, 0xf8, 0x15, 0xfe, 0x36, 0x6a, 0x06, 0xb0, 0x0d, 0xd6, 0x9b, 0x7f,
|
||||
0x94, 0xf4, 0xff, 0x98, 0xff, 0xf0, 0xea, 0xdb, 0x59, 0x2a, 0xdd, 0x4d, 0xbe, 0x8c, 0x85, 0xde,
|
||||
0x8c, 0x32, 0xf9, 0x03, 0xd7, 0xd2, 0xd5, 0x3f, 0x8d, 0xd0, 0xd9, 0x88, 0x8c, 0x58, 0xb6, 0x2b,
|
||||
0xf4, 0xf6, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x2f, 0x23, 0xe5, 0x3f, 0x89, 0x03, 0x00, 0x00,
|
||||
}
|
||||
45
rpc/whep_client.go
Normal file
45
rpc/whep_client.go
Normal file
@@ -0,0 +1,45 @@
|
||||
// Copyright 2023 LiveKit, Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package rpc
|
||||
|
||||
type WHEPClient interface {
|
||||
WHEPInternalClient
|
||||
WHEPHandlerClient
|
||||
}
|
||||
|
||||
type whepClient struct {
|
||||
WHEPInternalClient
|
||||
WHEPHandlerClient
|
||||
}
|
||||
|
||||
func NewWHEPClient(params ClientParams) (WHEPClient, error) {
|
||||
if params.Bus == nil {
|
||||
return nil, nil
|
||||
}
|
||||
opts := params.Options()
|
||||
|
||||
internalClient, err := NewWHEPInternalClient(params.Bus, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
handlerClient, err := NewWHEPHandlerClient(params.Bus, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &whepClient{
|
||||
WHEPInternalClient: internalClient,
|
||||
WHEPHandlerClient: handlerClient,
|
||||
}, nil
|
||||
}
|
||||
29
sdp/sdp.go
29
sdp/sdp.go
@@ -149,3 +149,32 @@ func ExtractStreamID(media *sdp.MediaDescription) (string, bool) {
|
||||
}
|
||||
return streamID, true
|
||||
}
|
||||
|
||||
func ReplaceICEDetails(inSdp, ufrag, pwd string) (string, error) {
|
||||
var parsed sdp.SessionDescription
|
||||
replaceAttributes := func(attributes []sdp.Attribute) {
|
||||
for i := range attributes {
|
||||
if attributes[i].Key == "ice-ufrag" {
|
||||
attributes[i].Value = ufrag
|
||||
} else if attributes[i].Key == "ice-pwd" {
|
||||
attributes[i].Value = pwd
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if err := parsed.UnmarshalString(inSdp); err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
replaceAttributes(parsed.Attributes)
|
||||
for _, m := range parsed.MediaDescriptions {
|
||||
replaceAttributes(m.Attributes)
|
||||
}
|
||||
|
||||
replacedSdp, err := parsed.Marshal()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(replacedSdp), nil
|
||||
}
|
||||
|
||||
@@ -46,7 +46,8 @@ const (
|
||||
SIPDispatchRulePrefix = "SDR_"
|
||||
SIPCallPrefix = "SCL_"
|
||||
RPCPrefix = "RPC_"
|
||||
WHIPResourcePrefix = "WH_"
|
||||
WHIPResourcePrefix = "WHIP_"
|
||||
WHEPResourcePrefix = "WHEP_"
|
||||
RTMPResourcePrefix = "RT_"
|
||||
URLResourcePrefix = "UR_"
|
||||
AgentWorkerPrefix = "AW_"
|
||||
|
||||
@@ -36,6 +36,7 @@ const (
|
||||
SIPCallPrefix = guid.SIPCallPrefix
|
||||
RPCPrefix = guid.RPCPrefix
|
||||
WHIPResourcePrefix = guid.WHIPResourcePrefix
|
||||
WHEPResourcePrefix = guid.WHEPResourcePrefix
|
||||
RTMPResourcePrefix = guid.RTMPResourcePrefix
|
||||
URLResourcePrefix = guid.URLResourcePrefix
|
||||
AgentWorkerPrefix = guid.AgentWorkerPrefix
|
||||
|
||||
Reference in New Issue
Block a user