query

package
v0.1.0-alpha Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// LevelError equals 1
	LevelError LogLevel = 1
	// LevelWarning equals 2
	LevelWarning = LevelError + 1
	// LevelDebug equals 3
	LevelDebug = LevelWarning + 1
	// LevelInfo equals 4
	LevelInfo = LevelDebug + 1
)

Variables

This section is empty.

Functions

This section is empty.

Types

type APIKey

type APIKey struct {
	Key        string `mapstructure:"apikey"`
	ID         int    `mapstructure:"id"`
	ServerID   int    `mapstructure:"sid"`
	ClientDBID int    `mapstructure:"cldbid"`
	Scope      Scope  `mapstructure:"scope"`
	Created    int64  `mapstructure:"created_at"`
	Expires    int64  `mapstructure:"expires_at"`
}

APIKey represents the output of ever APIKeyAdd or APIKeyList If this is a result of APIKeyList Key is empty

type Agent

type Agent struct {
	Query libts.Query
}

Agent is a collection of prepared commands for querying teamspeak

func (Agent) APIKeyAdd

func (a Agent) APIKeyAdd(sid int, s Scope, lifetime int, cldbid int) (*APIKey, error)

APIKeyAdd a new key on server sid for user cldbid with the scope s and lifetime in days sid - required scope - required lifetime - optional - Default is 14 days (-1) cldbid - optional - Default is invoker (0)

func (Agent) APIKeyDel

func (a Agent) APIKeyDel(sid int, id int) error

APIKeyDel the key id from server sid sid - required id - required

func (Agent) APIKeyList

func (a Agent) APIKeyList(sid int, cldbid int, offset int, count int) ([]APIKey, error)

APIKeyList all keys on server sid for client cldbid. Start at offset and return count keys total sid - required cldbid - optional - Default is invoker (0) - (-1) for all clients offset - optional count - optional - Default is all (0)

func (Agent) BanAdd

func (a Agent) BanAdd(sid int, ip string, name string, uid string, mytsid string, time time.Duration, reason string, lastnickname string) (int, error)

BanAdd a ban to server sid. Client to ban can be specified using ip, name, uid or myTeamSpeakId (I don't know what the lastnickname does, since the docs didn't bother to mention it) sid - required ip - optional - regexp for last ip of client name - optional - regexp for nickname uid - optional - uid of client mytsid - optional - myTeamSpeak ID time - optional - Default 0 (infinite) reason - optional lastnickname - optional - I dunno what ever Possibly returns multiple banids if more than one matche is found

func (Agent) BanClients

func (a Agent) BanClients(sid int, time time.Duration, reason string, clid ...int) ([]int, error)

BanClients clid on server sid for time time for reason reason sid - required time - optional reason - optional clid - required

func (Agent) BanDel

func (a Agent) BanDel(sid int, banid int) error

BanDel delete ban banid on server sid sid - required banid - required

func (Agent) BanDelAll

func (a Agent) BanDelAll(sid int) error

BanDelAll bans on server sid sid - required

func (Agent) BanList

func (a Agent) BanList(sid int, offset int, count int) error

BanList all bans on server sid with offset and a maximum of count sid - required offset - optional - Default 0 - skip the first 'offset' bans count - optional - Default 0

func (Agent) BindingList

func (a Agent) BindingList(sid int, subsystem string) ([]net.IP, error)

BindingList returns the bindings for the specified subsystem sid - required subsystem - optional - Default 'voice' - Possible 'voice', 'query', 'filetransfer'

func (Agent) Channel

func (a Agent) Channel(sid int, cid int) (*Channel, error)

Channel returns detailed info about a channel specified by cid on a server specified by sid

func (Agent) ChannelGroupList

func (a Agent) ChannelGroupList(sid int) ([]Group, error)

ChannelGroupList returns a list of all servergroups Type Channelgroups -> 0 = Template | 1 = Normal

func (Agent) ChannelIDList

func (a Agent) ChannelIDList(sid int) ([]int, error)

ChannelIDList only returns the ids of all channels on a virtual server This func executes the 'channellist' command, but discards all information except the cids for a uniform behaviour

func (Agent) ChannelList

func (a Agent) ChannelList(sid int) ([]Channel, error)

ChannelList returns a array of all channels Teamspeak returns different information dependening if you ask for one channel or multiple To compensate for that, ChannelList first asks for all channels and then for each channel individually resulting in a larger amount of requests

func (Agent) Client

func (a Agent) Client(sid int, clid int) (*Client, error)

Client returns client clid on server sid sid - required clid - required

func (Agent) ClientIDList

func (a Agent) ClientIDList(sid int) ([]int, error)

ClientIDList returns a list of only the client ids This has the same problem as all the list commands It provides different information than the corresponding info command sid - required

func (Agent) ClientList

func (a Agent) ClientList(sid int) ([]Client, error)

ClientList returns all currently logged in clients sid - required

func (Agent) Clients

func (a Agent) Clients(sid int, clids ...int) ([]Client, error)

Clients returns all clients specified by []clids Only here does the query provide a possibility to query multiple objects as you would expect them with one command So we might as well use it sid - required clids - required (returns when len(clids) == 0)

func (Agent) CreateDirectory

func (a Agent) CreateDirectory(sid int, cid int, cpw string, name string) error

CreateDirectory on server sid in channel cid with channelpassword cpw and name name This function is only supported by telnet and SSH query sid - required cid - required cpw - optional name - required

