engine

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrorInvalidParams           = 5001000
	ErrorInvalidSDP              = 5001001
	ErrorInvalidCandidate        = 5001002
	ErrorRoomFull                = 5002000
	ErrorPeerNotFound            = 5002001
	ErrorPeerClosed              = 5002002
	ErrorTrackNotFound           = 5002003
	ErrorServerNewPeerConnection = 5003000
	ErrorServerCreateOffer       = 5003001
	ErrorServerSetLocalOffer     = 5003002
	ErrorServerNewTrack          = 5003003
	ErrorServerAddTransceiver    = 5003004
	ErrorServerSetRemoteOffer    = 5003005
	ErrorServerCreateAnswer      = 5003006
	ErrorServerSetLocalAnswer    = 5003007
	ErrorServerSetRemoteAnswer   = 5003008
	ErrorServerTimeout           = 5003999
)

Variables

This section is empty.

Functions

func Boot

func Boot(cp string)

func ServeRPC

func ServeRPC(engine *Engine, conf *Configuration) error

Types

type Call

type Call struct {
	Id     string `json:"id"`
	Method string `json:"method"`
	Params []any  `json:"params"`
}

type Configuration

type Configuration struct {
	Engine struct {
		Interface string `toml:"interface"`
		Address   string `toml:"address"`
		LogLevel  int    `toml:"log-level"`
		PortMin   uint16 `toml:"port-min"`
		PortMax   uint16 `toml:"port-max"`
	} `toml:"engine"`
	Turn struct {
		Host   string `toml:"host"`
		Secret string `toml:"secret"`
	} `toml:"turn"`
	RPC struct {
		Port int `toml:"port"`
	} `toml:"rpc"`
}

func Setup

func Setup(path string) (*Configuration, error)

type Engine

type Engine struct {
	IP        string
	Interface string
	PortMin   uint16
	PortMax   uint16

	State State
	// contains filtered or unexported fields
}

func BuildEngine

func BuildEngine(conf *Configuration) (*Engine, error)

func (*Engine) GetRoom

func (engine *Engine) GetRoom(rid string) *pmap

func (*Engine) Loop

func (engine *Engine) Loop()

type Error

type Error struct {
	Status      int    `json:"status"`
	Code        int    `json:"code"`
	Description string `json:"description"`
}

func (Error) Error

func (e Error) Error() string

type NTS

type NTS struct {
	URLs       string `json:"urls"`
	Credential string `json:"credential"`
	Username   string `json:"username"`
}

type Peer

type Peer struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func BuildPeer

func BuildPeer(rid, uid string, pc *webrtc.PeerConnection, callback string) *Peer

func (*Peer) Close

func (p *Peer) Close() error

type R

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

type Render

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

func NewRender

func NewRender(w http.ResponseWriter, id string) *Render

func (*Render) RenderData

func (r *Render) RenderData(data any)

func (*Render) RenderError

func (r *Render) RenderError(err error)

type Router

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

func NewRouter

func NewRouter(engine *Engine) *Router

type Sender

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

type State

type State struct {
	UpdatedAt   time.Time `json:"updated_at"`
	ActivePeers int       `json:"active_peers"`
	ClosedPeers int       `json:"closed_peers"`
	ActiveRooms int       `json:"active_rooms"`
	ClosedRooms int       `json:"closed_rooms"`
}

Jump to

Keyboard shortcuts

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