api

package
v0.0.0-...-ac3bcd5 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2026 License: MIT Imports: 38 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	Router  *mux.Router
	Handler http.Handler
	DB      common.DBInterface
	// contains filtered or unexported fields
}

func (*App) AdminCreateDynamicConfig

func (a *App) AdminCreateDynamicConfig(w http.ResponseWriter, r *http.Request)

func (*App) AdminCreateRoom

func (a *App) AdminCreateRoom(w http.ResponseWriter, r *http.Request)

func (*App) AdminDeleteDynamicConfig

func (a *App) AdminDeleteDynamicConfig(w http.ResponseWriter, r *http.Request)

func (*App) AdminDeleteRoom

func (a *App) AdminDeleteRoom(w http.ResponseWriter, r *http.Request)

func (*App) AdminDeleteRoomsStatistics

func (a *App) AdminDeleteRoomsStatistics(w http.ResponseWriter, r *http.Request)

func (*App) AdminGatewaysHandleInfo

func (a *App) AdminGatewaysHandleInfo(w http.ResponseWriter, r *http.Request)

func (*App) AdminGetDynamicConfig

func (a *App) AdminGetDynamicConfig(w http.ResponseWriter, r *http.Request)

func (*App) AdminGetRoom

func (a *App) AdminGetRoom(w http.ResponseWriter, r *http.Request)

func (*App) AdminListDynamicConfigs

func (a *App) AdminListDynamicConfigs(w http.ResponseWriter, r *http.Request)

func (*App) AdminListGateways

func (a *App) AdminListGateways(w http.ResponseWriter, r *http.Request)

func (*App) AdminListRooms

func (a *App) AdminListRooms(w http.ResponseWriter, r *http.Request)

func (*App) AdminListSessions

func (a *App) AdminListSessions(w http.ResponseWriter, r *http.Request)

func (*App) AdminSetDynamicConfig

func (a *App) AdminSetDynamicConfig(w http.ResponseWriter, r *http.Request)

func (*App) AdminUpdateDynamicConfig

func (a *App) AdminUpdateDynamicConfig(w http.ResponseWriter, r *http.Request)

func (*App) AdminUpdateRoom

func (a *App) AdminUpdateRoom(w http.ResponseWriter, r *http.Request)

func (*App) HealthCheck

func (a *App) HealthCheck(w http.ResponseWriter, r *http.Request)

func (*App) Initialize

func (a *App) Initialize()

func (*App) InitializeWithDeps

func (a *App) InitializeWithDeps(db common.DBInterface, tokenVerifier middleware.OIDCTokenVerifier)

func (*App) Run

func (a *App) Run()

func (*App) Shutdown

func (a *App) Shutdown()

func (*App) V1CreateGroup

func (a *App) V1CreateGroup(w http.ResponseWriter, r *http.Request)

func (*App) V1GetComposite

func (a *App) V1GetComposite(w http.ResponseWriter, r *http.Request)

func (*App) V1GetRoom

func (a *App) V1GetRoom(w http.ResponseWriter, r *http.Request)

func (*App) V1GetUser

func (a *App) V1GetUser(w http.ResponseWriter, r *http.Request)

func (*App) V1HandleEvent

func (a *App) V1HandleEvent(w http.ResponseWriter, r *http.Request)

func (*App) V1HandleProtocol

func (a *App) V1HandleProtocol(w http.ResponseWriter, r *http.Request)

func (*App) V1HandleServiceProtocol

func (a *App) V1HandleServiceProtocol(w http.ResponseWriter, r *http.Request)

func (*App) V1ListComposites

func (a *App) V1ListComposites(w http.ResponseWriter, r *http.Request)

func (*App) V1ListGroups

func (a *App) V1ListGroups(w http.ResponseWriter, r *http.Request)

func (*App) V1ListRooms

func (a *App) V1ListRooms(w http.ResponseWriter, r *http.Request)

func (*App) V1ListUsers

func (a *App) V1ListUsers(w http.ResponseWriter, r *http.Request)

func (*App) V1UpdateComposite

func (a *App) V1UpdateComposite(w http.ResponseWriter, r *http.Request)

func (*App) V1UpdateRoom

func (a *App) V1UpdateRoom(w http.ResponseWriter, r *http.Request)

func (*App) V1UpdateSession

func (a *App) V1UpdateSession(w http.ResponseWriter, r *http.Request)

func (*App) V2GetConfig

func (a *App) V2GetConfig(w http.ResponseWriter, r *http.Request)

