1package webrtc 2 3import ( 4 "errors" 5) 6 7var ( 8 // ErrUnknownType indicates an error with Unknown info. 9 ErrUnknownType = errors.New("unknown") 10 11 // ErrConnectionClosed indicates an operation executed after connection 12 // has already been closed. 13 ErrConnectionClosed = errors.New("connection closed") 14 15 // ErrDataChannelNotOpen indicates an operation executed when the data 16 // channel is not (yet) open. 17 ErrDataChannelNotOpen = errors.New("data channel not open") 18 19 // ErrCertificateExpired indicates that an x509 certificate has expired. 20 ErrCertificateExpired = errors.New("x509Cert expired") 21 22 // ErrNoTurnCredentials indicates that a TURN server URL was provided 23 // without required credentials. 24 ErrNoTurnCredentials = errors.New("turn server credentials required") 25 26 // ErrTurnCredentials indicates that provided TURN credentials are partial 27 // or malformed. 28 ErrTurnCredentials = errors.New("invalid turn server credentials") 29 30 // ErrExistingTrack indicates that a track already exists. 31 ErrExistingTrack = errors.New("track already exists") 32 33 // ErrPrivateKeyType indicates that a particular private key encryption 34 // chosen to generate a certificate is not supported. 35 ErrPrivateKeyType = errors.New("private key type not supported") 36 37 // ErrModifyingPeerIdentity indicates that an attempt to modify 38 // PeerIdentity was made after PeerConnection has been initialized. 39 ErrModifyingPeerIdentity = errors.New("peerIdentity cannot be modified") 40 41 // ErrModifyingCertificates indicates that an attempt to modify 42 // Certificates was made after PeerConnection has been initialized. 43 ErrModifyingCertificates = errors.New("certificates cannot be modified") 44 45 // ErrModifyingBundlePolicy indicates that an attempt to modify 46 // BundlePolicy was made after PeerConnection has been initialized. 47 ErrModifyingBundlePolicy = errors.New("bundle policy cannot be modified") 48 49 // ErrModifyingRTCPMuxPolicy indicates that an attempt to modify 50 // RTCPMuxPolicy was made after PeerConnection has been initialized. 51 ErrModifyingRTCPMuxPolicy = errors.New("rtcp mux policy cannot be modified") 52 53 // ErrModifyingICECandidatePoolSize indicates that an attempt to modify 54 // ICECandidatePoolSize was made after PeerConnection has been initialized. 55 ErrModifyingICECandidatePoolSize = errors.New("ice candidate pool size cannot be modified") 56 57 // ErrStringSizeLimit indicates that the character size limit of string is 58 // exceeded. The limit is hardcoded to 65535 according to specifications. 59 ErrStringSizeLimit = errors.New("data channel label exceeds size limit") 60 61 // ErrMaxDataChannelID indicates that the maximum number ID that could be 62 // specified for a data channel has been exceeded. 63 ErrMaxDataChannelID = errors.New("maximum number ID for datachannel specified") 64 65 // ErrNegotiatedWithoutID indicates that an attempt to create a data channel 66 // was made while setting the negotiated option to true without providing 67 // the negotiated channel ID. 68 ErrNegotiatedWithoutID = errors.New("negotiated set without channel id") 69 70 // ErrRetransmitsOrPacketLifeTime indicates that an attempt to create a data 71 // channel was made with both options MaxPacketLifeTime and MaxRetransmits 72 // set together. Such configuration is not supported by the specification 73 // and is mutually exclusive. 74 ErrRetransmitsOrPacketLifeTime = errors.New("both MaxPacketLifeTime and MaxRetransmits was set") 75 76 // ErrCodecNotFound is returned when a codec search to the Media Engine fails 77 ErrCodecNotFound = errors.New("codec not found") 78 79 // ErrNoRemoteDescription indicates that an operation was rejected because 80 // the remote description is not set 81 ErrNoRemoteDescription = errors.New("remote description is not set") 82 83 // ErrIncorrectSDPSemantics indicates that the PeerConnection was configured to 84 // generate SDP Answers with different SDP Semantics than the received Offer 85 ErrIncorrectSDPSemantics = errors.New("offer SDP semantics does not match configuration") 86 87 // ErrIncorrectSignalingState indicates that the signaling state of PeerConnection is not correct 88 ErrIncorrectSignalingState = errors.New("operation can not be run in current signaling state") 89 90 // ErrProtocolTooLarge indicates that value given for a DataChannelInit protocol is 91 // longer then 65535 bytes 92 ErrProtocolTooLarge = errors.New("protocol is larger then 65535 bytes") 93 94 // ErrSenderNotCreatedByConnection indicates RemoveTrack was called with a RtpSender not created 95 // by this PeerConnection 96 ErrSenderNotCreatedByConnection = errors.New("RtpSender not created by this PeerConnection") 97 98 // ErrSessionDescriptionNoFingerprint indicates SetRemoteDescription was called with a SessionDescription that has no 99 // fingerprint 100 ErrSessionDescriptionNoFingerprint = errors.New("SetRemoteDescription called with no fingerprint") 101 102 // ErrSessionDescriptionInvalidFingerprint indicates SetRemoteDescription was called with a SessionDescription that 103 // has an invalid fingerprint 104 ErrSessionDescriptionInvalidFingerprint = errors.New("SetRemoteDescription called with an invalid fingerprint") 105 106 // ErrSessionDescriptionConflictingFingerprints indicates SetRemoteDescription was called with a SessionDescription that 107 // has an conflicting fingerprints 108 ErrSessionDescriptionConflictingFingerprints = errors.New("SetRemoteDescription called with multiple conflicting fingerprint") 109 110 // ErrSessionDescriptionMissingIceUfrag indicates SetRemoteDescription was called with a SessionDescription that 111 // is missing an ice-ufrag value 112 ErrSessionDescriptionMissingIceUfrag = errors.New("SetRemoteDescription called with no ice-ufrag") 113 114 // ErrSessionDescriptionMissingIcePwd indicates SetRemoteDescription was called with a SessionDescription that 115 // is missing an ice-pwd value 116 ErrSessionDescriptionMissingIcePwd = errors.New("SetRemoteDescription called with no ice-pwd") 117 118 // ErrSessionDescriptionConflictingIceUfrag indicates SetRemoteDescription was called with a SessionDescription that 119 // contains multiple conflicting ice-ufrag values 120 ErrSessionDescriptionConflictingIceUfrag = errors.New("SetRemoteDescription called with multiple conflicting ice-ufrag values") 121 122 // ErrSessionDescriptionConflictingIcePwd indicates SetRemoteDescription was called with a SessionDescription that 123 // contains multiple conflicting ice-pwd values 124 ErrSessionDescriptionConflictingIcePwd = errors.New("SetRemoteDescription called with multiple conflicting ice-pwd values") 125 126 // ErrNoSRTPProtectionProfile indicates that the DTLS handshake completed and no SRTP Protection Profile was chosen 127 ErrNoSRTPProtectionProfile = errors.New("DTLS Handshake completed and no SRTP Protection Profile was chosen") 128 129 // ErrFailedToGenerateCertificateFingerprint indicates that we failed to generate the fingerprint used for comparing certificates 130 ErrFailedToGenerateCertificateFingerprint = errors.New("failed to generate certificate fingerprint") 131 132 // ErrNoCodecsAvailable indicates that operation isn't possible because the MediaEngine has no codecs available 133 ErrNoCodecsAvailable = errors.New("operation failed no codecs are available") 134 135 // ErrUnsupportedCodec indicates the remote peer doesn't support the requested codec 136 ErrUnsupportedCodec = errors.New("unable to start track, codec is not supported by remote") 137 138 // ErrUnbindFailed indicates that a TrackLocal was not able to be unbind 139 ErrUnbindFailed = errors.New("failed to unbind TrackLocal from PeerConnection") 140 141 // ErrNoPayloaderForCodec indicates that the requested codec does not have a payloader 142 ErrNoPayloaderForCodec = errors.New("the requested codec does not have a payloader") 143 144 // ErrRegisterHeaderExtensionInvalidDirection indicates that a extension was registered with a direction besides `sendonly` or `recvonly` 145 ErrRegisterHeaderExtensionInvalidDirection = errors.New("a header extension must be registered as 'recvonly', 'sendonly' or both") 146 147 // ErrSimulcastProbeOverflow indicates that too many Simulcast probe streams are in flight and the requested SSRC was ignored 148 ErrSimulcastProbeOverflow = errors.New("simulcast probe limit has been reached, new SSRC has been discarded") 149 150 errDetachNotEnabled = errors.New("enable detaching by calling webrtc.DetachDataChannels()") 151 errDetachBeforeOpened = errors.New("datachannel not opened yet, try calling Detach from OnOpen") 152 errDtlsTransportNotStarted = errors.New("the DTLS transport has not started yet") 153 errDtlsKeyExtractionFailed = errors.New("failed extracting keys from DTLS for SRTP") 154 errFailedToStartSRTP = errors.New("failed to start SRTP") 155 errFailedToStartSRTCP = errors.New("failed to start SRTCP") 156 errInvalidDTLSStart = errors.New("attempted to start DTLSTransport that is not in new state") 157 errNoRemoteCertificate = errors.New("peer didn't provide certificate via DTLS") 158 errIdentityProviderNotImplemented = errors.New("identity provider is not implemented") 159 errNoMatchingCertificateFingerprint = errors.New("remote certificate does not match any fingerprint") 160 161 errICEConnectionNotStarted = errors.New("ICE connection not started") 162 errICECandidateTypeUnknown = errors.New("unknown candidate type") 163 errICEInvalidConvertCandidateType = errors.New("cannot convert ice.CandidateType into webrtc.ICECandidateType, invalid type") 164 errICEAgentNotExist = errors.New("ICEAgent does not exist") 165 errICECandiatesCoversionFailed = errors.New("unable to convert ICE candidates to ICECandidates") 166 errICERoleUnknown = errors.New("unknown ICE Role") 167 errICEProtocolUnknown = errors.New("unknown protocol") 168 errICEGathererNotStarted = errors.New("gatherer not started") 169 170 errNetworkTypeUnknown = errors.New("unknown network type") 171 172 errSDPDoesNotMatchOffer = errors.New("new sdp does not match previous offer") 173 errSDPDoesNotMatchAnswer = errors.New("new sdp does not match previous answer") 174 errPeerConnSDPTypeInvalidValue = errors.New("provided value is not a valid enum value of type SDPType") 175 errPeerConnStateChangeInvalid = errors.New("invalid state change op") 176 errPeerConnStateChangeUnhandled = errors.New("unhandled state change op") 177 errPeerConnSDPTypeInvalidValueSetLocalDescription = errors.New("invalid SDP type supplied to SetLocalDescription()") 178 errPeerConnRemoteDescriptionWithoutMidValue = errors.New("remoteDescription contained media section without mid value") 179 errPeerConnRemoteDescriptionNil = errors.New("remoteDescription has not been set yet") 180 errPeerConnSingleMediaSectionHasExplicitSSRC = errors.New("single media section has an explicit SSRC") 181 errPeerConnRemoteSSRCAddTransceiver = errors.New("could not add transceiver for remote SSRC") 182 errPeerConnSimulcastMidRTPExtensionRequired = errors.New("mid RTP Extensions required for Simulcast") 183 errPeerConnSimulcastStreamIDRTPExtensionRequired = errors.New("stream id RTP Extensions required for Simulcast") 184 errPeerConnSimulcastIncomingSSRCFailed = errors.New("incoming SSRC failed Simulcast probing") 185 errPeerConnAddTransceiverFromKindOnlyAcceptsOne = errors.New("AddTransceiverFromKind only accepts one RtpTransceiverInit") 186 errPeerConnAddTransceiverFromTrackOnlyAcceptsOne = errors.New("AddTransceiverFromTrack only accepts one RtpTransceiverInit") 187 errPeerConnAddTransceiverFromKindSupport = errors.New("AddTransceiverFromKind currently only supports recvonly") 188 errPeerConnAddTransceiverFromTrackSupport = errors.New("AddTransceiverFromTrack currently only supports sendonly and sendrecv") 189 errPeerConnSetIdentityProviderNotImplemented = errors.New("TODO SetIdentityProvider") 190 errPeerConnWriteRTCPOpenWriteStream = errors.New("WriteRTCP failed to open WriteStream") 191 errPeerConnTranscieverMidNil = errors.New("cannot find transceiver with mid") 192 193 errRTPReceiverDTLSTransportNil = errors.New("DTLSTransport must not be nil") 194 errRTPReceiverReceiveAlreadyCalled = errors.New("Receive has already been called") 195 errRTPReceiverWithSSRCTrackStreamNotFound = errors.New("unable to find stream for Track with SSRC") 196 errRTPReceiverForSSRCTrackStreamNotFound = errors.New("no trackStreams found for SSRC") 197 errRTPReceiverForRIDTrackStreamNotFound = errors.New("no trackStreams found for RID") 198 199 errRTPSenderTrackNil = errors.New("Track must not be nil") 200 errRTPSenderDTLSTransportNil = errors.New("DTLSTransport must not be nil") 201 errRTPSenderSendAlreadyCalled = errors.New("Send has already been called") 202 203 errRTPTransceiverCannotChangeMid = errors.New("errRTPSenderTrackNil") 204 errRTPTransceiverSetSendingInvalidState = errors.New("invalid state change in RTPTransceiver.setSending") 205 206 errSCTPTransportDTLS = errors.New("DTLS not established") 207 208 errSDPZeroTransceivers = errors.New("addTransceiverSDP() called with 0 transceivers") 209 errSDPMediaSectionMediaDataChanInvalid = errors.New("invalid Media Section. Media + DataChannel both enabled") 210 errSDPMediaSectionMultipleTrackInvalid = errors.New("invalid Media Section. Can not have multiple tracks in one MediaSection in UnifiedPlan") 211 212 errSettingEngineSetAnsweringDTLSRole = errors.New("SetAnsweringDTLSRole must DTLSRoleClient or DTLSRoleServer") 213 214 errSignalingStateCannotRollback = errors.New("can't rollback from stable state") 215 errSignalingStateProposedTransitionInvalid = errors.New("invalid proposed signaling state transition") 216 217 errStatsICECandidateStateInvalid = errors.New("cannot convert to StatsICECandidatePairStateSucceeded invalid ice candidate state") 218 219 errICETransportNotInNew = errors.New("ICETransport can only be called in ICETransportStateNew") 220) 221