func (Agent) DBClients

func (a Agent) DBClients(sid int, cldbids ...int) (*[]DBClient, error)

DBClients returns clients from database of server sid sid - required cldbids - required (returns when len(cldbids) == 0)

func (Agent) DeleteFile

func (a Agent) DeleteFile(sid int, cid int, cpw string, name ...string) error

DeleteFile deletes one or more files on server sid in channel cid with channelpassword cpw and names name sid - required cid - required cpw - optional name - required

func (Agent) DeleteOfflineMessage

func (a Agent) DeleteOfflineMessage(sid int, id int) error

DeleteOfflineMessage on server sid with message id id from your inbox I don't really know why this functionality even exists. I wasn't able to figure out, how to even send offline messages to the server query sid - required id - required

func (Agent) DownloadAvatar

func (a Agent) DownloadAvatar(sid int, clientBase64Hash string) ([]byte, error)

DownloadAvatar for a specific client This function is only supported by telnet and SSH query

func (Agent) DownloadFile

func (a Agent) DownloadFile(ft *FileTransfer) ([]byte, error)

DownloadFile returns the File for ft

func (Agent) DownloadIcon

func (a Agent) DownloadIcon(sid int, iconID uint32) ([]byte, error)

DownloadIcon for specific iconID This function is only supported by telnet and SSH query iconID is normally an int in the structs. It is supposed to be an uint32, but the query screws up sometimes Read all about it here: https://community.teamspeak.com/t/bug-query-sends-wrong-icon-id-in-response/15054 so just do uint32(iconID) to get the correct iconID

func (Agent) FileInfo

func (a Agent) FileInfo(sid int, cid int, cpw string, name ...string) ([]File, error)

FileInfo returns a File on server sid in channel cid with channelpassword cpw and name name This method is only supported by Telnet and SSH query sid - required cid - required cpw - optional name - required

func (Agent) FileList

func (a Agent) FileList(sid int, cid int, cpw string, path string) ([]File, error)

FileList lists all files on server sid in channel cid with channelpassword cpw in path path This function is only supported by telnet and SSH query sid - required cid - required cpw - optional path - required

func (Agent) GetOfflineMessage

func (a Agent) GetOfflineMessage(sid, id int) error

GetOfflineMessage on server sid with message id id from your inbox I don't really know why this functionality even exists. I wasn't able to figure out, how to even send offline messages to the server query sid - required id - required

func (Agent) GlobalMessage

func (a Agent) GlobalMessage(message string) error

GlobalMessage sends message message to virtualservers in the server chat (using the gm command - I just don't know, why this command has such a non descriptive name) message - required

func (Agent) HashToUID

func (a Agent) HashToUID(hash string) (string, error)

HashToUID converts the client.Base64Hash to the client UID This is useful to find the client an avatar belongs to

func (Agent) Host

func (a Agent) Host() (*HostInfo, error)

Host retrieves info about the host of the TeamSpeak server

func (Agent) InitDownload

func (a Agent) InitDownload(sid int, f File, cpw string) (*FileTransfer, error)

InitDownload initializes the download for file f with channelpassword cpw on server sid This is only supported by telnet and ssh query sid - required f - required cpw - optional

func (Agent) InitUpload

func (a Agent) InitUpload(sid, cid int, cpw string, name string, overwrite bool, size int) (*FileTransfer, error)

InitUpload initialized the upload on server sid into channel cid for a file with name name and size size This is only supported by telnet and ssh query sid - required cid - required cpw - optional name - required overwrite - optional - default false size - required

func (Agent) Instance

func (a Agent) Instance() (*InstanceInfo, error)

Instance returns the combined result of hostinfo and instanceinfo since I didn't really see point in dividing them

func (Agent) InstanceEdit

func (a Agent) InstanceEdit(instance InstanceInfo) error

InstanceEdit changes the instance according to instance instance - required - be aware that also null values are used. e.g.: if FileTransferPort is left undeclared in the struct it will have 0 as its value and the function will attempt to change the port to 0 So it is advice to first get the InstanceInfo using Instance(), then change what you want to change and send it back

func (Agent) LogAdd

func (a Agent) LogAdd(sid int, level LogLevel, message string) error

LogAdd adds a custom log message to the virtualserver log. You cannot log to the instance log sid - required level - required message - required

func (Agent) LogView

func (a Agent) LogView(sid int) ([]LogEntry, error)

LogView returns either the instances logs (sid 0) or the server logs It always returns the whole log, what could take a while TODO: Pageination There is currently a bug where the first three bytes of the first line of a log file are not returned, thus the timestamp of the first logentry is empty sid - optional

func (Agent) Login

func (a Agent) Login(username, password string) error

Login to a useraccount This is not supported by webquery username - required password - required

func (Agent) Logout

func (a Agent) Logout() error

Logout from a server This is not supported by webquery

func (Agent) MoveClient

func (a Agent) MoveClient(sid, clid, from, to int, cpw string) error

MoveClient cid form channel "from" to channel "to" sid - required clid - required from - required to - required cpw - optional

func (Agent) MoveFile

func (a Agent) MoveFile(sid int, cid int, cpw string, tcid int, tcpw string, name string, newname string) error

MoveFile on server sid from channel cid with channelpassword cpw to channel tcid with channelpassword tcpw and rename from name to newname sid - required cid - required cpw - optional tcid - required - can be same as cid (then the file will only be renamed) tcpw - optional - see above name - required newname - required - can be same as name (then the file will only be moved)

func (Agent) SendOfflineMessage

func (a Agent) SendOfflineMessage(sid int, cluid, subject, message string) error

SendOfflineMessage on server sid to client cluid with header subject and body message sid - required cluid - required subject - required message - required

func (Agent) ServerGroupList

func (a Agent) ServerGroupList(sid int) ([]Group, error)

ServerGroupList returns a list of all servergroups Type Servergroups -> 2 = Server Query Group | 0 = Template | 1 = Normal (I think)

func (Agent) SnapshotCreate

func (a Agent) SnapshotCreate(sid int, password string) (*RawSnapshot, error)

SnapshotCreate returns a newly created snapshot form server sid with password password sid - required password - optional

func (Agent) SnapshotDeploy

func (a Agent) SnapshotDeploy(sid int, keepFiles bool, password string, snapshot RawSnapshot) error

SnapshotDeploy a snapshot snapshot with password password to server sid and keepfiles sid - required - 0 for new virtualserver keepFiles - optional password - optional snapshot - required

func (Agent) UIDToHash

func (a Agent) UIDToHash(uid string) (string, error)

UIDToHash converts a client.UID to a Base64Hash

func (Agent) UploadFile

func (a Agent) UploadFile(ft *FileTransfer, file []byte) error

UploadFile uploads the given file to the server

func (Agent) VirtualServer

func (a Agent) VirtualServer(sid int) (*VirtualServer, error)

VirtualServer returns the virtual server represented by id

func (Agent) VirtualServerIDList

func (a Agent) VirtualServerIDList() ([]int, error)

VirtualServerIDList only returns the ids of all virtual servers

func (Agent) VirtualServerList

func (a Agent) VirtualServerList() ([]VirtualServer, error)

VirtualServerList returns an array of all virtual servers

func (Agent) WhoAmI

func (a Agent) WhoAmI(sid int) (*Me, error)

WhoAmI returns Me sid - optional - It depends on the used query what happens. WebQuery will execute WhoAmI without a server. Telnet and SSH query will use the currently selected virtual server The output (filled fields) obviously varies based on the circumstances of the call (with or whithout sid)

type Ban

type Ban struct {
	ID           int    `mapstructure:"banid"`
	IP           string `mapstructure:"ip"`
	Created      int64  `mapstructure:"created"`
	InvokerName  string `mapstructure:"ivokername"`
	InvokerDBID  int    `mapstructure:"invokercldbid"`
	InvokerUID   string `mapstructure:"invokeruid"`
	Reason       string `mapstructure:"reason"`
	Enforcements int    `mapstructure:"enforcements"`
}

Ban is a single ban on a virtualserver obtained by BanList

type Channel

type Channel struct {
	ID               int    `mapstructure:"id"`
	ParentID         int    `mapstructure:"pid"`
	IconID           int    `mapstructure:"channel_icon_id"`
	Name             string `mapstructure:"channel_name"`
	Topic            string `mapstructure:"channel_topic"`
	Description      string `mapstructure:"channel_description"`
	Password         bool   `mapstructure:"channel_flag_password"`
	Codec            Codec  `mapstructure:"channel_codec"`
	CodecQuality     int    `mapstructure:"channel_codec_quality"`
	MaxClients       int    `mapstructure:"channel_maxclients"`
	MaxFamilyClients int    `mapstructure:"channel_maxfamilyclients"`
	Order            int    `mapstructure:"channel_order"`
	Permanent        bool   `mapstructure:"channel_flag_permanent"`
	SemiPermanent    bool   `mapstructure:"channel_flag_semi_permanent"`
	Temporary        bool   `mapstructure:"channel_flag_temporary"`
	DefaultChannel   bool   `mapstructure:"channel_flag_default"`
	TalkPower        int    `mapstructure:"channel_needed_talk_power"`
	NamePhonetic     string `mapstructure:"channel_name_phonetic"`
	FilePath         string `mapstructure:"channel_filepath"`
	Silenced         bool   `mapstructure:"channel_forced_silence"`
	SecondsEmpty     int64  `mapstructure:"seconds_empty"`
}

Channel is a single Channel on a virtual server

type Client

type Client struct {
	ID                         int
	Away                       int       `mapstructure:"client_away"`
	AwayMessage                string    `mapstructure:"client_away_message"`
	Base64Hash                 string    `mapstructure:"client_base64HashClientUID"`
	ChannelGroups              GroupList `mapstructure:"client_channel_group_id"`
	ChannelID                  int       `mapstructure:"cid"`
	ConnectedTime              int       `mapstructure:"connection_connected_time"`
	Country                    string    `mapstructure:"client_country"`
	DBID                       int       `mapstructure:"client_database_id"`
	DefaultChannel             string    `mapstructure:"client_default_channel"`
	DefaultToken               string    `mapstructure:"client_default_token"`
	Description                string    `mapstructure:"client_description"`
	EstimatedLocation          string    `mapstructure:"client_estimated_location"`
	FirstConnect               int64     `mapstructure:"client_created"`
	FlagAvatar                 string    `mapstructure:"client_flag_avatar"`
	IP                         string    `mapstructure:"connection_client_ip"`
	IconID                     uint32    `mapstructure:"client_icon_id"`
	IdleTime                   int       `mapstructure:"client_idle_time"`
	InputHardware              bool      `mapstructure:"client_input_hardware"`
	InputMuted                 bool      `mapstructure:"client_input_muted"`
	Integrations               string    `mapstructure:"client_integrations"`
	IsChannelCommander         bool      `mapstructure:"client_is_channel_commander"`
	IsPrioritySpeaker          bool      `mapstructure:"client_is_priority_speaker"`
	IsRecording                bool      `mapstructure:"client_is_recording"`
	IsServerQuery              bool      `mapstructure:"client_type"`
	IsTalker                   bool      `mapstructure:"client_is_talker"`
	LastConnect                int64     `mapstructure:"client_lastconnected"`
	LoginName                  string    `mapstructure:"client_login_name"`
	Metadata                   string    `mapstructure:"client_meta_data"`
	MyTeamspeakAvatar          string    `mapstructure:"client_myteamspeak_avatar"`
	MyTeamspeakID              string    `mapstructure:"client_myteamspeak_id"`
	NeededServerQueryViewPower int       `mapstructure:"client_needed_serverquery_view_power"`
	Nickname                   string    `mapstructure:"client_nickname"`
	NicknamePhonetic           string    `mapstructure:"client_nickname_phonetic"`
	OutputHardware             bool      `mapstructure:"client_output_hardware"`
	OutputMuted                bool      `mapstructure:"client_output_muted"`
	OutputOnlyMuted            bool      `mapstructure:"client_outputonly_muted"`
	Platform                   string    `mapstructure:"client_platform"`
	SecurityHash               string    `mapstructure:"client_security_hash"`
	ServerGroups               GroupList `mapstructure:"client_servergroups"`
	TalkRequest                bool      `mapstructure:"client_talk_request"`
	TalkRequestMessage         string    `mapstructure:"client_talk_request_msg"`
	Talkpower                  int       `mapstructure:"client_talk_power"`
	TotalConnections           int       `mapstructure:"client_totalconnections"`
	UID                        string    `mapstructure:"client_unique_identifier"`
	Version                    string    `mapstructure:"client_version"`
	VersionSign                string    `mapstructure:"client_version_sign"`
}

Client is a single logged in client on a virtual server

type Codec

type Codec string

Codec represents the possible codecs of a channel

func (*Codec) UnmarshalText

func (c *Codec) UnmarshalText(text []byte) error

UnmarshalText turns number to correct Codec

type DBClient

type DBClient struct {
	FlagAvatar       string `mapstructure:"client_flag_avatar"`
	Base64Hash       string `mapstructure:"client_base64HashClientUID"`
	DBID             int    `mapstructure:"client_database_id"`
	LastIP           string `mapstructure:"client_lastip"`
	Created          int64  `mapstructure:"client_created"`
	TotalConnections int    `mapstructure:"client_totalconnections"`
	UID              string `mapstructure:"client_unique_identifier"`
	Nickname         string `mapstructure:"client_nickname"`
	LastConnected    int64  `mapstructure:"client_lastconnected"`
	Description      string `mapstructure:"client_description"`
}

DBClient is a single client in the database of a virtualserver

type File

type File struct {
	ChannelID int    `mapstructure:"cid"`
	Name      string `mapstructure:"name"`
	Size      int64  `mapstructure:"size"`
	Timestamp int64  `mapstructure:"datetime"`
	IsFile    bool   `mapstructure:"type"`
}

File represents a file on a virtual server

type FileTransfer

type FileTransfer struct {
	ClientFTFID int    `mapstructure:"clientftfid"`
	ServerFTFID int    `mapstructure:"serverftfid"`
	FTKey       string `mapstructure:"ftkey"`
	Port        int    `mapstructure:"port"`
	Size        int64  `mapstructure:"size"`
	Host        string
}

FileTransfer represents an ongoing filetransfer to or from teamspeak

type Group

type Group struct {
	ID     int    `mapstructure:"sgid" mapstructure:"cgid"`
	Name   string `mapstructure:"name"`
	Type   int    `mapstructure:"type"`   // 1 -> Server | 2 -> Channel
	IconID int32  `mapstructure:"iconid"` // ok so here me out: There is a bug, that is not a bug. Read all about it here (https://community.teamspeak.com/t/bug-query-sends-wrong-icon-id-in-response/15054)
	SaveDB bool   `mapstructure:"savedb"`
}

Group represents a group on a virtual server (server|channel)

type GroupList

type GroupList []int

GroupList represents a list of group ids

func (*GroupList) UnmarshalText

func (gl *GroupList) UnmarshalText(text []byte) error

UnmarshalText unmarshals Teamspeaks "arrays" into real int arrays

type HostInfo

type HostInfo struct {
	MaxClients                     int     `mapstructure:"virtualservers_total_maxclients"`
	FileTransferBandwithSent       big.Int `mapstructure:"connection_filetransfer_bandwidth_sent"`
	FileTransferBytesReceivedTotal big.Int `mapstructure:"connection_filetransfer_bytes_received_total"`
	SentLastSecondTotal            big.Int `mapstructure:"connection_bandwidth_sent_last_second_total"`
	ReceivedLastSecondTotal        big.Int `mapstructure:"connection_bandwidth_received_last_second_total"`
	ClientsOnlineTotal             int     `mapstructure:"virtualservers_total_clients_online"`
	ChannelsOnlineTotal            int     `mapstructure:"virtualservers_total_channels_online"`
	Uptime                         int     `mapstructure:"instance_uptime"`
	FileTransferBandwidthReceived  big.Int `mapstructure:"connection_filetransfer_bandwidth_received"`
	FileTransferBytesSentTotal     big.Int `mapstructure:"connection_filetransfer_bytes_sent_total"`
	BytesSendTotal                 big.Int `mapstructure:"connection_bytes_sent_total"`
	ReceivedLastMinuteTotal        big.Int `mapstructure:"connection_bandwidth_received_last_minute_total"`
	SentLastMinuteTotal            big.Int `mapstructure:"connection_bandwidth_sent_last_minute_total"`
	TimestampUTC                   int64   `mapstructure:"host_timestamp_utc"`
	VirtualserverRunningTotal      int     `mapstructure:"virtualservers_running_total"`
	PacketsSentTotal               big.Int `mapstructure:"connection_packets_sent_total"`
	PacketsReceivedTotal           big.Int `mapstructure:"connection_packets_received_total"`
	BytesReceivedTotal             big.Int `mapstructure:"connection_bytes_received_total"`
}

HostInfo contains the info about the TeamSpeak 3 server host

type InstanceInfo

type InstanceInfo struct {
	FileTransterPort               int     `mapstructure:"serverinstance_filetransfer_port"`
	MaxDownloadBandwidthTotal      big.Int `mapstructure:"serverinstance_max_download_total_bandwidth"`
	ServerQueryFloodCommands       int     `mapstructure:"serverinstance_serverquery_flood_commands"`
	ChannelDefaultGroupTemplate    int     `mapstructure:"serverinstance_template_channeldefault_group"`
	PendingConnectionsPerIP        int     `mapstructure:"serverinstance_pending_connections_per_ip"`
	ServerQueryMaxConnectionsPerIP int     `mapstructure:"serverinstance_serverquery_max_connections_per_ip"`
	ServerQueryGuestGroup          int     `mapstructure:"serverinstance_guest_serverquery_group"`
	ServerQueryFloodTime           int     `mapstructure:"serverinstance_serverquery_flood_time"`
	ServerDefaultGroupTemplate     int     `mapstructure:"serverinstance_template_serverdefault_group"`
	ChannelAdminGroupTemplate      int     `mapstructure:"serverinstance_template_channeladmin_group"`
	PermissionsVersion             string  `mapstructure:"serverinstance_permissions_version"`
	DatabaseVersion                string  `mapstructure:"serverinstance_database_version"`
	MaxUploadTotalBandwidth        big.Int `mapstructure:"serverinstance_max_upload_total_bandwidth"`
	ServerQueryBanTime             int     `mapstructure:"serverinstance_serverquery_ban_time"`
	ServerAdminGroupTemplate       int     `mapstructure:"serverinstance_template_serveradmin_group"`
}

InstanceInfo contains info about the TeamSpeak 3 server instance

type LogEntry

type LogEntry struct {
	Timestamp time.Time
	Level     LogLevel
	Logger    string
	Filed3    string // I don't know if this field is just spacing or whatever
	Message   string
}

LogEntry represents one line of log

type LogLevel

type LogLevel int

LogLevel represents one of the four log levels teamspeak uses

func (LogLevel) MarshalText

func (ll LogLevel) MarshalText() ([]byte, error)

MarshalText used for encoding

func (*LogLevel) UnmarshalText

func (ll *LogLevel) UnmarshalText(text []byte) error

UnmarshalText used for decoding

type Me

type Me struct {
	ChannelID      int    `mapstructure:"client_channel_id"`
	DBID           int    `mapstructure:"client_database_id"`
	ID             int    `mapstructure:"client_id"`
	Name           string `mapstructure:"client_login_name"`
	Nickname       string `mapstructure:"client_nickname"`
	OriginServerID int    `mapstructure:"client_origin_server_id"`
	UID            string `mapstructure:"client_unique_identifier"`
	ServerID       int    `mapstructure:"virtualserver_id"`
	ServerPort     int    `mapstructure:"virtualserver_port"`
	ServerStatus   string `mapstructure:"virtualserver_status"`
	ServerUID      string `mapstructure:"virtualserver_unique_identifier"`
}

Me is the answer to WhoAmI ;)