func (*App) V2GetRoomServer

func (a *App) V2GetRoomServer(w http.ResponseWriter, r *http.Request)

func (*App) V2GetRoomsStatistics

func (a *App) V2GetRoomsStatistics(w http.ResponseWriter, r *http.Request)

func (*App) V2GetVHInfo

func (a *App) V2GetVHInfo(w http.ResponseWriter, r *http.Request)

type AppCache

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

func (*AppCache) Close

func (c *AppCache) Close()

func (*AppCache) Init

func (c *AppCache) Init(db common.DBInterface) error

func (*AppCache) ReloadAll

func (c *AppCache) ReloadAll(db common.DBInterface) error

type DynamicConfigCache

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

func (*DynamicConfigCache) ByKey

func (*DynamicConfigCache) LastModified

func (c *DynamicConfigCache) LastModified() time.Time

func (*DynamicConfigCache) Reload

func (*DynamicConfigCache) Set

func (*DynamicConfigCache) Values

func (c *DynamicConfigCache) Values() []*models.DynamicConfig

type DynamicConfigsResponse

type DynamicConfigsResponse struct {
	ListResponse
	Items []*models.DynamicConfig `json:"data"`
}

type FailoverMapping

type FailoverMapping struct {
	FailedServer   string    // Primary server that failed (e.g., "gxy1")
	FailoverServer string    // Failover server replacing it (e.g., "gxy12")
	FailedAt       time.Time // When failover happened
}

FailoverMapping tracks which failover server is serving which failed primary

type GatewayCache

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

func (*GatewayCache) ByID

func (c *GatewayCache) ByID(id int64) (*models.Gateway, bool)

func (*GatewayCache) ByName

func (c *GatewayCache) ByName(name string) (*models.Gateway, bool)

func (*GatewayCache) Reload

func (c *GatewayCache) Reload(db common.DBInterface) error

func (*GatewayCache) Set

func (c *GatewayCache) Set(gateway *models.Gateway)

func (*GatewayCache) Values

func (c *GatewayCache) Values() []*models.Gateway

type GatewayDTO

type GatewayDTO struct {
	ID          int64       `json:"id"`
	Name        string      `json:"name"`
	Description null.String `json:"description,omitempty"`
	URL         string      `json:"url"`
	Disabled    bool        `json:"disabled"`
	CreatedAt   time.Time   `json:"created_at"`
	UpdatedAt   null.Time   `json:"updated_at,omitempty"`
	RemovedAt   null.Time   `json:"removed_at,omitempty"`
	Type        string      `json:"type"`
}

func NewGatewayDTO

func NewGatewayDTO(g *models.Gateway) *GatewayDTO

type GatewayStatus

type GatewayStatus struct {
	Name         string
	Online       bool
	Sessions     int
	LastSeen     time.Time
	OfflineAt    time.Time   // When server went offline
	OfflineTimer *time.Timer // Timer for failover trigger
	// contains filtered or unexported fields
}

GatewayStatus holds the status of a Janus gateway

type GatewaysResponse

type GatewaysResponse struct {
	ListResponse
	Gateways []*GatewayDTO `json:"data"`
}

type JanusAdminResponse

type JanusAdminResponse struct {
	Janus       string  `json:"janus"`
	Transaction string  `json:"transaction"`
	Sessions    []int64 `json:"sessions"`
}

JanusAdminResponse represents the response from Janus admin API

type JanusStatusMessage

type JanusStatusMessage struct {
	Online bool `json:"online"`
}

JanusStatusMessage represents the status message from Janus gateway

type ListParams

type ListParams struct {
	PageNumber int    `json:"page_no"`
	PageSize   int    `json:"page_size"`
	OrderBy    string `json:"order_by"`
	GroupBy    string `json:"-"`
}

func ParseListParams

func ParseListParams(query url.Values) (*ListParams, error)

type ListResponse

type ListResponse struct {
	Total int64 `json:"total"`
}

type MQTTListener

type MQTTListener struct {
	SessionManager SessionManager
	// contains filtered or unexported fields
}

func NewMQTTListener

func NewMQTTListener(cache *AppCache, sph ServiceProtocolHandler, sm SessionManager, adminSecret string, roomServerAssignmentMgr *domain.RoomServerAssignmentManager) *MQTTListener

func (*MQTTListener) Client

func (l *MQTTListener) Client() mqtt.Client

func (*MQTTListener) Close

func (l *MQTTListener) Close()

func (*MQTTListener) GetGatewayStatuses

