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