Documentation
¶
Index ¶
- Constants
- Variables
- func AddChannel(name string, c *Client)
- func AddClient(c *Client)
- func Authorize(c *Client, data []byte) error
- func Configure() error
- func Encode(data Data) ([]byte, error)
- func FindClient(c *Client) bool
- func JsonAdd(data []byte, key string, value interface{}) ([]byte, error)
- func Launch_fail()
- func Log(level int, msg ...interface{})
- func Log_error(msg ...interface{})
- func MessageReceived(c *Client, pmsg []byte)
- func RemoveChannel(name string)
- func RemoveClient(c *Client)
- func Start() int
- type AddressList
- type Client
- func (c *Client) ClearChannel()
- func (c *Client) GetChannel() *ClientChannel
- func (c *Client) GetConnectionType() string
- func (c *Client) GetID() int
- func (c *Client) GetIP() string
- func (c *Client) GetVersion() int
- func (c *Client) Send(b []byte)
- func (c *Client) SetChannel(clientChannel *ClientChannel)
- func (c *Client) SetConnectionType(ctype string)
- func (c *Client) SetID(id int)
- func (c *Client) SetVersion(version int)
- type ClientChannel
- func (c *ClientChannel) Add(client *Client)
- func (c *ClientChannel) EndIfEmpty() bool
- func (c *ClientChannel) Name() string
- func (c *ClientChannel) Quit()
- func (c *ClientChannel) Remove(client *Client)
- func (c *ClientChannel) SendAll(msg []byte, client *Client)
- func (c *ClientChannel) SendOthers(msg []byte, client *Client)
- type ClientData
- type Data
- type Server
Constants ¶
View Source
const DEFAULT_ADDRESS string = ":6837"
View Source
const DEFAULT_CERT_FILE string = ""
View Source
const DEFAULT_GEN_CERT_FILE = ""
View Source
const DEFAULT_KEY_FILE string = ""
View Source
const DEFAULT_LAUNCH bool = true
View Source
const DEFAULT_LOGLEVEL int = 0
View Source
const DEFAULT_LOG_FILE string = ""
View Source
const DEFAULT_MOTD string = ""
View Source
const DEFAULT_MOTD_ALWAYS_DISPLAY bool = false
View Source
const DEFAULT_SEND_ORIGIN bool = true
View Source
const LOG_CHANNEL int = 2
View Source
const LOG_CONNECTION int = 1
View Source
const LOG_DEBUG int = 3
View Source
const LOG_INFO int = 0
View Source
const LOG_PROTOCOL int = 4
View Source
const LOG_SILENT int = -1
Variables ¶
View Source
var Cert string
View Source
var EndMessage byte = '\n'
View Source
var Key string
View Source
var Launch bool
View Source
var Servers []*Server
View Source
var StopServers context.CancelFunc
Functions ¶
func AddChannel ¶
func FindClient ¶
func Launch_fail ¶ added in v0.2.2
func Launch_fail()
func MessageReceived ¶
func RemoveChannel ¶
func RemoveChannel(name string)
func RemoveClient ¶
func RemoveClient(c *Client)
Types ¶
type AddressList ¶ added in v0.3.1
type AddressList []string
func (*AddressList) Set ¶ added in v0.3.1
func (a *AddressList) Set(v string) error
func (*AddressList) String ¶ added in v0.3.1
func (a *AddressList) String() string
type Client ¶
type Client struct {
sync.Mutex
Close context.CancelFunc
// contains filtered or unexported fields
}
func (*Client) ClearChannel ¶
func (c *Client) ClearChannel()
func (*Client) GetChannel ¶
func (c *Client) GetChannel() *ClientChannel
func (*Client) GetConnectionType ¶
func (*Client) GetVersion ¶
func (*Client) SetChannel ¶
func (c *Client) SetChannel(clientChannel *ClientChannel)
func (*Client) SetConnectionType ¶
func (*Client) SetVersion ¶
type ClientChannel ¶
type ClientChannel struct {
sync.Mutex
ClientsAll map[int]*Client
ClientsMaster map[int]*Client
ClientsSlave map[int]*Client
// contains filtered or unexported fields
}
func FindChannel ¶
func FindChannel(name string) *ClientChannel
func NewClientChannel ¶
func NewClientChannel(name string, client *Client) *ClientChannel
func (*ClientChannel) Add ¶
func (c *ClientChannel) Add(client *Client)
func (*ClientChannel) EndIfEmpty ¶
func (c *ClientChannel) EndIfEmpty() bool
func (*ClientChannel) Name ¶
func (c *ClientChannel) Name() string
func (*ClientChannel) Quit ¶
func (c *ClientChannel) Quit()
func (*ClientChannel) Remove ¶
func (c *ClientChannel) Remove(client *Client)
func (*ClientChannel) SendAll ¶
func (c *ClientChannel) SendAll(msg []byte, client *Client)
func (*ClientChannel) SendOthers ¶
func (c *ClientChannel) SendOthers(msg []byte, client *Client)
type ClientData ¶
type Data ¶
type Data struct {
Type string `json:"type"`
Channel string `json:"channel,omitempty"`
ConnectionType string `json:"connection_type,omitempty"`
Version int `json:"version,omitempty"`
Origin int `json:"origin,omitempty"`
Key string `json:"key,omitempty"`
ID int `json:"user_id,omitempty"`
UserIds []int `json:"user_ids,omitempty"`
Clients []ClientData `json:"clients,omitempty"`
Client *ClientData `json:"client,omitempty"`
Error string `json:"error,omitempty"`
Motd string `json:"motd,omitempty"`
MotdAlwaysDisplay bool `json:"force_display,omitempty"`
}
type Server ¶
type Server struct {
sync.Mutex
sync.WaitGroup
Stop context.CancelFunc
// contains filtered or unexported fields
}
TCP server
func (*Server) MessageTerminator ¶
Set message terminator
Click to show internal directories.
Click to hide internal directories.