Add Username/Password to URL

Needed to allow auth for TURN
This commit is contained in:
Sean DuBois
2019-05-25 16:05:53 -07:00
parent ef86b93272
commit f88c7d2cfa
2 changed files with 12 additions and 4 deletions

View File

@@ -41,4 +41,10 @@ var (
// ErrRemotePwdEmpty indicates agent was started with an empty remote pwd // ErrRemotePwdEmpty indicates agent was started with an empty remote pwd
ErrRemotePwdEmpty = errors.New("remote pwd is empty") ErrRemotePwdEmpty = errors.New("remote pwd is empty")
// ErrUsernameEmpty indicates agent was give TURN URL with an empty Username
ErrUsernameEmpty = errors.New("username is empty")
// ErrPasswordEmpty indicates agent was give TURN URL with an empty Password
ErrPasswordEmpty = errors.New("password is empty")
) )

10
url.go
View File

@@ -99,10 +99,12 @@ func (t ProtoType) String() string {
// URL represents a STUN (rfc7064) or TURN (rfc7065) URL // URL represents a STUN (rfc7064) or TURN (rfc7065) URL
type URL struct { type URL struct {
Scheme SchemeType Scheme SchemeType
Host string Host string
Port int Port int
Proto ProtoType Username string
Password string
Proto ProtoType
} }
// ParseURL parses a STUN or TURN urls following the ABNF syntax described in // ParseURL parses a STUN or TURN urls following the ABNF syntax described in