mirror of
https://github.com/pion/webrtc.git
synced 2025-10-25 08:10:37 +08:00
Modify RTCSdpType to protect newRTCSdpType Modify RTCPriorityType to protect methods Modify RTCSctpTransportState to protect methods Modify RTCRtcpMuxPolicy to protect methods Modify RTCPeerConnectionState to protect methods Modify RTCIceTransportPolicy to protect methods Modify RTCIceGatheringState to protect methods Modify RTCIceCredentialType to protect methods Modify RTCIceConnectionState to protect methods Modify RTCDtlsTransportState to protect methods Modify RTCDataChannelState to protect methods Modify RTCBundlePolicy to protect methods Relates to #83
55 lines
1.7 KiB
Go
55 lines
1.7 KiB
Go
package webrtc
|
|
|
|
// RTCSctpTransportState indicates the state of the SCTP transport.
|
|
type RTCSctpTransportState int
|
|
|
|
const (
|
|
// RTCSctpTransportStateConnecting indicates the RTCSctpTransport is in the
|
|
// process of negotiating an association. This is the initial state of the
|
|
// SctpTransportState when an RTCSctpTransport is created.
|
|
RTCSctpTransportStateConnecting RTCSctpTransportState = iota + 1
|
|
|
|
// RTCSctpTransportStateConnected indicates the negotiation of an
|
|
// association is completed.
|
|
RTCSctpTransportStateConnected
|
|
|
|
// RTCSctpTransportStateClosed indicates a SHUTDOWN or ABORT chunk is
|
|
// received or when the SCTP association has been closed intentionally,
|
|
// such as by closing the peer connection or applying a remote description
|
|
// that rejects data or changes the SCTP port.
|
|
RTCSctpTransportStateClosed
|
|
)
|
|
|
|
// This is done this way because of a linter.
|
|
const (
|
|
rtcSctpTransportStateConnectingStr = "connecting"
|
|
rtcSctpTransportStateConnectedStr = "connected"
|
|
rtcSctpTransportStateClosedStr = "closed"
|
|
)
|
|
|
|
func newRTCSctpTransportState(raw string) RTCSctpTransportState {
|
|
switch raw {
|
|
case rtcSctpTransportStateConnectingStr:
|
|
return RTCSctpTransportStateConnecting
|
|
case rtcSctpTransportStateConnectedStr:
|
|
return RTCSctpTransportStateConnected
|
|
case rtcSctpTransportStateClosedStr:
|
|
return RTCSctpTransportStateClosed
|
|
default:
|
|
return RTCSctpTransportState(Unknown)
|
|
}
|
|
}
|
|
|
|
func (s RTCSctpTransportState) String() string {
|
|
switch s {
|
|
case RTCSctpTransportStateConnecting:
|
|
return rtcSctpTransportStateConnectingStr
|
|
case RTCSctpTransportStateConnected:
|
|
return rtcSctpTransportStateConnectedStr
|
|
case RTCSctpTransportStateClosed:
|
|
return rtcSctpTransportStateClosedStr
|
|
default:
|
|
return ErrUnknownType.Error()
|
|
}
|
|
}
|