-
Notifications
You must be signed in to change notification settings - Fork 205
Expand file tree
/
Copy pathice.go
More file actions
110 lines (89 loc) · 2.7 KB
/
ice.go
File metadata and controls
110 lines (89 loc) · 2.7 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
// SPDX-FileCopyrightText: 2026 The Pion community <https://pion.ly>
// SPDX-License-Identifier: MIT
package ice
// ConnectionState is an enum showing the state of a ICE Connection.
type ConnectionState int
// List of supported States.
const (
// ConnectionStateUnknown represents an unknown state.
ConnectionStateUnknown ConnectionState = iota
// ConnectionStateNew ICE agent is gathering addresses.
ConnectionStateNew
// ConnectionStateChecking ICE agent has been given local and remote candidates, and is attempting to find a match.
ConnectionStateChecking
// ConnectionStateConnected ICE agent has a pairing, but is still checking other pairs.
ConnectionStateConnected
// ConnectionStateCompleted ICE agent has finished.
ConnectionStateCompleted
// ConnectionStateFailed ICE agent never could successfully connect.
ConnectionStateFailed
// ConnectionStateDisconnected ICE agent connected successfully, but has entered a failed state.
ConnectionStateDisconnected
// ConnectionStateClosed ICE agent has finished and is no longer handling requests.
ConnectionStateClosed
)
func (c ConnectionState) String() string {
switch c {
case ConnectionStateNew:
return "New"
case ConnectionStateChecking:
return "Checking"
case ConnectionStateConnected:
return "Connected"
case ConnectionStateCompleted:
return "Completed"
case ConnectionStateFailed:
return "Failed"
case ConnectionStateDisconnected:
return "Disconnected"
case ConnectionStateClosed:
return "Closed"
default:
return "Invalid"
}
}
// GatheringState describes the state of the candidate gathering process.
type GatheringState int
const (
// GatheringStateUnknown represents an unknown state.
GatheringStateUnknown GatheringState = iota
// GatheringStateNew indicates candidate gathering is not yet started.
GatheringStateNew
// GatheringStateGathering indicates candidate gathering is ongoing.
GatheringStateGathering
// GatheringStateComplete indicates candidate gathering has been completed.
GatheringStateComplete
)
func (t GatheringState) String() string {
switch t {
case GatheringStateNew:
return "new"
case GatheringStateGathering:
return "gathering"
case GatheringStateComplete:
return "complete"
default:
return ErrUnknownType.Error()
}
}
// ContinualGatheringPolicy defines the behavior for gathering ICE candidates.
type ContinualGatheringPolicy int
const (
GatherOnce ContinualGatheringPolicy = iota
GatherContinually
)
func (c ContinualGatheringPolicy) String() string {
switch c {
case GatherOnce:
return "gather_once"
case GatherContinually:
return "gather_continually"
default:
return unknownStr
}
}
const (
unknownStr = "unknown"
relayProtocolDTLS = "dtls"
relayProtocolTLS = "tls"
)