irc

package
Version: v1.6.6 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2017 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IDLE_TIMEOUT = time.Minute // how long before a client is considered idle
	QUIT_TIMEOUT = time.Minute // how long after idle before a client is kicked
)
View Source
const (
	CRLF          = "\r\n"
	MAX_REPLY_LEN = 512 - len(CRLF)

	// string codes
	AUTHENTICATE StringCode = "AUTHENTICATE" // SASL
	AWAY         StringCode = "AWAY"
	CAP          StringCode = "CAP"
	ERROR        StringCode = "ERROR"
	INVITE       StringCode = "INVITE"
	ISON         StringCode = "ISON"
	JOIN         StringCode = "JOIN"
	KICK         StringCode = "KICK"
	KILL         StringCode = "KILL"
	LIST         StringCode = "LIST"
	MODE         StringCode = "MODE"
	MOTD         StringCode = "MOTD"
	NAMES        StringCode = "NAMES"
	NICK         StringCode = "NICK"
	NOTICE       StringCode = "NOTICE"
	ONICK        StringCode = "ONICK"
	OPER         StringCode = "OPER"
	REHASH       StringCode = "REHASH"
	PART         StringCode = "PART"
	PASS         StringCode = "PASS"
	PING         StringCode = "PING"
	PONG         StringCode = "PONG"
	PRIVMSG      StringCode = "PRIVMSG"
	QUIT         StringCode = "QUIT"
	TIME         StringCode = "TIME"
	LUSERS       StringCode = "LUSERS"
	TOPIC        StringCode = "TOPIC"
	USER         StringCode = "USER"
	VERSION      StringCode = "VERSION"
	WALLOPS      StringCode = "WALLOPS"
	WHO          StringCode = "WHO"
	WHOIS        StringCode = "WHOIS"
	WHOWAS       StringCode = "WHOWAS"

	// numeric codes
	RPL_WELCOME           NumericCode = 1
	RPL_YOURHOST          NumericCode = 2
	RPL_CREATED           NumericCode = 3
	RPL_MYINFO            NumericCode = 4
	RPL_BOUNCE            NumericCode = 5
	RPL_TRACELINK         NumericCode = 200
	RPL_TRACECONNECTING   NumericCode = 201
	RPL_TRACEHANDSHAKE    NumericCode = 202
	RPL_TRACEUNKNOWN      NumericCode = 203
	RPL_TRACEOPERATOR     NumericCode = 204
	RPL_TRACEUSER         NumericCode = 205
	RPL_TRACESERVER       NumericCode = 206
	RPL_TRACESERVICE      NumericCode = 207
	RPL_TRACENEWTYPE      NumericCode = 208
	RPL_TRACECLASS        NumericCode = 209
	RPL_TRACERECONNECT    NumericCode = 210
	RPL_STATSLINKINFO     NumericCode = 211
	RPL_STATSCOMMANDS     NumericCode = 212
	RPL_ENDOFSTATS        NumericCode = 219
	RPL_UMODEIS           NumericCode = 221
	RPL_SERVLIST          NumericCode = 234
	RPL_SERVLISTEND       NumericCode = 235
	RPL_STATSUPTIME       NumericCode = 242
	RPL_STATSOLINE        NumericCode = 243
	RPL_LUSERCLIENT       NumericCode = 251
	RPL_LUSEROP           NumericCode = 252
	RPL_LUSERUNKNOWN      NumericCode = 253
	RPL_LUSERCHANNELS     NumericCode = 254
	RPL_LUSERME           NumericCode = 255
	RPL_ADMINME           NumericCode = 256
	RPL_ADMINLOC1         NumericCode = 257
	RPL_ADMINLOC2         NumericCode = 258
	RPL_ADMINEMAIL        NumericCode = 259
	RPL_TRACELOG          NumericCode = 261
	RPL_TRACEEND          NumericCode = 262
	RPL_TRYAGAIN          NumericCode = 263
	RPL_AWAY              NumericCode = 301
	RPL_USERHOST          NumericCode = 302
	RPL_ISON              NumericCode = 303
	RPL_UNAWAY            NumericCode = 305
	RPL_NOWAWAY           NumericCode = 306
	RPL_WHOISUSER         NumericCode = 311
	RPL_WHOISSERVER       NumericCode = 312
	RPL_WHOISOPERATOR     NumericCode = 313
	RPL_WHOWASUSER        NumericCode = 314
	RPL_ENDOFWHO          NumericCode = 315
	RPL_WHOISIDLE         NumericCode = 317
	RPL_ENDOFWHOIS        NumericCode = 318
	RPL_WHOISCHANNELS     NumericCode = 319
	RPL_LIST              NumericCode = 322
	RPL_LISTEND           NumericCode = 323
	RPL_CHANNELMODEIS     NumericCode = 324
	RPL_UNIQOPIS          NumericCode = 325
	RPL_WHOISLOGGEDIN     NumericCode = 330
	RPL_NOTOPIC           NumericCode = 331
	RPL_TOPIC             NumericCode = 332
	RPL_INVITING          NumericCode = 341
	RPL_SUMMONING         NumericCode = 342
	RPL_INVITELIST        NumericCode = 346
	RPL_ENDOFINVITELIST   NumericCode = 347
	RPL_EXCEPTLIST        NumericCode = 348
	RPL_ENDOFEXCEPTLIST   NumericCode = 349
	RPL_VERSION           NumericCode = 351
	RPL_WHOREPLY          NumericCode = 352
	RPL_NAMREPLY          NumericCode = 353
	RPL_LINKS             NumericCode = 364
	RPL_ENDOFLINKS        NumericCode = 365
	RPL_ENDOFNAMES        NumericCode = 366
	RPL_BANLIST           NumericCode = 367
	RPL_ENDOFBANLIST      NumericCode = 368
	RPL_ENDOFWHOWAS       NumericCode = 369
	RPL_INFO              NumericCode = 371
	RPL_MOTD              NumericCode = 372
	RPL_ENDOFINFO         NumericCode = 374
	RPL_MOTDSTART         NumericCode = 375
	RPL_ENDOFMOTD         NumericCode = 376
	RPL_YOUREOPER         NumericCode = 381
	RPL_REHASHING         NumericCode = 382
	RPL_YOURESERVICE      NumericCode = 383
	RPL_TIME              NumericCode = 391
	RPL_USERSSTART        NumericCode = 392
	RPL_USERS             NumericCode = 393
	RPL_ENDOFUSERS        NumericCode = 394
	RPL_NOUSERS           NumericCode = 395
	ERR_NOSUCHNICK        NumericCode = 401
	ERR_NOSUCHSERVER      NumericCode = 402
	ERR_NOSUCHCHANNEL     NumericCode = 403
	ERR_CANNOTSENDTOCHAN  NumericCode = 404
	ERR_TOOMANYCHANNELS   NumericCode = 405
	ERR_WASNOSUCHNICK     NumericCode = 406
	ERR_TOOMANYTARGETS    NumericCode = 407
	ERR_NOSUCHSERVICE     NumericCode = 408
	ERR_NOORIGIN          NumericCode = 409
	ERR_INVALIDCAPCMD     NumericCode = 410
	ERR_NORECIPIENT       NumericCode = 411
	ERR_NOTEXTTOSEND      NumericCode = 412
	ERR_NOTOPLEVEL        NumericCode = 413
	ERR_WILDTOPLEVEL      NumericCode = 414
	ERR_BADMASK           NumericCode = 415
	ERR_UNKNOWNCOMMAND    NumericCode = 421
	ERR_NOMOTD            NumericCode = 422
	ERR_NOADMININFO       NumericCode = 423
	ERR_FILEERROR         NumericCode = 424
	ERR_NONICKNAMEGIVEN   NumericCode = 431
	ERR_ERRONEUSNICKNAME  NumericCode = 432
	ERR_NICKNAMEINUSE     NumericCode = 433
	ERR_NICKCOLLISION     NumericCode = 436
	ERR_UNAVAILRESOURCE   NumericCode = 437
	ERR_USERNOTINCHANNEL  NumericCode = 441
	ERR_NOTONCHANNEL      NumericCode = 442
	ERR_USERONCHANNEL     NumericCode = 443
	ERR_NOLOGIN           NumericCode = 444
	ERR_SUMMONDISABLED    NumericCode = 445
	ERR_USERSDISABLED     NumericCode = 446
	ERR_NOTREGISTERED     NumericCode = 451
	ERR_NEEDMOREPARAMS    NumericCode = 461
	ERR_ALREADYREGISTRED  NumericCode = 462
	ERR_NOPERMFORHOST     NumericCode = 463
	ERR_PASSWDMISMATCH    NumericCode = 464
	ERR_YOUREBANNEDCREEP  NumericCode = 465
	ERR_YOUWILLBEBANNED   NumericCode = 466
	ERR_KEYSET            NumericCode = 467
	ERR_CHANNELISFULL     NumericCode = 471
	ERR_UNKNOWNMODE       NumericCode = 472
	ERR_INVITEONLYCHAN    NumericCode = 473
	ERR_BANNEDFROMCHAN    NumericCode = 474
	ERR_BADCHANNELKEY     NumericCode = 475
	ERR_BADCHANMASK       NumericCode = 476
	ERR_NOCHANMODES       NumericCode = 477
	ERR_BANLISTFULL       NumericCode = 478
	ERR_NOPRIVILEGES      NumericCode = 481
	ERR_CHANOPRIVSNEEDED  NumericCode = 482
	ERR_CANTKILLSERVER    NumericCode = 483
	ERR_RESTRICTED        NumericCode = 484
	ERR_UNIQOPPRIVSNEEDED NumericCode = 485
	ERR_NOOPERHOST        NumericCode = 491
	ERR_CANNOTSENDTOUSER  NumericCode = 492
	ERR_UMODEUNKNOWNFLAG  NumericCode = 501
	ERR_USERSDONTMATCH    NumericCode = 502
	RPL_WHOISSECURE       NumericCode = 671

	// SASL
	RPL_LOGGEDIN    NumericCode = 900
	RPL_LOGGEDOUT   NumericCode = 901
	ERR_NICKLOCKED  NumericCode = 902
	RPL_SASLSUCCESS NumericCode = 903
	ERR_SASLFAIL    NumericCode = 904
	ERR_SASLTOOLONG NumericCode = 905
	ERR_SASLABORTED NumericCode = 906
	ERR_SASLALREADY NumericCode = 907
	RPL_SASLMECHS   NumericCode = 908
)
View Source
const (
	R = '→'
	W = '←'
)

