snapshot of https://github.com/pion/webrtc.git (main, 2026-09-15; blobs > 131072B omitted)
Some checks failed
REUSE Compliance Check / lint (push) Failing after 0s
Browser E2E / Test (push) Failing after 3s
Test / test (1.24) (push) Failing after 0s
Test / test-i386 (1.25) (push) Failing after 0s
Test / test-i386 (1.24) (push) Failing after 0s
Test / test-windows (1.25) (push) Failing after 0s
Test / test-windows (1.24) (push) Failing after 0s
Test / test (1.25) (push) Failing after 0s
Examples Tests / Test (push) Failing after 3s
Test / test-macos (1.25) (push) Failing after 0s
Test / test-macos (1.24) (push) Failing after 0s
Go mod tidy / tidy (push) Failing after 0s
Test / test-wasm (push) Failing after 0s
CodeQL / analyze (push) Failing after 1s
Fuzz / fuzz (push) Failing after 0s

This commit is contained in:
upstream-mirror
2026-09-15 20:06:07 +05:00
commit 8acb1a3a29
394 changed files with 78746 additions and 0 deletions

100
iceconnectionstate.go Normal file
View File

@@ -0,0 +1,100 @@
// SPDX-FileCopyrightText: 2026 The Pion community <https://pion.ly>
// SPDX-License-Identifier: MIT
package webrtc
// ICEConnectionState indicates signaling state of the ICE Connection.
type ICEConnectionState int
const (
// ICEConnectionStateUnknown is the enum's zero-value.
ICEConnectionStateUnknown ICEConnectionState = iota
// ICEConnectionStateNew indicates that any of the ICETransports are
// in the "new" state and none of them are in the "checking", "disconnected"
// or "failed" state, or all ICETransports are in the "closed" state, or
// there are no transports.
ICEConnectionStateNew
// ICEConnectionStateChecking indicates that any of the ICETransports
// are in the "checking" state and none of them are in the "disconnected"
// or "failed" state.
ICEConnectionStateChecking
// ICEConnectionStateConnected indicates that all ICETransports are
// in the "connected", "completed" or "closed" state and at least one of
// them is in the "connected" state.
ICEConnectionStateConnected
// ICEConnectionStateCompleted indicates that all ICETransports are
// in the "completed" or "closed" state and at least one of them is in the
// "completed" state.
ICEConnectionStateCompleted
// ICEConnectionStateDisconnected indicates that any of the
// ICETransports are in the "disconnected" state and none of them are
// in the "failed" state.
ICEConnectionStateDisconnected
// ICEConnectionStateFailed indicates that any of the ICETransports
// are in the "failed" state.
ICEConnectionStateFailed
// ICEConnectionStateClosed indicates that the PeerConnection's
// isClosed is true.
ICEConnectionStateClosed
)
// This is done this way because of a linter.
const (
iceConnectionStateNewStr = "new"
iceConnectionStateCheckingStr = "checking"
iceConnectionStateConnectedStr = "connected"
iceConnectionStateCompletedStr = "completed"
iceConnectionStateDisconnectedStr = "disconnected"
iceConnectionStateFailedStr = "failed"
iceConnectionStateClosedStr = "closed"
)
// NewICEConnectionState takes a string and converts it to ICEConnectionState.
func NewICEConnectionState(raw string) ICEConnectionState {
switch raw {
case iceConnectionStateNewStr:
return ICEConnectionStateNew
case iceConnectionStateCheckingStr:
return ICEConnectionStateChecking
case iceConnectionStateConnectedStr:
return ICEConnectionStateConnected
case iceConnectionStateCompletedStr:
return ICEConnectionStateCompleted
case iceConnectionStateDisconnectedStr:
return ICEConnectionStateDisconnected
case iceConnectionStateFailedStr:
return ICEConnectionStateFailed
case iceConnectionStateClosedStr:
return ICEConnectionStateClosed
default:
return ICEConnectionStateUnknown
}
}
func (c ICEConnectionState) String() string {
switch c {
case ICEConnectionStateNew:
return iceConnectionStateNewStr
case ICEConnectionStateChecking:
return iceConnectionStateCheckingStr
case ICEConnectionStateConnected:
return iceConnectionStateConnectedStr
case ICEConnectionStateCompleted:
return iceConnectionStateCompletedStr
case ICEConnectionStateDisconnected:
return iceConnectionStateDisconnectedStr
case ICEConnectionStateFailed:
return iceConnectionStateFailedStr
case ICEConnectionStateClosed:
return iceConnectionStateClosedStr
default:
return ErrUnknownType.Error()
}
}