update protocol (#2760)

* update protocol

* deps
This commit is contained in:
Paul Wells
2024-06-05 19:46:34 -07:00
committed by GitHub
parent d3f9e8b8e5
commit f1886ece42
22 changed files with 53 additions and 38 deletions
+2 -1
View File
@@ -28,6 +28,7 @@ import (
"github.com/livekit/protocol/auth" "github.com/livekit/protocol/auth"
"github.com/livekit/protocol/utils" "github.com/livekit/protocol/utils"
"github.com/livekit/protocol/utils/guid"
"github.com/livekit/livekit-server/pkg/config" "github.com/livekit/livekit-server/pkg/config"
"github.com/livekit/livekit-server/pkg/routing" "github.com/livekit/livekit-server/pkg/routing"
@@ -35,7 +36,7 @@ import (
) )
func generateKeys(_ *cli.Context) error { func generateKeys(_ *cli.Context) error {
apiKey := utils.NewGuid(utils.APIKeyPrefix) apiKey := guid.New(utils.APIKeyPrefix)
secret := utils.RandomSecret() secret := utils.RandomSecret()
fmt.Println("API Key: ", apiKey) fmt.Println("API Key: ", apiKey)
fmt.Println("API Secret: ", secret) fmt.Println("API Secret: ", secret)
+1 -1
View File
@@ -20,7 +20,7 @@ require (
github.com/jxskiss/base62 v1.1.0 github.com/jxskiss/base62 v1.1.0
github.com/livekit/mageutil v0.0.0-20230125210925-54e8a70427c1 github.com/livekit/mageutil v0.0.0-20230125210925-54e8a70427c1
github.com/livekit/mediatransportutil v0.0.0-20240501132628-6105557bbb9a github.com/livekit/mediatransportutil v0.0.0-20240501132628-6105557bbb9a
github.com/livekit/protocol v1.17.0 github.com/livekit/protocol v1.17.1-0.20240606023900-429fec77a69b
github.com/livekit/psrpc v0.5.3-0.20240526192918-fbdaf10e6aa5 github.com/livekit/psrpc v0.5.3-0.20240526192918-fbdaf10e6aa5
github.com/mackerelio/go-osstat v0.2.4 github.com/mackerelio/go-osstat v0.2.4
github.com/magefile/mage v1.15.0 github.com/magefile/mage v1.15.0
+2 -2
View File
@@ -120,8 +120,8 @@ github.com/livekit/mageutil v0.0.0-20230125210925-54e8a70427c1 h1:jm09419p0lqTkD
github.com/livekit/mageutil v0.0.0-20230125210925-54e8a70427c1/go.mod h1:Rs3MhFwutWhGwmY1VQsygw28z5bWcnEYmS1OG9OxjOQ= github.com/livekit/mageutil v0.0.0-20230125210925-54e8a70427c1/go.mod h1:Rs3MhFwutWhGwmY1VQsygw28z5bWcnEYmS1OG9OxjOQ=
github.com/livekit/mediatransportutil v0.0.0-20240501132628-6105557bbb9a h1:ATbv0x7G5tW2HgiouQ57csFE/G4gekl2oV1cxb2Dy24= github.com/livekit/mediatransportutil v0.0.0-20240501132628-6105557bbb9a h1:ATbv0x7G5tW2HgiouQ57csFE/G4gekl2oV1cxb2Dy24=
github.com/livekit/mediatransportutil v0.0.0-20240501132628-6105557bbb9a/go.mod h1:jwKUCmObuiEDH0iiuJHaGMXwRs3RjrB4G6qqgkr/5oE= github.com/livekit/mediatransportutil v0.0.0-20240501132628-6105557bbb9a/go.mod h1:jwKUCmObuiEDH0iiuJHaGMXwRs3RjrB4G6qqgkr/5oE=
github.com/livekit/protocol v1.17.0 h1:E8t9kssblb1MVEYTPF0R65lFqN4pEr4SOcnlbcI3ehc= github.com/livekit/protocol v1.17.1-0.20240606023900-429fec77a69b h1:VZMvqc23x/dXRpJQLc6CIkCuLUjev0HDLFO9NCEqfOk=
github.com/livekit/protocol v1.17.0/go.mod h1:cN8WmGQR+kWz1+UWcAQdFFUcbW76PnfZDdkLAbYIqd4= github.com/livekit/protocol v1.17.1-0.20240606023900-429fec77a69b/go.mod h1:cN8WmGQR+kWz1+UWcAQdFFUcbW76PnfZDdkLAbYIqd4=
github.com/livekit/psrpc v0.5.3-0.20240526192918-fbdaf10e6aa5 h1:mTZyrjk5WEWMsvaYtJ42pG7DuxysKj21DKPINpGSIto= github.com/livekit/psrpc v0.5.3-0.20240526192918-fbdaf10e6aa5 h1:mTZyrjk5WEWMsvaYtJ42pG7DuxysKj21DKPINpGSIto=
github.com/livekit/psrpc v0.5.3-0.20240526192918-fbdaf10e6aa5/go.mod h1:CQUBSPfYYAaevg1TNCc6/aYsa8DJH4jSRFdCeSZk5u0= github.com/livekit/psrpc v0.5.3-0.20240526192918-fbdaf10e6aa5/go.mod h1:CQUBSPfYYAaevg1TNCc6/aYsa8DJH4jSRFdCeSZk5u0=
github.com/mackerelio/go-osstat v0.2.4 h1:qxGbdPkFo65PXOb/F/nhDKpF2nGmGaCFDLXoZjJTtUs= github.com/mackerelio/go-osstat v0.2.4 h1:qxGbdPkFo65PXOb/F/nhDKpF2nGmGaCFDLXoZjJTtUs=
+2 -1
View File
@@ -27,6 +27,7 @@ import (
"github.com/livekit/protocol/logger" "github.com/livekit/protocol/logger"
"github.com/livekit/protocol/rpc" "github.com/livekit/protocol/rpc"
"github.com/livekit/protocol/utils" "github.com/livekit/protocol/utils"
"github.com/livekit/protocol/utils/guid"
"github.com/livekit/psrpc" "github.com/livekit/psrpc"
) )
@@ -121,7 +122,7 @@ func (c *agentClient) LaunchJob(ctx context.Context, desc *JobDescription) {
target.ForEach(func(ns string) { target.ForEach(func(ns string) {
c.workers.Submit(func() { c.workers.Submit(func() {
_, err := c.client.JobRequest(ctx, ns, jobTypeTopic, &livekit.Job{ _, err := c.client.JobRequest(ctx, ns, jobTypeTopic, &livekit.Job{
Id: utils.NewGuid(utils.AgentJobPrefix), Id: guid.New(utils.AgentJobPrefix),
Type: desc.JobType, Type: desc.JobType,
Room: desc.Room, Room: desc.Room,
Participant: desc.Participant, Participant: desc.Participant,
+2 -1
View File
@@ -28,6 +28,7 @@ import (
"github.com/livekit/protocol/logger" "github.com/livekit/protocol/logger"
"github.com/livekit/protocol/utils" "github.com/livekit/protocol/utils"
putil "github.com/livekit/protocol/utils" putil "github.com/livekit/protocol/utils"
"github.com/livekit/protocol/utils/guid"
) )
type WorkerProtocolVersion int type WorkerProtocolVersion int
@@ -353,7 +354,7 @@ func (w *Worker) handleSimulateJob(simulate *livekit.SimulateJobRequest) {
} }
job := &livekit.Job{ job := &livekit.Job{
Id: utils.NewGuid(utils.AgentJobPrefix), Id: guid.New(utils.AgentJobPrefix),
Type: jobType, Type: jobType,
Room: simulate.Room, Room: simulate.Room,
Participant: simulate.Participant, Participant: simulate.Participant,
+2 -1
View File
@@ -20,6 +20,7 @@ import (
"github.com/livekit/protocol/livekit" "github.com/livekit/protocol/livekit"
"github.com/livekit/protocol/utils" "github.com/livekit/protocol/utils"
"github.com/livekit/protocol/utils/guid"
"github.com/livekit/livekit-server/pkg/config" "github.com/livekit/livekit-server/pkg/config"
) )
@@ -27,7 +28,7 @@ import (
type LocalNode *livekit.Node type LocalNode *livekit.Node
func NewLocalNode(conf *config.Config) (LocalNode, error) { func NewLocalNode(conf *config.Config) (LocalNode, error) {
nodeID := utils.NewGuid(utils.NodePrefix) nodeID := guid.New(utils.NodePrefix)
if conf.RTC.NodeIP == "" { if conf.RTC.NodeIP == "" {
return nil, ErrIPNotSet return nil, ErrIPNotSet
} }
+2 -1
View File
@@ -22,6 +22,7 @@ import (
"github.com/livekit/protocol/livekit" "github.com/livekit/protocol/livekit"
"github.com/livekit/protocol/utils" "github.com/livekit/protocol/utils"
"github.com/livekit/protocol/utils/guid"
"github.com/livekit/livekit-server/pkg/config" "github.com/livekit/livekit-server/pkg/config"
"github.com/livekit/livekit-server/pkg/routing/selector" "github.com/livekit/livekit-server/pkg/routing/selector"
@@ -152,7 +153,7 @@ func newTestNodeInRegion(region string, available bool) *livekit.Node {
load = 1.0 load = 1.0
} }
return &livekit.Node{ return &livekit.Node{
Id: utils.NewGuid(utils.NodePrefix), Id: guid.New(utils.NodePrefix),
Region: region, Region: region,
State: livekit.NodeState_SERVING, State: livekit.NodeState_SERVING,
Stats: &livekit.NodeStats{ Stats: &livekit.NodeStats{
+2 -2
View File
@@ -28,7 +28,7 @@ import (
"github.com/livekit/protocol/livekit" "github.com/livekit/protocol/livekit"
"github.com/livekit/protocol/logger" "github.com/livekit/protocol/logger"
"github.com/livekit/protocol/rpc" "github.com/livekit/protocol/rpc"
"github.com/livekit/protocol/utils" "github.com/livekit/protocol/utils/guid"
"github.com/livekit/psrpc" "github.com/livekit/psrpc"
"github.com/livekit/psrpc/pkg/middleware" "github.com/livekit/psrpc/pkg/middleware"
) )
@@ -84,7 +84,7 @@ func (r *signalClient) StartParticipantSignal(
resSource MessageSource, resSource MessageSource,
err error, err error,
) { ) {
connectionID = livekit.ConnectionID(utils.NewGuid("CO_")) connectionID = livekit.ConnectionID(guid.New("CO_"))
ss, err := pi.ToStartSession(roomName, connectionID) ss, err := pi.ToStartSession(roomName, connectionID)
if err != nil { if err != nil {
return return
+2 -1
View File
@@ -38,6 +38,7 @@ import (
"github.com/livekit/protocol/livekit" "github.com/livekit/protocol/livekit"
"github.com/livekit/protocol/logger" "github.com/livekit/protocol/logger"
"github.com/livekit/protocol/utils" "github.com/livekit/protocol/utils"
"github.com/livekit/protocol/utils/guid"
"github.com/livekit/livekit-server/pkg/config" "github.com/livekit/livekit-server/pkg/config"
"github.com/livekit/livekit-server/pkg/routing" "github.com/livekit/livekit-server/pkg/routing"
@@ -2297,7 +2298,7 @@ func (p *ParticipantImpl) setStableTrackID(cid string, info *livekit.TrackInfo)
case livekit.TrackSource_SCREEN_SHARE_AUDIO: case livekit.TrackSource_SCREEN_SHARE_AUDIO:
trackPrefix += "s" trackPrefix += "s"
} }
trackID = utils.NewGuid(trackPrefix) trackID = guid.New(trackPrefix)
} }
info.Sid = trackID info.Sid = trackID
} }
+2 -1
View File
@@ -31,6 +31,7 @@ import (
"github.com/livekit/protocol/livekit" "github.com/livekit/protocol/livekit"
"github.com/livekit/protocol/logger" "github.com/livekit/protocol/logger"
"github.com/livekit/protocol/utils" "github.com/livekit/protocol/utils"
"github.com/livekit/protocol/utils/guid"
"github.com/livekit/livekit-server/pkg/config" "github.com/livekit/livekit-server/pkg/config"
"github.com/livekit/livekit-server/pkg/routing" "github.com/livekit/livekit-server/pkg/routing"
@@ -749,7 +750,7 @@ func newParticipantForTestWithOpts(identity livekit.ParticipantIdentity, opts *p
FmtpLine: c.FmtpLine, FmtpLine: c.FmtpLine,
}) })
} }
sid := livekit.ParticipantID(utils.NewGuid(utils.ParticipantPrefix)) sid := livekit.ParticipantID(guid.New(utils.ParticipantPrefix))
p, _ := NewParticipant(ParticipantParams{ p, _ := NewParticipant(ParticipantParams{
SID: sid, SID: sid,
Identity: identity, Identity: identity,
+3 -2
View File
@@ -18,6 +18,7 @@ import (
"github.com/livekit/protocol/livekit" "github.com/livekit/protocol/livekit"
"github.com/livekit/protocol/logger" "github.com/livekit/protocol/logger"
"github.com/livekit/protocol/utils" "github.com/livekit/protocol/utils"
"github.com/livekit/protocol/utils/guid"
"github.com/livekit/livekit-server/pkg/rtc/types" "github.com/livekit/livekit-server/pkg/rtc/types"
"github.com/livekit/livekit-server/pkg/rtc/types/typesfakes" "github.com/livekit/livekit-server/pkg/rtc/types/typesfakes"
@@ -25,7 +26,7 @@ import (
func NewMockParticipant(identity livekit.ParticipantIdentity, protocol types.ProtocolVersion, hidden bool, publisher bool) *typesfakes.FakeLocalParticipant { func NewMockParticipant(identity livekit.ParticipantIdentity, protocol types.ProtocolVersion, hidden bool, publisher bool) *typesfakes.FakeLocalParticipant {
p := &typesfakes.FakeLocalParticipant{} p := &typesfakes.FakeLocalParticipant{}
sid := utils.NewGuid(utils.ParticipantPrefix) sid := guid.New(utils.ParticipantPrefix)
p.IDReturns(livekit.ParticipantID(sid)) p.IDReturns(livekit.ParticipantID(sid))
p.IdentityReturns(identity) p.IdentityReturns(identity)
p.StateReturns(livekit.ParticipantInfo_JOINED) p.StateReturns(livekit.ParticipantInfo_JOINED)
@@ -80,7 +81,7 @@ func NewMockParticipant(identity livekit.ParticipantIdentity, protocol types.Pro
func NewMockTrack(kind livekit.TrackType, name string) *typesfakes.FakeMediaTrack { func NewMockTrack(kind livekit.TrackType, name string) *typesfakes.FakeMediaTrack {
t := &typesfakes.FakeMediaTrack{} t := &typesfakes.FakeMediaTrack{}
t.IDReturns(livekit.TrackID(utils.NewGuid(utils.TrackPrefix))) t.IDReturns(livekit.TrackID(guid.New(utils.TrackPrefix)))
t.KindReturns(kind) t.KindReturns(kind)
t.NameReturns(name) t.NameReturns(name)
t.ToProtoReturns(&livekit.TrackInfo{ t.ToProtoReturns(&livekit.TrackInfo{
+2 -1
View File
@@ -24,6 +24,7 @@ import (
"github.com/livekit/protocol/logger" "github.com/livekit/protocol/logger"
"github.com/livekit/protocol/rpc" "github.com/livekit/protocol/rpc"
"github.com/livekit/protocol/utils" "github.com/livekit/protocol/utils"
"github.com/livekit/protocol/utils/guid"
) )
//go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 -generate //go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 -generate
@@ -73,7 +74,7 @@ func (s *egressLauncher) StartEgressWithClusterId(ctx context.Context, clusterId
// Ensure we have an Egress ID // Ensure we have an Egress ID
if req.EgressId == "" { if req.EgressId == "" {
req.EgressId = utils.NewGuid(utils.EgressPrefix) req.EgressId = guid.New(utils.EgressPrefix)
} }
return s.client.StartEgress(ctx, clusterId, req) return s.client.StartEgress(ctx, clusterId, req)
+3 -2
View File
@@ -26,6 +26,7 @@ import (
"github.com/livekit/protocol/logger" "github.com/livekit/protocol/logger"
"github.com/livekit/protocol/rpc" "github.com/livekit/protocol/rpc"
"github.com/livekit/protocol/utils" "github.com/livekit/protocol/utils"
"github.com/livekit/protocol/utils/guid"
"github.com/livekit/psrpc" "github.com/livekit/psrpc"
) )
@@ -145,11 +146,11 @@ func (s *IngressService) CreateIngressWithUrl(ctx context.Context, urlStr string
var sk string var sk string
if req.InputType != livekit.IngressInput_URL_INPUT { if req.InputType != livekit.IngressInput_URL_INPUT {
sk = utils.NewGuid("") sk = guid.New("")
} }
info := &livekit.IngressInfo{ info := &livekit.IngressInfo{
IngressId: utils.NewGuid(utils.IngressPrefix), IngressId: guid.New(utils.IngressPrefix),
Name: req.Name, Name: req.Name,
StreamKey: sk, StreamKey: sk,
Url: urlStr, Url: urlStr,
+2 -2
View File
@@ -29,7 +29,7 @@ import (
"github.com/livekit/protocol/ingress" "github.com/livekit/protocol/ingress"
"github.com/livekit/protocol/livekit" "github.com/livekit/protocol/livekit"
"github.com/livekit/protocol/logger" "github.com/livekit/protocol/logger"
"github.com/livekit/protocol/utils" "github.com/livekit/protocol/utils/guid"
"github.com/livekit/livekit-server/version" "github.com/livekit/livekit-server/version"
) )
@@ -240,7 +240,7 @@ func (s *RedisStore) DeleteRoom(ctx context.Context, roomName livekit.RoomName)
} }
func (s *RedisStore) LockRoom(_ context.Context, roomName livekit.RoomName, duration time.Duration) (string, error) { func (s *RedisStore) LockRoom(_ context.Context, roomName livekit.RoomName, duration time.Duration) (string, error) {
token := utils.NewGuid("LOCK") token := guid.New("LOCK")
key := RoomLockPrefix + string(roomName) key := RoomLockPrefix + string(roomName)
startTime := time.Now() startTime := time.Now()
+5 -4
View File
@@ -26,6 +26,7 @@ import (
"github.com/livekit/protocol/ingress" "github.com/livekit/protocol/ingress"
"github.com/livekit/protocol/livekit" "github.com/livekit/protocol/livekit"
"github.com/livekit/protocol/utils" "github.com/livekit/protocol/utils"
"github.com/livekit/protocol/utils/guid"
"github.com/livekit/livekit-server/pkg/service" "github.com/livekit/livekit-server/pkg/service"
) )
@@ -164,8 +165,8 @@ func TestEgressStore(t *testing.T) {
// store egress info // store egress info
info := &livekit.EgressInfo{ info := &livekit.EgressInfo{
EgressId: utils.NewGuid(utils.EgressPrefix), EgressId: guid.New(utils.EgressPrefix),
RoomId: utils.NewGuid(utils.RoomPrefix), RoomId: guid.New(utils.RoomPrefix),
RoomName: roomName, RoomName: roomName,
Status: livekit.EgressStatus_EGRESS_STARTING, Status: livekit.EgressStatus_EGRESS_STARTING,
Request: &livekit.EgressInfo_RoomComposite{ Request: &livekit.EgressInfo_RoomComposite{
@@ -184,8 +185,8 @@ func TestEgressStore(t *testing.T) {
// store another // store another
info2 := &livekit.EgressInfo{ info2 := &livekit.EgressInfo{
EgressId: utils.NewGuid(utils.EgressPrefix), EgressId: guid.New(utils.EgressPrefix),
RoomId: utils.NewGuid(utils.RoomPrefix), RoomId: guid.New(utils.RoomPrefix),
RoomName: "another-egress-test", RoomName: "another-egress-test",
Status: livekit.EgressStatus_EGRESS_STARTING, Status: livekit.EgressStatus_EGRESS_STARTING,
Request: &livekit.EgressInfo_RoomComposite{ Request: &livekit.EgressInfo_RoomComposite{
+2 -1
View File
@@ -22,6 +22,7 @@ import (
"github.com/livekit/protocol/livekit" "github.com/livekit/protocol/livekit"
"github.com/livekit/protocol/logger" "github.com/livekit/protocol/logger"
"github.com/livekit/protocol/utils" "github.com/livekit/protocol/utils"
"github.com/livekit/protocol/utils/guid"
"github.com/livekit/livekit-server/pkg/config" "github.com/livekit/livekit-server/pkg/config"
"github.com/livekit/livekit-server/pkg/routing" "github.com/livekit/livekit-server/pkg/routing"
@@ -66,7 +67,7 @@ func (r *StandardRoomAllocator) CreateRoom(ctx context.Context, req *livekit.Cre
if errors.Is(err, ErrRoomNotFound) { if errors.Is(err, ErrRoomNotFound) {
created = true created = true
rm = &livekit.Room{ rm = &livekit.Room{
Sid: utils.NewGuid(utils.RoomPrefix), Sid: guid.New(utils.RoomPrefix),
Name: req.Name, Name: req.Name,
CreationTime: time.Now().Unix(), CreationTime: time.Now().Unix(),
TurnPassword: utils.RandomSecret(), TurnPassword: utils.RandomSecret(),
+2 -1
View File
@@ -33,6 +33,7 @@ import (
"github.com/livekit/protocol/logger" "github.com/livekit/protocol/logger"
"github.com/livekit/protocol/rpc" "github.com/livekit/protocol/rpc"
"github.com/livekit/protocol/utils" "github.com/livekit/protocol/utils"
"github.com/livekit/protocol/utils/guid"
"github.com/livekit/protocol/utils/must" "github.com/livekit/protocol/utils/must"
"github.com/livekit/psrpc" "github.com/livekit/psrpc"
@@ -378,7 +379,7 @@ func (r *RoomManager) StartSession(
pv := types.ProtocolVersion(pi.Client.Protocol) pv := types.ProtocolVersion(pi.Client.Protocol)
rtcConf := *r.rtcConfig rtcConf := *r.rtcConfig
rtcConf.SetBufferFactory(room.GetBufferFactory()) rtcConf.SetBufferFactory(room.GetBufferFactory())
sid := livekit.ParticipantID(utils.NewGuid(utils.ParticipantPrefix)) sid := livekit.ParticipantID(guid.New(utils.ParticipantPrefix))
pLogger := rtc.LoggerWithParticipant( pLogger := rtc.LoggerWithParticipant(
rtc.LoggerWithRoom(logger.GetLogger(), room.Name(), room.ID()), rtc.LoggerWithRoom(logger.GetLogger(), room.Name(), room.ID()),
pi.Identity, pi.Identity,
+3 -2
View File
@@ -24,6 +24,7 @@ import (
"github.com/livekit/protocol/rpc" "github.com/livekit/protocol/rpc"
"github.com/livekit/protocol/sip" "github.com/livekit/protocol/sip"
"github.com/livekit/protocol/utils" "github.com/livekit/protocol/utils"
"github.com/livekit/protocol/utils/guid"
"github.com/livekit/psrpc" "github.com/livekit/psrpc"
"github.com/livekit/livekit-server/pkg/config" "github.com/livekit/livekit-server/pkg/config"
@@ -91,7 +92,7 @@ func (s *SIPService) CreateSIPTrunk(ctx context.Context, req *livekit.CreateSIPT
} }
// Now we can generate ID and store. // Now we can generate ID and store.
info.SipTrunkId = utils.NewGuid(utils.SIPTrunkPrefix) info.SipTrunkId = guid.New(utils.SIPTrunkPrefix)
if err := s.store.StoreSIPTrunk(ctx, info); err != nil { if err := s.store.StoreSIPTrunk(ctx, info); err != nil {
return nil, err return nil, err
} }
@@ -153,7 +154,7 @@ func (s *SIPService) CreateSIPDispatchRule(ctx context.Context, req *livekit.Cre
} }
// Now we can generate ID and store. // Now we can generate ID and store.
info.SipDispatchRuleId = utils.NewGuid(utils.SIPDispatchRulePrefix) info.SipDispatchRuleId = guid.New(utils.SIPDispatchRulePrefix)
if err := s.store.StoreSIPDispatchRule(ctx, info); err != nil { if err := s.store.StoreSIPDispatchRule(ctx, info); err != nil {
return nil, err return nil, err
} }
+4 -3
View File
@@ -21,6 +21,7 @@ import (
"google.golang.org/protobuf/types/known/timestamppb" "google.golang.org/protobuf/types/known/timestamppb"
"github.com/livekit/protocol/livekit" "github.com/livekit/protocol/livekit"
"github.com/livekit/protocol/livekit/rpc"
"github.com/livekit/protocol/logger" "github.com/livekit/protocol/logger"
"github.com/livekit/livekit-server/pkg/config" "github.com/livekit/livekit-server/pkg/config"
@@ -39,9 +40,9 @@ type analyticsService struct {
nodeID string nodeID string
sequenceNumber atomic.Uint64 sequenceNumber atomic.Uint64
events livekit.AnalyticsRecorderService_IngestEventsClient events rpc.AnalyticsRecorderService_IngestEventsClient
stats livekit.AnalyticsRecorderService_IngestStatsClient stats rpc.AnalyticsRecorderService_IngestStatsClient
nodeRooms livekit.AnalyticsRecorderService_IngestNodeRoomStatesClient nodeRooms rpc.AnalyticsRecorderService_IngestNodeRoomStatesClient
} }
func NewAnalyticsService(_ *config.Config, currentNode routing.LocalNode) AnalyticsService { func NewAnalyticsService(_ *config.Config, currentNode routing.LocalNode) AnalyticsService {
+2 -2
View File
@@ -23,7 +23,7 @@ import (
"github.com/livekit/livekit-server/pkg/telemetry/prometheus" "github.com/livekit/livekit-server/pkg/telemetry/prometheus"
"github.com/livekit/protocol/livekit" "github.com/livekit/protocol/livekit"
"github.com/livekit/protocol/logger" "github.com/livekit/protocol/logger"
"github.com/livekit/protocol/utils" "github.com/livekit/protocol/utils/guid"
"github.com/livekit/protocol/webhook" "github.com/livekit/protocol/webhook"
) )
@@ -33,7 +33,7 @@ func (t *telemetryService) NotifyEvent(ctx context.Context, event *livekit.Webho
} }
event.CreatedAt = time.Now().Unix() event.CreatedAt = time.Now().Unix()
event.Id = utils.NewGuid("EV_") event.Id = guid.New("EV_")
if err := t.notifier.QueueNotify(ctx, event); err != nil { if err := t.notifier.QueueNotify(ctx, event); err != nil {
logger.Warnw("failed to notify webhook", err, "event", event.Event) logger.Warnw("failed to notify webhook", err, "event", event.Event)
+4 -4
View File
@@ -35,7 +35,7 @@ import (
"github.com/livekit/protocol/auth" "github.com/livekit/protocol/auth"
"github.com/livekit/protocol/livekit" "github.com/livekit/protocol/livekit"
"github.com/livekit/protocol/logger" "github.com/livekit/protocol/logger"
"github.com/livekit/protocol/utils" "github.com/livekit/protocol/utils/guid"
) )
const ( const (
@@ -80,8 +80,8 @@ func setupSingleNodeTest(name string) (*service.LivekitServer, func()) {
func setupMultiNodeTest(name string) (*service.LivekitServer, *service.LivekitServer, func()) { func setupMultiNodeTest(name string) (*service.LivekitServer, *service.LivekitServer, func()) {
logger.Infow("----------------STARTING TEST----------------", "test", name) logger.Infow("----------------STARTING TEST----------------", "test", name)
s1 := createMultiNodeServer(utils.NewGuid(nodeID1), defaultServerPort) s1 := createMultiNodeServer(guid.New(nodeID1), defaultServerPort)
s2 := createMultiNodeServer(utils.NewGuid(nodeID2), secondServerPort) s2 := createMultiNodeServer(guid.New(nodeID2), secondServerPort)
go s1.Start() go s1.Start()
go s2.Start() go s2.Start()
@@ -161,7 +161,7 @@ func createSingleNodeServer(configUpdater func(*config.Config)) *service.Livekit
if err != nil { if err != nil {
panic(fmt.Sprintf("could not create local node: %v", err)) panic(fmt.Sprintf("could not create local node: %v", err))
} }
currentNode.Id = utils.NewGuid(nodeID1) currentNode.Id = guid.New(nodeID1)
s, err := service.InitializeServer(conf, currentNode) s, err := service.InitializeServer(conf, currentNode)
if err != nil { if err != nil {
+2 -2
View File
@@ -30,7 +30,7 @@ import (
"github.com/livekit/protocol/auth" "github.com/livekit/protocol/auth"
"github.com/livekit/protocol/livekit" "github.com/livekit/protocol/livekit"
"github.com/livekit/protocol/logger" "github.com/livekit/protocol/logger"
"github.com/livekit/protocol/utils" "github.com/livekit/protocol/utils/guid"
"github.com/livekit/protocol/webhook" "github.com/livekit/protocol/webhook"
"github.com/livekit/livekit-server/pkg/config" "github.com/livekit/livekit-server/pkg/config"
@@ -137,7 +137,7 @@ func setupServerWithWebhook() (server *service.LivekitServer, testServer *webhoo
if err != nil { if err != nil {
return return
} }
currentNode.Id = utils.NewGuid(nodeID1) currentNode.Id = guid.New(nodeID1)
server, err = service.InitializeServer(conf, currentNode) server, err = service.InitializeServer(conf, currentNode)
if err != nil { if err != nil {