Variables

View Source
var (
	ErrNickMissing      = errors.New("nick missing")
	ErrNicknameInUse    = errors.New("nickname in use")
	ErrNicknameMismatch = errors.New("nickname mismatch")
)
View Source
var (
	NotEnoughArgsError = errors.New("not enough arguments")
	ErrParseCommand    = errors.New("failed to parse message")
)
View Source
var (
	SupportedUserModes = UserModes{
		Invisible, Operator, HostMask,
	}
	DefaultChannelModes = ChannelModes{
		NoOutside, OpOnlyTopic,
	}
)
View Source
var (
	// regexps
	ChannelNameExpr = regexp.MustCompile(`^[&!#+][\pL\pN]{1,63}$`)
	NicknameExpr    = regexp.MustCompile(`^[\pL\pN\pP\pS]{1,32}$`)
)
View Source
var (
	// Package package name
	Package = "eris"

	// Version release version
	Version = "1.6.4"

	// Commit will be overwritten automatically by the build system
	Commit = "HEAD"
)
View Source
var DefObjectives = map[float64]float64{
	0.50: 0.05,
	0.90: 0.01,
	0.95: 0.005,
	0.99: 0.001,
}
View Source
var DefaultPasswordHasher = &Base64BCryptPasswordHasher{}
View Source
var (
	SupportedCapabilities = CapabilitySet{
		MultiPrefix: true,
		SASL:        true,
	}
)

Functions

func CanSeeChannel added in v1.6.3

func CanSeeChannel(client *Client, channel *Channel) bool

func ComparePassword

func ComparePassword(hash, password []byte) error

func DecodePassword

func DecodePassword(encoded string) (decoded []byte, err error)

func FullVersion

func FullVersion() string

FullVersion display the full version and build

func IsHostname added in v1.5.3

func IsHostname(name string) bool

func NewNumericReply

func NewNumericReply(target *Client, code NumericCode,
	format string, args ...interface{}) string

func NewStringReply

func NewStringReply(source Identifiable, code StringCode,
	format string, args ...interface{}) string

func RplAuthenticate added in v1.6.1

func RplAuthenticate(client *Client, arg string) string

func RplCTCPAction

func RplCTCPAction(source Identifiable, target Identifiable, action CTCPText) string

func RplCap

func RplCap(client *Client, subCommand CapSubCommand, arg interface{}) string

func RplChannelMode

func RplChannelMode(client *Client, channel *Channel,
	changes ChannelModeChanges) string

func RplError

func RplError(message string) string

func RplInviteMsg

func RplInviteMsg(inviter *Client, invitee *Client, channel Name) string

func RplJoin

func RplJoin(client *Client, channel *Channel) string

func RplKick

func RplKick(channel *Channel, client *Client, target *Client, comment Text) string

func RplKill

func RplKill(client *Client, target *Client, comment Text) string

func RplModeChanges

func RplModeChanges(client *Client, target *Client, changes ModeChanges) string

func RplNick

func RplNick(source Identifiable, newNick Name) string

func RplNotice

func RplNotice(source Identifiable, target Identifiable, message Text) string

func RplPart

func RplPart(client *Client, channel *Channel, message Text) string

func RplPing

func RplPing(target Identifiable) string

func RplPong

func RplPong(client *Client, msg Text) string

func RplPrivMsg

func RplPrivMsg(source Identifiable, target Identifiable, message Text) string

func RplQuit

func RplQuit(client *Client, message Text) string

func RplTopicMsg

func RplTopicMsg(source Identifiable, channel *Channel) string

func SHA256 added in v1.6.2

func SHA256(data string) string

Types

type AuthenticateCommand added in v1.6.1

type AuthenticateCommand struct {
	BaseCommand
	// contains filtered or unexported fields
}

func (*AuthenticateCommand) HandleRegServer added in v1.6.1

func (msg *AuthenticateCommand) HandleRegServer(server *Server)

type AwayCommand

type AwayCommand struct {
	BaseCommand
	// contains filtered or unexported fields
}

func (*AwayCommand) HandleServer

func (msg *AwayCommand) HandleServer(server *Server)

type Base64BCryptPasswordHasher added in v1.6.1

type Base64BCryptPasswordHasher struct{}

func (*Base64BCryptPasswordHasher) Compare added in v1.6.1

func (hasher *Base64BCryptPasswordHasher) Compare(encoded, password []byte) error

func (*Base64BCryptPasswordHasher) Decode added in v1.6.1

func (hasher *Base64BCryptPasswordHasher) Decode(encoded []byte) (decoded []byte, err error)

func (*Base64BCryptPasswordHasher) Encode added in v1.6.1

func (hasher *Base64BCryptPasswordHasher) Encode(password []byte) (encoded []byte, err error)

type BaseCommand

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

func (*BaseCommand) Client

func (command *BaseCommand) Client() *Client

func (*BaseCommand) Code

func (command *BaseCommand) Code() StringCode

func (*BaseCommand) SetClient

func (command *BaseCommand) SetClient(client *Client)

func (*BaseCommand) SetCode

func (command *BaseCommand) SetCode(code StringCode)

type CTCPText

type CTCPText string

CTCPText is text suitably escaped for CTCP.

func NewCTCPText

func NewCTCPText(str string) CTCPText

type CapCommand

type CapCommand struct {
	BaseCommand
	// contains filtered or unexported fields
}

func (*CapCommand) HandleRegServer

func (msg *CapCommand) HandleRegServer(server *Server)

type CapModifier

type CapModifier rune

CapModifiers are indicators showing the state of a capability after a REQ or ACK.

const (
	Ack     CapModifier = '~'
	Disable CapModifier = '-'
	Sticky  CapModifier = '='
)

func (CapModifier) String

func (mod CapModifier) String() string

type CapState

type CapState uint
const (
	CapNone        CapState = iota
	CapNegotiating CapState = iota
	CapNegotiated  CapState = iota
)

type CapSubCommand

type CapSubCommand string
const (
	CAP_LS    CapSubCommand = "LS"
	CAP_LIST  CapSubCommand = "LIST"
	CAP_REQ   CapSubCommand = "REQ"
	CAP_ACK   CapSubCommand = "ACK"
	CAP_NAK   CapSubCommand = "NAK"
	CAP_CLEAR CapSubCommand = "CLEAR"
	CAP_END   CapSubCommand = "END"
)

type Capability

type Capability string

Capabilities are optional features a client may request from a server.

const (
	MultiPrefix Capability = "multi-prefix"
	SASL        Capability = "sasl"
)

func (Capability) String

func (capability Capability) String() string

type CapabilitySet

type CapabilitySet map[Capability]bool

func (CapabilitySet) DisableString

func (set CapabilitySet) DisableString() string

func (CapabilitySet) String

func (set CapabilitySet) String() string

type Channel

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

func NewChannel

func NewChannel(s *Server, name Name, addDefaultModes bool) *Channel

NewChannel creates a new channel from a `Server` and a `name` string, which must be unique on the server.

func (*Channel) CanSpeak

func (channel *Channel) CanSpeak(client *Client) bool

func (*Channel) CheckKey

func (channel *Channel) CheckKey(key Text) bool

func (*Channel) ClientIsOperator

func (channel *Channel) ClientIsOperator(client *Client) bool

func (*Channel) GetTopic

func (channel *Channel) GetTopic(client *Client)

func (*Channel) Id

func (channel *Channel) Id() Name

func (*Channel) Invite

func (channel *Channel) Invite(invitee *Client, inviter *Client)

func (*Channel) IsEmpty

func (channel *Channel) IsEmpty() bool

func (*Channel) IsFull

func (channel *Channel) IsFull() bool

func (*Channel) Join

func (channel *Channel) Join(client *Client, key Text)

func (*Channel) Kick

func (channel *Channel) Kick(client *Client, target *Client, comment Text)

func (*Channel) Mode

func (channel *Channel) Mode(client *Client, changes ChannelModeChanges)

func (*Channel) ModeString

func (channel *Channel) ModeString(client *Client) (str string)

<mode> <mode params>

func (*Channel) Names

func (channel *Channel) Names(client *Client)

func (*Channel) Nick

func (channel *Channel) Nick() Name

func (*Channel) Nicks

func (channel *Channel) Nicks(target *Client) []string

func (*Channel) Notice

func (channel *Channel) Notice(client *Client, message Text)

func (*Channel) Part

func (channel *Channel) Part(client *Client, message Text)

func (*Channel) PrivMsg

func (channel *Channel) PrivMsg(client *Client, message Text)

func (*Channel) Quit

func (channel *Channel) Quit(client *Client)

func (*Channel) SetTopic

func (channel *Channel) SetTopic(client *Client, topic Text)

func (*Channel) ShowMaskList

func (channel *Channel) ShowMaskList(client *Client, mode ChannelMode)

func (*Channel) String

func (channel *Channel) String() string

type ChannelMode

type ChannelMode rune

channel mode flags

const (
	BanMask         ChannelMode = 'b' // arg
	ChannelCreator  ChannelMode = 'O' // flag
	ChannelOperator ChannelMode = 'o' // arg
	ExceptMask      ChannelMode = 'e' // arg
	InviteMask      ChannelMode = 'I' // arg
	InviteOnly      ChannelMode = 'i' // flag
	Key             ChannelMode = 'k' // flag arg
	Moderated       ChannelMode = 'm' // flag
	NoOutside       ChannelMode = 'n' // flag
	OpOnlyTopic     ChannelMode = 't' // flag
	Private         ChannelMode = 'p' // flag
	Secret          ChannelMode = 's' // flag, deprecated
	UserLimit       ChannelMode = 'l' // flag arg
	Voice           ChannelMode = 'v' // arg
	SecureChan      ChannelMode = 'Z' // arg
)

func (ChannelMode) String

func (mode ChannelMode) String() string

type ChannelModeChange

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

func (*ChannelModeChange) String

func (change *ChannelModeChange) String() (str string)

type ChannelModeChanges

type ChannelModeChanges []*ChannelModeChange

func (ChannelModeChanges) String

func (changes ChannelModeChanges) String() (str string)

type ChannelModeCommand

type ChannelModeCommand struct {
	BaseCommand
	// contains filtered or unexported fields
}

func (*ChannelModeCommand) HandleServer

func (msg *ChannelModeCommand) HandleServer(server *Server)

type ChannelModeSet

type ChannelModeSet struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

ChannelModeSet holds a mapping of channel modes

func NewChannelModeSet added in v1.6.0

func NewChannelModeSet() *ChannelModeSet

NewChannelModeSet returns a new ChannelModeSet

func (*ChannelModeSet) Has added in v1.6.0

func (set *ChannelModeSet) Has(mode ChannelMode) bool

Has returns true if the mode is set

func (*ChannelModeSet) Range added in v1.6.0

func (set *ChannelModeSet) Range(f func(mode ChannelMode) bool)

Range ranges of the modes calling f

func (*ChannelModeSet) Set added in v1.6.0

func (set *ChannelModeSet) Set(mode ChannelMode)

Set sets mode

func (*ChannelModeSet) String

func (set *ChannelModeSet) String() string

String returns a string representing the channel modes

func (*ChannelModeSet) Unset added in v1.6.0

func (set *ChannelModeSet) Unset(mode ChannelMode)

Unset unsets mode

type ChannelModes

type ChannelModes []ChannelMode

func (ChannelModes) String

func (modes ChannelModes) String() string

type ChannelNameMap

type ChannelNameMap struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

ChannelNameMap holds a mapping of channel names to *Channel structs that is safe for concurrent readers and writers.

func NewChannelNameMap added in v1.5.4

