Source File
datachannelstate.go
Belonging Package
github.com/pion/webrtc/v4
// SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>// SPDX-License-Identifier: MITpackage webrtc// DataChannelState indicates the state of a data channel.type DataChannelState intconst (// DataChannelStateUnknown is the enum's zero-value.DataChannelStateUnknown DataChannelState = iota// DataChannelStateConnecting indicates that the data channel is being// established. This is the initial state of DataChannel, whether created// with CreateDataChannel, or dispatched as a part of an DataChannelEvent.DataChannelStateConnecting// DataChannelStateOpen indicates that the underlying data transport is// established and communication is possible.DataChannelStateOpen// DataChannelStateClosing indicates that the procedure to close down the// underlying data transport has started.DataChannelStateClosing// DataChannelStateClosed indicates that the underlying data transport// has been closed or could not be established.DataChannelStateClosed)// This is done this way because of a linter.const (dataChannelStateConnectingStr = "connecting"dataChannelStateOpenStr = "open"dataChannelStateClosingStr = "closing"dataChannelStateClosedStr = "closed")func newDataChannelState( string) DataChannelState {switch {case dataChannelStateConnectingStr:return DataChannelStateConnectingcase dataChannelStateOpenStr:return DataChannelStateOpencase dataChannelStateClosingStr:return DataChannelStateClosingcase dataChannelStateClosedStr:return DataChannelStateCloseddefault:return DataChannelStateUnknown}}func ( DataChannelState) () string {switch {case DataChannelStateConnecting:return dataChannelStateConnectingStrcase DataChannelStateOpen:return dataChannelStateOpenStrcase DataChannelStateClosing:return dataChannelStateClosingStrcase DataChannelStateClosed:return dataChannelStateClosedStrdefault:return ErrUnknownType.Error()}}// MarshalText implements encoding.TextMarshaler.func ( DataChannelState) () ([]byte, error) {return []byte(.String()), nil}// UnmarshalText implements encoding.TextUnmarshaler.func ( *DataChannelState) ( []byte) error {* = newDataChannelState(string())return nil}
![]() |
The pages are generated with Golds v0.8.2. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |