From 75642c8f1ef73e6e106222624cfc3317454ff2ad Mon Sep 17 00:00:00 2001 From: David Zhao Date: Tue, 22 Oct 2024 10:23:49 -0700 Subject: [PATCH] Update to protocol 1.27 (#547) --- auth.go | 4 ++-- examples/echo/main.go | 2 +- go.mod | 14 +++++++++++++- go.sum | 8 ++++++-- room.go | 2 +- 5 files changed, 23 insertions(+), 7 deletions(-) diff --git a/auth.go b/auth.go index bacfd1ff..ff2ec06c 100644 --- a/auth.go +++ b/auth.go @@ -34,13 +34,13 @@ type authOption interface { type withVideoGrant auth.VideoGrant func (g withVideoGrant) Apply(t *auth.AccessToken) { - t.AddGrant((*auth.VideoGrant)(&g)) + t.SetVideoGrant((*auth.VideoGrant)(&g)) } type withSIPGrant auth.SIPGrant func (g withSIPGrant) Apply(t *auth.AccessToken) { - t.AddSIPGrant((*auth.SIPGrant)(&g)) + t.SetSIPGrant((*auth.SIPGrant)(&g)) } func (b authBase) withAuth(ctx context.Context, opt authOption, options ...authOption) (context.Context, error) { diff --git a/examples/echo/main.go b/examples/echo/main.go index acc0ed86..01c04a8c 100644 --- a/examples/echo/main.go +++ b/examples/echo/main.go @@ -98,7 +98,7 @@ func newAccessToken(apiKey, apiSecret, roomName, pID string) (string, error) { RoomJoin: true, Room: roomName, } - at.AddGrant(grant). + at.SetVideoGrant(grant). SetIdentity(pID). SetName(pID) diff --git a/go.mod b/go.mod index 27efb86f..41cff7d9 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,7 @@ require ( github.com/gorilla/websocket v1.5.2 github.com/livekit/mageutil v0.0.0-20230125210925-54e8a70427c1 github.com/livekit/mediatransportutil v0.0.0-20240730083616-559fa5ece598 - github.com/livekit/protocol v1.23.1-0.20241003084409-2406243b2f49 + github.com/livekit/protocol v1.27.0 github.com/magefile/mage v1.15.0 github.com/pion/dtls/v2 v2.2.12 github.com/pion/interceptor v0.1.30 @@ -27,16 +27,26 @@ require ( require ( buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.33.0-20240401165935-b983156c5e99.1 // indirect github.com/antlr4-go/antlr/v4 v4.13.0 // indirect + github.com/benbjohnson/clock v1.3.5 // indirect github.com/bufbuild/protovalidate-go v0.6.1 // indirect github.com/bufbuild/protoyaml-go v0.1.9 // indirect + github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect + github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect + github.com/frostbyte73/core v0.0.12 // indirect + github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/gammazero/deque v0.2.1 // indirect github.com/go-jose/go-jose/v3 v3.0.3 // indirect github.com/google/cel-go v0.20.1 // indirect github.com/google/uuid v1.6.0 // indirect github.com/jxskiss/base62 v1.1.0 // indirect + github.com/klauspost/compress v1.17.9 // indirect github.com/klauspost/cpuid/v2 v2.2.7 // indirect github.com/lithammer/shortuuid/v4 v4.0.0 // indirect + github.com/livekit/psrpc v0.6.1-0.20240924010758-9f0a4268a3b9 // indirect + github.com/nats-io/nats.go v1.36.0 // indirect + github.com/nats-io/nkeys v0.4.7 // indirect + github.com/nats-io/nuid v1.0.1 // indirect github.com/pion/datachannel v1.5.8 // indirect github.com/pion/ice/v2 v2.3.34 // indirect github.com/pion/logging v0.2.2 // indirect @@ -49,6 +59,7 @@ require ( github.com/pion/turn/v2 v2.1.6 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/puzpuzpuz/xsync/v3 v3.1.0 // indirect + github.com/redis/go-redis/v9 v9.6.1 // indirect github.com/stoewer/go-strcase v1.3.0 // indirect github.com/wlynxg/anet v0.0.3 // indirect github.com/zeebo/xxh3 v1.0.2 // indirect @@ -62,5 +73,6 @@ require ( golang.org/x/text v0.16.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240725223205-93522f1f2a9f // indirect + google.golang.org/grpc v1.65.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index c155371e..937372d3 100644 --- a/go.sum +++ b/go.sum @@ -6,6 +6,10 @@ github.com/benbjohnson/clock v1.3.5 h1:VvXlSJBzZpA/zum6Sj74hxwYI2DIxRWuNIoXAzHZz github.com/benbjohnson/clock v1.3.5/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/bep/debounce v1.2.1 h1:v67fRdBA9UQu2NhLFXrSg0Brw7CexQekrBwDMM8bzeY= github.com/bep/debounce v1.2.1/go.mod h1:H8yggRPQKLUhUoqrJC1bO2xNya7vanpDl7xR3ISbCJ0= +github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs= +github.com/bsm/ginkgo/v2 v2.12.0/go.mod h1:SwYbGRRDovPVboqFv0tPTcG1sN61LM1Z4ARdbAV9g4c= +github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA= +github.com/bsm/gomega v1.27.10/go.mod h1:JyEr/xRbxbtgWNi8tIEVPUYZ5Dzef52k01W3YH0H+O0= github.com/bufbuild/protovalidate-go v0.6.1 h1:uzW8r0CDvqApUChNj87VzZVoQSKhcVdw5UWOE605UIw= github.com/bufbuild/protovalidate-go v0.6.1/go.mod h1:4BR3rKEJiUiTy+sqsusFn2ladOf0kYmA2Reo6BHSBgQ= github.com/bufbuild/protoyaml-go v0.1.9 h1:anV5UtF1Mlvkkgp4NWA6U/zOnJFng8Orq4Vf3ZUQHBU= @@ -63,8 +67,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/mediatransportutil v0.0.0-20240730083616-559fa5ece598 h1:yLlkHk2feSLHstD9n4VKg7YEBR4rLODTI4WE8gNBEnQ= github.com/livekit/mediatransportutil v0.0.0-20240730083616-559fa5ece598/go.mod h1:jwKUCmObuiEDH0iiuJHaGMXwRs3RjrB4G6qqgkr/5oE= -github.com/livekit/protocol v1.23.1-0.20241003084409-2406243b2f49 h1:mk33tsjwZM8czksJbAj+xQfPfjnPo/RcGUYJLLfltOY= -github.com/livekit/protocol v1.23.1-0.20241003084409-2406243b2f49/go.mod h1:nxRzmQBKSYK64gqr7ABWwt78hvrgiO2wYuCojRYb7Gs= +github.com/livekit/protocol v1.27.0 h1:qdZ8S4eH11XbBQxpG4eHh9GZC7weyydngWNvH2NTD+w= +github.com/livekit/protocol v1.27.0/go.mod h1:nxRzmQBKSYK64gqr7ABWwt78hvrgiO2wYuCojRYb7Gs= github.com/livekit/psrpc v0.6.1-0.20240924010758-9f0a4268a3b9 h1:33oBjGpVD9tYkDXQU42tnHl8eCX9G6PVUToBVuCUyOs= github.com/livekit/psrpc v0.6.1-0.20240924010758-9f0a4268a3b9/go.mod h1:CQUBSPfYYAaevg1TNCc6/aYsa8DJH4jSRFdCeSZk5u0= github.com/magefile/mage v1.15.0 h1:BvGheCMAsG3bWUDbZ8AyXXpCNwU9u5CB6sM+HNb9HYg= diff --git a/room.go b/room.go index 1a0ae9a1..30d84988 100644 --- a/room.go +++ b/room.go @@ -265,7 +265,7 @@ func (r *Room) Join(url string, info ConnectInfo, opts ...ConnectOption) error { RoomJoin: true, Room: info.RoomName, } - at.AddGrant(grant). + at.SetVideoGrant(grant). SetIdentity(info.ParticipantIdentity). SetMetadata(info.ParticipantMetadata). SetAttributes(info.ParticipantAttributes).