mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-14 05:11:19 -04:00
Implement String() method on events
To make it safe for logging safelog.Scrub function is now public. Closes: #40141
This commit is contained in:
parent
9757784c5a
commit
1d592b06e5
3 changed files with 38 additions and 69 deletions
|
@ -38,7 +38,7 @@ type LogScrubber struct {
|
|||
func (ls *LogScrubber) Lock() { (*ls).lock.Lock() }
|
||||
func (ls *LogScrubber) Unlock() { (*ls).lock.Unlock() }
|
||||
|
||||
func scrub(b []byte) []byte {
|
||||
func Scrub(b []byte) []byte {
|
||||
scrubbedBytes := b
|
||||
for _, pattern := range scrubberPatterns {
|
||||
// this is a workaround since go does not yet support look ahead or look
|
||||
|
@ -62,7 +62,7 @@ func (ls *LogScrubber) Write(b []byte) (n int, err error) {
|
|||
return
|
||||
}
|
||||
fullLines := ls.buffer[:i+1]
|
||||
_, err = ls.Output.Write(scrub(fullLines))
|
||||
_, err = ls.Output.Write(Scrub(fullLines))
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue