Documentation ¶
Index ¶
- Constants
- Variables
- func Buffer(buf []byte, max int) func(*Client) error
- func ConnectHeader(connectHeader string) func(*Client) error
- func Decode(str string) string
- func DecodeResponse(lines []string, v interface{}) error
- func KeepAlive(keepAlive time.Duration) func(*Client) error
- func NotificationBuffer(size int) func(*Client) error
- func ScanLines(data []byte, atEOF bool) (advance int, token []byte, err error)
- func Timeout(timeout time.Duration) func(*Client) error
- type Arg
- type ArgGroup
- type ArgSet
- type Channel
- type Client
- func (c *Client) ClientUpdate(properties ...CmdArg) error
- func (c *Client) Close() error
- func (c *Client) Exec(cmd string) ([]string, error)
- func (c *Client) ExecCmd(cmd *Cmd) ([]string, error)
- func (c *Client) IsConnected() bool
- func (c *Client) Login(user, passwd string) error
- func (c *Client) Logout() error
- func (c *Client) Notifications() <-chan Notification
- func (c *Client) Register(event NotifyCategory) error
- func (c *Client) RegisterChannel(id uint) error
- func (c *Client) SetChannelCommander(val bool) error
- func (c *Client) SetDescription(description string) error
- func (c *Client) SetIcon(id int) error
- func (c *Client) SetNick(nick string) error
- func (c *Client) SetTalker(val bool) error
- func (c *Client) Unregister() error
- func (c *Client) Use(id int) error
- func (c *Client) UsePort(port int) error
- func (c *Client) Version() (*Version, error)
- func (c *Client) Whoami() (*ConnectionInfo, error)
- type Cmd
- type CmdArg
- type ConnectionInfo
- type CreatedServer
- type DBClient
- type DetailedOnlineClient
- type Error
- type Group
- type Instance
- type InvalidResponseError
- type Notification
- type NotifyCategory
- type OnlineClient
- type PrivilegeKey
- type Server
- type ServerConnectionInfo
- type ServerMethods
- func (s *ServerMethods) ChannelList() ([]*Channel, error)
- func (s *ServerMethods) ClientDBList() ([]*DBClient, error)
- func (s *ServerMethods) ClientInfo(clientID int) (*DetailedOnlineClient, error)
- func (s *ServerMethods) ClientList() ([]*OnlineClient, error)
- func (s *ServerMethods) Create(name string, args ...CmdArg) (*CreatedServer, error)
- func (s *ServerMethods) Delete(id int) error
- func (s *ServerMethods) Edit(args ...CmdArg) error
- func (s *ServerMethods) GroupList() ([]*Group, error)
- func (s *ServerMethods) IDGetByPort(port uint16) (int, error)
- func (s *ServerMethods) Info() (*Server, error)
- func (s *ServerMethods) InstanceInfo() (*Instance, error)
- func (s *ServerMethods) List(options ...string) (servers []*Server, err error)
- func (s *ServerMethods) PrivilegeKeyAdd(ttype, id1, id2 int, options ...CmdArg) (string, error)
- func (s *ServerMethods) PrivilegeKeyList() ([]*PrivilegeKey, error)
- func (s *ServerMethods) ServerConnectionInfo() (*ServerConnectionInfo, error)
- func (s *ServerMethods) Start(id int) error
- func (s *ServerMethods) Stop(id int) error
- type Version
Constants ¶
const ( ClientNickname = "client_nickname" ClientIsTalker = "client_is_talker" ClientDescription = "client_description" ClientIsChannelCommander = "client_is_channel_commander" ClientIconID = "client_icon_id" )
Properties that can be changed with ClientUpdate
const ( // DefaultPort is the default TeamSpeak 3 ServerQuery port. DefaultPort = 10011 // MaxParseTokenSize is the maximum buffer size used to parse the // server responses. // It's relatively large to enable us to deal with the typical responses // to commands such as serversnapshotcreate. MaxParseTokenSize = 10 << 20 // DefaultConnectHeader send by server on connect. DefaultConnectHeader = "TS3" )
const (
// ExtendedServerList can be passed to List to get extended server information.
ExtendedServerList = "-extended"
)
Variables ¶
var ( // DefaultTimeout is the default read / write / dial timeout for Clients. DefaultTimeout = 10 * time.Second // DefaultKeepAlive is the default interval in which keepalive data is sent. DefaultKeepAlive = 200 * time.Second // DefaultNotifyBufSize is the default notification buffer size. DefaultNotifyBufSize = 5 )
var ( // ErrInvalidConnectHeader is returned by NewClient if the server // doesn't respond with the required connection header. ErrInvalidConnectHeader = errors.New("invalid connect header") // ErrNilOption is returned by NewClient if an option is nil. ErrNilOption = errors.New("nil option") // ErrNotConnected is returned by Exec and ExecCmd if the client is not connected. ErrNotConnected = errors.New("not connected") // ErrTimeout is returned by Exec and ExecCmd if no response is received // within the specified timeout duration. ErrTimeout = errors.New("timeout") )
Functions ¶
func Buffer ¶
Buffer sets the initial buffer used to parse responses from the server and the maximum size of buffer that may be allocated. The maximum parsable token size is the larger of max and cap(buf). If max <= cap(buf), scanning will use this buffer only and do no allocation.
By default, parsing uses an internal buffer and sets the maximum token size to MaxParseTokenSize.
func ConnectHeader ¶
ConnectHeader sets the header expected on connect.
Default is "TS3" which is sent by server query. For client query use "TS3 Client".
func DecodeResponse ¶
DecodeResponse decodes a response into a struct.
func NotificationBuffer ¶
NotificationBuffer sets the notification buffer size.
func ScanLines ¶
ScanLines is a split function for a bytes.Scanner that returns each line of text, stripped of any trailing end-of-line marker. The returned line may be empty. The end-of-line marker is one newline followed by a carriage return. In regular expression notation, it is `\n\r`. The last non-empty line of input will be returned even if it has no newline.
Types ¶
type Arg ¶
type Arg struct {
// contains filtered or unexported fields
}
Arg represents a TeamSpeak 3 ServerQuery command argument. Args automatically escape white space and special characters before being sent to the server.
type ArgGroup ¶
type ArgGroup struct {
// contains filtered or unexported fields
}
ArgGroup represents a group of TeamSpeak 3 ServerQuery command arguments.
type ArgSet ¶
type ArgSet struct {
// contains filtered or unexported fields
}
ArgSet represents a set of TeamSpeak 3 ServerQuery command arguments.
type Channel ¶
type Channel struct { ID int `ms:"cid"` ParentID int `ms:"pid"` ChannelOrder int `ms:"channel_order"` ChannelName string `ms:"channel_name"` TotalClients int `ms:"total_clients"` NeededSubscribePower int `ms:"channel_needed_subscribe_power"` }
Channel represents a TeamSpeak 3 channel in a virtual server.
type Client ¶
type Client struct { Server *ServerMethods // contains filtered or unexported fields }
Client is a TeamSpeak 3 ServerQuery client.
func (*Client) ClientUpdate ¶
ClientUpdate changes properties of the client to a given value.
func (*Client) IsConnected ¶
IsConnected returns whether the client is connected.
func (*Client) Notifications ¶
func (c *Client) Notifications() <-chan Notification
Notifications returns a read-only channel that outputs received notifications.
If you subscribe to server and channel events you will receive duplicate `cliententerview` and `clientleftview` notifications. Sending a private message from the client results in a `textmessage` Notification even if the client didn't subscribe to any events.
Notifications are not documented by TeamSpeak; A complete but unofficial documentation in German can be found here: http://yat.qa/ressourcen/server-query-notify/
func (*Client) Register ¶
func (c *Client) Register(event NotifyCategory) error
Register registers for a NotifyCategory.
Subscriptions can be reset with `Unregister()` but will also be reset when calling `logout`, `login`, `use`.
func (*Client) RegisterChannel ¶
RegisterChannel registers for channel event notifications.
It's not possible to subscribe to multiple channels. To receive events for all channels the id can be set to 0.
func (*Client) SetChannelCommander ¶
SetChannelCommander sets whether the client is a channel commander.
func (*Client) SetDescription ¶
SetDescription sets the clients description.
func (*Client) Unregister ¶
Unregister unregisters all events previously registered.
func (*Client) Whoami ¶
func (c *Client) Whoami() (*ConnectionInfo, error)
Whoami returns information about the current connection including the currently selected virtual server.
type Cmd ¶
type Cmd struct {
// contains filtered or unexported fields
}
Cmd represents a TeamSpeak 3 ServerQuery command.
func (*Cmd) WithOptions ¶
WithOptions sets the command Options.
func (*Cmd) WithResponse ¶
WithResponse sets the command Response which will have the data returned from the server decoded into it.
type CmdArg ¶
type CmdArg interface {
ArgString() string
}
CmdArg is implemented by types which can be used as a command argument.
type ConnectionInfo ¶
type ConnectionInfo struct { ServerStatus string `ms:"virtualserver_status"` ServerID int `ms:"virtualserver_id"` ServerUniqueIdentifier string `ms:"virtualserver_unique_identifier"` ServerPort int `ms:"virtualserver_port"` ClientID int `ms:"client_id"` ClientChannelID int `ms:"client_channel_id"` ClientName string `ms:"client_nickname"` ClientDatabaseID int `ms:"client_database_id"` ClientLoginName string `ms:"client_login_name"` ClientUniqueIdentifier string `ms:"client_unique_identifier"` ClientOriginServerID int `ms:"client_origin_server_id"` }
ConnectionInfo represents an answer of the whoami command.
type CreatedServer ¶
CreatedServer is the details returned by a server create.
type DBClient ¶
type DBClient struct { ID int `ms:"cldbid"` UniqueIdentifier string `ms:"client_unique_identifier"` Nickname string `ms:"client_nickname"` Created time.Time `ms:"client_created"` LastConnected time.Time `ms:"client_lastconnected"` Connections int `ms:"client_totalconnections"` }
DBClient represents a client identity on a virtual server.
type DetailedOnlineClient ¶
type DetailedOnlineClient struct { OnlineClient `ms:",squash"` // Creation date and time of the clients first connection to the server. Created time.Time `ms:"client_created"` // Termination date and time of the clients last connection to the server. // Note: The manual claims this to be the *creation* date and time but the // values received while testing suggest otherwise. LastConnected time.Time `ms:"client_lastconnected"` // Empty or a string of 32 hexadecimal characters. Indicates whether the // client has set an avatar or not. // What platform the client is running on. For example "Windows". Base64HashClientUID string `ms:"client_base64HashClientUID"` // For example "83.123.45.6". According to the manual this is always IPv4. ConnectionClientIP string `ms:"connection_client_ip"` // For example "DE" for Germany. Country string `ms:"client_country"` // Takes the form of "/channelID" DefaultChannel string `ms:"client_default_channel"` DefaultToken string `ms:"client_default_token"` Description string `ms:"client_description"` LoginName string `ms:"client_login_name"` NicknamePhonetic string `ms:"client_nickname_phonetic"` SecurityHash string `ms:"client_security_hash"` TalkRequestMsg string `ms:"client_talk_request_msg"` UniqueIdentifier string `ms:"client_unique_identifier"` FlagAvatar string `ms:"client_flag_avatar"` Platform string `ms:"client_platform"` // Which version of the Teamspeak client application this client uses. Version string `ms:"client_version"` VersionSign string `ms:"client_version_sign"` // Milliseconds since the client connected to the server. ConnectionConnectedTime int64 `ms:"connection_connected_time"` ConnectionBytesReceivedTotal int64 `ms:"connection_bytes_received_total"` ConnectionBytesSentTotal int64 `ms:"connection_bytes_sent_total"` ConnectionPacketsReceivedTotal int64 `ms:"connection_packets_received_total"` ConnectionPacketsSentTotal int64 `ms:"connection_packets_sent_total"` // Milliseconds since the client did something, for example sending // a message, muting themselves or talking. IdleTime int64 `ms:"client_idle_time"` MonthBytesDownloaded int64 `ms:"client_month_bytes_downloaded"` MonthBytesUploaded int64 `ms:"client_month_bytes_uploaded"` TotalBytesDownloaded int64 `ms:"client_total_bytes_downloaded"` TotalBytesUploaded int64 `ms:"client_total_bytes_uploaded"` // Current bandwidth used for outgoing file transfers (Bytes/s) ConnectionFiletransferBandwidthSent int `ms:"connection_filetransfer_bandwidth_sent"` // Current bandwidth used for incoming file transfers (Bytes/s) ConnectionFiletransferBandwidthReceived int `ms:"connection_filetransfer_bandwidth_received"` // Average bandwidth used for outgoing data in the last second (Bytes/s) ConnectionBandwidthSentLastSecondTotal int `ms:"connection_bandwidth_sent_last_second_total"` // Average bandwidth used for outgoing data in the last minute (Bytes/s) ConnectionBandwidthSentLastMinuteTotal int `ms:"connection_bandwidth_sent_last_minute_total"` // Average bandwidth used for incoming data in the last second (Bytes/s) ConnectionBandwidthReceivedLastSecondTotal int `ms:"connection_bandwidth_received_last_second_total"` // Average bandwidth used for incoming data in the last minute (Bytes/s) ConnectionBandwidthReceivedLastMinuteTotal int `ms:"connection_bandwidth_received_last_minute_total"` ChannelGroupID int `ms:"client_channel_group_id"` ChannelGroupInheritedChannelID int `ms:"client_channel_group_inherited_channel_id"` NeededServerqueryViewPower int `ms:"client_needed_serverquery_view_power"` Servergroups []int `ms:"client_servergroups"` TalkPower int `ms:"client_talk_power"` // How often the client has connected to the server. Totalconnections int `ms:"client_totalconnections"` // CRC32 checksum of the client icon IconID uint32 `ms:"client_icon_id"` // False if the client has their microphone disabled, for example // because they unplugged it. Do not confuse this with InputMuted. InputHardware bool `ms:"client_input_hardware"` // True if the client has their microphone muted InputMuted bool `ms:"client_input_muted"` IsChannelCommander bool `ms:"client_is_channel_commander"` IsPrioritySpeaker bool `ms:"client_is_priority_speaker"` IsRecording bool `ms:"client_is_recording"` // False if the client has their speakers disabled, for example // because they are unplugged. Do not confuse this with OutputMuted. OutputHardware bool `ms:"client_output_hardware"` // True if the client has their speakers muted OutputMuted bool `ms:"client_output_muted"` OutputOnlyMuted bool `ms:"client_outputonly_muted"` TalkRequest bool `ms:"client_talk_request"` // Indicates whether the client is able to talk or not. //TODO(Henner25): This is always 0, even if my talk power is high enough? IsTalker bool `ms:"client_is_talker"` }
DetailedOnlineClient extends OnlineClient with all information from the clientinfo server query command about a client online on a virtual server.
type Error ¶
Error represents a error returned from the TeamSpeak 3 server.
type Group ¶
type Group struct { ID int `ms:"sgid"` Name string Type int IconID int Saved bool `ms:"savedb"` SortID int NameMode int ModifyPower int `ms:"n_modifyp"` MemberAddPower int `ms:"n_member_addp"` MemberRemovePower int `ms:"n_member_addp"` }
Group represents a virtual server group.
type Instance ¶
type Instance struct { DatabaseVersion int `ms:"serverinstance_database_version"` FileTransferPort int `ms:"serverinstance_filetransfer_port"` MaxTotalDownloadBandwidth uint64 `ms:"serverinstance_max_download_total_bandwidth"` MaxTotalUploadBandwidth uint64 `ms:"serverinstance_max_upload_total_bandwidth"` GuestServerQueryGroup int `ms:"serverinstance_guest_serverquery_group"` ServerQueryFloodCommands int `ms:"serverinstance_serverquery_flood_commands"` ServerQueryFloodTime int `ms:"serverinstance_serverquery_flood_time"` ServerQueryBanTime int `ms:"serverinstance_serverquery_ban_time"` TemplateServerAdminGroup int `ms:"serverinstance_template_serveradmin_group"` TemplateServerDefaultGroup int `ms:"serverinstance_template_serverdefault_group"` TemplateChannelAdminGroup int `ms:"serverinstance_template_channeladmin_group"` TemplateChannelDefaultGroup int `ms:"serverinstance_template_channeldefault_group"` PermissionsVersion int `ms:"serverinstance_permissions_version"` PendingConnectionsPerIP int `ms:"serverinstance_pending_connections_per_ip"` }
Instance represents basic information for a TeamSpeak 3 instance.
type InvalidResponseError ¶
InvalidResponseError is the error returned when the response data was invalid.
func NewInvalidResponseError ¶
func NewInvalidResponseError(reason string, lines []string) *InvalidResponseError
NewInvalidResponseError returns a new InvalidResponseError from lines.
func (*InvalidResponseError) Error ¶
func (e *InvalidResponseError) Error() string
type Notification ¶
Notification contains the information of a notify event.
type NotifyCategory ¶
type NotifyCategory string
NotifyCategory is an event category.
const ( // ServerEvents registers the following events: // `cliententerview`, `clientleftview`, `serveredited`. ServerEvents NotifyCategory = "server" // ChannelEvents registers the following events: // `cliententerview`, `clientleftview`, `channeldescriptionchanged`, `channelpasswordchanged` // `channelmoved`, `channeledited`, `channelcreated`, `channeldeleted`, `clientmoved`. ChannelEvents NotifyCategory = "channel" // TextServerEvents registers the `textmessage` event with `targetmode = 3`. TextServerEvents NotifyCategory = "textserver" // TextChannelEvents registers the `textmessage` event with `targetmode = 2`. // // Notifications are only received for messages that are sent in the channel that the client is in. TextChannelEvents NotifyCategory = "textchannel" // TextPrivateEvents registers the `textmessage` event with `targetmode = 1`. TextPrivateEvents NotifyCategory = "textprivate" // TokenUsedEvents registers the `tokenused` event. TokenUsedEvents NotifyCategory = "tokenused" )
type OnlineClient ¶
type OnlineClient struct { ID int `ms:"clid"` ChannelID int `ms:"cid"` DatabaseID int `ms:"client_database_id"` Nickname string `ms:"client_nickname"` Type int `ms:"client_type"` Away bool `ms:"client_away"` AwayMessage string `ms:"client_away_message"` }
OnlineClient represents a client online on a virtual server.
type PrivilegeKey ¶
type PrivilegeKey struct { Token string Type int `ms:"token_type"` ID1 int `ms:"token_id1"` ID2 int `ms:"token_id2"` Created int `ms:"token_created"` Description string `ms:"token_description"` }
PrivilegeKey represents a server privilege key.
type Server ¶
type Server struct { AntiFloodPointsNeededCommandBlock int `ms:"virtualserver_antiflood_points_needed_command_block"` AntiFloodPointsNeededIPBlock int `ms:"virtualserver_antiflood_points_needed_ip_block"` AntiFloodPointsTickReduce int `ms:"virtualserver_antiflood_points_tick_reduce"` ChannelsOnline int `ms:"virtualserver_channelsonline"` ClientsOnline int `ms:"virtualserver_clientsonline"` CodecEncryptionMode int `ms:"virtualserver_codec_encryption_mode"` ComplainAutoBanCount int `ms:"virtualserver_complain_autoban_count"` ComplainAutoBanTime int `ms:"virtualserver_complain_autoban_time"` ComplainRemoveTime int `ms:"virtualserver_complain_remove_time"` Created int `ms:"virtualserver_created"` DefaultChannelAdminGroup int `ms:"virtualserver_default_channel_admin_group"` DefaultChannelGroup int `ms:"virtualserver_default_channel_group"` DefaultServerGroup int `ms:"virtualserver_default_server_group"` HostBannerGFXInterval int `ms:"virtualserver_hostbanner_gfx_interval"` HostMessageMode int `ms:"virtualserver_hostmessage_mode"` ID int `ms:"virtualserver_id"` MachineID string `ms:"virtualserver_machine_id"` MaxClients int `ms:"virtualserver_maxclients"` MinClientsInChannelBeforeForcedSilence int `ms:"virtualserver_min_clients_in_channel_before_forced_silence"` NeededIdentitySecurityLevel int `ms:"virtualserver_needed_identity_security_level"` Port int `ms:"virtualserver_port"` QueryClientsOnline int `ms:"virtualserver_queryclientsonline"` Uptime int `ms:"virtualserver_uptime"` // TODO(steve): use time.Duration AskForPrivilegeKey bool `ms:"virtualserver_ask_for_privilegekey"` AutoStart bool `ms:"virtualserver_autostart"` FlagPassword bool `ms:"virtualserver_flag_password"` LogChannel bool `ms:"virtualserver_log_channel"` LogClient bool `ms:"virtualserver_log_client"` LogFileTransfer bool `ms:"virtualserver_log_filetransfer"` LogPermissions bool `ms:"virtualserver_log_permissions"` LogQuery bool `ms:"virtualserver_log_client"` LogServer bool `ms:"virtualserver_log_server"` WebListEnabled bool `ms:"virtualserver_web_list_enabled"` PrioritySpeakerDimmModificator float32 `ms:"virtualserver_priority_speaker_dimm_modificator"` BandwidthReceivedLastMinuteTotal int `ms:"virtualserver_bandwidth_received_last_minute_total"` BandwidthReceivedLastSecondTotal int `ms:"virtualserver_bandwidth_received_last_second_total"` BandwidthSentLastMinuteTotal int `ms:"virtualserver_bandwidth_sent_last_minute_total"` BandwidthSentLastSecondTotal int `ms:"virtualserver_bandwidth_sent_last_second_total"` ChannelTempDeleteDelayDefault int `ms:"virtualserver_channel_temp_delete_delay_default"` HostBannerMode int `ms:"virtualserver_hostbanner_mode"` IconID int `ms:"virtualserver_icon_id"` MinAndroidVersion int `ms:"virtualserver_min_android_version"` MinClientVersion int `ms:"virtualserver_min_client_version"` MiniOSVersion int `ms:"virtualserver_min_ios_version"` ReservedSlots int `ms:"virtualserver_reserved_slots"` TotalPing float32 `ms:"virtualserver_total_ping"` MaxDownloadTotalBandwidth uint64 `ms:"virtualserver_max_download_total_bandwidth"` MaxUploadTotalBandwidth uint64 `ms:"virtualserver_max_upload_total_bandwidth"` MonthBytesDownloaded int64 `ms:"virtualserver_month_bytes_downloaded"` MonthBytesUploaded int64 `ms:"virtualserver_month_bytes_uploaded"` TotalBytesDownloaded int64 `ms:"virtualserver_total_bytes_downloaded"` TotalBytesUploaded int64 `ms:"virtualserver_total_bytes_uploaded"` TotalPacketLossControl float64 `ms:"virtualserver_total_packetloss_control"` TotalPacketLossKeepalive float64 `ms:"virtualserver_total_packetloss_keepalive"` TotalPacketLossSpeech float64 `ms:"virtualserver_total_packetloss_speech"` TotalPacketLossTotal float64 `ms:"virtualserver_total_packetloss_total"` VirtualServerDownloadQuota uint64 `ms:"virtualserver_download_quota"` VirtualServerUploadQuota uint64 `ms:"virtualserver_upload_quota"` FileBase string `ms:"virtualserver_filebase"` HostBannerGFXURL string `ms:"virtualserver_hostbanner_gfx_url"` HostBannerURL string `ms:"virtualserver_hostbanner_url"` HostButtonGFXURL string `ms:"virtualserver_hostbutton_gfx_url"` HostButtonToolTip string `ms:"virtualserver_hostbutton_tooltip"` HostButtonURL string `ms:"virtualserver_hostbutton_url"` HostMessage string `ms:"virtualserver_hostmessage"` Name string `ms:"virtualserver_name"` NamePhonetic string `ms:"virtualserver_name_phonetic"` Password string `ms:"virtualserver_password"` Platform string `ms:"virtualserver_platform"` Status string `ms:"virtualserver_status"` UniqueIdentifier string `ms:"virtualserver_unique_identifier"` Version string `ms:"virtualserver_version"` WelcomeMessage string `ms:"virtualserver_welcomemessage"` }
Server represents a TeamSpeak 3 virtual server.
type ServerConnectionInfo ¶
type ServerConnectionInfo struct { FileTransferBandwidthSent uint64 `ms:"connection_filetransfer_bandwidth_sent"` FileTransferBandwidthReceived uint64 `ms:"connection_filetransfer_bandwidth_received"` FileTransferTotalSent uint64 `ms:"connection_filetransfer_bytes_sent_total"` FileTransferTotalReceived uint64 `ms:"connection_filetransfer_bytes_received_total"` PacketsSentTotal uint64 `ms:"connection_packets_sent_total"` PacketsReceivedTotal uint64 `ms:"connection_packets_received_total"` BytesSentTotal uint64 `ms:"connection_bytes_sent_total"` BytesReceivedTotal uint64 `ms:"connection_bytes_received_total"` BandwidthSentLastSecond uint64 `ms:"connection_bandwidth_sent_last_second_total"` BandwidthReceivedLastSecond uint64 `ms:"connection_bandwidth_received_last_second_total"` BandwidthSentLastMinute uint64 `ms:"connection_bandwidth_sent_last_minute_total"` BandwidthReceivedLastMinute uint64 `ms:"connection_bandwidth_received_last_minute_total"` ConnectedTime uint32 `ms:"connection_connected_time"` PacketLossTotalAvg float32 `ms:"connection_packetloss_total"` PingTotalAvg float32 `ms:"connection_ping"` PacketsSentSpeech uint64 `ms:"connection_packets_sent_speech"` PacketsReceivedSpeech uint64 `ms:"connection_packets_received_speech"` BytesSentSpeech uint64 `ms:"connection_bytes_sent_speech"` BytesReceivedSpeech uint64 `ms:"connection_bytes_received_speech"` PacketsSentKeepalive uint64 `ms:"connection_packets_sent_keepalive"` PacketsReceivedKeepalive uint64 `ms:"connection_packets_received_keepalive"` BytesSentKeepalive uint64 `ms:"connection_bytes_sent_keepalive"` BytesReceivedKeepalive uint64 `ms:"connection_bytes_received_keepalive"` PacketsSentControl uint64 `ms:"connection_packets_sent_control"` PacketsReceivedControl uint64 `ms:"connection_packets_received_control"` BytesSentControl uint64 `ms:"connection_bytes_sent_control"` BytesReceivedControl uint64 `ms:"connection_bytes_received_control"` }
ServerConnectionInfo represents the connection info for a TeamSpeak 3 instance.
type ServerMethods ¶
type ServerMethods struct {
*Client
}
ServerMethods groups server methods.
func (*ServerMethods) ChannelList ¶
func (s *ServerMethods) ChannelList() ([]*Channel, error)
ChannelList returns a list of channels for the selected server.
func (*ServerMethods) ClientDBList ¶
func (s *ServerMethods) ClientDBList() ([]*DBClient, error)
ClientDBList returns a list of client identities known by the server.
func (*ServerMethods) ClientInfo ¶
func (s *ServerMethods) ClientInfo(clientID int) (*DetailedOnlineClient, error)
ClientInfo returns detailed information about a single online client.
func (*ServerMethods) ClientList ¶
func (s *ServerMethods) ClientList() ([]*OnlineClient, error)
ClientList returns a list of online clients.
func (*ServerMethods) Create ¶
func (s *ServerMethods) Create(name string, args ...CmdArg) (*CreatedServer, error)
Create creates a new virtual server using the given properties and returns its ID, port and initial administrator privilege key. If virtualserver_port arg is not specified, the server will use the first unused UDP port.
func (*ServerMethods) Delete ¶
func (s *ServerMethods) Delete(id int) error
Delete deletes the virtual server specified by id. Only virtual server in a stopped state can be deleted.
func (*ServerMethods) Edit ¶
func (s *ServerMethods) Edit(args ...CmdArg) error
Edit changes the selected virtual servers configuration using the given args.
func (*ServerMethods) GroupList ¶
func (s *ServerMethods) GroupList() ([]*Group, error)
GroupList returns a list of available groups for the selected server.
func (*ServerMethods) IDGetByPort ¶
func (s *ServerMethods) IDGetByPort(port uint16) (int, error)
IDGetByPort returns the database id of the virtual server running on UDP port.
func (*ServerMethods) Info ¶
func (s *ServerMethods) Info() (*Server, error)
Info returns detailed configuration information about the selected server.
func (*ServerMethods) InstanceInfo ¶
func (s *ServerMethods) InstanceInfo() (*Instance, error)
InstanceInfo returns detailed information about the selected instance.
func (*ServerMethods) List ¶
func (s *ServerMethods) List(options ...string) (servers []*Server, err error)
List lists virtual servers. In addition to the options supported by the Teamspeak 3 query protocol it also supports the ExtendedServerList option. If ExtendedServerList is specified in options then each server returned contain extended server information as returned by Info.
func (*ServerMethods) PrivilegeKeyAdd ¶
func (s *ServerMethods) PrivilegeKeyAdd(ttype, id1, id2 int, options ...CmdArg) (string, error)
PrivilegeKeyAdd creates a new privilege token to the selected server and returns it. If tokentype is set to 0, the ID specified with id1 will be a server group ID. Otherwise, id1 is used as a channel group ID and you need to provide a valid channel ID using id2.
func (*ServerMethods) PrivilegeKeyList ¶
func (s *ServerMethods) PrivilegeKeyList() ([]*PrivilegeKey, error)
PrivilegeKeyList returns a list of available privilege keys for the selected server, including their type and group IDs.
func (*ServerMethods) ServerConnectionInfo ¶
func (s *ServerMethods) ServerConnectionInfo() (*ServerConnectionInfo, error)
ServerConnectionInfo returns detailed bandwidth and transfer information about the selected instance.
func (*ServerMethods) Start ¶
func (s *ServerMethods) Start(id int) error
Start starts the virtual server specified by id.
func (*ServerMethods) Stop ¶
func (s *ServerMethods) Stop(id int) error
Stop stops the virtual server specified by id.