Documentation
¶
Overview ¶
Package server implements the private API to implement a TURN server
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type NonceHash ¶
type NonceHash struct {
// contains filtered or unexported fields
}
NonceHash is used to create and verify nonces.
type NonceManager ¶
NonceManager interface that both implementations satisfy.
func NewShortNonceHash ¶
func NewShortNonceHash(hmacLen int) (NonceManager, error)
NewShortNonceHash creates a ShortNonceHash. The hmacLen argument specifies the number of HMAC bytes to include (2-32 bytes). The total nonce size will be 4 + hmacLen bytes, default hmaclen is 12 bytes. The 4 bytes timestamp gives about ~8000 years before nonces would start to repeat (safe until year 10,135).
type Request ¶
type Request struct {
// Current Request State
Conn net.PacketConn
SrcAddr net.Addr
Buff []byte
TLS *tls.ConnectionState
// Server State
AllocationManager *allocation.Manager
NonceHash NonceManager
// User Configuration
AuthHandler auth.AuthHandler
// Quota Handler
QuotaHandler func(username string, realm string, srcAddr net.Addr) (ok bool)
Log logging.LeveledLogger
Realm string
ChannelBindTimeout time.Duration
PermissionTimeout time.Duration
AllocationLifetime time.Duration
}
Request contains all the state needed to process a single incoming datagram.
type ShortNonceHash ¶
type ShortNonceHash struct {
// contains filtered or unexported fields
}
ShortNonceHash is used to create and verify short nonces.
func (*ShortNonceHash) Generate ¶
func (s *ShortNonceHash) Generate() (string, error)
Generate a short nonce (4 + hmacLen bytes encoded as base36).
func (*ShortNonceHash) Validate ¶
func (s *ShortNonceHash) Validate(nonce string) error
Validate checks that nonce is signed and is not expired.