Documentation ¶
Index ¶
- Constants
- Variables
- func ClientRegister(client *Client, cmd string, cols []string)
- func HandlerJoin(client *Client, cmd string)
- func HitCallback(fn func())
- func Logger(logdir string, events <-chan LogEvent)
- func Processor(events chan ClientEvent, finished chan struct{})
- func RoomNameValid(name string) bool
- func SendList(client *Client, cols []string)
- func SendLusers(client *Client)
- func SendMotd(client *Client)
- func SendWhois(client *Client, nicknames []string)
- func SetSettings(settings Settings)
- func StateKeeper(statedir string, events <-chan StateEvent)
- type Client
- func (c *Client) Close()
- func (c *Client) Host() string
- func (c *Client) Msg(text string)
- func (c *Client) MsgSender()
- func (c *Client) Processor(sink chan ClientEvent)
- func (c *Client) Reply(text string)
- func (c *Client) ReplyNicknamed(code string, text ...string)
- func (c *Client) ReplyNoChannel(channel string)
- func (c *Client) ReplyNoNickChan(channel string)
- func (c *Client) ReplyNotEnoughParameters(command string)
- func (c *Client) ReplyParts(code string, text ...string)
- func (c *Client) SetDead()
- func (c *Client) String() string
- type ClientEvent
- type LogEvent
- type Room
- type Settings
- type StateEvent
Constants ¶
const ( BufSize = 1500 MaxOutBuf = 1 << 12 )
const ( // Max deadline time of client's unresponsiveness PingTimeout = time.Second * 180 // Max idle client's time before PING are sent PingThreshold = time.Second * 90 )
Variables ¶
var ( LogSink = logSink StateSink = stateSink )
var (
CRLF []byte = []byte{'\x0d', '\x0a'}
)
var (
HitFunc func()
)
var (
RENickname = regexp.MustCompile("^[a-zA-Z0-9-]{1,24}$")
)
var (
RERoom = regexp.MustCompile("^#[^\x00\x07\x0a\x0d ,:/]{1,200}$")
)
Functions ¶
func ClientRegister ¶
Unregistered client workflow processor. Unregistered client: * is not PINGed * only QUIT, NICK and USER commands are processed * other commands are quietly ignored When client finishes NICK/USER workflow, then MOTD and LUSERS are send to him.
func HandlerJoin ¶
func HitCallback ¶
func HitCallback(fn func())
func Logger ¶
Logging events logger itself Each room's events are written to separate file in logdir Events include messages, topic and keys changes, joining and leaving
func Processor ¶
func Processor(events chan ClientEvent, finished chan struct{})
func RoomNameValid ¶
Sanitize room's name. It can consist of 1 to 50 ASCII symbols with some exclusions. All room names will have "#" prefix.
func SendLusers ¶
func SendLusers(client *Client)
func SetSettings ¶
func SetSettings(settings Settings)
func StateKeeper ¶
func StateKeeper(statedir string, events <-chan StateEvent)
Room state events saver Room states shows that either topic or key has been changed Each room's state is written to separate file in statedir
Types ¶
type Client ¶
func (*Client) Processor ¶
func (c *Client) Processor(sink chan ClientEvent)
Client processor blockingly reads everything remote client sends, splits messages by CRLF and send them to Daemon gorouting for processing it futher. Also it can signalize that client is unavailable (disconnected).
func (*Client) ReplyNicknamed ¶
Send nicknamed server message. After servername it always has target client's nickname. The last part is prefixed with ":".
func (*Client) ReplyNoChannel ¶
Reply "403 no such channel" error for specified channel.
func (*Client) ReplyNoNickChan ¶
func (*Client) ReplyNotEnoughParameters ¶
Reply "461 not enough parameters" error for given command.
func (*Client) ReplyParts ¶
Send server message, concatenating all provided text parts and prefix the last one with ":".
type ClientEvent ¶
type ClientEvent struct {
// contains filtered or unexported fields
}
Client events going from each of client They can be either NEW, DEL or unparsed MSG
func (ClientEvent) String ¶
func (m ClientEvent) String() string
type LogEvent ¶
type LogEvent struct {
// contains filtered or unexported fields
}
Logging in-room events Intended to tell when, where and who send a message or meta command
type Room ¶
func RoomRegister ¶
func RoomRegister(name string) (*Room, chan ClientEvent)
Register new room in Daemon. Create an object, events sink, save pointers to corresponding daemon's places and start room's processor goroutine.
func (*Room) Processor ¶
func (room *Room) Processor(events <-chan ClientEvent)
type StateEvent ¶
type StateEvent struct {
// contains filtered or unexported fields
}