Fix misspelled error types

ErrNoTurnCredencials => ErrNoTurnCredentials
ErrTurnCredencials => ErrTurnCredentials
This commit is contained in:
Vicken Simonian
2019-10-17 20:40:44 -07:00
committed by Sean DuBois
parent d0ec72397e
commit 27f93a7f3d
6 changed files with 19 additions and 18 deletions

View File

@@ -138,6 +138,7 @@ Check out the **[contributing wiki](https://github.com/pion/webrtc/wiki/Contribu
* [Hongchao Ma(马洪超)](https://github.com/hcm007)
* [Aaron France](https://github.com/AeroNotix)
* [Chris Hiszpanski](https://github.com/thinkski) - *Fix Answer bundle generation*
* [Vicken Simonian](https://github.com/vsimon)
### License
MIT License - see [LICENSE](LICENSE) for full text

View File

@@ -19,13 +19,13 @@ var (
// ErrCertificateExpired indicates that an x509 certificate has expired.
ErrCertificateExpired = errors.New("x509Cert expired")
// ErrNoTurnCredencials indicates that a TURN server URL was provided
// ErrNoTurnCredentials indicates that a TURN server URL was provided
// without required credentials.
ErrNoTurnCredencials = errors.New("turn server credentials required")
ErrNoTurnCredentials = errors.New("turn server credentials required")
// ErrTurnCredencials indicates that provided TURN credentials are partial
// ErrTurnCredentials indicates that provided TURN credentials are partial
// or malformed.
ErrTurnCredencials = errors.New("invalid turn server credentials")
ErrTurnCredentials = errors.New("invalid turn server credentials")
// ErrExistingTrack indicates that a track already exists.
ErrExistingTrack = errors.New("track already exists")

View File

@@ -37,7 +37,7 @@ func (s ICEServer) urls() ([]*ice.URL, error) {
if url.Scheme == ice.SchemeTypeTURN || url.Scheme == ice.SchemeTypeTURNS {
// https://www.w3.org/TR/webrtc/#set-the-configuration (step #11.3.2)
if s.Username == "" || s.Credential == nil {
return nil, &rtcerr.InvalidAccessError{Err: ErrNoTurnCredencials}
return nil, &rtcerr.InvalidAccessError{Err: ErrNoTurnCredentials}
}
url.Username = s.Username
@@ -46,18 +46,18 @@ func (s ICEServer) urls() ([]*ice.URL, error) {
// https://www.w3.org/TR/webrtc/#set-the-configuration (step #11.3.3)
password, ok := s.Credential.(string)
if !ok {
return nil, &rtcerr.InvalidAccessError{Err: ErrTurnCredencials}
return nil, &rtcerr.InvalidAccessError{Err: ErrTurnCredentials}
}
url.Password = password
case ICECredentialTypeOauth:
// https://www.w3.org/TR/webrtc/#set-the-configuration (step #11.3.4)
if _, ok := s.Credential.(OAuthCredential); !ok {
return nil, &rtcerr.InvalidAccessError{Err: ErrTurnCredencials}
return nil, &rtcerr.InvalidAccessError{Err: ErrTurnCredentials}
}
default:
return nil, &rtcerr.InvalidAccessError{Err: ErrTurnCredencials}
return nil, &rtcerr.InvalidAccessError{Err: ErrTurnCredentials}
}
}

View File

@@ -34,24 +34,24 @@ func (s ICEServer) validate() ([]*ice.URL, error) {
if url.Scheme == ice.SchemeTypeTURN || url.Scheme == ice.SchemeTypeTURNS {
// // https://www.w3.org/TR/webrtc/#set-the-configuration (step #11.3.2)
// if s.Username == "" || s.Credential == nil {
// return nil, &rtcerr.InvalidAccessError{Err: ErrNoTurnCredencials}
// return nil, &rtcerr.InvalidAccessError{Err: ErrNoTurnCredentials}
// }
// switch s.CredentialType {
// case ICECredentialTypePassword:
// // https://www.w3.org/TR/webrtc/#set-the-configuration (step #11.3.3)
// if _, ok := s.Credential.(string); !ok {
// return nil, &rtcerr.InvalidAccessError{Err: ErrTurnCredencials}
// return nil, &rtcerr.InvalidAccessError{Err: ErrTurnCredentials}
// }
// case ICECredentialTypeOauth:
// // https://www.w3.org/TR/webrtc/#set-the-configuration (step #11.3.4)
// if _, ok := s.Credential.(OAuthCredential); !ok {
// return nil, &rtcerr.InvalidAccessError{Err: ErrTurnCredencials}
// return nil, &rtcerr.InvalidAccessError{Err: ErrTurnCredentials}
// }
// default:
// return nil, &rtcerr.InvalidAccessError{Err: ErrTurnCredencials}
// return nil, &rtcerr.InvalidAccessError{Err: ErrTurnCredentials}
// }
return nil, errors.New("TURN is not currently supported in the JavaScript/Wasm bindings")
}

View File

@@ -45,25 +45,25 @@ func TestICEServer_validate(t *testing.T) {
}{
{ICEServer{
URLs: []string{"turn:192.158.29.39?transport=udp"},
}, &rtcerr.InvalidAccessError{Err: ErrNoTurnCredencials}},
}, &rtcerr.InvalidAccessError{Err: ErrNoTurnCredentials}},
{ICEServer{
URLs: []string{"turn:192.158.29.39?transport=udp"},
Username: "unittest",
Credential: false,
CredentialType: ICECredentialTypePassword,
}, &rtcerr.InvalidAccessError{Err: ErrTurnCredencials}},
}, &rtcerr.InvalidAccessError{Err: ErrTurnCredentials}},
{ICEServer{
URLs: []string{"turn:192.158.29.39?transport=udp"},
Username: "unittest",
Credential: false,
CredentialType: ICECredentialTypeOauth,
}, &rtcerr.InvalidAccessError{Err: ErrTurnCredencials}},
}, &rtcerr.InvalidAccessError{Err: ErrTurnCredentials}},
{ICEServer{
URLs: []string{"turn:192.158.29.39?transport=udp"},
Username: "unittest",
Credential: false,
CredentialType: Unknown,
}, &rtcerr.InvalidAccessError{Err: ErrTurnCredencials}},
}, &rtcerr.InvalidAccessError{Err: ErrTurnCredentials}},
{ICEServer{
URLs: []string{"stun:google.de?transport=udp"},
Username: "unittest",

View File

@@ -104,7 +104,7 @@ func TestNew_Go(t *testing.T) {
},
},
})
}, &rtcerr.InvalidAccessError{Err: ErrNoTurnCredencials}},
}, &rtcerr.InvalidAccessError{Err: ErrNoTurnCredentials}},
}
for i, testCase := range testCases {
@@ -220,7 +220,7 @@ func TestPeerConnection_SetConfiguration_Go(t *testing.T) {
},
},
},
wantErr: &rtcerr.InvalidAccessError{Err: ErrNoTurnCredencials},
wantErr: &rtcerr.InvalidAccessError{Err: ErrNoTurnCredentials},
},
} {
pc, err := test.init()