func (l *MQTTListener) GetGatewayStatuses() map[string]*common.GatewayStatusInfo

GetGatewayStatuses returns a copy of all gateway statuses (thread-safe) Returns simple structs without mutexes for external use

func (*MQTTListener) HandleEvent

func (l *MQTTListener) HandleEvent(c mqtt.Client, m mqtt.Message)

func (*MQTTListener) HandleGatewayAdminResponse

func (l *MQTTListener) HandleGatewayAdminResponse(c mqtt.Client, m mqtt.Message)

HandleGatewayAdminResponse processes admin responses from Janus gateways (janus/{server}/from-janus-admin)

func (*MQTTListener) HandleGatewayStatus

func (l *MQTTListener) HandleGatewayStatus(c mqtt.Client, m mqtt.Message)

HandleGatewayStatus processes status messages from Janus gateways (janus/{server}/status)

func (*MQTTListener) HandleServiceProtocol

func (l *MQTTListener) HandleServiceProtocol(c mqtt.Client, m mqtt.Message)

func (*MQTTListener) IsGatewayOnline

func (l *MQTTListener) IsGatewayOnline(serverName string) bool

IsGatewayOnline implements domain.GatewayStatusChecker

func (*MQTTListener) SendAdminMessage

func (l *MQTTListener) SendAdminMessage(topic string)

SendAdminMessage sends a list_sessions request to a Janus gateway

func (*MQTTListener) SetAdminClient

func (l *MQTTListener) SetAdminClient(ac *janus.MQTTAdminClient)

func (*MQTTListener) Start

func (l *MQTTListener) Start() error

func (*MQTTListener) Subscribe

func (l *MQTTListener) Subscribe(c mqtt.Client)

func (*MQTTListener) UpdateSession

func (l *MQTTListener) UpdateSession(c mqtt.Client, m mqtt.Message)

type PahoLogAdapter

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

func NewPahoLogAdapter

func NewPahoLogAdapter(level zerolog.Level) *PahoLogAdapter

func (*PahoLogAdapter) Printf

func (a *PahoLogAdapter) Printf(format string, v ...interface{})

func (*PahoLogAdapter) Println

func (a *PahoLogAdapter) Println(v ...interface{})

type PeriodicSessionCleaner

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

func (*PeriodicSessionCleaner) Close

func (psc *PeriodicSessionCleaner) Close()

func (*PeriodicSessionCleaner) Start

func (psc *PeriodicSessionCleaner) Start()

type ProtocolError

type ProtocolError struct {
	errs.WithMessage
}

func NewProtocolError

func NewProtocolError(msg string) *ProtocolError

func WrappingProtocolError

func WrappingProtocolError(err error, msg string) *ProtocolError

type RoomCache

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

func (*RoomCache) ByGatewayUID

func (c *RoomCache) ByGatewayUID(uid string) (*models.Room, bool)

func (*RoomCache) Reload

func (c *RoomCache) Reload(db common.DBInterface) error

func (*RoomCache) Set

func (c *RoomCache) Set(room *models.Room)

func (*RoomCache) Values

func (c *RoomCache) Values() []*models.Room

type RoomsRequest

type RoomsRequest struct {
	Gateways []int64
	Disabled null.Bool
	Removed  null.Bool
	Term     string
}

func ParseRoomsRequest

func ParseRoomsRequest(query url.Values) (*RoomsRequest, error)

type RoomsResponse

type RoomsResponse struct {
	ListResponse
	Rooms []*models.Room `json:"data"`
}

type ServiceProtocolHandler

type ServiceProtocolHandler interface {
	HandleMessage(ctx context.Context, payload string) error
}

func NewV1ServiceProtocolHandler

func NewV1ServiceProtocolHandler(cache *AppCache, rsm *domain.RoomStatisticsManager) ServiceProtocolHandler

type SessionManager

type SessionManager interface {
	HandleEvent(context.Context, interface{}) error
	HandleProtocol(context.Context, *janus.TextroomPostMsg) error
	UpsertSession(context.Context, *V1User) error
	Start()
	Close()
}

type SessionsResponse

type SessionsResponse struct {
	ListResponse
	Sessions []*V1User `json:"data"`
}

type UserCache

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

func (*UserCache) ByAccountsID

func (c *UserCache) ByAccountsID(id string) (*models.User, bool)

func (*UserCache) Reload

func (c *UserCache) Reload(db common.DBInterface) error

func (*UserCache) Set

func (c *UserCache) Set(user *models.User)