func NewChannelNameMap() *ChannelNameMap

NewChannelNameMap returns a new initialized *ChannelNameMap

func (*ChannelNameMap) Add

func (c *ChannelNameMap) Add(channel *Channel) error

Add adds a new *Channel if not already exists or an error otherwise

func (*ChannelNameMap) Count added in v1.6.0

func (c *ChannelNameMap) Count() int

Count returns the number of *Channel9s)

func (*ChannelNameMap) Get

func (c *ChannelNameMap) Get(name Name) *Channel

Get returns a *Channel given a name if it exists or a zero-value *Channel

func (*ChannelNameMap) Range added in v1.5.4

func (c *ChannelNameMap) Range(f func(kay Name, value *Channel) bool)

Range ranges of the *Channels(s) calling f

func (*ChannelNameMap) Remove

func (c *ChannelNameMap) Remove(channel *Channel) error

Remove removes a *Channel if it exists or an error otherwise

type ChannelSet

type ChannelSet struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewChannelSet added in v1.6.0

func NewChannelSet() *ChannelSet

func (*ChannelSet) Add

func (set *ChannelSet) Add(channel *Channel)

func (*ChannelSet) Count added in v1.6.0

func (set *ChannelSet) Count() int

func (*ChannelSet) Range added in v1.6.0

func (set *ChannelSet) Range(f func(channel *Channel) bool)

func (*ChannelSet) Remove

func (set *ChannelSet) Remove(channel *Channel)

type Client

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

func NewClient

func NewClient(server *Server, conn net.Conn) *Client

func (*Client) Active

func (client *Client) Active()

func (*Client) CanSpeak

func (client *Client) CanSpeak(target *Client) bool

func (*Client) ChangeNickname

func (client *Client) ChangeNickname(nickname Name)

func (*Client) ErrAlreadyRegistered

func (target *Client) ErrAlreadyRegistered()

func (*Client) ErrBadChannelKey

func (target *Client) ErrBadChannelKey(channel *Channel)

func (*Client) ErrBannedFromChan

func (target *Client) ErrBannedFromChan(channel *Channel)

func (*Client) ErrCannotSendToChan

func (target *Client) ErrCannotSendToChan(channel *Channel)

func (*Client) ErrCannotSendToUser

func (target *Client) ErrCannotSendToUser(nick Name, reason string)

func (*Client) ErrChanOPrivIsNeeded

func (target *Client) ErrChanOPrivIsNeeded(channel *Channel)

<channel> :You're not channel operator

func (*Client) ErrChannelIsFull

func (target *Client) ErrChannelIsFull(channel *Channel)

func (*Client) ErrConfiguredMode

func (target *Client) ErrConfiguredMode(mode ChannelMode)

func (*Client) ErrErroneusNickname

func (target *Client) ErrErroneusNickname(nick Name)

func (*Client) ErrInvalidCapCmd

func (target *Client) ErrInvalidCapCmd(subCommand CapSubCommand)

func (*Client) ErrInviteOnlyChan

func (target *Client) ErrInviteOnlyChan(channel *Channel)

func (*Client) ErrInviteOnlyChannel

func (target *Client) ErrInviteOnlyChannel(channel *Channel)

func (*Client) ErrNeedMoreParams

func (target *Client) ErrNeedMoreParams(command StringCode)

func (*Client) ErrNickLocked added in v1.6.1

func (target *Client) ErrNickLocked()

func (*Client) ErrNickNameInUse

func (target *Client) ErrNickNameInUse(nick Name)

func (*Client) ErrNoChanModes

func (target *Client) ErrNoChanModes(channel *Channel)

func (*Client) ErrNoMOTD

func (target *Client) ErrNoMOTD()

func (*Client) ErrNoNicknameGiven

func (target *Client) ErrNoNicknameGiven()

func (*Client) ErrNoPrivileges

func (target *Client) ErrNoPrivileges()

func (*Client) ErrNoSuchChannel

func (target *Client) ErrNoSuchChannel(channel Name)

func (*Client) ErrNoSuchNick

func (target *Client) ErrNoSuchNick(nick Name)

func (*Client) ErrNoSuchServer

func (target *Client) ErrNoSuchServer(server Name)

func (*Client) ErrNotOnChannel

func (target *Client) ErrNotOnChannel(channel *Channel)

func (*Client) ErrPasswdMismatch

func (target *Client) ErrPasswdMismatch()

func (*Client) ErrRestricted

func (target *Client) ErrRestricted()

func (*Client) ErrSaslAborted added in v1.6.1

func (target *Client) ErrSaslAborted()

func (*Client) ErrSaslAlready added in v1.6.1

func (target *Client) ErrSaslAlready()

func (*Client) ErrSaslFail added in v1.6.1

func (target *Client) ErrSaslFail(message string)

func (*Client) ErrSaslTooLong added in v1.6.1

func (target *Client) ErrSaslTooLong()

func (*Client) ErrUnknownCommand

func (target *Client) ErrUnknownCommand(code StringCode)

func (*Client) ErrUnknownMode

func (target *Client) ErrUnknownMode(mode ChannelMode, channel *Channel)

func (*Client) ErrUserNotInChannel

func (target *Client) ErrUserNotInChannel(channel *Channel, client *Client)

func (*Client) ErrUserOnChannel

func (target *Client) ErrUserOnChannel(channel *Channel, member *Client)

func (*Client) ErrUsersDontMatch

func (target *Client) ErrUsersDontMatch()

func (*Client) ErrWasNoSuchNick

func (target *Client) ErrWasNoSuchNick(nickname Name)

func (*Client) Friends

func (client *Client) Friends() *ClientSet

func (*Client) HasNick

func (client *Client) HasNick() bool

func (*Client) HasUsername

func (client *Client) HasUsername() bool

func (*Client) Id

func (c *Client) Id() Name

func (*Client) Idle

func (client *Client) Idle()

func (*Client) IdleSeconds

func (client *Client) IdleSeconds() uint64

func (*Client) IdleTime

func (client *Client) IdleTime() time.Duration

func (*Client) ModeString

func (c *Client) ModeString() (str string)

<mode>

func (*Client) MultilineReply

func (target *Client) MultilineReply(names []string, code NumericCode, format string,
	args ...interface{})

func (*Client) Nick

func (c *Client) Nick() Name

func (*Client) NumericReply

func (target *Client) NumericReply(code NumericCode,
	format string, args ...interface{})

func (*Client) Quit

func (client *Client) Quit(message Text)

func (*Client) Register

func (client *Client) Register()

func (*Client) Reply

func (client *Client) Reply(reply string)

func (*Client) RplAway

func (target *Client) RplAway(client *Client)

func (*Client) RplBanList

func (target *Client) RplBanList(channel *Channel, mask Name)

func (*Client) RplChannelModeIs

func (target *Client) RplChannelModeIs(channel *Channel)

func (*Client) RplCreated

func (target *Client) RplCreated()

func (*Client) RplEndOfBanList

func (target *Client) RplEndOfBanList(channel *Channel)

func (*Client) RplEndOfExceptList

func (target *Client) RplEndOfExceptList(channel *Channel)

func (*Client) RplEndOfInviteList

func (target *Client) RplEndOfInviteList(channel *Channel)

func (*Client) RplEndOfMaskList

func (target *Client) RplEndOfMaskList(mode ChannelMode, channel *Channel)

func (*Client) RplEndOfNames

func (target *Client) RplEndOfNames(channel *Channel)

