integrity_debug.go 445 B

12345678910111213141516171819202122
  1. // SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>
  2. // SPDX-License-Identifier: MIT
  3. //go:build debug
  4. // +build debug
  5. package stun
  6. import "fmt"
  7. // IntegrityErr occurs when computed HMAC differs from expected.
  8. type IntegrityErr struct {
  9. Expected []byte
  10. Actual []byte
  11. }
  12. func (i *IntegrityErr) Error() string {
  13. return fmt.Sprintf(
  14. "Integrity check failed: 0x%x (expected) !- 0x%x (actual)",
  15. i.Expected, i.Actual,
  16. )
  17. }