teamspeak3

package module
v0.0.0-...-34c5fac Latest Latest
Warning

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

Go to latest
Published: May 18, 2022 License: GPL-3.0 Imports: 12 Imported by: 0

README

go-teamspeak3

Documentation

Index

Constants

View Source
const (
	ReasonIdIndependentlySwitchChannelsOrEnterServer IReasonId = iota
	ReasonIdUserOrChannelMoved                                 = 1
	ReasonIdTimeout                                            = 3
	ReasonIdChannelKick                                        = 4
	ReasonIdServerKick                                         = 5
	ReasonIdBan                                                = 6
	ReasonIdVoluntarilyLeaveServer                             = 8
	ReasonIdServerOrChannelEdited                              = 10
	ReasonIdServerShutdown                                     = 11
)
View Source
const (
	DefaultConnectTimeout = time.Second * 10
	DefaultMsgPipeLength  = 10
	MaxBufferSize         = 10 << 20
	DefaultBufferSize     = 4096
)
View Source
const (
	MinKeepAliveDuration = time.Second * 5
)
View Source
const TitleCheck = "TS3"

Variables

This section is empty.

Functions

func DecodeResponse

func DecodeResponse(text string) (res map[string]interface{})

func ReplaceAnsiEscapeCode

func ReplaceAnsiEscapeCode(text string) string

Types

type Client

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

func NewClient

func NewClient(t Type, host string, port int, username string, password string) (client *Client, err error)

func (*Client) Close

func (c *Client) Close() (err error)

func (*Client) Command

func (c *Client) Command(content string) (response Message, error Error)

func (*Client) Notification

func (c *Client) Notification() <-chan Notify

type Error

type Error struct {
	Id  int
	Msg string
}

func NewError

func NewError(content string) (e Error, err error)

func (*Error) Decode

func (e *Error) Decode(content map[string]interface{}) (err error)

type IClientType

type IClientType int
const (
	ClientTypeVoice IClientType = iota
	ClientTypeQuery             = 1
)

type IReasonId

type IReasonId int

type Message

type Message struct {
}

func NewMessage

func NewMessage(content string) (m Message, err error)

type Notify

type Notify interface {
	Type() NotifyEventType
	Decode(content map[string]interface{}) error
}

func NewNotify

func NewNotify(content string) (n Notify, err error)

type NotifyClientEnterView

type NotifyClientEnterView struct {
	// Cfid source channel; "0" when entering the server
	Cfid int `mapstructure:"cfid"`
	// Ctid target channel
	Ctid                   int       `mapstructure:"ctid"`
	ReasonId               IReasonId `mapstructure:"reasonid"`
	Clid                   int       `mapstructure:"clid"`
	ClientUniqueIdentifier string    `mapstructure:"client_unique_identifier"`
	ClientNickname         string    `mapstructure:"client_nickname"`
	ClientInputMuted       int       `mapstructure:"client_input_muted"`
	ClientOutputMuted      int       `mapstructure:"client_output_muted"`
	ClientOutputOnlyMuted  int       `mapstructure:"client_outputonly_muted"`
	ClientInputHardware    int       `mapstructure:"client_input_hardware"`
	ClientOutputHardWare   int       `mapstructure:"client_output_hardware"`
	ClientMetaData         string    `mapstructure:"client_meta_data"`
	ClientIsRecording      int       `mapstructure:"client_is_recording"`
	ClientDatabaseId       int       `mapstructure:"client_database_id"`

	ClientServerGroups                   int         `mapstructure:"client_server_groups"`
	ClientAway                           int         `mapstructure:"client_away"`
	ClientAwayMessage                    string      `mapstructure:"client_away_message"`
	ClientType                           IClientType `mapstructure:"client_type"`
	ClientFlagAvatar                     string      `mapstructure:"client_flag_avatar"`
	ClientTalkPower                      int         `mapstructure:"client_talk_power"`
	ClientTalkRequest                    int         `mapstructure:"client_talk_request"`
	ClientTalkRequestMsg                 string      `mapstructure:"client_talk_request_msg"`
	ClientDescription                    string      `mapstructure:"client_description"`
	ClientIsTalker                       int         `mapstructure:"client_is_talker"`
	ClientIsPrioritySpeaker              int         `mapstructure:"client_is_priority_speaker"`
	ClientUnreadMessages                 int         `mapstructure:"client_unread_messages"`
	ClientNicknamePhonetic               string      `mapstructure:"client_nickname_phonetic"`
	ClientNeededServerQueryViewPower     int         `mapstructure:"client_needed_serverquery_view_power"`
	ClientIconId                         int         `mapstructure:"client_icon_id"`
	ClientIsChannelCommander             int         `mapstructure:"client_is_channel_commander"`
	ClientCountry                        string      `mapstructure:"client_country"`
	ClientChannelGroupInheritedChannelId int         `mapstructure:"client_channel_group_inherited_channel_id"`
	ClientBadges                         string      `mapstructure:"client_badges"`
	ClientMyteamspeakId                  string      `mapstructure:"client_myteamspeak_id"`
	ClientIntegrations                   string      `mapstructure:"client_integrations"`
	ClientMyteamspeakAvatar              string      `mapstructure:"client_myteamspeak_avatar"`
	ClientSignedBadges                   string      `mapstructure:"client_signed_badges"`
	// contains filtered or unexported fields
}

func (*NotifyClientEnterView) Decode

func (n *NotifyClientEnterView) Decode(content map[string]interface{}) (err error)

func (*NotifyClientEnterView) Type

type NotifyClientLeftView

type NotifyClientLeftView struct {
	Cfid        int       `mapstructure:"cfid"`
	Ctid        int       `mapstructure:"ctid"`
	ReasonId    IReasonId `mapstructure:"reasonid"`
	ReasonMsg   string    `mapstructure:"reasonmsg"`
	Clid        int       `mapstructure:"clid"`
	InvokerId   string    `mapstructure:"invokerid"`
	InvokerName string    `mapstructure:"invokername"`
	InvokerUid  int       `mapstructure:"invokeruid"`
	Bantime     int       `mapstructure:"bantime"`
}

func (*NotifyClientLeftView) Decode

func (n *NotifyClientLeftView) Decode(content map[string]interface{}) (err error)

func (*NotifyClientLeftView) Type

type NotifyEventType

type NotifyEventType string
const (
	ClientEnterView NotifyEventType = "notifycliententerview"
	ClientLeftView                  = "notifyclientleftview"
)

type Protocol

type Protocol interface {
	Connect(host string, port int, username string, password string) error
	Disconnect() error
	SetInput(content string) error
	GetOutputPipe() (<-chan string, error)
}

Protocol provide an interface to implement transport protocol

func NewProtocol

func NewProtocol(t Type) (p Protocol, err error)

type Query

type Query interface {
	Init(protocol Protocol, keepAliveDuration time.Duration, keepAliveData string, keepAliveResponseLines int) error
	Request(content string) error
	GetResponsePipe() (<-chan string, error)
	Close() error
}

Query provide an interface to implement standard io with protocol io

func NewQuery

func NewQuery(t Type) (q Query, err error)

type Type

type Type int
const (
	Ssh Type = iota
)

Jump to

Keyboard shortcuts

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