resume.go 512 B

12345678910111213141516171819202122
  1. // SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>
  2. // SPDX-License-Identifier: MIT
  3. package dtls
  4. import (
  5. "context"
  6. "net"
  7. )
  8. // Resume imports an already established dtls connection using a specific dtls state
  9. func Resume(state *State, conn net.Conn, config *Config) (*Conn, error) {
  10. if err := state.initCipherSuite(); err != nil {
  11. return nil, err
  12. }
  13. c, err := createConn(context.Background(), conn, config, state.isClient, state)
  14. if err != nil {
  15. return nil, err
  16. }
  17. return c, nil
  18. }