forked from gortc/ice
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ice.go
33 lines (27 loc) · 896 Bytes
/
ice.go
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
// Package ice implements RFC 8445
// Interactive Connectivity Establishment (ICE):
// A Protocol for Network Address Translator (NAT) Traversal
package ice
import "encoding/binary"
// bin is shorthand for BigEndian.
var bin = binary.BigEndian
// State represents the ICE agent state.
//
// As per RFC 8445 Section 6.1.3, the ICE agent has a state determined by the
// state of the checklists. The state is Completed if all checklists are
// Completed, Failed if all checklists are Failed, or Running otherwise.
type State byte
const (
// Running if all checklists are nor completed not failed.
Running State = iota
// Completed if all checklists are completed.
Completed
// Failed if all checklists are failed.
Failed
)
var stateToStr = map[State]string{
Running: "Running",
Completed: "Completed",
Failed: "Failed",
}
func (s State) String() string { return stateToStr[s] }