rtc

package
v0.6.8 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2022 License: AGPL-3.0, Apache-2.0 Imports: 25 Imported by: 4

Documentation

Index

Constants

View Source
const MaxTURNCredentialsExpiration = 7 * 24 * 60 // 1 week in minutes

Variables

This section is empty.

Functions

This section is empty.

Types

type ICEServerConfig added in v0.6.7

type ICEServerConfig struct {
	URLs       []string `toml:"urls" json:"urls"`
	Username   string   `toml:"username,omitempty" json:"username,omitempty"`
	Credential string   `toml:"credential,omitempty" json:"credential,omitempty"`
}

func (ICEServerConfig) IsSTUN added in v0.6.8

func (c ICEServerConfig) IsSTUN() bool

func (ICEServerConfig) IsTURN added in v0.6.8

func (c ICEServerConfig) IsTURN() bool

func (ICEServerConfig) IsValid added in v0.6.7

func (c ICEServerConfig) IsValid() error

type ICEServers added in v0.6.7

type ICEServers []ICEServerConfig

func GenTURNConfigs added in v0.6.8

func GenTURNConfigs(turnServers ICEServers, username, secret string, expiryMinutes int) (ICEServers, error)

func (*ICEServers) Decode added in v0.6.7

func (s *ICEServers) Decode(value string) error

func (ICEServers) IsValid added in v0.6.7

func (s ICEServers) IsValid() error

func (*ICEServers) UnmarshalTOML added in v0.6.7

func (s *ICEServers) UnmarshalTOML(data interface{}) error

type Message

type Message struct {
	GroupID   string      `msgpack:"group_id"`
	UserID    string      `msgpack:"user_id"`
	SessionID string      `msgpack:"session_id"`
	Type      MessageType `msgpack:"type"`
	Data      []byte      `msgpack:"data,omitempty"`
}

func (*Message) IsValid

func (m *Message) IsValid() error

type MessageType

type MessageType int
const (
	ICEMessage MessageType = iota + 1
	SDPMessage
	MuteMessage
	UnmuteMessage
	ScreenOnMessage
	ScreenOffMessage
)

type Metrics

type Metrics interface {
	IncRTCSessions(groupID string, callID string)
	DecRTCSessions(groupID string, callID string)
	IncRTCConnState(state string)
	IncRTPPackets(direction, trackType string)
	AddRTPPacketBytes(direction, trackType string, value int)
	IncRTCErrors(groupID string, errType string)
}

type Server

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

func NewServer

func NewServer(cfg ServerConfig, log mlog.LoggerIFace, metrics Metrics) (*Server, error)

func (*Server) CloseSession

func (s *Server) CloseSession(sessionID string) error

func (*Server) InitSession

func (s *Server) InitSession(cfg SessionConfig, closeCb func() error) error

func (*Server) ReceiveCh

func (s *Server) ReceiveCh() <-chan Message

func (*Server) Send

func (s *Server) Send(msg Message) error

func (*Server) Start

func (s *Server) Start() error

func (*Server) Stop

func (s *Server) Stop() error

type ServerConfig

type ServerConfig struct {
	// ICEPortUDP specifies the UDP port the RTC service should listen to.
	ICEPortUDP int `toml:"ice_port_udp"`
	// ICEHostOverride optionally specifies an IP address (or hostname)
	// to be used as the main host ICE candidate.
	ICEHostOverride string `toml:"ice_host_override"`
	// A list of ICE server (STUN/TURN) configurations to use.
	ICEServers ICEServers `toml:"ice_servers"`
	TURNConfig TURNConfig `toml:"turn"`
}

func (ServerConfig) IsValid

func (c ServerConfig) IsValid() error

type SessionConfig

type SessionConfig struct {
	// GroupID specifies the id of the group the session should belong to.
	GroupID string
	// CallID specifies the id of the call the session should belong to.
	CallID string
	// UserID specifies the id of the user the session belongs to.
	UserID string
	// SessionID specifies the unique identifier for the session.
	SessionID string
}

func (SessionConfig) IsValid

func (c SessionConfig) IsValid() error

type TURNConfig added in v0.6.8

type TURNConfig struct {
	// The secret key used to generate TURN short-lived authentication
	// credentials.
	StaticAuthSecret string `toml:"static_auth_secret"`
	// The number of minutes that the generated TURN credentials will be valid for.
	CredentialsExpirationMinutes int `toml:"credentials_expiration_minutes"`
}

func (TURNConfig) IsValid added in v0.6.8

func (c TURNConfig) IsValid() error

Jump to

Keyboard shortcuts

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