type RawSnapshot

type RawSnapshot struct {
	Version int    `mapstructure:"version"`
	Salt    string `mapstructure:"salt"`
	Data    string `mapstructure:"data"`
}

RawSnapshot contains a created snapshot from a virtualserver

func (RawSnapshot) Decode

func (s RawSnapshot) Decode() (*Snapshot, error)

Decode a binary snapshot to a Snapshot struct At the moment only supports non encrypted snapshots

func (RawSnapshot) DecodeToString

func (s RawSnapshot) DecodeToString() (string, error)

DecodeToString decodes to snapshot to a string At the moment only supports non encrypted snapshots

type Scope

type Scope string

Scope of an APIKey

const (
	// ManageScope includes all commands
	ManageScope Scope = Scope("manage")
	// WriteScope includes more commands than the read, but fewer than the manage scope
	// See an overview [here]("https://community.teamspeak.com/t/webquery-discussion-help-3-12-0-onwards/7184")
	WriteScope Scope = Scope("write")
	// ReadScope is the least permissive scope
	// See an overview [here]("https://community.teamspeak.com/t/webquery-discussion-help-3-12-0-onwards/7184")
	ReadScope Scope = Scope("read")
)

func (*Scope) UnmarshalText

func (s *Scope) UnmarshalText(text []byte) error

