Documentation ¶
Overview ¶
Package gumble is a client for the Mumble voice chat software.
Getting started ¶
1. Create a new Config to hold your connection settings:
config := gumble.NewConfig() config.Username = "gumble-test" config.Address = "example.com:64738"
2. Create a new Client:
client := gumble.NewClient(config)
3. Implement EventListener (or use gumbleutil.Listener) and attach it to the client:
client.Attach(gumbleutil.Listener{ TextMessage: func(e *gumble.TextMessageEvent) { fmt.Printf("Received text message: %s\n", e.Message) }, })
4. Connect to the server:
if err := client.Connect(); err != nil { panic(err) }
Audio codecs ¶
Currently, only the Opus codec (https://www.opus-codec.org/) is supported for transmitting and receiving audio. It can be enabled by importing the following package for its side effect:
import ( _ "bitbucket.org/abex/yumeko/gumble/opus" )
To ensure that gumble clients can always transmit and receive audio to and from your server, add the following line to your murmur configuration file:
opusthreshold=0
Index ¶
- Constants
- func AddWriteMessage(i proto.Message) protoMessage
- func RegisterAudioCodec(id int, codec AudioCodec)
- type ACL
- type ACLEvent
- type ACLGroup
- type ACLRule
- type ACLUser
- type AccessTokens
- type AudioBuffer
- type AudioCodec
- type AudioDecoder
- type AudioEncoder
- type AudioListener
- type AudioPacket
- type AudioPacketEvent
- type Ban
- type BanList
- type BanListEvent
- type Channel
- func (c *Channel) Add(name string, temporary bool)
- func (c *Channel) Find(names ...string) *Channel
- func (c *Channel) IsRoot() bool
- func (c *Channel) Link(channel ...*Channel)
- func (c *Channel) Permission() *Permission
- func (c *Channel) Remove()
- func (c *Channel) Request(request Request)
- func (c *Channel) Send(message string, recursive bool)
- func (c *Channel) SetDescription(description string)
- func (c *Channel) SetName(name string)
- func (c *Channel) SetPosition(pos int32)
- func (c *Channel) Unlink(channel ...*Channel)
- type ChannelChangeEvent
- type ChannelChangeType
- type Channels
- type Client
- func (c *Client) Attach(listener EventListener) Detacher
- func (c *Client) AttachAudio(listener AudioListener) Detacher
- func (c *Client) AttachRawAudio(listener RawAudioListener)
- func (c *Client) Connect() error
- func (c *Client) Disconnect() error
- func (c *Client) Request(request Request)
- func (c *Client) Send(message Message) error
- type Config
- type Conn
- type ConnectEvent
- type ContextAction
- type ContextActionChangeEvent
- type ContextActionChangeType
- type ContextActionType
- type ContextActions
- type Detacher
- type DisconnectEvent
- type DisconnectType
- type EventListener
- type Message
- type Permission
- type PermissionDeniedEvent
- type PermissionDeniedType
- type PingResponse
- type PositionalAudioBuffer
- type RawAudioListener
- type RawAudioPacket
- type RegisteredUser
- type RegisteredUsers
- type Request
- type ServerConfigEvent
- type State
- type TextMessage
- type TextMessageEvent
- type User
- func (u *User) Ban(reason string)
- func (u *User) Decoder() AudioDecoder
- func (u *User) IsRegistered() bool
- func (u *User) Kick(reason string)
- func (u *User) Move(channel *Channel)
- func (u *User) Register()
- func (u *User) Request(request Request)
- func (u *User) Send(message string)
- func (u *User) SetComment(comment string)
- func (u *User) SetDeafened(muted bool)
- func (u *User) SetMuted(muted bool)
- func (u *User) SetPlugin(context []byte, identity string)
- func (u *User) SetPrioritySpeaker(prioritySpeaker bool)
- func (u *User) SetRecording(recording bool)
- func (u *User) SetSelfDeafened(muted bool)
- func (u *User) SetSelfMuted(muted bool)
- func (u *User) SetSuppressed(supressed bool)
- func (u *User) SetTexture(texture []byte)
- type UserChangeEvent
- type UserChangeType
- type UserListEvent
- type UserStats
- type Users
- type Version
- type VoiceTarget
Constants ¶
const ( ACLGroupEveryone = "all" ACLGroupAuthenticated = "auth" ACLGroupInsideChannel = "in" ACLGroupOutsideChannel = "out" )
ACL group names that are built-in.
const ( // AudioSampleRate is the audio sample rate (in hertz) for incoming and // outgoing audio. AudioSampleRate = 48000 // AudioDefaultInterval is the default interval that audio packets are sent // at. AudioDefaultInterval = 10 * time.Millisecond // AudioDefaultFrameSize is the number of audio frames that should be sent in // a 10ms window. AudioDefaultFrameSize = AudioSampleRate / 100 // AudioMaximumFrameSize is the maximum audio frame size from another user // that will be processed. AudioMaximumFrameSize = AudioDefaultFrameSize * 10 // AudioDefaultDataBytes is the default number of bytes that an audio frame // can use. AudioDefaultDataBytes = 40 // AudioChannels is the number of audio channels that are contained in an // audio stream. AudioChannels = 1 )
const ClientVersion = 1<<16 | 2<<8 | 4
ClientVersion is the protocol version that Client implements.
const UserUnregisteredID = math.MaxUint32
Variables ¶
This section is empty.
Functions ¶
func AddWriteMessage ¶
func RegisterAudioCodec ¶
func RegisterAudioCodec(id int, codec AudioCodec)
RegisterAudioCodec registers an audio codec that can be used for encoding and decoding outgoing and incoming audio data. The function panics if the ID is invalid.
Types ¶
type ACL ¶
type ACL struct { // The channel to which the ACL belongs. Channel *Channel // The ACL's groups. Groups []*ACLGroup // The ACL's rules. Rules []*ACLRule // Does the ACL inherits the parent channel's ACL?s Inherits bool }
ACL contains a list of ACLGroups and ACLRules linked to a channel.
type ACLGroup ¶
type ACLGroup struct { // The ACL group name. Name string // Is the group inherited from the parent channel's ACL? Inherited bool // Are group members are inherited from the parent channel's ACL? InheritUsers bool // Can the group be inherited by child channels? Inheritable bool // contains filtered or unexported fields }
ACLGroup is a named group of registered users which can be used in an ACLRule.
type ACLRule ¶
type ACLRule struct { // Does the rule apply to the channel in which the rule is defined? AppliesCurrent bool // Does the rule apply to the children of the channel in which the rule is // defined? AppliesChildren bool // Is the rule inherited from the parent channel's ACL? Inherited bool // The permissions granted by the rule. Granted Permission // The permissions denied by the rule. Denied Permission // The ACL user the rule applies to. Can be nil. User *ACLUser // The ACL group the rule applies to. Can be nil. Group *ACLGroup }
ACLRule is a set of granted and denied permissions given to an ACLUser or ACLGroup.
type ACLUser ¶
type ACLUser struct { // The user ID of the user. UserID uint32 // The name of the user. Name string }
ACLUser is a registered user who is part of or can be part of an ACL group or rule.
type AccessTokens ¶
type AccessTokens []string
AccessTokens are additional passwords that can be provided to the server to gain access to restricted channels.
type AudioCodec ¶
type AudioCodec interface { ID() int NewEncoder() AudioEncoder NewDecoder() AudioDecoder }
AudioCodec can create a encoder and a decoder for outgoing and incoming data.
type AudioDecoder ¶
AudioDecoder decodes an encoded byte slice to a chunk of PCM audio samples.
type AudioEncoder ¶
type AudioEncoder interface { ID() int Encode(pcm []int16, mframeSize, maxDataBytes int) ([]byte, error) }
AudioEncoder encodes a chunk of PCM audio samples to a certain type.
type AudioListener ¶
type AudioListener interface {
OnAudioPacket(e *AudioPacketEvent)
}
AudioListener is the interface that must be implemented by types wishing to receive incoming audio data from the server.
type AudioPacket ¶
type AudioPacket struct { Sender *User Target int Sequence int PositionalAudioBuffer }
AudioPacket contains incoming audio data and information.
type AudioPacketEvent ¶
type AudioPacketEvent struct { Client *Client AudioPacket AudioPacket }
AudioPacketEvent is event that is passed to AudioListener.OnAudioPacket.
type Ban ¶
type Ban struct { // The banned IP address. Address net.IP // The IP mask that the ban applies to. Mask net.IPMask // The name of the banned user. Name string // The certificate hash of the banned user. Hash string // The reason for the ban. Reason string // The start time from which the ban applies. Start time.Time // How long the ban is for. Duration time.Duration // contains filtered or unexported fields }
Ban represents an entry in the server ban list.
This type should not be initialized manually. Instead, create new ban entries using BanList.Add().
func (*Ban) Ban ¶
func (b *Ban) Ban()
Ban will ban the user from the server. This is only useful if Unban() was called on the ban entry.
func (*Ban) SetAddress ¶
SetAddress sets the banned IP address.
func (*Ban) SetDuration ¶
SetDuration changes the duration of the ban.
type BanList ¶
type BanList []*Ban
BanList is a list of server ban entries.
Whenever a ban is changed, it does not come into effect until the ban list is sent back to the server.
type BanListEvent ¶
BanListEvent is the event that is passed to EventListener.OnBanList.
type Channel ¶
type Channel struct { // The channel's unique ID. ID uint32 // The channel's name. Name string // The channel's parent. Contains nil if the channel is the root channel. Parent *Channel // The channels directly underneath the channel. Children Channels // The channels that are linked to the channel. Links map[uint32]*Channel // The users currently in the channel. Users Users // The channel's description. Contains the empty string if the channel does // not have a description, or if it needs to be requested. Description string // The channel's description hash. Contains nil if Channel.Description has // been populated. DescriptionHash []byte // The position at which the channel should be displayed in an ordered list. Position int32 // Is the channel temporary? Temporary bool // contains filtered or unexported fields }
Channel represents a channel in the server's channel tree.
func (*Channel) Find ¶
Find returns a channel whose path (by channel name) from the current channel is equal to the arguments passed.
For example, given the following server channel tree:
Root Child 1 Child 2 Child 2.1 Child 2.2 Child 2.2.1 Child 3
To get the "Child 2.2.1" channel:
root.Find("Child 2", "Child 2.2", "Child 2.2.1")
func (*Channel) Permission ¶
func (c *Channel) Permission() *Permission
Permission returns the permissions the user has in the channel, or nil if the permissions are unknown.
func (*Channel) Remove ¶
func (c *Channel) Remove()
Remove will remove the given channel and all sub-channels from the server's channel tree.
func (*Channel) Request ¶
Request requests channel information that has not yet been sent to the client. The supported request types are: RequestACL, RequestDescription, RequestPermission.
Note: the server will not reply to a RequestPermission request if the client has up-to-date permission information.
func (*Channel) SetDescription ¶
SetDescription will set the description of the channel.
func (*Channel) SetName ¶
SetName will set the name of the channel. This will have no effect if the channel is the server's root channel.
func (*Channel) SetPosition ¶
SetPosition will set the channel's position
type ChannelChangeEvent ¶
type ChannelChangeEvent struct { Client *Client Type ChannelChangeType Channel *Channel }
ChannelChangeEvent is the event that is passed to EventListener.OnChannelChange.
type ChannelChangeType ¶
type ChannelChangeType int
ChannelChangeType is a bitmask of items that changed for a channel.
const ( ChannelChangeCreated ChannelChangeType = 1 << iota ChannelChangeRemoved ChannelChangeMoved ChannelChangeName ChannelChangeLinks ChannelChangeDescription ChannelChangePosition ChannelChangePermission )
Channel change items.
func (ChannelChangeType) Has ¶
func (cct ChannelChangeType) Has(changeType ChannelChangeType) bool
Has returns true if the ChannelChangeType has changeType part of its bitmask.
type Channels ¶
Channels is a map of server channels.
When accessed through Client.Channels, it contains all channels on the server. When accessed through a specific channel (e.g. client.Channels[0].Children), it contains only the children of the channel.
type Client ¶
type Client struct { // The current state of the client. State State // The User associated with the client (nil if the client has not yet been // synced). Self *User // The client's configuration. Config *Config // The underlying Conn to the server. *Conn // The users currently connected to the server. Users Users // The connected server's channels. Channels Channels // A collection containing the server's context actions. ContextActions ContextActions // The audio encoder used when sending audio to the server. AudioEncoder AudioEncoder // To whom transmitted audio will be sent. The VoiceTarget must have already // been sent to the server for targeting to work correctly. Setting to nil // will disable voice targeting (i.e. switch back to regular speaking). VoiceTarget *VoiceTarget // contains filtered or unexported fields }
Client is the type used to create a connection to a server.
func (*Client) Attach ¶
func (c *Client) Attach(listener EventListener) Detacher
Attach adds an event listener that will receive incoming connection events.
func (*Client) AttachAudio ¶
func (c *Client) AttachAudio(listener AudioListener) Detacher
AttachAudio adds an audio event listener that will receive incoming audio packets.
func (*Client) AttachRawAudio ¶
func (c *Client) AttachRawAudio(listener RawAudioListener)
AttachRawAudio adds an audio listener that will receive raw audio packets. Pass nil to remove the listener. This will stop any other audio events
func (*Client) Disconnect ¶
Disconnect disconnects the client from the server.
type Config ¶
type Config struct { // User name used when authenticating with the server. Username string // Password used when authenticating with the server. A password is not // usually required to connect to a server. Password string // Server address, including port (e.g. localhost:64738). Address string Tokens AccessTokens // AudioInterval is the interval at which audio packets are sent. Valid // values are 10ms, 20ms, 40ms, and 60ms. AudioInterval time.Duration // AudioDataBytes is the number of bytes that an audio frame can use. AudioDataBytes int TLSConfig tls.Config // If non-nil, this function will be called after the connection to the // server has been made. If it returns nil, the connection will stay alive, // otherwise, it will be closed and Client.Connect will return the returned // error. TLSVerify func(state *tls.ConnectionState) error Dialer net.Dialer }
Config holds the configuration data used by Client.
func NewConfig ¶
func NewConfig() *Config
NewConfig returns a new Config struct with default values set.
func (*Config) GetAudioFrameSize ¶
GetAudioFrameSize returns the appropriate audio frame size, based off of the audio interval.
type Conn ¶
type Conn struct { sync.Mutex net.Conn MaximumPacketBytes int Timeout time.Duration // contains filtered or unexported fields }
Conn represents a connection to a Mumble client/server.
func (*Conn) ReadPacket ¶
ReadPacket reads a packet from the server. Returns the packet type, the packet data, and nil on success.
This function should only be called by a single go routine.
func (*Conn) WriteAudio ¶
WriteAudio writes an audio packet to the connection.
func (*Conn) WritePacket ¶
WritePacket writes a data packet of the given type to the connection.
type ConnectEvent ¶
ConnectEvent is the event that is passed to EventListener.OnConnect.
type ContextAction ¶
type ContextAction struct { // The context action type. Type ContextActionType // The name of the context action. Name string // The user-friendly description of the context action. Label string // contains filtered or unexported fields }
ContextAction is an triggerable item that has been added by a server-side plugin.
func (*ContextAction) Trigger ¶
func (ca *ContextAction) Trigger()
Trigger will trigger the context action in the context of the server.
func (*ContextAction) TriggerChannel ¶
func (ca *ContextAction) TriggerChannel(channel *Channel)
TriggerChannel will trigger the context action in the context of the given channel.
func (*ContextAction) TriggerUser ¶
func (ca *ContextAction) TriggerUser(user *User)
TriggerUser will trigger the context action in the context of the given user.
type ContextActionChangeEvent ¶
type ContextActionChangeEvent struct { Client *Client Type ContextActionChangeType ContextAction *ContextAction }
ContextActionChangeEvent is the event that is passed to EventListener.OnContextActionChange.
type ContextActionChangeType ¶
type ContextActionChangeType int
ContextActionChangeType specifies how a ContextAction changed.
const ( ContextActionAdd ContextActionChangeType = ContextActionChangeType(MumbleProto.ContextActionModify_Add) ContextActionRemove ContextActionChangeType = ContextActionChangeType(MumbleProto.ContextActionModify_Remove) )
ContextAction change types.
type ContextActionType ¶
type ContextActionType int
ContextActionType is a bitmask of contexts where a ContextAction can be triggered.
const ( ContextActionServer ContextActionType = ContextActionType(MumbleProto.ContextActionModify_Server) ContextActionChannel ContextActionType = ContextActionType(MumbleProto.ContextActionModify_Channel) ContextActionUser ContextActionType = ContextActionType(MumbleProto.ContextActionModify_User) )
Supported ContextAction contexts.
type ContextActions ¶
type ContextActions map[string]*ContextAction
ContextActions is a map of ContextActions.
type Detacher ¶
type Detacher interface {
Detach()
}
Detacher is an interface that event listeners implement. After the Detach method is called, the listener will no longer receive events.
type DisconnectEvent ¶
type DisconnectEvent struct { Client *Client Type DisconnectType String string }
DisconnectEvent is the event that is passed to EventListener.OnDisconnect.
type DisconnectType ¶
type DisconnectType int
DisconnectType specifies why a Client disconnected from a server.
const ( DisconnectError DisconnectType = 0xFE - iota DisconnectKicked DisconnectBanned DisconnectUser DisconnectOther DisconnectType = DisconnectType(MumbleProto.Reject_None) DisconnectVersion DisconnectType = DisconnectType(MumbleProto.Reject_WrongVersion) DisconnectUserName DisconnectType = DisconnectType(MumbleProto.Reject_InvalidUsername) DisconnectUserCredentials DisconnectType = DisconnectType(MumbleProto.Reject_WrongUserPW) DisconnectServerPassword DisconnectType = DisconnectType(MumbleProto.Reject_WrongServerPW) DisconnectUsernameInUse DisconnectType = DisconnectType(MumbleProto.Reject_UsernameInUse) DisconnectServerFull DisconnectType = DisconnectType(MumbleProto.Reject_ServerFull) DisconnectNoCertificate DisconnectType = DisconnectType(MumbleProto.Reject_NoCertificate) DisconnectAuthenticatorFail DisconnectType = DisconnectType(MumbleProto.Reject_AuthenticatorFail) )
Client disconnect reasons.
func (DisconnectType) Has ¶
func (dt DisconnectType) Has(changeType DisconnectType) bool
Has returns true if the DisconnectType has changeType part of its bitmask.
type EventListener ¶
type EventListener interface { OnConnect(e *ConnectEvent) OnDisconnect(e *DisconnectEvent) OnTextMessage(e *TextMessageEvent) OnUserChange(e *UserChangeEvent) OnChannelChange(e *ChannelChangeEvent) OnPermissionDenied(e *PermissionDeniedEvent) OnUserList(e *UserListEvent) OnACL(e *ACLEvent) OnBanList(e *BanListEvent) OnContextActionChange(e *ContextActionChangeEvent) OnServerConfig(e *ServerConfigEvent) }
EventListener is the interface that must be implemented by a type if it wishes to be notified of Client events.
type Message ¶
type Message interface {
// contains filtered or unexported methods
}
Message is data that be encoded and sent to the server. The following types implement this interface: AudioBuffer, AccessTokens, BanList, RegisteredUsers, TextMessage, and VoiceTarget.
type Permission ¶
type Permission int
Permission is a bitmask of permissions given to a certain user.
const ( PermissionWrite Permission = 1 << iota PermissionTraverse PermissionEnter PermissionSpeak PermissionMuteDeafen PermissionMove PermissionMakeChannel PermissionLinkChannel PermissionWhisper PermissionTextMessage PermissionMakeTemporaryChannel )
Permissions that can be applied in any channel.
const ( PermissionKick Permission = 0x10000 << iota PermissionBan PermissionRegister PermissionRegisterSelf )
Permissions that can only be applied in the root channel.
type PermissionDeniedEvent ¶
type PermissionDeniedEvent struct { Client *Client Type PermissionDeniedType Channel *Channel User *User Permission Permission String string }
PermissionDeniedEvent is the event that is passed to EventListener.OnPermissionDenied.
type PermissionDeniedType ¶
type PermissionDeniedType int
PermissionDeniedType specifies why a Client was denied permission to perform a particular action.
const ( PermissionDeniedOther PermissionDeniedType = PermissionDeniedType(MumbleProto.PermissionDenied_Text) PermissionDeniedPermission PermissionDeniedType = PermissionDeniedType(MumbleProto.PermissionDenied_Permission) PermissionDeniedSuperUser PermissionDeniedType = PermissionDeniedType(MumbleProto.PermissionDenied_SuperUser) PermissionDeniedInvalidChannelName PermissionDeniedType = PermissionDeniedType(MumbleProto.PermissionDenied_ChannelName) PermissionDeniedTextTooLong PermissionDeniedType = PermissionDeniedType(MumbleProto.PermissionDenied_TextTooLong) PermissionDeniedTemporaryChannel PermissionDeniedType = PermissionDeniedType(MumbleProto.PermissionDenied_TemporaryChannel) PermissionDeniedMissingCertificate PermissionDeniedType = PermissionDeniedType(MumbleProto.PermissionDenied_MissingCertificate) PermissionDeniedInvalidUserName PermissionDeniedType = PermissionDeniedType(MumbleProto.PermissionDenied_UserName) PermissionDeniedChannelFull PermissionDeniedType = PermissionDeniedType(MumbleProto.PermissionDenied_ChannelFull) PermissionDeniedNestingLimit PermissionDeniedType = PermissionDeniedType(MumbleProto.PermissionDenied_NestingLimit) )
Permission denied types.
func (PermissionDeniedType) Has ¶
func (pdt PermissionDeniedType) Has(changeType PermissionDeniedType) bool
Has returns true if the PermissionDeniedType has changeType part of its bitmask.
type PingResponse ¶
type PingResponse struct { // The address of the pinged server. Address *net.UDPAddr // The round-trip time from the client to the server. Ping time.Duration // The server's version. Only the Version field and SemanticVersion method of // the value will be valid. Version Version // The number users currently connected to the server. ConnectedUsers int // The maximum number of users that can connect to the server. MaximumUsers int // The maximum audio bitrate per user for the server. MaximumBitrate int }
PingResponse contains information about a server that responded to a UDP ping packet.
type PositionalAudioBuffer ¶
type PositionalAudioBuffer struct {
X, Y, Z float32
AudioBuffer
}
PositionalAudioBuffer is an AudioBuffer that has a position in 3D space associated with it.
type RawAudioListener ¶
type RawAudioListener func(*RawAudioPacket)
RawAudioListener forces all audio packet to be given to it
type RawAudioPacket ¶
RawAudioPacket is given to the RawAudioListener
type RegisteredUser ¶
type RegisteredUser struct { // The registered user's ID. UserID uint32 // The registered user's name. Name string // contains filtered or unexported fields }
RegisteredUser represents a registered user on the server.
func (*RegisteredUser) ACLUser ¶
func (ru *RegisteredUser) ACLUser() *ACLUser
ACLUser returns an ACLUser for the given registered user.
func (*RegisteredUser) Deregister ¶
func (ru *RegisteredUser) Deregister()
Deregister will remove the registered user from the server.
func (*RegisteredUser) Register ¶
func (ru *RegisteredUser) Register()
Register will keep the user registered on the server. This is only useful if Deregister() was called on the registered user.
func (*RegisteredUser) SetName ¶
func (ru *RegisteredUser) SetName(name string)
SetName sets the new name for the user.
type RegisteredUsers ¶
type RegisteredUsers []*RegisteredUser
RegisteredUsers is a list of users who are registered on the server.
Whenever a registered user is changed, it does not come into effect until the registered user list is sent back to the server.
type Request ¶
type Request int
Request is a mask of items that the client can ask the server to send.
const ( RequestDescription Request = 1 << iota RequestComment RequestTexture RequestStats RequestUserList RequestACL RequestBanList RequestPermission )
Items that can be requested from the server. See the documentation for Channel.Request, Client.Request, and User.Request to see which request types each one supports.
type ServerConfigEvent ¶
type ServerConfigEvent struct { Client *Client MaximumBitrate *int WelcomeMessage *string AllowHTML *bool MaximumMessageLength *int MaximumImageMessageLength *int CodecAlpha *int32 CodecBeta *int32 CodecPreferAlpha *bool CodecOpus *bool SuggestVersion *Version SuggestPositional *bool SuggestPushToTalk *bool }
ServerConfigEvent is the event that is passed to EventListener.OnServerConfig.
type State ¶
type State int
State is the current state of the client's connection to the server.
const ( // StateDisconnected means the client is not connected to a server. StateDisconnected State = iota // StateConnected means the client is connected to a server, but has yet to // receive the initial server state. StateConnected // StateSynced means the client is connected to a server and has been sent // the server state. StateSynced )
type TextMessage ¶
type TextMessage struct { // User who sent the message (can be nil). Sender *User // Users that receive the message. Users []*User // Channels that receive the message. Channels []*Channel // Channels that receive the message and send it recursively to sub-channels. Trees []*Channel // Chat message. Message string }
TextMessage is a chat message that can be received from and sent to the server.
type TextMessageEvent ¶
type TextMessageEvent struct { Client *Client TextMessage }
TextMessageEvent is the event that is passed to EventListener.OnTextMessage.
type User ¶
type User struct { // The user's unique session ID. Session uint32 // The user's ID. Contains an invalid value if the user is not registered. UserID uint32 // The user's name. Name string // The channel that the user is currently in. Channel *Channel // Has the user has been muted? Muted bool // Has the user been deafened? Deafened bool // Has the user been suppressed? Suppressed bool // Has the user been muted by him/herself? SelfMuted bool // Has the user been deafened by him/herself? SelfDeafened bool // Is the user a priority speaker in the channel? PrioritySpeaker bool // Is the user recording audio? Recording bool // The user's comment. Contains the empty string if the user does not have a // comment, or if the comment needs to be requested. Comment string // The user's comment hash. Contains nil if User.Comment has been populated. CommentHash []byte // The hash of the user's certificate (can be empty). Hash string // The user's texture (avatar). Contains nil if the user does not have a // texture, or if the texture needs to be requested. Texture []byte // The user's texture hash. Contains nil if User.Texture has been populated. TextureHash []byte // The user's stats. Containts nil if the stats have not yet been requested. Stats *UserStats // contains filtered or unexported fields }
User represents a user that is currently connected to the server.
func (*User) Decoder ¶
func (u *User) Decoder() AudioDecoder
Decoder returns the user's audio decoder
func (*User) IsRegistered ¶
IsRegistered returns true if the user's certificate has been registered with the server. A registered user will have a valid user ID.
func (*User) Register ¶
func (u *User) Register()
Register will register the user with the server. If the client has permission to do so, the user will shortly be given a UserID.
func (*User) Request ¶
Request requests user information that has not yet been sent to the client. The supported request types are: RequestStats, RequestTexture, and RequestComment.
func (*User) SetComment ¶
SetComment will set the user's comment to the given string. The user's comment will be erased if the comment is set to the empty string.
func (*User) SetDeafened ¶
SetDeafened sets whether the user can receive audio or not.
func (*User) SetPlugin ¶
SetPlugin sets the user's plugin data.
Plugins are currently only used for positional audio. Clients will receive positional audio information from other users if their plugin context is the same. The official Mumble client sets the context to:
PluginShortName + "\x00" + AdditionalContextInformation
func (*User) SetPrioritySpeaker ¶
SetPrioritySpeaker sets if the user is a priority speaker in the channel.
func (*User) SetRecording ¶
SetRecording sets if the user is recording audio.
func (*User) SetSelfDeafened ¶
SetSelfDeafened sets whether the user can receive audio or not.
This method should only be called on Client.Self().
func (*User) SetSelfMuted ¶
SetSelfMuted sets whether the user can transmit audio or not.
This method should only be called on Client.Self().
func (*User) SetSuppressed ¶
SetSuppressed sets whether the user is suppressed by the server or not.
func (*User) SetTexture ¶
SetTexture sets the user's texture.
type UserChangeEvent ¶
type UserChangeEvent struct { Client *Client Type UserChangeType User *User Actor *User String string }
UserChangeEvent is the event that is passed to EventListener.OnUserChange.
type UserChangeType ¶
type UserChangeType int
UserChangeType is a bitmask of items that changed for a user.
const ( UserChangeConnected UserChangeType = 1 << iota UserChangeDisconnected UserChangeKicked UserChangeBanned UserChangeRegistered UserChangeUnregistered UserChangeName UserChangeChannel UserChangeComment UserChangeAudio UserChangeTexture UserChangePrioritySpeaker UserChangeRecording UserChangeStats )
User change items.
func (UserChangeType) Has ¶
func (uct UserChangeType) Has(changeType UserChangeType) bool
Has returns true if the UserChangeType has changeType part of its bitmask.
type UserListEvent ¶
type UserListEvent struct { Client *Client UserList RegisteredUsers }
UserListEvent is the event that is passed to EventListener.OnUserList.
type UserStats ¶
type UserStats struct { // The owner of the stats. User *User // The user's version. Version Version // When the user connected to the server. Connected time.Time // How long the user has been idle. Idle time.Duration // How much bandwidth the user is current using. Bandwidth int // The user's certificate chain. Certificates []*x509.Certificate // Does the user have a strong certificate? A strong certificate is one that // is not self signed, nor expired, etc. StrongCertificate bool // A list of CELT versions supported by the user's client. CELTVersions []int32 // Does the user's client supports the Opus audio codec? Opus bool // The user's IP address. IP net.IP }
UserStats contains additional information about a user.
type Users ¶
Users is a map of server users.
When accessed through client.Users, it contains all users currently on the server. When accessed through a specific channel (e.g. client.Channels[0].Users), it contains only the users in the channel.
type Version ¶
type Version struct { // The semantic version information as a single unsigned integer. // // Bits 0-15 are the major version, bits 16-23 are the minor version, and // bits 24-31 are the patch version. Version uint32 // The name of the client. Release string // The operating system name. OS string // The operating system version. OSVersion string }
Version represents a Mumble client or server version.
func (*Version) SemanticVersion ¶
SemanticVersion returns the version's semantic version components.
type VoiceTarget ¶
type VoiceTarget struct { // The voice target ID. This value must be in the range [1, 30]. ID uint32 // contains filtered or unexported fields }
VoiceTarget represents a set of users and/or channels that the client can whisper to.
var VoiceTargetLoopback *VoiceTarget
VoiceTargetLoopback is a special voice target which causes any audio sent to the server to be returned to the client.
Its ID should not be modified, and it does not have to to be sent to the server before use.
func (*VoiceTarget) AddChannel ¶
func (vt *VoiceTarget) AddChannel(channel *Channel, recursive, links bool, group string)
AddChannel adds a user to the voice target. If group is non-empty, only users belonging to that ACL group will be targeted.
func (*VoiceTarget) AddUser ¶
func (vt *VoiceTarget) AddUser(user *User)
AddUser adds a user to the voice target.
func (*VoiceTarget) Clear ¶
func (vt *VoiceTarget) Clear()
Clear removes all users and channels from the voice target.
Source Files ¶
- acl.go
- audio.go
- audiocodec.go
- audiomultiplexer.go
- bans.go
- channel.go
- channels.go
- client.go
- config.go
- conn.go
- contextaction.go
- contextactions.go
- doc.go
- event.go
- eventmultiplexer.go
- handlers.go
- message.go
- permission.go
- ping.go
- pingstats.go
- protomessage.go
- request.go
- textmessage.go
- user.go
- userlist.go
- users.go
- userstats.go
- version.go
- voicetarget.go
Directories ¶
Path | Synopsis |
---|---|
Package MumbleProto is a generated protocol buffer package.
|
Package MumbleProto is a generated protocol buffer package. |