router

package
v0.0.0-...-6470968 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNSNotFound           = errors.New("namespace not found")
	ErrRouterNotFound       = errors.New("router not found")
	ErrSessionAlreadyExists = errors.New("session already exists")
	ErrRouterClosed         = errors.New("router closed")
	ErrSessionIdleTimeout   = errors.New("session idle timeout")
	ErrProducerEmpty        = errors.New("producer empty")
	ErrProducerRepeated     = errors.New("producer repeated")
	ErrStreamFormatNotFound = errors.New("stream format not found")
	ErrStreamClosed         = errors.New("stream closed")
	ErrNilFrameDestination  = errors.New("nil frame destination")
	ErrNilFrameSource       = errors.New("nil frame source")
	ErrStreamTimeout        = errors.New("stream timeout")
	ErrFrameSourceExists    = errors.New("frame source exists")
	ErrPaddingDestination   = errors.New("padding destination")
)

Functions

This section is empty.

Types

type NSManager

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

func NewNSManager

func NewNSManager(params NSManagerParams) *NSManager

func (*NSManager) GetOrNewNamespace

func (m *NSManager) GetOrNewNamespace(ctx context.Context, name string) (*Namespace, bool)

func (*NSManager) GetOrNewNamespaceByDomain

func (m *NSManager) GetOrNewNamespaceByDomain(ctx context.Context, domain string) (*Namespace, bool)

func (*NSManager) LookupDomain

func (m *NSManager) LookupDomain(domain string) (*Namespace, bool)

func (*NSManager) Namespaces

func (m *NSManager) Namespaces() []*Namespace

func (*NSManager) String

func (m *NSManager) String() string

type NSManagerParams

type NSManagerParams struct {
	Namespaces             map[string]NamespaceParams `yaml:"namespaces" json:"namespaces" mapstructure:"namespaces"`
	DefaultNamespaceParams *NamespaceParams           `yaml:"default_namespace" json:"default_namespace" mapstructure:"default_namespace"`
}

type Namespace

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

func NewNamespace

func NewNamespace(ctx context.Context, params NamespaceParams) *Namespace

func (*Namespace) Domains

func (ns *Namespace) Domains() []string

func (*Namespace) GetOrNewRouter

func (ns *Namespace) GetOrNewRouter(id string) (Router, bool)

func (*Namespace) HasDomain

func (ns *Namespace) HasDomain(domain string) bool

func (*Namespace) Name

func (ns *Namespace) Name() string

func (*Namespace) RemoveRouter

func (ns *Namespace) RemoveRouter(r Router)

func (*Namespace) Router

func (ns *Namespace) Router(name string) Router

type NamespaceParams

type NamespaceParams struct {
	Name                string                  `yaml:"name" json:"name" mapstructure:"name"`
	Domains             []string                `yaml:"domains" json:"domains" mapstructure:"domains"`
	DefaultRouterParams RouterParams            `yaml:"default_router" json:"default_router" mapstructure:"default_router"`
	RoutersParams       map[string]RouterParams `yaml:"routers" json:"routers" mapstructure:"routers"`
}

type PeerParams

type PeerParams struct {
	ACodec         deliver.CodecType  `json:"audio_codec"`
	VCodec         deliver.CodecType  `json:"video_codec"`
	PacketType     deliver.PacketType `json:"packet_type"`
	RemoteAddr     string
	LocalAddr      string
	PeerID         string
	RouterID       string
	Domain         string
	URI            string // URI is the path of the request, e.g. /live/room1
	Args           map[string]string
	Producer       bool
	HasAudio       bool
	HasVideo       bool
	HasDataChannel bool
}

type Router

type Router interface {
	ID() string
	AddSession(s Session) error
	Namespace() *Namespace
	Context() context.Context
	Closed() bool
}

func NewRouter

func NewRouter(ctx context.Context, ns *Namespace, params RouterParams, id string, logger *logrus.Entry) Router

type RouterImpl

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

func (*RouterImpl) AddSession

func (r *RouterImpl) AddSession(s Session) error

func (*RouterImpl) Closed

func (r *RouterImpl) Closed() bool

func (*RouterImpl) Context

func (r *RouterImpl) Context() context.Context

func (*RouterImpl) ID

func (r *RouterImpl) ID() string

func (*RouterImpl) Namespace

func (r *RouterImpl) Namespace() *Namespace

type RouterParams

type RouterParams struct {
	IdleSubscriberTimeout int `yaml:"idle_subscriber_timeout" json:"idle_subscriber_timeout" mapstructure:"idle_subscriber_timeout"`
	MaxProducerTimeout    int `yaml:"max_producer_timeout" json:"max_producer_timeout" mapstructure:"max_producer_timeout"`
	MaxSubscriberTimeout  int `yaml:"max_subscriber_timeout" json:"max_subscriber_timeout" mapstructure:"max_subscriber_timeout"`
}

type Session

type Session interface {
	ID() string
	Set(key, value interface{})
	Get(key interface{}) interface{}
	Logger() *logrus.Entry
	Context() context.Context
	GetNamespace() *Namespace
	SetNamespace(ns *Namespace)
	GetRouter() Router
	SetRouter(r Router)
	PeerParams() PeerParams
	Finalize(e error)
	RouterID() string
	BindFrameSource(src deliver.FrameSource) error
	BindFrameDestination(dest deliver.FrameDestination) error
	FrameSource() deliver.FrameSource
	FrameDestination() deliver.FrameDestination
	Join() error
}

type Stream

type Stream interface {
	GetFormat(fmtName string) (StreamFormat, error)
	AddFrameSource(source deliver.FrameSource) error
	AddFrameDestination(dest deliver.FrameDestination) (err error)
	Close()
}

func NewStreamImpl

func NewStreamImpl(ctx context.Context, id string) Stream

type StreamFormat

type StreamFormat interface {
	deliver.MediaFramePipe
}

func NewStreamFormat

func NewStreamFormat(ctx context.Context, fmtSettings deliver.FormatSettings, opts ...StreamFormatOption) (StreamFormat, error)

type StreamFormatImpl

type StreamFormatImpl struct {
	deliver.MediaFramePipe
	// contains filtered or unexported fields
}

func (*StreamFormatImpl) Close

func (fmt *StreamFormatImpl) Close()

type StreamFormatOption

type StreamFormatOption func(*StreamFormatImpl)

func WithFrameSourceManager

func WithFrameSourceManager(sm *sourcemanager.Instance) StreamFormatOption

type StreamImpl

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

func (*StreamImpl) AddFrameDestination

func (s *StreamImpl) AddFrameDestination(dest deliver.FrameDestination) (err error)

func (*StreamImpl) AddFrameSource

func (s *StreamImpl) AddFrameSource(source deliver.FrameSource) error

func (*StreamImpl) Close

func (s *StreamImpl) Close()

func (*StreamImpl) GetFormat

func (s *StreamImpl) GetFormat(fmtName string) (StreamFormat, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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