UnmarshalText fulfills the TextUnmarshaler interface

type Server

type Server struct {
	Uptime                         int64 `mapstructure:"instance_uptime"`
	ServerTime                     int64 `mapstructure:"host_timestamp_utc"`
	VirtualServerCount             int   `mapstructure:"virtualservers_running_total"`
	MaxClients                     int   `mapstructure:"virtualservers_total_maxclients"`
	TotalClients                   int   `mapstructure:"virtualservers_total_clients_online"`
	TotalChannels                  int   `mapstructure:"virtualservers_total_channels_online"`
	FTPPort                        int   `mapstructure:"serverinstance_filetransfer_port"`
	DefaultServerQueryGroup        int   `mapstructure:"serverinstance_guest_serverquery_group"`
	MaxServerQueryCommands         int   `mapstructure:"serverinstance_serverquery_flood_commands"`
	ServerQueryFloodTime           int   `mapstructure:"serverinstance_serverquery_flood_time"` //seconds
	ServerQueryFloodBanTime        int   `mapstructure:"serverinstance_serverquery_ban_time"`   //seconds
	DatabaseVersion                int   `mapstructure:"serverinstance_database_version"`
	PendingConnectionsPerIP        int   `mapstructure:"serverinstance_pending_connections_per_ip"`
	PermissionsVersion             int   `mapstructure:"serverinstance_permissions_version"`
	ServerQueryMaxConnectionsPerIP int   `mapstructure:"serverinstance_serverquery_max_connections_per_ip"`
	TemplateChannelAdminGroup      int   `mapstructure:"serverinstance_template_channeladmin_group"`
	TemplateChannelDefaultGroup    int   `mapstructure:"serverinstance_template_channeldefault_group"`
	TemplateServerAdminGroup       int   `mapstructure:"serverinstance_template_serveradmin_group"`
	TemplateServerDefaultGroup     int   `mapstructure:"serverinstance_template_serverdefault_group"`
}