func (*Client) RplEndOfWho

func (target *Client) RplEndOfWho(name Name)

<name> :End of WHO list

func (*Client) RplEndOfWhoWas

func (target *Client) RplEndOfWhoWas(nickname Name)

func (*Client) RplEndOfWhois

func (target *Client) RplEndOfWhois(client *Client)

func (*Client) RplExceptList

func (target *Client) RplExceptList(channel *Channel, mask Name)

func (*Client) RplInviteList

func (target *Client) RplInviteList(channel *Channel, mask Name)

func (*Client) RplInviting

func (target *Client) RplInviting(invitee *Client, channel Name)

func (*Client) RplInvitingMsg

func (target *Client) RplInvitingMsg(invitee *Client, channel Name)

<nick> <channel> NB: correction in errata

func (*Client) RplIsOn

func (target *Client) RplIsOn(nicks []string)

func (*Client) RplLUserChannels added in v1.5.3

func (target *Client) RplLUserChannels()

func (*Client) RplLUserClient added in v1.5.3

func (target *Client) RplLUserClient()

func (*Client) RplLUserMe added in v1.5.3

func (target *Client) RplLUserMe()

func (*Client) RplLUserOp added in v1.5.3

func (target *Client) RplLUserOp()

func (*Client) RplLUserUnknown added in v1.5.3

func (target *Client) RplLUserUnknown()

func (*Client) RplList

func (target *Client) RplList(channel *Channel)

func (*Client) RplListEnd

func (target *Client) RplListEnd(server *Server)

func (*Client) RplLoggedIn added in v1.6.1

func (target *Client) RplLoggedIn(authcid string)

func (*Client) RplLoggedOut added in v1.6.1

func (target *Client) RplLoggedOut()

func (*Client) RplMOTD

func (target *Client) RplMOTD(line string)

func (*Client) RplMOTDEnd

func (target *Client) RplMOTDEnd()

func (*Client) RplMOTDStart

func (target *Client) RplMOTDStart()

func (*Client) RplMaskList

func (target *Client) RplMaskList(mode ChannelMode, channel *Channel, mask Name)

func (*Client) RplMyInfo

func (target *Client) RplMyInfo()

func (*Client) RplNamReply

func (target *Client) RplNamReply(channel *Channel)

func (*Client) RplNoTopic

func (target *Client) RplNoTopic(channel *Channel)

func (*Client) RplNowAway

func (target *Client) RplNowAway()

func (*Client) RplRehashing added in v1.5.3

func (target *Client) RplRehashing()

<config file> :Rehashing

func (*Client) RplSaslMechs added in v1.6.1

func (target *Client) RplSaslMechs(mechs ...string)

func (*Client) RplSaslSuccess added in v1.6.1

func (target *Client) RplSaslSuccess()

func (*Client) RplTime

func (target *Client) RplTime()

func (*Client) RplTopic

func (target *Client) RplTopic(channel *Channel)

func (*Client) RplUModeIs

func (target *Client) RplUModeIs(client *Client)

func (*Client) RplUnAway

func (target *Client) RplUnAway()

func (*Client) RplVersion

func (target *Client) RplVersion()

func (*Client) RplWelcome

func (target *Client) RplWelcome()

func (*Client) RplWhoReply

func (target *Client) RplWhoReply(channel *Channel, client *Client)

<channel> <user> <host> <server> <nick> ( "H" / "G" ) ["*"] [ ( "@" / "+" ) ] :<hopcount> <real name>

func (*Client) RplWhoWasUser

func (target *Client) RplWhoWasUser(whoWas *WhoWas)

func (*Client) RplWhois

func (target *Client) RplWhois(client *Client)

func (*Client) RplWhoisChannels

func (target *Client) RplWhoisChannels(client *Client)

func (*Client) RplWhoisIdle

func (target *Client) RplWhoisIdle(client *Client)

func (*Client) RplWhoisLoggedIn added in v1.6.1

func (target *Client) RplWhoisLoggedIn(client *Client)

func (*Client) RplWhoisOperator

func (target *Client) RplWhoisOperator(client *Client)

func (*Client) RplWhoisSecure

func (target *Client) RplWhoisSecure(client *Client)

func (*Client) RplWhoisServer added in v1.5.3

func (target *Client) RplWhoisServer(client *Client)

func (*Client) RplWhoisUser

func (target *Client) RplWhoisUser(client *Client)

func (*Client) RplYourHost

func (target *Client) RplYourHost()

func (*Client) RplYoureOper

func (target *Client) RplYoureOper()

:You are now an IRC operator

func (*Client) Server added in v1.5.3

func (c *Client) Server() Name

func (*Client) ServerInfo added in v1.5.3

func (c *Client) ServerInfo() string

func (*Client) SetNickname

func (client *Client) SetNickname(nickname Name)

func (*Client) SignonTime

func (client *Client) SignonTime() int64

func (*Client) String

func (c *Client) String() string

func (*Client) Touch

func (client *Client) Touch()

func (*Client) UserHost

func (c *Client) UserHost(cloacked bool) Name

func (*Client) WhoisChannelsNames

func (client *Client) WhoisChannelsNames(target *Client) []string

type ClientLookupSet

type ClientLookupSet struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewClientLookupSet

func NewClientLookupSet() *ClientLookupSet

func (*ClientLookupSet) Add

func (clients *ClientLookupSet) Add(client *Client) error

func (*ClientLookupSet) Count added in v1.5.3

func (clients *ClientLookupSet) Count() int

func (*ClientLookupSet) Find

func (clients *ClientLookupSet) Find(userhost Name) *Client

func (*ClientLookupSet) FindAll

func (clients *ClientLookupSet) FindAll(userhost Name) *ClientSet

func (*ClientLookupSet) Get

func (clients *ClientLookupSet) Get(nick Name) *Client

func (*ClientLookupSet) Range added in v1.6.0

func (clients *ClientLookupSet) Range(f func(nick Name, client *Client) bool)

func (*ClientLookupSet) Remove

func (clients *ClientLookupSet) Remove(client *Client) error

type ClientSet

type ClientSet struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewClientSet added in v1.6.0

func NewClientSet() *ClientSet

func (*ClientSet) Add

func (set *ClientSet) Add(client *Client)

func (*ClientSet) Count added in v1.6.0

func (set *ClientSet) Count() int

func (*ClientSet) Has

func (set *ClientSet) Has(client *Client) bool

func (*ClientSet) Range added in v1.6.0

func (set *ClientSet) Range(f func(client *Client) bool)

func (*ClientSet) Remove

func (set *ClientSet) Remove(client *Client)

type Command

type Command interface {
	Client() *Client
	Code() StringCode
	SetClient(*Client)
	SetCode(StringCode)
}

func ParseAuthenticateCommand added in v1.6.1

func ParseAuthenticateCommand(args []string) (Command, error)

func ParseAwayCommand

func ParseAwayCommand(args []string) (Command, error)

func ParseCapCommand

func ParseCapCommand(args []string) (Command, error)

func ParseChannelModeCommand

func ParseChannelModeCommand(channel Name, args []string) (Command, error)

MODE <channel> *( ( "-" / "+" ) *<modes> *<modeparams> )

func ParseCommand

func ParseCommand(line string) (cmd Command, err error)

func ParseInviteCommand

func ParseInviteCommand(args []string) (Command, error)

func ParseIsOnCommand

func ParseIsOnCommand(args []string) (Command, error)

func ParseJoinCommand

