Skip to content

Commit

Permalink
Adopt redact methods from protocol (#425)
Browse files Browse the repository at this point in the history
  • Loading branch information
biglittlebigben committed Jul 11, 2023
1 parent d575729 commit 2f81637
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 60 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ require (
github.com/gorilla/websocket v1.5.0
github.com/livekit/livekit-server v1.4.4-0.20230612120056-afa773374840
github.com/livekit/mageutil v0.0.0-20230125210925-54e8a70427c1
github.com/livekit/protocol v1.5.9
github.com/livekit/protocol v1.5.10-0.20230711003953-193f7bd19180
github.com/livekit/psrpc v0.3.1
github.com/livekit/server-sdk-go v1.0.14-0.20230710162205-84a425768a90
github.com/pion/rtp v1.7.13
Expand All @@ -33,7 +33,7 @@ require (
go.uber.org/atomic v1.11.0
go.uber.org/zap v1.24.0
google.golang.org/api v0.130.0
google.golang.org/grpc v1.56.1
google.golang.org/grpc v1.56.2
google.golang.org/protobuf v1.31.0
gopkg.in/yaml.v3 v3.0.1
)
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,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-20230612070454-d5299b956135 h1:lWYbsondvqG69czxoACDwaJ/BoyD57BahCo70ZH+m4U=
github.com/livekit/mediatransportutil v0.0.0-20230612070454-d5299b956135/go.mod h1:MRc0zSOSzXuFt0X218SgabzlaKevkvCckPgBEoHYc34=
github.com/livekit/protocol v1.5.9 h1:fqPOLgKkWmkmUMnpfj2KDZlidHgAazAPU2T3FewyLew=
github.com/livekit/protocol v1.5.9/go.mod h1:GMTlFbc0JypUGo+PMilDrL45AX+yUBiQ1Cl/FGZibDY=
github.com/livekit/protocol v1.5.10-0.20230711003953-193f7bd19180 h1:gexr11azmmaop/D3oMCcqqibuekDq2udxhrZaRdWfqQ=
github.com/livekit/protocol v1.5.10-0.20230711003953-193f7bd19180/go.mod h1:zqhhOl9Cw8R6lVR58DsYryjP1WqA/iPWItamJnnYy8M=
github.com/livekit/psrpc v0.3.1 h1:KfylgJHvoLQcc22t/oflwMOeSnx0c14G7cWsS+9MYS4=
github.com/livekit/psrpc v0.3.1/go.mod h1:n6JntEg+zT6Ji8InoyTpV7wusPNwGqqtxmHlkNhDN0U=
github.com/livekit/server-sdk-go v1.0.14-0.20230710162205-84a425768a90 h1:r+EpbPmVWvGmOs70xkdztx+vvC3Y53UxNcpY78FAJTQ=
Expand Down Expand Up @@ -471,8 +471,8 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp
google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc=
google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ=
google.golang.org/grpc v1.56.1 h1:z0dNfjIl0VpaZ9iSVjA6daGatAYwPGstTjt5vkRMFkQ=
google.golang.org/grpc v1.56.1/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s=
google.golang.org/grpc v1.56.2 h1:fVRFRnXvU+x6C4IlHZewvJOVHoOv1TUuQyoRsYnB4bI=
google.golang.org/grpc v1.56.2/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
Expand Down
4 changes: 2 additions & 2 deletions pkg/config/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package config
import (
"github.com/livekit/egress/pkg/errors"
"github.com/livekit/egress/pkg/types"
"github.com/livekit/egress/pkg/util"
"github.com/livekit/protocol/livekit"
"github.com/livekit/protocol/utils"
)

type OutputConfig interface {
Expand Down Expand Up @@ -191,7 +191,7 @@ func redactEncodedOutputs(out EncodedOutput) {

func redactStreamKeys(stream *livekit.StreamOutput) {
for i, url := range stream.Urls {
if redacted, ok := util.RedactStreamKey(url); ok {
if redacted, ok := utils.RedactStreamKey(url); ok {
stream.Urls[i] = redacted
}
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/config/pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ import (

"github.com/livekit/egress/pkg/errors"
"github.com/livekit/egress/pkg/types"
"github.com/livekit/egress/pkg/util"
"github.com/livekit/protocol/egress"
"github.com/livekit/protocol/livekit"
"github.com/livekit/protocol/rpc"
"github.com/livekit/protocol/tracer"
"github.com/livekit/protocol/utils"
)

const (
Expand Down Expand Up @@ -526,7 +526,7 @@ func (p *PipelineConfig) ValidateUrl(rawUrl string, outputType types.OutputType)
rawUrl = fmt.Sprintf("rtmps://global-live.mux.com:443/app/%s", parsed.Host)
}

redacted, ok := util.RedactStreamKey(rawUrl)
redacted, ok := utils.RedactStreamKey(rawUrl)
if !ok {
return "", "", errors.ErrInvalidUrl(rawUrl, "rtmp urls must be of format rtmp(s)://{host}(/{path})/{app}/{stream_key}( live=1)")
}
Expand Down
16 changes: 8 additions & 8 deletions pkg/config/uploads.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package config

import (
"github.com/livekit/egress/pkg/util"
"github.com/livekit/protocol/livekit"
"github.com/livekit/protocol/utils"
)

type UploadConfig interface{}
Expand Down Expand Up @@ -69,25 +69,25 @@ func (c StorageConfig) ToUploadConfig() UploadConfig {

func redactUpload(req uploadRequest) {
if s3 := req.GetS3(); s3 != nil {
s3.AccessKey = util.Redact(s3.AccessKey, "{access_key}")
s3.Secret = util.Redact(s3.Secret, "{secret}")
s3.AccessKey = utils.Redact(s3.AccessKey, "{access_key}")
s3.Secret = utils.Redact(s3.Secret, "{secret}")
return
}

if gcp := req.GetGcp(); gcp != nil {
gcp.Credentials = util.Redact(gcp.Credentials, "{credentials}")
gcp.Credentials = utils.Redact(gcp.Credentials, "{credentials}")
return
}

if azure := req.GetAzure(); azure != nil {
azure.AccountName = util.Redact(azure.AccountName, "{account_name}")
azure.AccountKey = util.Redact(azure.AccountKey, "{account_key}")
azure.AccountName = utils.Redact(azure.AccountName, "{account_name}")
azure.AccountKey = utils.Redact(azure.AccountKey, "{account_key}")
return
}

if aliOSS := req.GetAliOSS(); aliOSS != nil {
aliOSS.AccessKey = util.Redact(aliOSS.AccessKey, "{access_key}")
aliOSS.Secret = util.Redact(aliOSS.Secret, "{secret}")
aliOSS.AccessKey = utils.Redact(aliOSS.AccessKey, "{access_key}")
aliOSS.Secret = utils.Redact(aliOSS.Secret, "{secret}")
return
}
}
4 changes: 2 additions & 2 deletions pkg/pipeline/pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ import (
"github.com/livekit/egress/pkg/pipeline/sink"
"github.com/livekit/egress/pkg/pipeline/source"
"github.com/livekit/egress/pkg/types"
"github.com/livekit/egress/pkg/util"
"github.com/livekit/protocol/livekit"
"github.com/livekit/protocol/logger"
"github.com/livekit/protocol/tracer"
"github.com/livekit/protocol/utils"
)

const (
Expand Down Expand Up @@ -350,7 +350,7 @@ func (p *Pipeline) removeSink(ctx context.Context, url string, streamErr error)
p.mu.Unlock()

// log removal
redacted, _ := util.RedactStreamKey(url)
redacted, _ := utils.RedactStreamKey(url)
logger.Infow("removing stream sink",
"url", redacted,
"status", streamInfo.Status,
Expand Down
40 changes: 0 additions & 40 deletions pkg/util/redact.go

This file was deleted.

0 comments on commit 2f81637

Please sign in to comment.