Server represents the actual server instance Can contain multiple virtual servers This is the combined result of "hostinfo" and "instanceinfo"

type Snapshot

type Snapshot struct {
	VirtualServer struct {
		MaxClients                       int     `mapstructure:"virtualserver_maxclients"`
		SecurityLevel                    int     `mapstructure:"virtualserver_needed_identity_security_level"`
		Weblist                          bool    `mapstructure:"virtualserver_weblist_enabled"`
		HostbannerGFXURL                 string  `mapstructure:"virtualserver_hostbanner_gfx_url"`
		ComplainAutobanCount             int     `mapstructure:"virtualserver_complain_autoban_count"`
		IconID                           int     `mapstructure:"virtualserver_icon_id"`
		Password                         string  `mapstructure:"virtualserver_password"`
		DefaultChannelGroup              int     `mapstructure:"virtualserver_default_channel_group"`
		HostbannerURL                    string  `mapstructure:"virtualserver_hostbanner_url"`
		PrioritySpeakerMod               float32 `mapstructure:"virtualserver_priority_speaker_dimm_modificator"`
		FileStorageClass                 string  `mapstructure:"virtualserver_file_storage_class"`
		LogChannel                       bool    `mapstructure:"virtualserver_log_channel"`
		LogServer                        bool    `mapstructure:"virtualserver_log_server"`
		CodecEncryption                  int     `mapstructure:"virtualserver_codec_encryption_mode"`
		HostbuttonToolTip                string  `mapstructure:"virtualserver_hostbutton_tooltip"`
		DefaultServerGroup               int     `mapstructure:"virtualserver_default_server_group"`
		LogPermissions                   bool    `mapstructure:"virtualserver_log_permissions"`
		HostMessage                      string  `mapstructure:"virtualserver_hostmessage"`
		HostMessageMode                  int     `mapstructure:"virtualserver_hostmessage_mode"`
		HasPassword                      bool    `mapstructure:"virtualserver_flag_password"`
		LogQuery                         bool    `mapstructure:"virtualserver_log_query"`
		MaxDownloadTotal                 big.Int `mapstructure:"virtualserver_max_download_total_bandwidth"`
		UploadQuota                      big.Int `mapstructure:"virtualserver_upload_quota"`
		ReservedSlots                    int     `mapstructure:"virtualserver_reserved_slots"`
		AntifloodPluginBlock             int     `mapstructure:"virtualserver_antiflood_points_needed_plugin_block"`
		LogClient                        bool    `mapstructure:"virtualserver_log_client"`
		Keypair                          string  `mapstructure:"virtualserver_keypair"`
		DefaultChannelAdminGroup         int     `mapstructure:"virtualserver_default_channel_admin_group"`
		AntifloodPointsTickReduce        int     `mapstructure:"virtualserver_antiflood_points_tick_reduce"`
		AntifloodIPBlock                 int     `mapstructure:"virtualserver_antiflood_points_needed_ip_block"`
		HostbannerMode                   int     `mapstructure:"virtualserver_hostbanner_mode"`
		MinIOSVersion                    string  `mapstructure:"virtualserver_min_ios_version"`
		ProtocolVerifyKeypair            string  `mapstructure:"virtualserver_protocol_verify_keypair"`
		Name                             string  `mapstructure:"virtualserver_name"`
		LogFileTransfer                  bool    `mapstructure:"virtualserver_log_filetransfer"`
		Nickname                         string  `mapstructure:"virtualserver_nickname"`
		Filebase                         string  `mapstructure:"virtualserver_filebase"`
		HostbannerGFXInterval            string  `mapstructure:"virtualserver_hostbanner_gfx_interval"`
		AccountingToken                  string  `mapstructure:"virtualserver_accounting_token"`
		Created                          int64   `mapstructure:"virtualserver_created"`
		MinClientsInChannelForcedSilence int     `mapstructure:"virtualserver_min_clients_in_channel_before_forced_silence"`
		HostbuttonURL                    string  `mapstructure:"virtualserver_hostbutton_url"`
		HostbuttonGFXURL                 string  `mapstructure:"virtualserver_hostbutton_gfx_url"`
		TempChannelDeleteDelayDefault    int     `mapstructure:"virtualserver_channel_temp_delete_delay_default"`
		WelcomeMessage                   string  `mapstructure:"virtualserver_welcomemessage"`
		MinAndroidVersion                string  `mapstructure:"virtualserver_min_android_version"`
		AntifloodCommandBlock            int     `mapstructure:"virtualserver_antiflood_points_needed_command_block"`
		MinClientVersion                 string  `mapstructure:"virtualserver_min_client_version"`
		UID                              string  `mapstructure:"virtualserver_unique_identifier"`
		MaxUploadTotalBandwidth          big.Int `mapstructure:"virtualserver_max_upload_total_bandwidth"`
		DownloadQuota                    big.Int `mapstructure:"virtualserver_download_quota"`
		ComplainAutobanTime              int64   `mapstructure:"virtualserver_complain_autoban_time"`
		ComplainRemoveTime               int64   `mapstructure:"virtualserver_complain_remove_time"`
		NamePhonetic                     string  `mapstructure:"virtualserver_name_phonetic"`
	}
	Channels []struct {
		PID                         int    `mapstructure:"channel_pid"`
		Description                 string `mapstructure:"channel_description"`
		MaxClients                  int    `mapstructure:"channel_maxclients"`
		IsPermanent                 bool   `mapstructure:"channel_flag_permanent"`
		CodecIsUnencrypted          bool   `mapstructure:"channel_codec_is_unencrypted"`
		BannerMode                  int    `mapstructure:"channel_banner_mode"`
		Password                    string `mapstructure:"channel_password"`
		CodecQuality                int    `mapstructure:"channel_codec_quality"`
		Order                       int    `mapstructure:"channel_order"`
		HasPassword                 bool   `mapstructure:"channel_flag_password"`
		MaxFamilyClientsIsUnlimited bool   `mapstructure:"channel_flag_maxfamilyclients_unlimited"`
		MaxFamilyClientsIsInherited bool   `mapstructure:"channel_flag_maxfamilyclients_inherited"`
		ID                          int    `mapstructure:"channel_id"`
		Name                        string `mapstructure:"channel_name"`
		Codec                       Codec  `mapstructure:"channel_codec"`
		CodecLatencyFactor          int    `mapstructure:"channel_codec_latency_factor"`
		Filepath                    string `mapstructure:"channel_filepath"`
		BannerGFXURL                string `mapstructure:"channel_banner_gfx_url"`
		NamePhonetic                string `mapstructure:"channel_name_phonetic"`
		Topic                       string `mapstructure:"channel_topic"`
		MaxFamilyClients            int    `mapstructure:"channel_maxfamilyclients"`
		IsSemiPermanent             bool   `mapstructure:"channel_flag_semi_permanent"`
		IsDefault                   bool   `mapstructure:"channel_flag_default"`
		SecuritySalt                string `mapstructure:"channel_security_salt"`
		UID                         string `mapstructure:"channel_unique_identifier"`
		MaxClientsIsUnlimited       bool   `mapstructure:"channel_flag_maxclients_unlimited"`
	}
	Clients []struct {
		UID              string `mapstructure:"client_unique_id"`
		Nickname         string `mapstructure:"client_nickname"`
		LastConnected    int64  `mapstructure:"client_lastconnected"`
		TotalConnections int    `mapstructure:"client_totalconnections"`
		Created          int64  `mapstructure:"client_created"`
		Description      string `mapstructure:"client_description"`
		ID               int    `mapstructure:"client_id"`
	}
	ServerGroups         []snapshotGroup
	ChannelGroups        []snapshotGroup
	ServerGroupRelations []struct {
		ClientDBID int `mapstructure:"cldbid"`
		GroupID    int `mapstructure:"gid"`
	}
	ChannelGroupRelations []struct {
		ChannelID  int `mapstructure:"iid"`
		ClientDBID int `mapstructure:"cldbid"`
		GroupID    int `mapstructure:"gid"`
	}
	ClientPermissions []struct {
		ClientDBID        int    `mapstructure:"id1"`
		PermissionID      string `mapstructure:"permid"`
		PermissionValue   int    `mapstructure:"permvalue"`
		PermissionSkip    bool   `mapstructure:"permskip"`
		PermissionNegated bool   `mapstructure:"permnegated"`
	}
	ChannelPermissions []struct {
		ChannelID         int    `mapstructure:"id1"`
		PermissionID      string `mapstructure:"permid"`
		PermissionValue   int    `mapstructure:"permvalue"`
		PermissionSkip    bool   `mapstructure:"permskip"`
		PermissionNegated bool   `mapstructure:"permnegated"`
	}
	ChannelClientPermissions []struct {
		ChannelID         int    `mapstructure:"id1"`
		ClientDBID        int    `mapstructure:"id2"`
		PermissionID      string `mapstructure:"permid"`
		PermissionValue   int    `mapstructure:"permvalue"`
		PermissionSkip    bool   `mapstructure:"permskip"`
		PermissionNegated bool   `mapstructure:"permnegated"`
	}
	APIKeys []struct {
		Hash      string `mapstructure:"hash"`
		ClientUID string `mapstructure:"cluid"`
		Scope     Scope  `mapstructure:"scope"`
		Created   int64  `mapstructure:"created_at"`
		Expires   int64  `mapstructure:"expires_at"`
	}
}