func ParseJoinCommand(args []string) (Command, error)

func ParseKickCommand

func ParseKickCommand(args []string) (Command, error)

func ParseKillCommand

func ParseKillCommand(args []string) (Command, error)

func ParseLUsersCommand added in v1.5.3

func ParseLUsersCommand(args []string) (Command, error)

func ParseListCommand

func ParseListCommand(args []string) (Command, error)

func ParseMOTDCommand

func ParseMOTDCommand(args []string) (Command, error)

func ParseModeCommand

func ParseModeCommand(args []string) (Command, error)

func ParseNamesCommand

func ParseNamesCommand(args []string) (Command, error)

func ParseNickCommand

func ParseNickCommand(args []string) (Command, error)

func ParseNoticeCommand

func ParseNoticeCommand(args []string) (Command, error)

func ParseOperCommand

func ParseOperCommand(args []string) (Command, error)

OPER <name> <password>

func ParseOperNickCommand

func ParseOperNickCommand(args []string) (Command, error)

func ParsePartCommand

func ParsePartCommand(args []string) (Command, error)

func ParsePassCommand

func ParsePassCommand(args []string) (Command, error)

func ParsePingCommand

func ParsePingCommand(args []string) (Command, error)

func ParsePongCommand

func ParsePongCommand(args []string) (Command, error)

func ParsePrivMsgCommand

func ParsePrivMsgCommand(args []string) (Command, error)

func ParseQuitCommand

func ParseQuitCommand(args []string) (Command, error)

func ParseRehashCommand added in v1.5.3

func ParseRehashCommand(args []string) (Command, error)

REHASH

func ParseTimeCommand

func ParseTimeCommand(args []string) (Command, error)

func ParseTopicCommand

func ParseTopicCommand(args []string) (Command, error)

func ParseUserCommand

func ParseUserCommand(args []string) (Command, error)

func ParseUserModeCommand

func ParseUserModeCommand(nickname Name, args []string) (Command, error)

MODE <nickname> *( ( "+" / "-" ) *( "i" / "w" / "o" / "O" / "r" ) )

func ParseVersionCommand

func ParseVersionCommand(args []string) (Command, error)

func ParseWallopsCommand added in v1.6.0

func ParseWallopsCommand(args []string) (Command, error)

func ParseWhoCommand

func ParseWhoCommand(args []string) (Command, error)

WHO [ <mask> [ "o" ] ]

func ParseWhoWasCommand

func ParseWhoWasCommand(args []string) (Command, error)

func ParseWhoisCommand

func ParseWhoisCommand(args []string) (Command, error)

WHOIS [ <target> ] <mask> *( "," <mask> )

type Config

type Config struct {
	sync.Mutex

	Network struct {
		Name string
	}

	Server struct {
		PassConfig  `yaml:",inline"`
		Listen      []string
		TLSListen   map[string]*TLSConfig
		Log         string
		MOTD        string
		Name        string
		Description string
	}

	Operator map[string]*PassConfig
	Account  map[string]*PassConfig
	// contains filtered or unexported fields
}

func LoadConfig

func LoadConfig(filename string) (config *Config, err error)

func (*Config) Accounts added in v1.6.1

func (conf *Config) Accounts() map[string][]byte

func (*Config) Name added in v1.5.3

func (conf *Config) Name() string

func (*Config) Operators

func (conf *Config) Operators() map[Name][]byte

func (*Config) Reload added in v1.5.3

func (conf *Config) Reload() error

type Counter added in v1.6.0

type Counter struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*Counter) Dec added in v1.6.0

func (c *Counter) Dec()

func (*Counter) Inc added in v1.6.0

func (c *Counter) Inc()

func (*Counter) Value added in v1.6.0

func (c *Counter) Value() int

type Identifiable

type Identifiable interface {
	Id() Name
	Nick() Name
}

type Identity added in v1.6.0

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

func NewIdentity added in v1.6.0

func NewIdentity(hostname string, args ...string) *Identity

func (*Identity) Id added in v1.6.0

func (id *Identity) Id() Name

func (*Identity) Nick added in v1.6.0

func (id *Identity) Nick() Name

func (*Identity) String added in v1.6.0

func (id *Identity) String() string

type InviteCommand

type InviteCommand struct {
	BaseCommand
	// contains filtered or unexported fields
}

func (*InviteCommand) HandleServer

func (msg *InviteCommand) HandleServer(server *Server)

type IsOnCommand

type IsOnCommand struct {
	BaseCommand
	// contains filtered or unexported fields
}

func (*IsOnCommand) HandleServer

func (msg *IsOnCommand) HandleServer(server *Server)

type JoinCommand

type JoinCommand struct {
	BaseCommand
	// contains filtered or unexported fields
}

func (*JoinCommand) HandleServer

func (m *JoinCommand) HandleServer(s *Server)

type KickCommand

type KickCommand struct {
	BaseCommand
	// contains filtered or unexported fields
}

func (*KickCommand) Comment

func (msg *KickCommand) Comment() Text

func (*KickCommand) HandleServer

func (msg *KickCommand) HandleServer(server *Server)

type KillCommand

type KillCommand struct {
	BaseCommand
	// contains filtered or unexported fields
}

func (*KillCommand) HandleServer

func (msg *KillCommand) HandleServer(server *Server)

type LUsersCommand added in v1.5.3

type LUsersCommand struct {
	BaseCommand
}

func (*LUsersCommand) HandleServer added in v1.5.3

func (msg *LUsersCommand) HandleServer(server *Server)

type ListCommand

type ListCommand struct {
	BaseCommand
	// contains filtered or unexported fields
}

func (*ListCommand) HandleServer

func (msg *ListCommand) HandleServer(server *Server)

type MOTDCommand

type MOTDCommand struct {
	BaseCommand
	// contains filtered or unexported fields
}

func (*MOTDCommand) HandleServer

func (msg *MOTDCommand) HandleServer(server *Server)

type MemberSet

type MemberSet struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewMemberSet added in v1.6.0

func NewMemberSet() *MemberSet

func (*MemberSet) Add

func (set *MemberSet) Add(member *Client)

func (*MemberSet) Count added in v1.6.0

func (set *MemberSet) Count() int

func (*MemberSet) Get added in v1.6.0

func (set *MemberSet) Get(member *Client) *ChannelModeSet

func (*MemberSet) Has

func (set *MemberSet) Has(member *Client) bool

func (*MemberSet) HasMode

func (set *MemberSet) HasMode(member *Client, mode ChannelMode) bool

func (*MemberSet) Range added in v1.6.0

func (set *MemberSet) Range(f func(client *Client, modes *ChannelModeSet) bool)

func (*MemberSet) Remove

func (set *MemberSet) Remove(member *Client)

type MemoryPasswordStore added in v1.6.1

type MemoryPasswordStore struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewMemoryPasswordStore added in v1.6.1

func NewMemoryPasswordStore(passwords map[string][]byte, opts PasswordStoreOpts) *MemoryPasswordStore

func (*MemoryPasswordStore) Get added in v1.6.1

func (store *MemoryPasswordStore) Get(username string) ([]byte, bool)

func (*MemoryPasswordStore) Set added in v1.6.1

func (store *MemoryPasswordStore) Set(username, password string) error

func (*MemoryPasswordStore) Verify added in v1.6.1

func (store *MemoryPasswordStore) Verify(username, password string) error

type Metrics added in v1.6.0

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

