Documentation
¶
Overview ¶
Package ts3 makes it easier to use with the TeamSpeak 3's Server Query interface
Index ¶
Constants ¶
const (
// WelcomeMessage is used to match the welcome message received from the server
WelcomeMessage = "TS3"
)
Variables ¶
var ( // ErrNoResponse is returned when the server doesn't response ErrNoResponse = errors.New("No response from the server query. Make sure your IP address is whitelisted.") // ErrBadResponseFormat is returned when the server returns a malformed response ErrBadResponseFormat = errors.New("The response is in the wrong format. Make sure your server software is up to date.") // ErrBadWelcome is returned when the server sends an unexpected welcome message ErrBadWelcome = errors.New("Got an unexpected welcome message. Make sure you're connecting to a TeamSpeak 3 server.") )
var ( // WelcomeTimeout is the longest time to wait for // before assuming that the server will not respond WelcomeTimeout = 5 * time.Second // ResponseBufferSize is the largest number // of lines to hold in the receiving buffer ResponseBufferSize = 10 )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// NotifyFunc is called whenever a notify-prefixed
// message is received from the server
NotifyFunc func(response ServerResponse) error
// DisconnectFunc is called when the client is disconnected
// from the server and not does not try to reconnect
DisconnectFunc func()
// contains filtered or unexported fields
}
A Client interfaces with TeamSpeak 3's Server Query interface
func DialTimeout ¶
DialTimeout opens a new connection to a TeamSpeak 3's Server Query with a specific timeout.
func (*Client) Command ¶
func (c *Client) Command(command string) (ServerResponse, error)
Command sends a string command to the Server Query
type Command ¶
type Command interface {
Command() string
}
A Command is a wrapper for Server Query commands
type ServerResponse ¶
type ServerResponse string
A ServerResponse is a wrapper for raw responses received from the server query
func (ServerResponse) Array ¶
func (r ServerResponse) Array() []map[string]string
Array parses and returns the response data into an array when there is more than one set of data in the response.
func (ServerResponse) Header ¶
func (r ServerResponse) Header() string
Header returns the first word of the raw response. Includes but is not limited to notify callbacks and error responses. Does not include words that are part of the response data.
func (ServerResponse) Map ¶
func (r ServerResponse) Map() map[string]string
Map parses and returns the response data into a map when there is only one set of data in the response.
func (ServerResponse) String ¶
func (r ServerResponse) String() string
String returns the raw response
Directories
¶
| Path | Synopsis |
|---|---|
|
Package ts3command binds to various TeamSpeak 3 Server Query commands
|
Package ts3command binds to various TeamSpeak 3 Server Query commands |
|
Package ts3util contains helper functions for the ts3 package
|
Package ts3util contains helper functions for the ts3 package |