content.go 546 B

123456789101112131415161718192021
  1. package protocol
  2. // ContentType represents the IANA Registered ContentTypes
  3. //
  4. // https://tools.ietf.org/html/rfc4346#section-6.2.1
  5. type ContentType uint8
  6. // ContentType enums
  7. const (
  8. ContentTypeChangeCipherSpec ContentType = 20
  9. ContentTypeAlert ContentType = 21
  10. ContentTypeHandshake ContentType = 22
  11. ContentTypeApplicationData ContentType = 23
  12. )
  13. // Content is the top level distinguisher for a DTLS Datagram
  14. type Content interface {
  15. ContentType() ContentType
  16. Marshal() ([]byte, error)
  17. Unmarshal(data []byte) error
  18. }