mirror of
https://github.com/XTLS/REALITY.git
synced 2026-09-27 17:38:00 +03:00
crypto/tls: wrap KeyLogWriter errors w/ prefix
If a tls.Config populates a KeyLogWriter, and the io.Writer's Write() returns an error when using it in writeKeyLog() we should wrap the error with a prefix that indicates the source to aid in debugging. Fixes #79392 Change-Id: Ie16bb2908575123a8e80c623a15f3835a7bc3e92 Reviewed-on: https://go-review.googlesource.com/c/go/+/784740 Reviewed-by: Roland Shoemaker <roland@golang.org> Auto-Submit: Daniel McCarney <daniel@binaryparadox.net> Reviewed-by: Neal Patel <neal@golang.org> LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Neal Patel <nealpatel@google.com>
This commit is contained in:
@@ -1650,7 +1650,10 @@ func (c *Config) writeKeyLog(label string, clientRandom, secret []byte) error {
|
||||
_, err := c.KeyLogWriter.Write(logLine)
|
||||
writerMutex.Unlock()
|
||||
|
||||
return err
|
||||
if err != nil {
|
||||
return fmt.Errorf("tls: KeyLogWriter: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// writerMutex protects all KeyLogWriters globally. It is rarely enabled,
|
||||
|
||||
Reference in New Issue
Block a user