Skip to content

Commit 624ea31

Browse files
Add StreamDestination ids to egress stream outputs (#1873)
* Add StreamDestination ids to egress stream outputs Clients can tag each stream URL with their own id via StreamOutput.destinations or UpdateStreamRequest.add_destinations, and get it back on StreamInfo.id, since redacted URLs and the order of stream_results can't identify a stream. RedactStreamKeys now redacts destination URLs too. * generated protobuf --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 166233b commit 624ea31

6 files changed

Lines changed: 672 additions & 553 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@livekit/protocol": patch
3+
---
4+
5+
`StreamDestination` (`id`, `url`) on `StreamOutput.destinations` and `UpdateStreamRequest.add_destinations`, echoed as `StreamInfo.id`, so a client can tell its streams apart; `RedactStreamKeys` redacts destination URLs

‎egress/redact.go‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,4 +104,9 @@ func RedactStreamKeys(stream *livekit.StreamOutput) {
104104
stream.Urls[i] = redacted
105105
}
106106
}
107+
for _, d := range stream.Destinations {
108+
if redacted, ok := utils.RedactStreamKey(d.Url); ok {
109+
d.Url = redacted
110+
}
111+
}
107112
}

‎egress/redact_test.go‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,11 @@ func TestRedactStreamOutput(t *testing.T) {
112112
"srt://foo.bar.com:9999",
113113
"srt://foo.bar.com:9999?streamid=124939da-5244&passphrase=WnxknzJTUbwYl9SpdqAudX",
114114
},
115+
Destinations: []*livekit.StreamDestination{
116+
{Id: "a", Url: "rtmps://foo.bar.com/app/secret_stream_key"},
117+
{Id: "b", Url: "srt://foo.bar.com:9999?streamid=124939da-5244&passphrase=WnxknzJTUbwYl9SpdqAudX"},
118+
{Id: "c", Url: "srt://foo.bar.com:9999"},
119+
},
115120
}
116121

117122
RedactStreamKeys(so)
@@ -120,6 +125,13 @@ func TestRedactStreamOutput(t *testing.T) {
120125
require.Equal(t, "twitch://{liv...nop}", so.Urls[2])
121126
require.Equal(t, "srt://foo.bar.com:9999", so.Urls[3])
122127
require.Equal(t, "srt://foo.bar.com:9999?streamid={...}&passphrase={...}", so.Urls[4])
128+
129+
require.Equal(t, "rtmps://foo.bar.com/app/{sec...key}", so.Destinations[0].Url)
130+
require.Equal(t, "srt://foo.bar.com:9999?streamid={...}&passphrase={...}", so.Destinations[1].Url)
131+
require.Equal(t, "srt://foo.bar.com:9999", so.Destinations[2].Url)
132+
require.Equal(t, "a", so.Destinations[0].Id)
133+
require.Equal(t, "b", so.Destinations[1].Id)
134+
require.Equal(t, "c", so.Destinations[2].Id)
123135
}
124136

125137
func TestRedactEncodedOutputs(t *testing.T) {

0 commit comments

Comments
 (0)