type V1Composite

type V1Composite struct {
	VQuad []*V1CompositeRoom `json:"vquad"`
}

type V1CompositeRoom

type V1CompositeRoom struct {
	V1Room
	Position int `json:"queue"`
}

type V1ProtocolMessageText

type V1ProtocolMessageText struct {
	Type   string
	Status bool
	Room   string // Changed from int to string for Janus string ID support
	User   V1User
}

type V1Room

type V1Room struct {
	V1RoomInfo
	Questions bool                   `json:"questions"`
	NumUsers  int                    `json:"num_users"`
	Users     []*V1User              `json:"users"`
	Region    string                 `json:"region"`
	Extra     map[string]interface{} `json:"extra"`
	// contains filtered or unexported fields
}

type V1RoomInfo

type V1RoomInfo struct {
	Room        string `json:"room"` // Changed from int to string for Janus string ID support
	Janus       string `json:"janus"`
	Description string `json:"description"`
}

type V1ServiceProtocolHandler

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

func (*V1ServiceProtocolHandler) HandleMessage

func (h *V1ServiceProtocolHandler) HandleMessage(ctx context.Context, payload string) error

type V1ServiceProtocolMessageText

type V1ServiceProtocolMessageText struct {
	Type        string
	Status      bool
	Room        *string // Changed from *int to *string for Janus string ID support
	Column      *int    `json:"col"`
	Index       *int    `json:"i"`
	Transaction *string
}

type V1SessionManager

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

func (*V1SessionManager) Close

func (sm *V1SessionManager) Close()

func (*V1SessionManager) HandleEvent

func (sm *V1SessionManager) HandleEvent(ctx context.Context, event interface{}) error

func (*V1SessionManager) HandleProtocol

func (sm *V1SessionManager) HandleProtocol(ctx context.Context, msg *janus.TextroomPostMsg) error

func (*V1SessionManager) Start

func (sm *V1SessionManager) Start()

func (*V1SessionManager) UpsertSession

func (sm *V1SessionManager) UpsertSession(ctx context.Context, user *V1User) error

type V1User

type V1User struct {
	ID             string                 `json:"id"`
	Display        string                 `json:"display"`
	Email          string                 `json:"email"`
	Group          string                 `json:"group"`
	IP             string                 `json:"ip"`
	Janus          string                 `json:"janus"`
	Name           string                 `json:"name"`
	Role           string                 `json:"role"`
	System         string                 `json:"system"`
	Username       string                 `json:"username"`
	Room           string                 `json:"room"` // Changed from int to string for Janus string ID support
	Timestamp      int64                  `json:"timestamp"`
	Session        int64                  `json:"session"`
	Handle         int64                  `json:"handle"`
	RFID           string                 `json:"rfid"`
	TextroomHandle int64                  `json:"textroom_handle"`
	Camera         bool                   `json:"camera"`
	Question       bool                   `json:"question"`
	SelfTest       bool                   `json:"self_test"`
	SoundTest      bool                   `json:"sound_test"`
	Extra          map[string]interface{} `json:"extra"`
}

type V2Config

type V2Config struct {
	Gateways      map[string]map[string]*V2Gateway `json:"gateways"`
	IceServers    map[string][]string              `json:"ice_servers"`
	DynamicConfig map[string]string                `json:"dynamic_config"`
	LastModified  time.Time                        `json:"last_modified"`
}

type V2Gateway

type V2Gateway struct {
	Name string `json:"name"`
	URL  string `json:"url"`
	Type string `json:"type"`
}

type V2RoomServerRequest

type V2RoomServerRequest struct {
	Room string                  `json:"room"` // Changed from int to string for Janus string ID support
	Geo  *V2RoomServerRequestGeo `json:"geo,omitempty"`
}

type V2RoomServerRequestGeo

type V2RoomServerRequestGeo struct {
	CountryCode string `json:"country_code,omitempty"` // e.g., "US", "RU", "IL"
}

type V2RoomServerResponse

type V2RoomServerResponse struct {
	Janus string `json:"janus"`
}

type V2RoomStatistics

type V2RoomStatistics struct {
	OnAir int `json:"on_air"`
}

type VHInfo

type VHInfo struct {
	UserID    string    `json:"id"`
	FirstName string    `json:"first_name"`
	LastName  string    `json:"last_name"`
	Email     string    `json:"email"`
	Active    bool      `json:"active"`
	CreatedAt time.Time `json:"created_at"`
}

Jump to

Keyboard shortcuts

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