Add an almost complete rfc complaint RTCConfiguration

This commit is contained in:
Konstantin Itskov
2018-08-24 01:27:22 -04:00
committed by Sean DuBois
parent 26e0fb8423
commit 20191a4974
26 changed files with 738 additions and 570 deletions

View File

@@ -5,23 +5,18 @@ import (
"fmt"
)
// Types of InvalidStateErrors
var (
ErrConnectionClosed = errors.New("connection closed")
)
// InvalidStateError indicates the object is in an invalid state.
type InvalidStateError struct {
Err error
}
func (e *InvalidStateError) Error() string {
return fmt.Sprintf("invalid state error: %v", e.Err)
return fmt.Sprintf("webrtc: InvalidStateError: %v", e.Err)
}
// Types of UnknownErrors
// Types of InvalidStateErrors
var (
ErrNoConfig = errors.New("no configuration provided")
ErrConnectionClosed = errors.New("connection closed")
)
// UnknownError indicates the operation failed for an unknown transient reason
@@ -30,7 +25,21 @@ type UnknownError struct {
}
func (e *UnknownError) Error() string {
return fmt.Sprintf("unknown error: %v", e.Err)
return fmt.Sprintf("webrtc: UnknownError: %v", e.Err)
}
// Types of UnknownErrors
var (
ErrNoConfig = errors.New("no configuration provided")
)
// InvalidAccessError indicates the object does not support the operation or argument.
type InvalidAccessError struct {
Err error
}
func (e *InvalidAccessError) Error() string {
return fmt.Sprintf("webrtc: InvalidAccessError: %v", e.Err)
}
// Types of InvalidAccessErrors
@@ -41,34 +50,17 @@ var (
ErrExistingTrack = errors.New("track aready exists")
)
// InvalidAccessError indicates the object does not support the operation or argument.
type InvalidAccessError struct {
Err error
}
func (e *InvalidAccessError) Error() string {
return fmt.Sprintf("invalid access error: %v", e.Err)
}
// Types of NotSupportedErrors
var ()
// NotSupportedError indicates the operation is not supported.
type NotSupportedError struct {
Err error
}
func (e *NotSupportedError) Error() string {
return fmt.Sprintf("not supported error: %v", e.Err)
return fmt.Sprintf("webrtc: NotSupportedError: %v", e.Err)
}
// Types of InvalidModificationErrors
var (
ErrModPeerIdentity = errors.New("peer identity cannot be modified")
ErrModCertificates = errors.New("certificates cannot be modified")
ErrModRtcpMuxPolicy = errors.New("rtcp mux policy cannot be modified")
ErrModICECandidatePoolSize = errors.New("ice candidate pool size cannot be modified")
)
// Types of NotSupportedErrors
var ()
// InvalidModificationError indicates the object can not be modified in this way.
type InvalidModificationError struct {
@@ -76,11 +68,17 @@ type InvalidModificationError struct {
}
func (e *InvalidModificationError) Error() string {
return fmt.Sprintf("invalid modification error: %v", e.Err)
return fmt.Sprintf("webrtc: InvalidModificationError: %v", e.Err)
}
// Types of SyntaxErrors
var ()
// Types of InvalidModificationErrors
var (
ErrModifyingPeerIdentity = errors.New("peerIdentity cannot be modified")
ErrModifyingCertificates = errors.New("certificates cannot be modified")
ErrModifyingBundlePolicy = errors.New("bundle policy cannot be modified")
ErrModifyingRtcpMuxPolicy = errors.New("rtcp mux policy cannot be modified")
ErrModifyingIceCandidatePoolSize = errors.New("ice candidate pool size cannot be modified")
)
// SyntaxError indicates the string did not match the expected pattern.
type SyntaxError struct {
@@ -88,13 +86,11 @@ type SyntaxError struct {
}
func (e *SyntaxError) Error() string {
return fmt.Sprintf("syntax error: %v", e.Err)
return fmt.Sprintf("webrtc: SyntaxError: %v", e.Err)
}
// Types of TypeError
var (
ErrInvalidValue = errors.New("invalid value")
)
// Types of SyntaxErrors
var ()
// TypeError indicates an issue with a supplied value
type TypeError struct {
@@ -102,12 +98,12 @@ type TypeError struct {
}
func (e *TypeError) Error() string {
return fmt.Sprintf("type error: %v", e.Err)
return fmt.Sprintf("webrtc: TypeError: %v", e.Err)
}
// Types of OperationError
// Types of TypeError
var (
ErrMaxDataChannels = errors.New("maximum number of datachannels reached")
ErrInvalidValue = errors.New("invalid value")
)
// OperationError indicates an issue with execution
@@ -116,8 +112,13 @@ type OperationError struct {
}
func (e *OperationError) Error() string {
return fmt.Sprintf("operation error: %v", e.Err)
return fmt.Sprintf("webrtc: OperationError: %v", e.Err)
}
// Types of OperationError
var (
ErrMaxDataChannels = errors.New("maximum number of datachannels reached")
)
// ErrUnknownType indicates a Unknown info
var ErrUnknownType = errors.New("Unknown")