ts3

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2020 License: BSD-2-Clause Imports: 11 Imported by: 0

README

TeamSpeak 3 Go Report Card License GoDoc Build Status

go-ts3 is a Go client for the TeamSpeak 3 ServerQuery Protocol.

Features

Installation

go get -u github.com/multiplay/go-ts3

Examples

Using go-ts3 is simple just create a client, login and then send commands e.g.

package main

import (
	"log"

        "github.com/multiplay/go-ts3"
)

func main() {
        c, err := ts3.NewClient("192.168.1.102:10011")
	if err != nil {
		log.Fatal(err)
	}
	defer c.Close()

	if err := c.Login(user, pass); err != nil {
		log.Fatal(err)
	}

	if v, err := c.Version(); err != nil {
		log.Fatal(err)
	} else {
		log.Println("server is running:", v)
	}
}

Documentation

License

go-ts3 is available under the BSD 2-Clause License.

Documentation

Index

Constants

View Source
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

View Source
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"
)
View Source
const (
	// ExtendedServerList can be passed to List to get extended server information.
	ExtendedServerList = "-extended"
)

Variables

View Source
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
)
View Source
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

func Buffer(buf []byte, max int) func(*Client) error

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 added in v1.1.0

func ConnectHeader(connectHeader string) func(*Client) error

ConnectHeader sets the header expected on connect.

Default is "TS3" which is sent by server query. For client query use "TS3 Client".

func Decode

func Decode(str string) string

Decode returns a decoded version of str.

func DecodeResponse

func DecodeResponse(lines []string, v interface{}) error

DecodeResponse decodes a response into a struct.

func KeepAlive added in v1.1.0

func KeepAlive(keepAlive time.Duration) func(*Client) error

KeepAlive sets the keepAlive interval.

func NotificationBuffer added in v1.1.0

func NotificationBuffer(size int) func(*Client) error

NotificationBuffer sets the notification buffer size.

func ScanLines

func ScanLines(data []byte, atEOF bool) (advance int, token []byte, err error)

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.

func Timeout

func Timeout(timeout time.Duration) func(*Client) error

Timeout sets read / write / dial timeout for a TeamSpeak 3 Client.

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.

func NewArg

func NewArg(key string, val interface{}) *Arg

NewArg returns a new Arg with key val.

func (*Arg) ArgString

func (a *Arg) ArgString() string

ArgString implements CmdArg

type ArgGroup

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

ArgGroup represents a group of TeamSpeak 3 ServerQuery command arguments.

func NewArgGroup

func NewArgGroup(args ...CmdArg) *ArgGroup

NewArgGroup returns a new ArgGroup.

func (*ArgGroup) ArgString

func (ag *ArgGroup) ArgString() string

ArgString implements CmdArg.

type ArgSet

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

ArgSet represents a set of TeamSpeak 3 ServerQuery command arguments.

func NewArgSet

func NewArgSet(args ...CmdArg) *ArgSet

NewArgSet returns a new ArgSet.

func (*ArgSet) ArgString

func (ag *ArgSet) ArgString() string

ArgString implements CmdArg.

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"`
	ChannelMaxClients    int    `ms:"channel_maxclients"`
	// contains filtered or unexported fields
}

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 NewClient

func NewClient(addr string, options ...func(c *Client) error) (*Client, error)

NewClient returns a new TeamSpeak 3 client connected to addr.

func (*Client) ClientUpdate added in v1.1.0

func (c *Client) ClientUpdate(properties ...CmdArg) error

ClientUpdate changes properties of the client to a given value.

func (*Client) Close

func (c *Client) Close() error

Close closes the connection to the server.

func (*Client) Exec

func (c *Client) Exec(cmd string) ([]string, error)

Exec executes cmd on the server and returns the response.

func (*Client) ExecCmd

func (c *Client) ExecCmd(cmd *Cmd) ([]string, error)

ExecCmd executes cmd on the server and returns the response.

func (*Client) IsConnected added in v1.1.0

func (c *Client) IsConnected() bool

IsConnected returns whether the client is connected.

func (*Client) Login

func (c *Client) Login(user, passwd string) error

Login authenticates with the server.

func (*Client) Logout

func (c *Client) Logout() error

Logout deselect virtual server and log out.

func (*Client) Notifications added in v1.1.0

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 added in v1.1.0

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 added in v1.1.0

func (c *Client) RegisterChannel(id uint) error

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 added in v1.1.0

func (c *Client) SetChannelCommander(val bool) error

SetChannelCommander sets whether the client is a channel commander.

func (*Client) SetDescription added in v1.1.0

func (c *Client) SetDescription(description string) error

SetDescription sets the clients description.

func (*Client) SetIcon added in v1.1.0

func (c *Client) SetIcon(id int) error

SetIcon sets the clients icon based on the CRC32 checksum.

func (*Client) SetNick added in v1.1.0

func (c *Client) SetNick(nick string) error

SetNick sets the clients nickname.

func (*Client) SetTalker added in v1.1.0

func (c *Client) SetTalker(val bool) error

SetTalker sets whether the client is able to talk.

func (*Client) Unregister added in v1.1.0

func (c *Client) Unregister() error

Unregister unregisters all events previously registered.

func (*Client) Use

func (c *Client) Use(id int) error

Use selects a virtual server by id.

func (*Client) UsePort

func (c *Client) UsePort(port int) error

UsePort selects a virtual server by port.

func (*Client) Version

func (c *Client) Version() (*Version, error)

Version returns version information.

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 NewCmd

func NewCmd(cmd string) *Cmd

NewCmd creates a new Cmd.

func (*Cmd) String

func (c *Cmd) String() string

func (*Cmd) WithArgs

func (c *Cmd) WithArgs(args ...CmdArg) *Cmd

WithArgs sets the command Args.

func (*Cmd) WithOptions

func (c *Cmd) WithOptions(options ...string) *Cmd

WithOptions sets the command Options.

func (*Cmd) WithResponse

func (c *Cmd) WithResponse(r interface{}) *Cmd

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

type CreatedServer struct {
	ID    int    `ms:"sid"`
	Port  uint16 `ms:"virtualserver_port"`
	Token string
}

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 Error

type Error struct {
	ID      int
	Msg     string
	Details map[string]interface{}
}

Error represents a error returned from the TeamSpeak 3 server.

func NewError

func NewError(matches []string) *Error

NewError returns a new Error parsed from TeamSpeak 3 server response.

func (*Error) Error

func (e *Error) Error() string

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

type InvalidResponseError struct {
	Reason string
	Data   []string
}

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 added in v1.1.0

type Notification struct {
	Type string
	Data map[string]string
}

Notification contains the information of a notify event.

type NotifyCategory added in v1.1.0

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 {
	CID                int    `ms:"cid"`
	CLID               int    `ms:"clid"`
	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"`
	ClientServerGroups string `ms:"client_servergroups"`
	ConnectionClientIP string `ms:"connection_client_ip"`
}

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"`
}

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) ClientKick added in v1.1.0

func (s *ServerMethods) ClientKick(c OnlineClient, reasonid, reasonmsg string) error

ClientKick - Kicks user form server

func (*ServerMethods) ClientList

func (s *ServerMethods) ClientList(args string) ([]*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.

type Version

type Version struct {
	Version  string
	Platform string
	Build    int
}

Version represents version information.

Jump to

Keyboard shortcuts

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