Documentation ¶
Overview ¶
Package masker provides a wrapper around an io.Writer that replaces sensitive values in its output.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MaskedWriter ¶
type MaskedWriter struct {
// contains filtered or unexported fields
}
MaskedWriter wraps an io.Writer which masks all occurrences of masks by maskString. If no write is made for timeout on the io.Writer, any matches in progress are reset and the buffer is flushed. This is to ensure that the writer does not hang on partial matches.
func NewMaskedWriter ¶
func NewMaskedWriter(w io.Writer, masks [][]byte, maskString string, timeout time.Duration) *MaskedWriter
NewMaskedWriter returns a new MaskedWriter that masks all occurrences of sequences in masks with maskString.
func (*MaskedWriter) Flush ¶
func (mw *MaskedWriter) Flush() error
Flush is called to make sure that all output is written to the underlying io.Writer. Returns any errors caused by the writing.
func (*MaskedWriter) Run ¶
func (mw *MaskedWriter) Run()
Run writes any processed data from the output channel to the underlying io.Writer. If no new data is received on the output channel for timeout, the output buffer is forced flushed and all ongoing matches are reset.
This should be run in a separate goroutine.