summaryrefslogtreecommitdiff
path: root/vendor/github.com/pion/webrtc/v3/icegatheringstate.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/pion/webrtc/v3/icegatheringstate.go')
-rw-r--r--vendor/github.com/pion/webrtc/v3/icegatheringstate.go53
1 files changed, 53 insertions, 0 deletions
diff --git a/vendor/github.com/pion/webrtc/v3/icegatheringstate.go b/vendor/github.com/pion/webrtc/v3/icegatheringstate.go
new file mode 100644
index 0000000..21361f9
--- /dev/null
+++ b/vendor/github.com/pion/webrtc/v3/icegatheringstate.go
@@ -0,0 +1,53 @@
+package webrtc
+
+// ICEGatheringState describes the state of the candidate gathering process.
+type ICEGatheringState int
+
+const (
+ // ICEGatheringStateNew indicates that any of the ICETransports are
+ // in the "new" gathering state and none of the transports are in the
+ // "gathering" state, or there are no transports.
+ ICEGatheringStateNew ICEGatheringState = iota + 1
+
+ // ICEGatheringStateGathering indicates that any of the ICETransports
+ // are in the "gathering" state.
+ ICEGatheringStateGathering
+
+ // ICEGatheringStateComplete indicates that at least one ICETransport
+ // exists, and all ICETransports are in the "completed" gathering state.
+ ICEGatheringStateComplete
+)
+
+// This is done this way because of a linter.
+const (
+ iceGatheringStateNewStr = "new"
+ iceGatheringStateGatheringStr = "gathering"
+ iceGatheringStateCompleteStr = "complete"
+)
+
+// NewICEGatheringState takes a string and converts it to ICEGatheringState
+func NewICEGatheringState(raw string) ICEGatheringState {
+ switch raw {
+ case iceGatheringStateNewStr:
+ return ICEGatheringStateNew
+ case iceGatheringStateGatheringStr:
+ return ICEGatheringStateGathering
+ case iceGatheringStateCompleteStr:
+ return ICEGatheringStateComplete
+ default:
+ return ICEGatheringState(Unknown)
+ }
+}
+
+func (t ICEGatheringState) String() string {
+ switch t {
+ case ICEGatheringStateNew:
+ return iceGatheringStateNewStr
+ case ICEGatheringStateGathering:
+ return iceGatheringStateGatheringStr
+ case ICEGatheringStateComplete:
+ return iceGatheringStateCompleteStr
+ default:
+ return ErrUnknownType.Error()
+ }
+}