func NewMetrics added in v1.6.0

func NewMetrics(namespace string) *Metrics

func (*Metrics) Counter added in v1.6.0

func (m *Metrics) Counter(subsystem, name string) prometheus.Counter

func (*Metrics) Gauge added in v1.6.0

func (m *Metrics) Gauge(subsystem, name string) prometheus.Gauge

func (*Metrics) GaugeVec added in v1.6.3

func (m *Metrics) GaugeVec(subsystem, name string) *prometheus.GaugeVec

func (*Metrics) Handler added in v1.6.0

func (m *Metrics) Handler() http.Handler

func (*Metrics) NewCounter added in v1.6.0

func (m *Metrics) NewCounter(subsystem, name, help string) prometheus.Counter

func (*Metrics) NewCounterFunc added in v1.6.0

func (m *Metrics) NewCounterFunc(subsystem, name, help string, f func() float64) prometheus.CounterFunc

func (*Metrics) NewGauge added in v1.6.0

func (m *Metrics) NewGauge(subsystem, name, help string) prometheus.Gauge

func (*Metrics) NewGaugeFunc added in v1.6.0

func (m *Metrics) NewGaugeFunc(subsystem, name, help string, f func() float64) prometheus.GaugeFunc

func (*Metrics) NewGaugeVec added in v1.6.3

func (m *Metrics) NewGaugeVec(subsystem, name, help string, labels []string) *prometheus.GaugeVec

func (*Metrics) NewSummary added in v1.6.0

func (m *Metrics) NewSummary(subsystem, name, help string) prometheus.Summary

func (*Metrics) NewSummaryVec added in v1.6.0

func (m *Metrics) NewSummaryVec(subsystem, name, help string, labels []string) *prometheus.SummaryVec

func (*Metrics) Run added in v1.6.0

func (m *Metrics) Run(addr string)

func (*Metrics) Summary added in v1.6.0

func (m *Metrics) Summary(subsystem, name string) prometheus.Summary

func (*Metrics) SummaryVec added in v1.6.0

func (m *Metrics) SummaryVec(subsystem, name string) *prometheus.SummaryVec

type ModeChange

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

func (*ModeChange) String

func (change *ModeChange) String() string

type ModeChanges

type ModeChanges []*ModeChange

func (ModeChanges) String

func (changes ModeChanges) String() string

type ModeCommand

type ModeCommand struct {
	BaseCommand
	// contains filtered or unexported fields
}

func (*ModeCommand) HandleServer

func (m *ModeCommand) HandleServer(s *Server)

type ModeOp

type ModeOp rune
const (
	Add    ModeOp = '+'
	List   ModeOp = '='
	Remove ModeOp = '-'
)

func (ModeOp) String

func (op ModeOp) String() string

type Name

type Name string

Names are normalized and canonicalized to remove formatting marks and simplify usage. They are things like hostnames and usermasks.

func AddrLookupHostname

func AddrLookupHostname(addr net.Addr) Name

func ExpandUserHost

func ExpandUserHost(userhost Name) (expanded Name)

func IPString

func IPString(addr net.Addr) Name

func LookupHostname

func LookupHostname(addr Name) Name

func NewName

func NewName(str string) Name

func NewNames

func NewNames(strs []string) []Name

func (Name) IsChannel

func (name Name) IsChannel() bool

func (Name) IsNickname

func (name Name) IsNickname() bool

func (Name) String

func (name Name) String() string

func (Name) Text

func (name Name) Text() Text

It's safe to coerce a Name to Text. Name is a strict subset of Text.

func (Name) ToLower

func (name Name) ToLower() Name

type NamesCommand

type NamesCommand struct {
	BaseCommand
	// contains filtered or unexported fields
}

func (*NamesCommand) HandleServer

func (msg *NamesCommand) HandleServer(server *Server)

type NickCommand

type NickCommand struct {
	BaseCommand
	// contains filtered or unexported fields
}

func (*NickCommand) HandleRegServer

func (m *NickCommand) HandleRegServer(s *Server)

func (*NickCommand) HandleServer

func (msg *NickCommand) HandleServer(server *Server)

type NoticeCommand

type NoticeCommand struct {
	BaseCommand
	// contains filtered or unexported fields
}

func (*NoticeCommand) HandleServer

func (msg *NoticeCommand) HandleServer(server *Server)

type NumericCode

type NumericCode uint

func (NumericCode) String

func (code NumericCode) String() string

type OperCommand

type OperCommand struct {
	PassCommand
	// contains filtered or unexported fields
}

func (*OperCommand) HandleServer

func (msg *OperCommand) HandleServer(server *Server)

func (*OperCommand) LoadPassword

func (msg *OperCommand) LoadPassword(server *Server)

type OperNickCommand

type OperNickCommand struct {
	BaseCommand
	// contains filtered or unexported fields
}

func (*OperNickCommand) HandleServer

func (msg *OperNickCommand) HandleServer(server *Server)

type PartCommand

type PartCommand struct {
	BaseCommand
	// contains filtered or unexported fields
}

func (*PartCommand) HandleServer

func (m *PartCommand) HandleServer(server *Server)

func (*PartCommand) Message

func (cmd *PartCommand) Message() Text

type PassCommand

type PassCommand struct {
	BaseCommand
	// contains filtered or unexported fields
}

func (*PassCommand) CheckPassword

func (cmd *PassCommand) CheckPassword()

func (*PassCommand) HandleRegServer

func (msg *PassCommand) HandleRegServer(server *Server)

func (*PassCommand) HandleServer

func (m *PassCommand) HandleServer(s *Server)

func (*PassCommand) LoadPassword

func (cmd *PassCommand) LoadPassword(server *Server)

type PassConfig

type PassConfig struct {
	Password string
}

func (*PassConfig) PasswordBytes

func (conf *PassConfig) PasswordBytes() []byte

type PasswordHasher added in v1.6.1

type PasswordHasher interface {
	Decode(encoded []byte) (decoded []byte, err error)
	Encode(password []byte) (encoded []byte, err error)
	Compare(encoded []byte, password []byte) error
}

type PasswordStore added in v1.6.1

type PasswordStore interface {
	Get(username string) ([]byte, bool)
	Set(username, password string) error
	Verify(username, password string) error
}

type PasswordStoreOpts added in v1.6.1

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

type PingCommand

type PingCommand struct {
	BaseCommand
	// contains filtered or unexported fields
}

func (*PingCommand) HandleServer

func (m *PingCommand) HandleServer(s *Server)

type PongCommand

type PongCommand struct {
	BaseCommand
	// contains filtered or unexported fields
}

func (*PongCommand) HandleServer

func (m *PongCommand) HandleServer(s *Server)

type PrivMsgCommand

type PrivMsgCommand struct {
	BaseCommand
	// contains filtered or unexported fields
}

func (*PrivMsgCommand) HandleServer

func (msg *PrivMsgCommand) HandleServer(server *Server)

type QuitCommand

type QuitCommand struct {
	BaseCommand
	// contains filtered or unexported fields
}

func NewQuitCommand

func NewQuitCommand(message Text) *QuitCommand

func (*QuitCommand) HandleRegServer

func (msg *QuitCommand) HandleRegServer(server *Server)

func (*QuitCommand) HandleServer

func (msg *QuitCommand) HandleServer(server *Server)

type RFC1459UserCommand

type RFC1459UserCommand struct {
	UserCommand
	// contains filtered or unexported fields
}

USER <username> <hostname> <servername> <realname>

