session.go 609 B

123456789101112131415161718192021222324
  1. // SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>
  2. // SPDX-License-Identifier: MIT
  3. package dtls
  4. // Session store data needed in resumption
  5. type Session struct {
  6. // ID store session id
  7. ID []byte
  8. // Secret store session master secret
  9. Secret []byte
  10. }
  11. // SessionStore defines methods needed for session resumption.
  12. type SessionStore interface {
  13. // Set save a session.
  14. // For client, use server name as key.
  15. // For server, use session id.
  16. Set(key []byte, s Session) error
  17. // Get fetch a session.
  18. Get(key []byte) (Session, error)
  19. // Del clean saved session.
  20. Del(key []byte) error
  21. }