-
Notifications
You must be signed in to change notification settings - Fork 189
Expand file tree
/
Copy pathresume.go
More file actions
37 lines (29 loc) · 956 Bytes
/
resume.go
File metadata and controls
37 lines (29 loc) · 956 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// SPDX-FileCopyrightText: 2026 The Pion community <https://pion.ly>
// SPDX-License-Identifier: MIT
package dtls
import (
"net"
)
// Resume imports an already established dtls connection using a specific dtls state.
//
// Deprecated: Use ResumeWithOptions instead.
func Resume(state *State, conn net.PacketConn, rAddr net.Addr, config *Config) (*Conn, error) {
if err := state.initCipherSuite(); err != nil {
return nil, err
}
if config == nil {
return nil, errNoConfigProvided
}
if err := validateConfig(config); err != nil {
return nil, err
}
return createConn(conn, rAddr, config, state.isClient, state)
}
// ResumeWithOptions imports an already established dtls connection using a specific dtls state.
func ResumeWithOptions(state *State, conn net.PacketConn, rAddr net.Addr, opts ...Option) (*Conn, error) {
config, err := buildConfig(opts...)
if err != nil {
return nil, err
}
return Resume(state, conn, rAddr, config)
}