package redact

import "github.com/google/go-containerregistry/internal/redact"

Package redact contains a simple context signal for redacting requests.

Index

Functions

func Error

func Error(err error) error

Error redacts potentially sensitive query parameter values in the URL from the error's message.

If the error is a *url.Error, this returns a *url.Error with the URL redacted. Any other error type, or nil, is returned unchanged.

func FromContext

func FromContext(ctx context.Context) (bool, string)

FromContext returns the redaction reason, if any.

func NewContext

func NewContext(ctx context.Context, reason string) context.Context

NewContext creates a new ctx with the reason for redaction.

func URL

func URL(u *url.URL) string

URL redacts potentially sensitive query parameter values from the URL's query string.

Source Files

redact.go

Version
v0.20.3 (latest)
Published
Jan 15, 2025
Platform
linux/amd64
Imports
3 packages
Last checked
21 hours ago

Tools for package owners.