server

package
v4.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 21, 2026 License: MIT Imports: 15 Imported by: 0

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

func HandleRequest

func HandleRequest(r Request) error

HandleRequest processes the give Request.

Types

type NonceHash

type NonceHash struct {
	// contains filtered or unexported fields
}

NonceHash is used to create and verify nonces.

func NewNonceHash

func NewNonceHash() (*NonceHash, error)

NewNonceHash creates a NonceHash.

func (*NonceHash) Generate

func (n *NonceHash) Generate() (string, error)

Generate a nonce.

func (*NonceHash) Validate

func (n *NonceHash) Validate(nonce string) error

Validate checks that nonce is signed and is not expired.

type Request

type Request struct {
	// Current Request State
	Conn    net.PacketConn
	SrcAddr net.Addr
	Buff    []byte

	// Server State
	AllocationManager *allocation.Manager
	NonceHash         *NonceHash

	// User Configuration
	AuthHandler        func(username string, realm string, srcAddr net.Addr) (key []byte, ok bool)
	Log                logging.LeveledLogger
	Realm              string
	ChannelBindTimeout time.Duration
}

Request contains all the state needed to process a single incoming datagram.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址