version.go 678 B

123456789101112131415161718192021222324
  1. // SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>
  2. // SPDX-License-Identifier: MIT
  3. // Package protocol provides the DTLS wire format
  4. package protocol
  5. // Version enums
  6. var (
  7. Version1_0 = Version{Major: 0xfe, Minor: 0xff} //nolint:gochecknoglobals
  8. Version1_2 = Version{Major: 0xfe, Minor: 0xfd} //nolint:gochecknoglobals
  9. )
  10. // Version is the minor/major value in the RecordLayer
  11. // and ClientHello/ServerHello
  12. //
  13. // https://tools.ietf.org/html/rfc4346#section-6.2.1
  14. type Version struct {
  15. Major, Minor uint8
  16. }
  17. // Equal determines if two protocol versions are equal
  18. func (v Version) Equal(x Version) bool {
  19. return v.Major == x.Major && v.Minor == x.Minor
  20. }