Snapshot contains a decoded and decompressed snapshot

type VirtualServer

type VirtualServer struct {
	UID                              string  `mapstructure:"virtualserver_unique_identifier"`
	Name                             string  `mapstructure:"virtualserver_name"`
	WelcomeMessage                   string  `mapstructure:"virtualserver_welcomemessage"`
	Platform                         string  `mapstructure:"virtualserver_platform"`
	Version                          string  `mapstructure:"virtualserver_version"`
	MaxClients                       int     `mapstructure:"virtualserver_maxclients"`
	TotalClients                     int     `mapstructure:"virtualserver_clientsonline"`
	ChannelCount                     int     `mapstructure:"virtualserver_channelsonline"`
	Created                          int64   `mapstructure:"virtualserver_created"`
	Uptime                           int64   `mapstructure:"virtualserver_uptime"`
	CodecEncryption                  int     `mapstructure:"virtualserver_codec_encryption_mod"`
	HostMessage                      string  `mapstructure:"virtualserver_hostmessage"`
	HostMessageMode                  int     `mapstructure:"virtualserver_hostmessage_mode"`
	FileBase                         string  `mapstructure:"virtualserver_filebase"`
	DefaultServerGroup               int     `mapstructure:"virtualserver_default_server_group"`
	DefaultChannelGroup              int     `mapstructure:"virtualserver_default_channel_group"`
	Password                         bool    `mapstructure:"virtualserver_flag_password"`
	DefaultChannelAdminGroup         int     `mapstructure:"virtualserver_default_channel_admin_group"`
	HostbannerURL                    string  `mapstructure:"virtualserver_hostbanner_url"`
	HostbannerGFXURL                 string  `mapstructure:"virtualserver_hostbanner_gfx_url"`
	HostbannerGFXInterval            string  `mapstructure:"virtualserver_hostbanner_gfx_interval"`
	ComplainAutobanCount             int     `mapstructure:"virtualserver_complain_autoban_count"`
	ComplainAutobanTime              int     `mapstructure:"virtualserver_complain_autoban_time"`
	ComplainRemoveTime               int     `mapstructure:"virtualserver_complain_remove_time"`
	MinClientsInChannelForcedSilence int     `mapstructure:"virtualserver_min_clients_in_channel_before_forced_silence"`
	PrioritySpeakerMod               float32 `mapstructure:"virtualserver_priority_speaker_dimm_modificator"`
	ID                               int     `mapstructure:"virtualserver_id"`
	AntifloodPointsTickReduce        int     `mapstructure:"virtualserver_antiflood_points_tick_reduce"`
	AntifloodCommandBlock            int     `mapstructure:"virtualserver_antiflood_points_needed_command_block"`
	AntifloodIPBlock                 int     `mapstructure:"virtualserver_antiflood_points_needed_ip_block"`
	TotalClientConnections           int     `mapstructure:"virtualserver_client_connections"`       // I think thats all connections since startup (not creation)
	TotalQueryConnections            int     `mapstructure:"virtualserver_query_client_connections"` // Same here
	HostbuttonToolTip                string  `mapstructure:"virtualserver_hostbutton_tooltip"`
	HostbuttonURL                    string  `mapstructure:"virtualserver_hostbutton_url"`
	HostbuttonGFXURL                 string  `mapstructure:"virtualserver_hostbutton_gfx_url"`
	QueryClientCount                 int     `mapstructure:"virtualserver_queryclientsonline"`
	Port                             int     `mapstructure:"virtualserver_port"`
	Autostart                        bool    `mapstructure:"virtualserver_autostart"`
	SecurityLevel                    int     `mapstructure:"virtualserver_needed_identity_security_level"`
	NamePhonetic                     string  `mapstructure:"virtualserver_name_phonetic"`
	IconID                           int     `mapstructure:"virtualserver_icon_id"`
	ReservedSlots                    int     `mapstructure:"virtualserver_reserved_slots"`
	Ping                             float32 `mapstructure:"virtualserver_total_ping"`
	Weblist                          bool    `mapstructure:"virtualserver_weblist_enabled"`
	HostbannerMode                   int     `mapstructure:"virtualserver_hostbanner_mode"`
	TempChannelDeleteDelayDefault    int     `mapstructure:"virtualserver_channel_temp_delete_delay_default"`
	Nickname                         string  `mapstructure:"virtualserver_nickname"`
	AntifloodPluginBlock             int     `mapstructure:"virtualserver_antiflood_points_needed_plugin_block"`
	Status                           string  `mapstructure:"virtualserver_status"`
}

VirtualServer represents a single virtual server instance

Jump to

Keyboard shortcuts

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