Documentation ¶
Index ¶
- Constants
- Variables
- func EnsureAdminPermission(ctx context.Context, room string) error
- func EnsureCreatePermission(ctx context.Context) error
- func EnsureJoinPermission(ctx context.Context) (name string, err error)
- func EnsureListPermission(ctx context.Context) error
- func GetGrants(ctx context.Context) *auth.ClaimGrants
- func NewTurnServer(conf *config.Config, roomStore RoomStore, node routing.LocalNode) (*turn.Server, error)
- func SetAuthorizationToken(r *http.Request, token string)
- type APIKeyAuthMiddleware
- type LivekitServer
- type LocalRoomStore
- func (p *LocalRoomStore) CreateRoom(room *livekit.Room) error
- func (p *LocalRoomStore) DeleteParticipant(roomName, identity string) error
- func (p *LocalRoomStore) DeleteRoom(idOrName string) error
- func (p *LocalRoomStore) GetParticipant(roomName, identity string) (*livekit.ParticipantInfo, error)
- func (p *LocalRoomStore) GetRoom(idOrName string) (*livekit.Room, error)
- func (p *LocalRoomStore) ListParticipants(roomName string) ([]*livekit.ParticipantInfo, error)
- func (p *LocalRoomStore) ListRooms() ([]*livekit.Room, error)
- func (p *LocalRoomStore) LockRoom(name string, duration time.Duration) (string, error)
- func (p *LocalRoomStore) PersistParticipant(roomName string, participant *livekit.ParticipantInfo) error
- func (p *LocalRoomStore) UnlockRoom(name string, uid string) error
- type RTCService
- type RedisRoomStore
- func (p *RedisRoomStore) CreateRoom(room *livekit.Room) error
- func (p *RedisRoomStore) DeleteParticipant(roomName, identity string) error
- func (p *RedisRoomStore) DeleteRoom(idOrName string) error
- func (p *RedisRoomStore) GetParticipant(roomName, identity string) (*livekit.ParticipantInfo, error)
- func (p *RedisRoomStore) GetRoom(idOrName string) (*livekit.Room, error)
- func (p *RedisRoomStore) ListParticipants(roomName string) ([]*livekit.ParticipantInfo, error)
- func (p *RedisRoomStore) ListRooms() ([]*livekit.Room, error)
- func (p *RedisRoomStore) LockRoom(name string, duration time.Duration) (string, error)
- func (p *RedisRoomStore) PersistParticipant(roomName string, participant *livekit.ParticipantInfo) error
- func (p *RedisRoomStore) UnlockRoom(name string, uid string) error
- type RoomManager
- func (r *RoomManager) CleanupRooms() error
- func (r *RoomManager) CloseIdleRooms()
- func (r *RoomManager) CreateRoom(req *livekit.CreateRoomRequest) (*livekit.Room, error)
- func (r *RoomManager) DeleteRoom(roomName string) error
- func (r *RoomManager) GetRoom(roomName string) *rtc.Room
- func (r *RoomManager) StartSession(roomName string, pi routing.ParticipantInit, ...)
- func (r *RoomManager) Stop()
- type RoomService
- func (s *RoomService) CreateRoom(ctx context.Context, req *livekit.CreateRoomRequest) (rm *livekit.Room, err error)
- func (s *RoomService) DeleteRoom(ctx context.Context, req *livekit.DeleteRoomRequest) (*livekit.DeleteRoomResponse, error)
- func (s *RoomService) GetParticipant(ctx context.Context, req *livekit.RoomParticipantIdentity) (res *livekit.ParticipantInfo, err error)
- func (s *RoomService) ListParticipants(ctx context.Context, req *livekit.ListParticipantsRequest) (res *livekit.ListParticipantsResponse, err error)
- func (s *RoomService) ListRooms(ctx context.Context, req *livekit.ListRoomsRequest) (res *livekit.ListRoomsResponse, err error)
- func (s *RoomService) MutePublishedTrack(ctx context.Context, req *livekit.MuteRoomTrackRequest) (res *livekit.MuteRoomTrackResponse, err error)
- func (s *RoomService) RemoveParticipant(ctx context.Context, req *livekit.RoomParticipantIdentity) (res *livekit.RemoveParticipantResponse, err error)
- func (s *RoomService) UpdateParticipant(ctx context.Context, req *livekit.UpdateParticipantRequest) (*livekit.ParticipantInfo, error)
- func (s *RoomService) UpdateSubscriptions(ctx context.Context, req *livekit.UpdateSubscriptionsRequest) (*livekit.UpdateSubscriptionsResponse, error)
- type RoomStore
- type WSSignalConnection
Constants ¶
const ( // RoomsKey is hash of room_name => Room proto RoomsKey = "rooms" // RoomIdMap is hash of room_id => room name RoomIdMap = "room_id_map" // RoomParticipantsPrefix is hash of participant_name => ParticipantInfo // a key for each room, with expiration RoomParticipantsPrefix = "room_participants:" // RoomLockPrefix is a simple key containing a provided lock uid RoomLockPrefix = "room_lock:" )
Variables ¶
var ( ErrRoomNotFound = errors.New("requested room does not exist") ErrRoomLockFailed = errors.New("could not lock room") ErrRoomUnlockFailed = errors.New("could not unlock room, lock token does not match") ErrParticipantNotFound = errors.New("participant does not exist") ErrTrackNotFound = errors.New("track is not found") )
var (
ErrPermissionDenied = errors.New("permissions denied")
)
var ServiceSet = wire.NewSet( NewRoomService, NewRTCService, NewLivekitServer, NewRoomManager, NewTurnServer, config.GetAudioConfig, wire.Bind(new(livekit.RoomService), new(*RoomService)), )
Functions ¶
func EnsureCreatePermission ¶
func EnsureListPermission ¶
func NewTurnServer ¶
func SetAuthorizationToken ¶
Types ¶
type APIKeyAuthMiddleware ¶
type APIKeyAuthMiddleware struct {
// contains filtered or unexported fields
}
authentication middleware
func NewAPIKeyAuthMiddleware ¶
func NewAPIKeyAuthMiddleware(provider auth.KeyProvider) *APIKeyAuthMiddleware
func (*APIKeyAuthMiddleware) ServeHTTP ¶
func (m *APIKeyAuthMiddleware) ServeHTTP(w http.ResponseWriter, r *http.Request, next http.HandlerFunc)
type LivekitServer ¶
type LivekitServer struct {
// contains filtered or unexported fields
}
func InitializeServer ¶
func InitializeServer(conf *config.Config, keyProvider auth.KeyProvider, roomStore RoomStore, router routing.Router, currentNode routing.LocalNode, selector routing.NodeSelector) (*LivekitServer, error)
func NewLivekitServer ¶
func NewLivekitServer(conf *config.Config, roomService livekit.RoomService, rtcService *RTCService, keyProvider auth.KeyProvider, router routing.Router, roomManager *RoomManager, turnServer *turn.Server, currentNode routing.LocalNode, ) (s *LivekitServer, err error)
func (*LivekitServer) IsRunning ¶
func (s *LivekitServer) IsRunning() bool
func (*LivekitServer) Node ¶
func (s *LivekitServer) Node() *livekit.Node
func (*LivekitServer) RoomManager ¶ added in v0.9.2
func (s *LivekitServer) RoomManager() *RoomManager
func (*LivekitServer) Start ¶
func (s *LivekitServer) Start() error
func (*LivekitServer) Stop ¶
func (s *LivekitServer) Stop()
type LocalRoomStore ¶
type LocalRoomStore struct {
// contains filtered or unexported fields
}
encapsulates CRUD operations for room settings
func NewLocalRoomStore ¶
func NewLocalRoomStore() *LocalRoomStore
func (*LocalRoomStore) CreateRoom ¶
func (p *LocalRoomStore) CreateRoom(room *livekit.Room) error
func (*LocalRoomStore) DeleteParticipant ¶
func (p *LocalRoomStore) DeleteParticipant(roomName, identity string) error
func (*LocalRoomStore) DeleteRoom ¶
func (p *LocalRoomStore) DeleteRoom(idOrName string) error
func (*LocalRoomStore) GetParticipant ¶
func (p *LocalRoomStore) GetParticipant(roomName, identity string) (*livekit.ParticipantInfo, error)
func (*LocalRoomStore) GetRoom ¶
func (p *LocalRoomStore) GetRoom(idOrName string) (*livekit.Room, error)
func (*LocalRoomStore) ListParticipants ¶
func (p *LocalRoomStore) ListParticipants(roomName string) ([]*livekit.ParticipantInfo, error)
func (*LocalRoomStore) PersistParticipant ¶
func (p *LocalRoomStore) PersistParticipant(roomName string, participant *livekit.ParticipantInfo) error
func (*LocalRoomStore) UnlockRoom ¶ added in v0.10.6
func (p *LocalRoomStore) UnlockRoom(name string, uid string) error
type RTCService ¶
type RTCService struct {
// contains filtered or unexported fields
}
func NewRTCService ¶
func NewRTCService(conf *config.Config, roomStore RoomStore, roomManager *RoomManager, router routing.Router, currentNode routing.LocalNode) *RTCService
func (*RTCService) ServeHTTP ¶
func (s *RTCService) ServeHTTP(w http.ResponseWriter, r *http.Request)
type RedisRoomStore ¶
type RedisRoomStore struct {
// contains filtered or unexported fields
}
func NewRedisRoomStore ¶
func NewRedisRoomStore(rc *redis.Client) *RedisRoomStore
func (*RedisRoomStore) CreateRoom ¶
func (p *RedisRoomStore) CreateRoom(room *livekit.Room) error
func (*RedisRoomStore) DeleteParticipant ¶
func (p *RedisRoomStore) DeleteParticipant(roomName, identity string) error
func (*RedisRoomStore) DeleteRoom ¶
func (p *RedisRoomStore) DeleteRoom(idOrName string) error
func (*RedisRoomStore) GetParticipant ¶
func (p *RedisRoomStore) GetParticipant(roomName, identity string) (*livekit.ParticipantInfo, error)
func (*RedisRoomStore) GetRoom ¶
func (p *RedisRoomStore) GetRoom(idOrName string) (*livekit.Room, error)
func (*RedisRoomStore) ListParticipants ¶
func (p *RedisRoomStore) ListParticipants(roomName string) ([]*livekit.ParticipantInfo, error)
func (*RedisRoomStore) PersistParticipant ¶
func (p *RedisRoomStore) PersistParticipant(roomName string, participant *livekit.ParticipantInfo) error
func (*RedisRoomStore) UnlockRoom ¶ added in v0.10.6
func (p *RedisRoomStore) UnlockRoom(name string, uid string) error
type RoomManager ¶
type RoomManager struct {
// contains filtered or unexported fields
}
RoomManager manages rooms and its interaction with participants. It's responsible for creating, deleting rooms, as well as running sessions for participants
func NewRoomManager ¶
func (*RoomManager) CleanupRooms ¶
func (r *RoomManager) CleanupRooms() error
CleanupRooms cleans up after old rooms that have been around for awhile
func (*RoomManager) CloseIdleRooms ¶
func (r *RoomManager) CloseIdleRooms()
func (*RoomManager) CreateRoom ¶
func (r *RoomManager) CreateRoom(req *livekit.CreateRoomRequest) (*livekit.Room, error)
CreateRoom creates a new room from a request and allocates it to a node to handle it'll also monitor fits state, and cleans it up when appropriate
func (*RoomManager) DeleteRoom ¶
func (r *RoomManager) DeleteRoom(roomName string) error
DeleteRoom completely deletes all room information, including active sessions, room store, and routing info
func (*RoomManager) GetRoom ¶ added in v0.9.2
func (r *RoomManager) GetRoom(roomName string) *rtc.Room
func (*RoomManager) StartSession ¶
func (r *RoomManager) StartSession(roomName string, pi routing.ParticipantInit, requestSource routing.MessageSource, responseSink routing.MessageSink)
StartSession starts WebRTC session when a new participant is connected, takes place on RTC node
func (*RoomManager) Stop ¶
func (r *RoomManager) Stop()
type RoomService ¶
type RoomService struct {
// contains filtered or unexported fields
}
A rooms service that supports a single node
func NewRoomService ¶
func NewRoomService(roomManager *RoomManager) (svc *RoomService, err error)
func (*RoomService) CreateRoom ¶
func (s *RoomService) CreateRoom(ctx context.Context, req *livekit.CreateRoomRequest) (rm *livekit.Room, err error)
func (*RoomService) DeleteRoom ¶
func (s *RoomService) DeleteRoom(ctx context.Context, req *livekit.DeleteRoomRequest) (*livekit.DeleteRoomResponse, error)
func (*RoomService) GetParticipant ¶
func (s *RoomService) GetParticipant(ctx context.Context, req *livekit.RoomParticipantIdentity) (res *livekit.ParticipantInfo, err error)
func (*RoomService) ListParticipants ¶
func (s *RoomService) ListParticipants(ctx context.Context, req *livekit.ListParticipantsRequest) (res *livekit.ListParticipantsResponse, err error)
func (*RoomService) ListRooms ¶
func (s *RoomService) ListRooms(ctx context.Context, req *livekit.ListRoomsRequest) (res *livekit.ListRoomsResponse, err error)
func (*RoomService) MutePublishedTrack ¶
func (s *RoomService) MutePublishedTrack(ctx context.Context, req *livekit.MuteRoomTrackRequest) (res *livekit.MuteRoomTrackResponse, err error)
func (*RoomService) RemoveParticipant ¶
func (s *RoomService) RemoveParticipant(ctx context.Context, req *livekit.RoomParticipantIdentity) (res *livekit.RemoveParticipantResponse, err error)
func (*RoomService) UpdateParticipant ¶
func (s *RoomService) UpdateParticipant(ctx context.Context, req *livekit.UpdateParticipantRequest) (*livekit.ParticipantInfo, error)
func (*RoomService) UpdateSubscriptions ¶ added in v0.9.14
func (s *RoomService) UpdateSubscriptions(ctx context.Context, req *livekit.UpdateSubscriptionsRequest) (*livekit.UpdateSubscriptionsResponse, error)
type RoomStore ¶
type RoomStore interface { CreateRoom(room *livekit.Room) error GetRoom(idOrName string) (*livekit.Room, error) ListRooms() ([]*livekit.Room, error) DeleteRoom(idOrName string) error // enable locking on a specific room to prevent race // returns a (lock uuid, error) LockRoom(name string, duration time.Duration) (string, error) UnlockRoom(name string, uid string) error PersistParticipant(roomName string, participant *livekit.ParticipantInfo) error GetParticipant(roomName, identity string) (*livekit.ParticipantInfo, error) ListParticipants(roomName string) ([]*livekit.ParticipantInfo, error) DeleteParticipant(roomName, identity string) error }
encapsulates CRUD operations for room settings look up participant
type WSSignalConnection ¶
type WSSignalConnection struct {
// contains filtered or unexported fields
}
func NewWSSignalConnection ¶
func NewWSSignalConnection(conn types.WebsocketClient) *WSSignalConnection
func (*WSSignalConnection) ReadRequest ¶
func (c *WSSignalConnection) ReadRequest() (*livekit.SignalRequest, error)
func (*WSSignalConnection) WriteResponse ¶
func (c *WSSignalConnection) WriteResponse(msg *livekit.SignalResponse) error