Documentation ¶
Overview ¶
Package auth contains variuos routines to generate and check STUNner authentication credentials.
Index ¶
- Constants
- func CheckTimeWindowedUsername(username string) error
- func GenerateAuthKey(username, realm, password string) []byte
- func GenerateTimeWindowedUsername(startTime time.Time, duration time.Duration, userid string) string
- func GetLongTermCredential(username string, sharedSecret string) (string, error)
- type AuthHandler
- type PermissionHandler
Constants ¶
const UsernameSeparator = ":"
UsernameSeparator is the separator character used in time-windowed TURN authentication as defined in "REST API For Access To TURN Services" (https://datatracker.ietf.org/doc/html/draft-uberti-behave-turn-rest-00).
Variables ¶
This section is empty.
Functions ¶
func CheckTimeWindowedUsername ¶
CheckTimeWindowedUsername checks the validity of an authentication credential. The method mostly follows the "REST API For Access To TURN Services" (https://datatracker.ietf.org/doc/html/draft-uberti-behave-turn-rest-00) spec with the exception that we make more effort to find out which component of the username is the UNIX timestamp: we find the first thing that looks like a UNIX timestamp in the username and use that for checking the time-windowed credential, and reject everything else.
func GenerateAuthKey ¶
GenerateAuthKey is a convenience function to easily generate keys in the format used by AuthHandler. Re-exported from `pion/turn` so that our callers will have a single import.
func GenerateTimeWindowedUsername ¶
func GenerateTimeWindowedUsername(startTime time.Time, duration time.Duration, userid string) string
GenerateTimeWindowedUsername creates a time-windowed username consisting of a validity timestamp and an arbitrary user id, as per the "REST API For Access To TURN Services" (https://datatracker.ietf.org/doc/html/draft-uberti-behave-turn-rest-00) spec.
Types ¶
type AuthHandler ¶ added in v0.14.5
type AuthHandler = turn.AuthHandler
AuthHandler specifies type of the TURN authentication handler used in Stunner. Re-exported from pion/turn for completeness.
type PermissionHandler ¶ added in v0.14.5
type PermissionHandler = turn.PermissionHandler
PermissionHandler specifies type of the TURN permission handler used in Stunner. Re-exported from pion/turn for completeness.