func (*RFC1459UserCommand) HandleRegServer

func (msg *RFC1459UserCommand) HandleRegServer(server *Server)

type RFC2812UserCommand

type RFC2812UserCommand struct {
	UserCommand
	// contains filtered or unexported fields
}

USER <user> <mode> <unused> <realname>

func (*RFC2812UserCommand) Flags

func (cmd *RFC2812UserCommand) Flags() []UserMode

func (*RFC2812UserCommand) HandleRegServer

func (msg *RFC2812UserCommand) HandleRegServer(server *Server)

type RegServerCommand

type RegServerCommand interface {
	Command
	HandleRegServer(*Server)
}

type RehashCommand added in v1.5.3

type RehashCommand struct {
	BaseCommand
}

func (*RehashCommand) HandleServer added in v1.5.3

func (msg *RehashCommand) HandleServer(server *Server)

type ReplyCode

type ReplyCode interface {
	String() string
}

type SaslState added in v1.6.1

type SaslState struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewSaslState added in v1.6.1

func NewSaslState() *SaslState

func (*SaslState) Id added in v1.6.1

func (s *SaslState) Id() string

func (SaslState) Len added in v1.6.1

func (s SaslState) Len() int

func (*SaslState) Login added in v1.6.1

func (s *SaslState) Login(authcid string)

func (*SaslState) Reset added in v1.6.1

func (s *SaslState) Reset()

func (*SaslState) Start added in v1.6.1

func (s *SaslState) Start()

func (*SaslState) Started added in v1.6.1

func (s *SaslState) Started() bool

func (*SaslState) String added in v1.6.1

func (s *SaslState) String() string

func (*SaslState) WriteString added in v1.6.1

func (s *SaslState) WriteString(data string)

type Server

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

func NewServer

func NewServer(config *Config) *Server

func (*Server) Global added in v1.6.0

func (server *Server) Global(message string)

func (*Server) Globalf added in v1.6.0

func (server *Server) Globalf(format string, args ...interface{})

func (*Server) Id

func (s *Server) Id() Name

func (*Server) MOTD

func (server *Server) MOTD(client *Client)

func (*Server) Network added in v1.6.2

func (s *Server) Network() Name

func (*Server) Nick

func (s *Server) Nick() Name

func (*Server) Rehash added in v1.5.3

func (s *Server) Rehash() error

func (*Server) Reply

func (server *Server) Reply(target *Client, message string)

func (*Server) Replyf

func (server *Server) Replyf(target *Client, format string, args ...interface{})

func (*Server) Run

func (server *Server) Run()

func (*Server) Shutdown

func (server *Server) Shutdown()

func (*Server) Stop added in v1.6.4

func (server *Server) Stop()

func (*Server) String

func (s *Server) String() string

func (*Server) Wallops added in v1.5.3

func (server *Server) Wallops(message string)

func (*Server) Wallopsf added in v1.5.3

func (server *Server) Wallopsf(format string, args ...interface{})

type ServerCommand

type ServerCommand interface {
	Command
	HandleServer(*Server)
}

type Socket

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

func NewSocket

func NewSocket(conn net.Conn) *Socket

func (*Socket) Close

func (socket *Socket) Close()

func (*Socket) Read

func (socket *Socket) Read() (line string, err error)

func (*Socket) String

func (socket *Socket) String() string

func (*Socket) Write

func (socket *Socket) Write(line string) (err error)

type StringCode

type StringCode string

func ParseLine

func ParseLine(line string) (command StringCode, args []string)

func (StringCode) String

func (code StringCode) String() string

type TLSConfig

type TLSConfig struct {
	Key  string
	Cert string
}

type Text

type Text string

Text is PRIVMSG, NOTICE, or TOPIC data. It's canonicalized UTF8 data to simplify but keeps all formatting.

func NewText

func NewText(str string) Text

func (Text) String

func (text Text) String() string

type TimeCommand

type TimeCommand struct {
	BaseCommand
	// contains filtered or unexported fields
}

func (*TimeCommand) HandleServer

func (msg *TimeCommand) HandleServer(server *Server)

type TopicCommand

type TopicCommand struct {
	BaseCommand
	// contains filtered or unexported fields
}

func (*TopicCommand) HandleServer

func (msg *TopicCommand) HandleServer(server *Server)

type UnknownCommand

type UnknownCommand struct {
	BaseCommand
	// contains filtered or unexported fields
}

func ParseUnknownCommand

func ParseUnknownCommand(args []string) *UnknownCommand

type UserCommand

type UserCommand struct {
	BaseCommand
	// contains filtered or unexported fields
}

func (*UserCommand) HandleServer

func (m *UserCommand) HandleServer(s *Server)

type UserMaskSet

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

func NewUserMaskSet

func NewUserMaskSet() *UserMaskSet

func (*UserMaskSet) Add

func (set *UserMaskSet) Add(mask Name) bool

func (*UserMaskSet) AddAll

func (set *UserMaskSet) AddAll(masks []Name) (added bool)

func (*UserMaskSet) Match

func (set *UserMaskSet) Match(userhost Name) bool

func (*UserMaskSet) Remove

func (set *UserMaskSet) Remove(mask Name) bool

func (*UserMaskSet) String

func (set *UserMaskSet) String() string

type UserMode

type UserMode rune

user mode flags

const (
	Away       UserMode = 'a' // not a real user mode (flag)
	Invisible  UserMode = 'i'
	Operator   UserMode = 'o'
	WallOps    UserMode = 'w'
	Registered UserMode = 'r' // not a real user mode (flag)
	SecureConn UserMode = 'z'
	SecureOnly UserMode = 'Z'
	HostMask   UserMode = 'x'
)

func (UserMode) String

func (mode UserMode) String() string

type UserModes

type UserModes []UserMode

func (UserModes) String

func (modes UserModes) String() string

type VersionCommand

type VersionCommand struct {
	BaseCommand
	// contains filtered or unexported fields
}

func (*VersionCommand) HandleServer

func (msg *VersionCommand) HandleServer(server *Server)

type WallopsCommand added in v1.6.0

type WallopsCommand struct {
	BaseCommand
	// contains filtered or unexported fields
}

func (*WallopsCommand) HandleServer added in v1.6.0

func (msg *WallopsCommand) HandleServer(server *Server)

type WhoCommand

type WhoCommand struct {
	BaseCommand
	// contains filtered or unexported fields
}

func (*WhoCommand) HandleServer

func (msg *WhoCommand) HandleServer(server *Server)

type WhoWas

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

type WhoWasCommand

type WhoWasCommand struct {
	BaseCommand
	// contains filtered or unexported fields
}

func (*WhoWasCommand) HandleServer

func (msg *WhoWasCommand) HandleServer(server *Server)

type WhoWasList

type WhoWasList struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewWhoWasList

func NewWhoWasList(size uint) *WhoWasList

func (*WhoWasList) Append

func (list *WhoWasList) Append(client *Client)

func (*WhoWasList) Each

func (list *WhoWasList) Each() <-chan *WhoWas

Iterate the buffer in reverse.

func (*WhoWasList) Find

func (list *WhoWasList) Find(nickname Name, limit int64) []*WhoWas

type WhoisCommand

type WhoisCommand struct {
	BaseCommand
	// contains filtered or unexported fields
}

func (*WhoisCommand) HandleServer

func (m *WhoisCommand) HandleServer(server *Server)

Jump to

Keyboard shortcuts

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