Documentation ¶
Index ¶
- Constants
- Variables
- func APIFromCodecs(codecs []webrtc.RTPCodecParameters) (*webrtc.API, error)
- func APIFromNames(names []string) (*webrtc.API, error)
- func CodecPayloadType(codec webrtc.RTPCodecCapability) (webrtc.PayloadType, error)
- func DelClient(c Client)
- func Delete(name string) bool
- func DeleteDescription(name, etag string) error
- func DeleteUser(group, username string, wildcard bool, etag string) error
- func GetDescriptionNames() ([]string, error)
- func GetDescriptionTag(name string) (string, error)
- func GetNames() []string
- func GetUserTag(group, username string, wildcard bool) (string, error)
- func GetUsers(group string) ([]string, string, error)
- func Range(f func(g *Group) bool)
- func SetKeys(group string, keys []map[string]any) error
- func SetUserPassword(group, username string, wildcard bool, pw Password) error
- func Shutdown(message string)
- func Update()
- func UpdateDescription(name, etag string, desc *Description) error
- func UpdateUser(group, username string, wildcard bool, etag string, user *UserDescription) error
- type ChatHistoryEntry
- type Client
- type ClientCredentials
- type ClientPattern
- type Configuration
- type Description
- type Group
- func (g *Group) API() (*webrtc.API, error)
- func (g *Group) AddToChatHistory(id, source string, user *string, time time.Time, kind string, ...)
- func (g *Group) ClearChatHistory(id string, userId string)
- func (g *Group) ClientCount() int
- func (g *Group) Data() map[string]interface{}
- func (g *Group) Description() *Description
- func (g *Group) GetChatHistory() []ChatHistoryEntry
- func (g *Group) GetClient(id string) Client
- func (g *Group) GetClients(except Client) []Client
- func (g *Group) GetPermission(creds ClientCredentials) (string, []string, error)
- func (g *Group) Locked() (bool, string)
- func (g *Group) Name() string
- func (g *Group) Range(f func(c Client) bool)
- func (g *Group) SetLocked(locked bool, message string)
- func (g *Group) Status(authentified bool, base *url.URL) Status
- func (g *Group) UpdateData(d map[string]interface{})
- func (g *Group) UserExists(username string) bool
- func (g *Group) WallOps(message string)
- type KickError
- type NotAuthorisedError
- type Password
- type Permissions
- type ProtocolError
- type RawPassword
- type Status
- type SubGroup
- type UserDescription
- type UserError
Constants ¶
const ( LowBitrate = 100 * 1024 MinBitrate = LowBitrate * 2 MaxBitrate = 1024 * 1024 * 1024 )
const DefaultMaxHistoryAge = 4 * time.Hour
Variables ¶
var AudioRTCPFeedback = []webrtc.RTCPFeedback(nil)
AudioRTCPFeedback is like VideoRTCPFeedback but for audio tracks.
var Directory, DataDirectory string
var ErrDescriptionsNotWritable = &NotAuthorisedError{}
var ErrDuplicateUsername = &NotAuthorisedError{ errors.New("this username is taken"), }
var ErrTagMismatch = errors.New("tag mismatch")
var ErrUnknownPermission = errors.New("unknown permission")
var UDPMin, UDPMax uint16
var UseMDNS bool
var VideoRTCPFeedback = []webrtc.RTCPFeedback{
{"goog-remb", ""},
{"nack", ""},
{"nack", "pli"},
{"ccm", "fir"},
}
VideoRTCPFeedback are the RTCP feedback types that we expect for video tracks.
Functions ¶
func APIFromCodecs ¶
func APIFromCodecs(codecs []webrtc.RTPCodecParameters) (*webrtc.API, error)
func APIFromNames ¶
func CodecPayloadType ¶
func CodecPayloadType(codec webrtc.RTPCodecCapability) (webrtc.PayloadType, error)
func DeleteDescription ¶
DeleteDescription deletes a description (and therefore persistently deletes a group) but only if it matches a given ETag.
func GetDescriptionNames ¶
func GetDescriptionTag ¶
GetDescriptionTag returns an ETag for a description.
func SetUserPassword ¶
func Update ¶
func Update()
Update checks that all in-memory groups are up-to-date and updates the list of public groups. It also removes from memory any non-public groups that haven't been accessed in maxHistoryAge.
func UpdateDescription ¶
func UpdateDescription(name, etag string, desc *Description) error
UpdateDescription overwrites a description if it matches a given ETag. In order to create a new group, pass an empty ETag.
func UpdateUser ¶
func UpdateUser(group, username string, wildcard bool, etag string, user *UserDescription) error
Types ¶
type ChatHistoryEntry ¶
type Client ¶
type Client interface { Group() *Group Addr() net.Addr Id() string Username() string SetUsername(string) Permissions() []string SetPermissions([]string) Data() map[string]interface{} PushConn(g *Group, id string, conn conn.Up, tracks []conn.UpTrack, replace string) error RequestConns(target Client, g *Group, id string) error Joined(group, kind string) error PushClient(group, kind, id, username string, perms []string, data map[string]interface{}) error Kick(id string, user *string, message string) error }
type ClientCredentials ¶
type ClientPattern ¶
type Configuration ¶
type Configuration struct { PublicServer bool `json:"publicServer"` CanonicalHost string `json:"canonicalHost"` ProxyURL string `json:"proxyURL"` WritableGroups bool `json:"writableGroups"` Users map[string]UserDescription // obsolete fields Admin []ClientPattern `json:"admin"` // contains filtered or unexported fields }
Configuration represents the contents of the data/config.json file.
func GetConfiguration ¶
func GetConfiguration() (*Configuration, error)
func (Configuration) Zero ¶
func (conf Configuration) Zero() bool
type Description ¶
type Description struct { // The file this was deserialised from. This is not necessarily // the name of the group, for example in case of a subgroup. FileName string `json:"-"` // The user-friendly group name DisplayName string `json:"displayName,omitempty"` // A user-readable description of the group. Description string `json:"description,omitempty"` // A user-readable contact, typically an e-mail address. Contact string `json:"contact,omitempty"` // A user-readable comment. Ignored by the server. Comment string `json:"comment,omitempty"` // Whether to display the group on the landing page. Public bool `json:"public,omitempty"` // A URL to redirect the group to. If this is not empty, most // other fields are ignored. Redirect string `json:"redirect,omitempty"` // The maximum number of simultaneous clients. Unlimited if 0. MaxClients int `json:"max-clients,omitempty"` // The time for which history entries are kept. MaxHistoryAge int `json:"max-history-age,omitempty"` // Time after which joining is no longer allowed Expires *time.Time `json:"expires,omitempty"` // Time before which joining is not allowed NotBefore *time.Time `json:"not-before,omitempty"` // Whether recording is allowed. AllowRecording bool `json:"allow-recording,omitempty"` // Whether creating tokens is allowed UnrestrictedTokens bool `json:"unrestricted-tokens,omitempty"` // Whether subgroups are created on the fly. AutoSubgroups bool `json:"auto-subgroups,omitempty"` // Whether to lock the group when the last op logs out. Autolock bool `json:"autolock,omitempty"` // Whether to kick all users when the last op logs out. Autokick bool `json:"autokick,omitempty"` // Users allowed to login Users map[string]UserDescription `json:"users,omitempty"` // Credentials for user with arbitrary username WildcardUser *UserDescription `json:"wildcard-user,omitempty"` // The (public) keys used for token authentication. AuthKeys []map[string]interface{} `json:"authKeys,omitempty"` // The URL of the authentication server, if any. AuthServer string `json:"authServer,omitempty"` // The URL of the authentication portal, if any. AuthPortal string `json:"authPortal,omitempty"` // Codec preferences. If empty, a suitable default is chosen in // the APIFromNames function. Codecs []string `json:"codecs,omitempty"` // Obsolete fields Op []ClientPattern `json:"op,omitempty"` Presenter []ClientPattern `json:"presenter,omitempty"` Other []ClientPattern `json:"other,omitempty"` AllowSubgroups bool `json:"allow-subgroups,omitempty"` AllowAnonymous bool `json:"allow-anonymous,omitempty"` // contains filtered or unexported fields }
Description represents a group description together with some metadata about the JSON file it was deserialised from.
func GetDescription ¶
func GetDescription(name string) (*Description, error)
GetDescription gets a group description, either from cache or from disk
func GetSanitisedDescription ¶
func GetSanitisedDescription(name string) (*Description, string, error)
GetSanitisedDescription returns the subset of the description that is published on the web interface together with a suitable ETag.
type Group ¶
type Group struct {
// contains filtered or unexported fields
}
func (*Group) AddToChatHistory ¶
func (*Group) ClearChatHistory ¶
func (*Group) ClientCount ¶
func (*Group) Description ¶
func (g *Group) Description() *Description
func (*Group) GetChatHistory ¶
func (g *Group) GetChatHistory() []ChatHistoryEntry
func (*Group) GetClients ¶
func (*Group) GetPermission ¶
func (g *Group) GetPermission(creds ClientCredentials) (string, []string, error)
func (*Group) Status ¶
Status returns a group's status. Base is the base URL for groups; if omitted, then both the Location and Endpoint members are omitted from the result.
func (*Group) UpdateData ¶
func (*Group) UserExists ¶
Return true if there is a user entry with the given username. Always return false for an empty username.
type NotAuthorisedError ¶
type NotAuthorisedError struct {
// contains filtered or unexported fields
}
func (*NotAuthorisedError) Error ¶
func (err *NotAuthorisedError) Error() string
func (*NotAuthorisedError) Unwrap ¶
func (err *NotAuthorisedError) Unwrap() error
type Password ¶
type Password RawPassword
func (Password) MarshalJSON ¶
func (*Password) UnmarshalJSON ¶
type Permissions ¶
type Permissions struct {
// contains filtered or unexported fields
}
func NewPermissions ¶
func NewPermissions(name string) (Permissions, error)
func (Permissions) MarshalJSON ¶
func (p Permissions) MarshalJSON() ([]byte, error)
func (Permissions) Permissions ¶
func (p Permissions) Permissions(desc *Description) []string
func (Permissions) String ¶
func (p Permissions) String() string
func (*Permissions) UnmarshalJSON ¶
func (p *Permissions) UnmarshalJSON(b []byte) error
type ProtocolError ¶
type ProtocolError string
func (ProtocolError) Error ¶
func (err ProtocolError) Error() string
type RawPassword ¶
type Status ¶
type Status struct { Name string `json:"name"` Redirect string `json:"redirect,omitempty"` Location string `json:"location,omitempty"` Endpoint string `json:"endpoint,omitempty"` DisplayName string `json:"displayName,omitempty"` Description string `json:"description,omitempty"` AuthServer string `json:"authServer,omitempty"` AuthPortal string `json:"authPortal,omitempty"` Locked bool `json:"locked,omitempty"` ClientCount *int `json:"clientCount,omitempty"` CanChangePassword bool `json:"canChangePassword,omitempty"` }
type SubGroup ¶
func GetSubGroups ¶
type UserDescription ¶
type UserDescription struct { Password Password `json:"password"` Permissions Permissions `json:"permissions"` }
func GetSanitisedUser ¶
func GetSanitisedUser(group, username string, wildcard bool) (UserDescription, string, error)
func (UserDescription) MarshalJSON ¶
func (u UserDescription) MarshalJSON() ([]byte, error)
Custom MarshalJSON in order to omit empty fields