Documentation ¶
Index ¶
- Constants
- Variables
- func ComparePassword(hash, password []byte) error
- func DecodePassword(encoded string) (decoded []byte, err error)
- func GenerateEncodedPassword(passwd string) (encoded string, err error)
- func HasWildcards(mask string) bool
- func InitDB(path string)
- func NewLogger(on bool) *log.Logger
- func NewNumericReply(target *Client, code NumericCode, format string, args ...interface{}) string
- func NewStringReply(source Identifiable, code StringCode, format string, args ...interface{}) string
- func OpenDB(path string) *sql.DB
- func QuoteLike(userhost Name) string
- func RplCTCPAction(source Identifiable, target Identifiable, action CTCPText) string
- func RplCap(client *Client, subCommand CapSubCommand, arg interface{}) string
- func RplChannelMode(client *Client, channel *Channel, changes ChannelModeChanges) string
- func RplCurrentMode(client *Client, target *Client) string
- func RplError(message string) string
- func RplInviteMsg(inviter *Client, invitee *Client, channel Name) string
- func RplJoin(client *Client, channel *Channel) string
- func RplKick(channel *Channel, client *Client, target *Client, comment Text) string
- func RplKill(client *Client, target *Client, comment Text) string
- func RplModeChanges(client *Client, target *Client, changes ModeChanges) string
- func RplNick(source Identifiable, newNick Name) string
- func RplNotice(source Identifiable, target Identifiable, message Text) string
- func RplPart(client *Client, channel *Channel, message Text) string
- func RplPing(target Identifiable) string
- func RplPong(client *Client, msg Text) string
- func RplPrivMsg(source Identifiable, target Identifiable, message Text) string
- func RplQuit(client *Client, message Text) string
- func RplTopicMsg(source Identifiable, channel *Channel) string
- func UpgradeDB(path string)
- type AwayCommand
- type BaseCommand
- type CTCPText
- type CapCommand
- type CapModifier
- type CapState
- type CapSubCommand
- type Capability
- type CapabilitySet
- type Channel
- func (channel *Channel) CanSpeak(client *Client) bool
- func (channel *Channel) CheckKey(key Text) bool
- func (channel *Channel) ClientIsOperator(client *Client) bool
- func (channel *Channel) GetTopic(client *Client)
- func (channel *Channel) Id() Name
- func (channel *Channel) Invite(invitee *Client, inviter *Client)
- func (channel *Channel) IsEmpty() bool
- func (channel *Channel) IsFull() bool
- func (channel *Channel) Join(client *Client, key Text)
- func (channel *Channel) Kick(client *Client, target *Client, comment Text)
- func (channel *Channel) Mode(client *Client, changes ChannelModeChanges)
- func (channel *Channel) ModeString(client *Client) (str string)
- func (channel *Channel) Names(client *Client)
- func (channel *Channel) Nick() Name
- func (channel *Channel) Nicks(target *Client) []string
- func (channel *Channel) Notice(client *Client, message Text)
- func (channel *Channel) Part(client *Client, message Text)
- func (channel *Channel) Persist() (err error)
- func (channel *Channel) PrivMsg(client *Client, message Text)
- func (channel *Channel) Quit(client *Client)
- func (channel *Channel) SetTopic(client *Client, topic Text)
- func (channel *Channel) ShowMaskList(client *Client, mode ChannelMode)
- func (channel *Channel) String() string
- type ChannelMode
- type ChannelModeChange
- type ChannelModeChanges
- type ChannelModeCommand
- type ChannelModeSet
- type ChannelModes
- type ChannelNameMap
- type ChannelSet
- type Client
- func (client *Client) Active()
- func (client *Client) ChangeNickname(nickname Name)
- func (target *Client) ErrAlreadyRegistered()
- func (target *Client) ErrBadChannelKey(channel *Channel)
- func (target *Client) ErrBannedFromChan(channel *Channel)
- func (target *Client) ErrCannotSendToChan(channel *Channel)
- func (target *Client) ErrChanOPrivIsNeeded(channel *Channel)
- func (target *Client) ErrChannelIsFull(channel *Channel)
- func (target *Client) ErrConfiguredMode(mode ChannelMode)
- func (target *Client) ErrErroneusNickname(nick Name)
- func (target *Client) ErrInvalidCapCmd(subCommand CapSubCommand)
- func (target *Client) ErrInviteOnlyChan(channel *Channel)
- func (target *Client) ErrInviteOnlyChannel(channel *Channel)
- func (target *Client) ErrNeedMoreParams(command StringCode)
- func (target *Client) ErrNickNameInUse(nick Name)
- func (target *Client) ErrNoChanModes(channel *Channel)
- func (target *Client) ErrNoMOTD()
- func (target *Client) ErrNoNicknameGiven()
- func (target *Client) ErrNoPrivileges()
- func (target *Client) ErrNoSuchChannel(channel Name)
- func (target *Client) ErrNoSuchNick(nick Name)
- func (target *Client) ErrNoSuchServer(server Name)
- func (target *Client) ErrNotOnChannel(channel *Channel)
- func (target *Client) ErrPasswdMismatch()
- func (target *Client) ErrRestricted()
- func (target *Client) ErrUnknownCommand(code StringCode)
- func (target *Client) ErrUnknownMode(mode ChannelMode, channel *Channel)
- func (target *Client) ErrUserNotInChannel(channel *Channel, client *Client)
- func (target *Client) ErrUserOnChannel(channel *Channel, member *Client)
- func (target *Client) ErrUsersDontMatch()
- func (target *Client) ErrWasNoSuchNick(nickname Name)
- func (client *Client) Friends() ClientSet
- func (client *Client) HasNick() bool
- func (client *Client) HasUsername() bool
- func (c *Client) Id() Name
- func (client *Client) Idle()
- func (client *Client) IdleSeconds() uint64
- func (client *Client) IdleTime() time.Duration
- func (c *Client) ModeString() (str string)
- func (target *Client) MultilineReply(names []string, code NumericCode, format string, args ...interface{})
- func (c *Client) Nick() Name
- func (target *Client) NumericReply(code NumericCode, format string, args ...interface{})
- func (client *Client) Quit(message Text)
- func (client *Client) Register()
- func (client *Client) Reply(reply string) error
- func (target *Client) RplAway(client *Client)
- func (target *Client) RplBanList(channel *Channel, mask Name)
- func (target *Client) RplChannelModeIs(channel *Channel)
- func (target *Client) RplCreated()
- func (target *Client) RplEndOfBanList(channel *Channel)
- func (target *Client) RplEndOfExceptList(channel *Channel)
- func (target *Client) RplEndOfInviteList(channel *Channel)
- func (target *Client) RplEndOfMaskList(mode ChannelMode, channel *Channel)
- func (target *Client) RplEndOfNames(channel *Channel)
- func (target *Client) RplEndOfWho(name Name)
- func (target *Client) RplEndOfWhoWas(nickname Name)
- func (target *Client) RplEndOfWhois()
- func (target *Client) RplExceptList(channel *Channel, mask Name)
- func (target *Client) RplInviteList(channel *Channel, mask Name)
- func (target *Client) RplInviting(invitee *Client, channel Name)
- func (target *Client) RplInvitingMsg(invitee *Client, channel Name)
- func (target *Client) RplIsOn(nicks []string)
- func (target *Client) RplList(channel *Channel)
- func (target *Client) RplListEnd(server *Server)
- func (target *Client) RplMOTD(line string)
- func (target *Client) RplMOTDEnd()
- func (target *Client) RplMOTDStart()
- func (target *Client) RplMaskList(mode ChannelMode, channel *Channel, mask Name)
- func (target *Client) RplMyInfo()
- func (target *Client) RplNamReply(channel *Channel)
- func (target *Client) RplNoTopic(channel *Channel)
- func (target *Client) RplNowAway()
- func (target *Client) RplTime()
- func (target *Client) RplTopic(channel *Channel)
- func (target *Client) RplUModeIs(client *Client)
- func (target *Client) RplUnAway()
- func (target *Client) RplVersion()
- func (target *Client) RplWelcome()
- func (target *Client) RplWhoReply(channel *Channel, client *Client)
- func (target *Client) RplWhoWasUser(whoWas *WhoWas)
- func (target *Client) RplWhois(client *Client)
- func (target *Client) RplWhoisChannels(client *Client)
- func (target *Client) RplWhoisIdle(client *Client)
- func (target *Client) RplWhoisOperator(client *Client)
- func (target *Client) RplWhoisUser(client *Client)
- func (target *Client) RplYourHost()
- func (target *Client) RplYoureOper()
- func (client *Client) SetNickname(nickname Name)
- func (client *Client) SignonTime() int64
- func (c *Client) String() string
- func (client *Client) Touch()
- func (c *Client) UserHost() Name
- func (client *Client) WhoisChannelsNames() []string
- type ClientDB
- type ClientLookupSet
- func (clients *ClientLookupSet) Add(client *Client) error
- func (clients *ClientLookupSet) Find(userhost Name) *Client
- func (clients *ClientLookupSet) FindAll(userhost Name) (set ClientSet)
- func (clients *ClientLookupSet) Get(nick Name) *Client
- func (clients *ClientLookupSet) Remove(client *Client) error
- type ClientSet
- type Command
- func ParseAwayCommand(args []string) (Command, error)
- func ParseCapCommand(args []string) (Command, error)
- func ParseChannelModeCommand(channel Name, args []string) (Command, error)
- func ParseCommand(line string) (cmd Command, err error)
- func ParseDebugCommand(args []string) (Command, error)
- func ParseInviteCommand(args []string) (Command, error)
- func ParseIsOnCommand(args []string) (Command, error)
- func ParseJoinCommand(args []string) (Command, error)
- func ParseKickCommand(args []string) (Command, error)
- func ParseKillCommand(args []string) (Command, error)
- func ParseListCommand(args []string) (Command, error)
- func ParseMOTDCommand(args []string) (Command, error)
- func ParseModeCommand(args []string) (Command, error)
- func ParseNamesCommand(args []string) (Command, error)
- func ParseNickCommand(args []string) (Command, error)
- func ParseNoticeCommand(args []string) (Command, error)
- func ParseOperCommand(args []string) (Command, error)
- func ParseOperNickCommand(args []string) (Command, error)
- func ParsePartCommand(args []string) (Command, error)
- func ParsePassCommand(args []string) (Command, error)
- func ParsePingCommand(args []string) (Command, error)
- func ParsePongCommand(args []string) (Command, error)
- func ParsePrivMsgCommand(args []string) (Command, error)
- func ParseProxyCommand(args []string) (Command, error)
- func ParseQuitCommand(args []string) (Command, error)
- func ParseTheaterCommand(args []string) (Command, error)
- func ParseTimeCommand(args []string) (Command, error)
- func ParseTopicCommand(args []string) (Command, error)
- func ParseUserCommand(args []string) (Command, error)
- func ParseUserModeCommand(nickname Name, args []string) (Command, error)
- func ParseVersionCommand(args []string) (Command, error)
- func ParseWhoCommand(args []string) (Command, error)
- func ParseWhoWasCommand(args []string) (Command, error)
- func ParseWhoisCommand(args []string) (Command, error)
- type Config
- type DebugCommand
- type Identifiable
- type InviteCommand
- type IsOnCommand
- type JoinCommand
- type KickCommand
- type KillCommand
- type ListCommand
- type Logging
- type MOTDCommand
- type MemberSet
- type ModeChange
- type ModeChanges
- type ModeCommand
- type ModeOp
- type Name
- type NamesCommand
- type NickCommand
- type NoticeCommand
- type NumericCode
- type OperCommand
- type OperNickCommand
- type PartCommand
- type PassCommand
- type PassConfig
- type PingCommand
- type PongCommand
- type PrivMsgCommand
- type ProxyCommand
- type QuitCommand
- type RFC1459UserCommand
- type RFC2812UserCommand
- type RegServerCommand
- type ReplyCode
- type Server
- func (s *Server) Id() Name
- func (server *Server) MOTD(client *Client)
- func (s *Server) Nick() Name
- func (server *Server) Reply(target *Client, message string)
- func (server *Server) Replyf(target *Client, format string, args ...interface{})
- func (server *Server) Run()
- func (server *Server) Shutdown()
- func (s *Server) String() string
- type ServerCommand
- type Socket
- type StringCode
- type Text
- type TheaterActionCommand
- type TheaterClient
- type TheaterIdentifyCommand
- type TheaterPrivMsgCommand
- type TheaterSubCommand
- type TimeCommand
- type TopicCommand
- type UnknownCommand
- type UserCommand
- type UserMaskSet
- type UserMode
- type UserModes
- type VersionCommand
- type WSContainer
- type WhoCommand
- type WhoWas
- type WhoWasCommand
- type WhoWasList
- type WhoisCommand
Constants ¶
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 )
const ( SEM_VER = "ergonomadic-1.4.4" CRLF = "\r\n" MAX_REPLY_LEN = 512 - len(CRLF) // string codes AWAY StringCode = "AWAY" CAP StringCode = "CAP" DEBUG StringCode = "DEBUG" 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" PART StringCode = "PART" PASS StringCode = "PASS" PING StringCode = "PING" PONG StringCode = "PONG" PRIVMSG StringCode = "PRIVMSG" PROXY StringCode = "PROXY" QUIT StringCode = "QUIT" THEATER StringCode = "THEATER" // nonstandard TIME StringCode = "TIME" TOPIC StringCode = "TOPIC" USER StringCode = "USER" VERSION StringCode = "VERSION" 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_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_UMODEUNKNOWNFLAG NumericCode = 501 ERR_USERSDONTMATCH NumericCode = 502 )
const ( R = '→' W = '←' )
Variables ¶
var ( ErrNickMissing = errors.New("nick missing") ErrNicknameInUse = errors.New("nickname in use") ErrNicknameMismatch = errors.New("nickname mismatch") )
var ( NotEnoughArgsError = errors.New("not enough arguments") ErrParseCommand = errors.New("failed to parse message") )
var ( // regexps ChannelNameExpr = regexp.MustCompile(`^[&!#+][\pL\pN]{1,63}$`) NicknameExpr = regexp.MustCompile("^[\\pL\\pN\\pP\\pS]{1,32}$") )
var (
EmptyPasswordError = errors.New("empty password")
)
var (
Log = NewLogging("warn")
)
var ( SERVER_SIGNALS = []os.Signal{syscall.SIGINT, syscall.SIGHUP, syscall.SIGTERM, syscall.SIGQUIT} )
var ( SupportedCapabilities = CapabilitySet{ MultiPrefix: true, } )
var ( SupportedChannelModes = ChannelModes{ BanMask, ExceptMask, InviteMask, InviteOnly, Key, NoOutside, OpOnlyTopic, Persistent, Private, Theater, UserLimit, } )
var ( SupportedUserModes = UserModes{ Away, Invisible, Operator, } )
Functions ¶
func ComparePassword ¶
func DecodePassword ¶
func GenerateEncodedPassword ¶
func HasWildcards ¶
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 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 RplCurrentMode ¶
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 RplPing ¶
func RplPing(target Identifiable) string
func RplPrivMsg ¶
func RplPrivMsg(source Identifiable, target Identifiable, message Text) string
func RplTopicMsg ¶
func RplTopicMsg(source Identifiable, channel *Channel) string
Types ¶
type AwayCommand ¶
type AwayCommand struct { BaseCommand // contains filtered or unexported fields }
func (*AwayCommand) HandleServer ¶
func (msg *AwayCommand) HandleServer(server *Server)
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 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 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 ¶
NewChannel creates a new channel from a `Server` and a `name` string, which must be unique on the server.
func (*Channel) ClientIsOperator ¶
func (*Channel) Mode ¶
func (channel *Channel) Mode(client *Client, changes ChannelModeChanges)
func (*Channel) ModeString ¶
<mode> <mode params>
func (*Channel) ShowMaskList ¶
func (channel *Channel) ShowMaskList(client *Client, mode ChannelMode)
type ChannelMode ¶
type ChannelMode rune
channel mode flags
const ( Anonymous ChannelMode = 'a' // flag 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 Persistent ChannelMode = 'P' // flag Private ChannelMode = 'p' // flag Quiet ChannelMode = 'q' // flag ReOp ChannelMode = 'r' // flag Secret ChannelMode = 's' // flag, deprecated Theater ChannelMode = 'T' // flag, nonstandard UserLimit ChannelMode = 'l' // flag arg Voice ChannelMode = 'v' // 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 map[ChannelMode]bool
func (ChannelModeSet) String ¶
func (set ChannelModeSet) String() string
type ChannelModes ¶
type ChannelModes []ChannelMode
func (ChannelModes) String ¶
func (modes ChannelModes) String() string
type ChannelNameMap ¶
func (ChannelNameMap) Add ¶
func (channels ChannelNameMap) Add(channel *Channel) error
func (ChannelNameMap) Get ¶
func (channels ChannelNameMap) Get(name Name) *Channel
func (ChannelNameMap) Remove ¶
func (channels ChannelNameMap) Remove(channel *Channel) error
type ChannelSet ¶
func (ChannelSet) Add ¶
func (channels ChannelSet) Add(channel *Channel)
func (ChannelSet) First ¶
func (channels ChannelSet) First() *Channel
func (ChannelSet) Remove ¶
func (channels ChannelSet) Remove(channel *Channel)
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) ChangeNickname ¶
func (*Client) ErrAlreadyRegistered ¶
func (target *Client) ErrAlreadyRegistered()
func (*Client) ErrBadChannelKey ¶
func (*Client) ErrBannedFromChan ¶
func (*Client) ErrCannotSendToChan ¶
func (*Client) ErrChanOPrivIsNeeded ¶
<channel> :You're not channel operator
func (*Client) ErrChannelIsFull ¶
func (*Client) ErrConfiguredMode ¶
func (target *Client) ErrConfiguredMode(mode ChannelMode)
func (*Client) ErrErroneusNickname ¶
func (*Client) ErrInvalidCapCmd ¶
func (target *Client) ErrInvalidCapCmd(subCommand CapSubCommand)
func (*Client) ErrInviteOnlyChan ¶
func (*Client) ErrInviteOnlyChannel ¶
func (*Client) ErrNeedMoreParams ¶
func (target *Client) ErrNeedMoreParams(command StringCode)
func (*Client) ErrNickNameInUse ¶
func (*Client) ErrNoChanModes ¶
func (*Client) ErrNoNicknameGiven ¶
func (target *Client) ErrNoNicknameGiven()
func (*Client) ErrNoPrivileges ¶
func (target *Client) ErrNoPrivileges()
func (*Client) ErrNoSuchChannel ¶
func (*Client) ErrNoSuchNick ¶
func (*Client) ErrNoSuchServer ¶
func (*Client) ErrNotOnChannel ¶
func (*Client) ErrPasswdMismatch ¶
func (target *Client) ErrPasswdMismatch()
func (*Client) ErrRestricted ¶
func (target *Client) ErrRestricted()
func (*Client) ErrUnknownCommand ¶
func (target *Client) ErrUnknownCommand(code StringCode)
func (*Client) ErrUnknownMode ¶
func (target *Client) ErrUnknownMode(mode ChannelMode, channel *Channel)
func (*Client) ErrUserNotInChannel ¶
func (*Client) ErrUserOnChannel ¶
func (*Client) ErrUsersDontMatch ¶
func (target *Client) ErrUsersDontMatch()
func (*Client) ErrWasNoSuchNick ¶
func (*Client) HasUsername ¶
func (*Client) IdleSeconds ¶
func (*Client) MultilineReply ¶
func (target *Client) MultilineReply(names []string, code NumericCode, format string, args ...interface{})
func (*Client) NumericReply ¶
func (target *Client) NumericReply(code NumericCode, format string, args ...interface{})
func (*Client) RplBanList ¶
func (*Client) RplChannelModeIs ¶
func (*Client) RplCreated ¶
func (target *Client) RplCreated()
func (*Client) RplEndOfBanList ¶
func (*Client) RplEndOfExceptList ¶
func (*Client) RplEndOfInviteList ¶
func (*Client) RplEndOfMaskList ¶
func (target *Client) RplEndOfMaskList(mode ChannelMode, channel *Channel)
func (*Client) RplEndOfNames ¶
func (*Client) RplEndOfWhoWas ¶
func (*Client) RplEndOfWhois ¶
func (target *Client) RplEndOfWhois()
func (*Client) RplExceptList ¶
func (*Client) RplInviteList ¶
func (*Client) RplInviting ¶
func (*Client) RplInvitingMsg ¶
<nick> <channel> NB: correction in errata
func (*Client) RplListEnd ¶
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) RplNamReply ¶
func (*Client) RplNoTopic ¶
func (*Client) RplNowAway ¶
func (target *Client) RplNowAway()
func (*Client) RplUModeIs ¶
func (*Client) RplVersion ¶
func (target *Client) RplVersion()
func (*Client) RplWelcome ¶
func (target *Client) RplWelcome()
func (*Client) RplWhoReply ¶
<channel> <user> <host> <server> <nick> ( "H" / "G" ) ["*"] [ ( "@" / "+" ) ] :<hopcount> <real name>
func (*Client) RplWhoWasUser ¶
func (*Client) RplWhoisChannels ¶
func (*Client) RplWhoisIdle ¶
func (*Client) RplWhoisOperator ¶
func (*Client) RplWhoisUser ¶
func (*Client) RplYourHost ¶
func (target *Client) RplYourHost()
func (*Client) SetNickname ¶
func (*Client) SignonTime ¶
func (*Client) WhoisChannelsNames ¶
type ClientDB ¶
type ClientDB struct {
// contains filtered or unexported fields
}
func NewClientDB ¶
func NewClientDB() *ClientDB
type ClientLookupSet ¶
type ClientLookupSet struct {
// contains filtered or unexported fields
}
func NewClientLookupSet ¶
func NewClientLookupSet() *ClientLookupSet
func (*ClientLookupSet) Add ¶
func (clients *ClientLookupSet) Add(client *Client) error
func (*ClientLookupSet) Find ¶
func (clients *ClientLookupSet) Find(userhost Name) *Client
func (*ClientLookupSet) FindAll ¶
func (clients *ClientLookupSet) FindAll(userhost Name) (set ClientSet)
func (*ClientLookupSet) Get ¶
func (clients *ClientLookupSet) Get(nick Name) *Client
func (*ClientLookupSet) Remove ¶
func (clients *ClientLookupSet) Remove(client *Client) error
type Command ¶
type Command interface { Client() *Client Code() StringCode SetClient(*Client) SetCode(StringCode) }
func ParseAwayCommand ¶
func ParseCapCommand ¶
func ParseChannelModeCommand ¶
MODE <channel> *( ( "-" / "+" ) *<modes> *<modeparams> )
func ParseCommand ¶
func ParseDebugCommand ¶
func ParseInviteCommand ¶
func ParseIsOnCommand ¶
func ParseJoinCommand ¶
func ParseKickCommand ¶
func ParseKillCommand ¶
func ParseListCommand ¶
func ParseMOTDCommand ¶
func ParseModeCommand ¶
func ParseNamesCommand ¶
func ParseNickCommand ¶
func ParseNoticeCommand ¶
func ParseOperCommand ¶
OPER <name> <password>
func ParseOperNickCommand ¶
func ParsePartCommand ¶
func ParsePassCommand ¶
func ParsePingCommand ¶
func ParsePongCommand ¶
func ParsePrivMsgCommand ¶
func ParseProxyCommand ¶
func ParseQuitCommand ¶
func ParseTheaterCommand ¶
func ParseTimeCommand ¶
func ParseTopicCommand ¶
func ParseUserCommand ¶
func ParseUserModeCommand ¶
MODE <nickname> *( ( "+" / "-" ) *( "i" / "w" / "o" / "O" / "r" ) )
func ParseVersionCommand ¶
func ParseWhoWasCommand ¶
func ParseWhoisCommand ¶
WHOIS [ <target> ] <mask> *( "," <mask> )
type Config ¶
type Config struct { Server struct { PassConfig Database string Listen []string Wslisten string Log string MOTD string Name string } Operator map[string]*PassConfig Theater map[string]*PassConfig }
func LoadConfig ¶
type DebugCommand ¶
type DebugCommand struct { BaseCommand // contains filtered or unexported fields }
func (*DebugCommand) HandleServer ¶
func (msg *DebugCommand) HandleServer(server *Server)
type Identifiable ¶
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 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 map[*Client]ChannelModeSet
func (MemberSet) AnyHasMode ¶
func (members MemberSet) AnyHasMode(mode ChannelMode) bool
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 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 ExpandUserHost ¶
func LookupHostname ¶
func (Name) IsNickname ¶
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 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 ProxyCommand ¶
type ProxyCommand struct { BaseCommand // contains filtered or unexported fields }
HAPROXY support
func NewProxyCommand ¶
func NewProxyCommand(hostname Name) *ProxyCommand
func (*ProxyCommand) HandleRegServer ¶
func (msg *ProxyCommand) HandleRegServer(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 Server ¶
type Server struct {
// contains filtered or unexported fields
}
type ServerCommand ¶
type StringCode ¶
type StringCode string
func ParseLine ¶
func ParseLine(line string) (command StringCode, args []string)
func (StringCode) String ¶
func (code StringCode) String() string
type Text ¶
type Text string
Text is PRIVMSG, NOTICE, or TOPIC data. It's canonicalized UTF8 data to simplify but keeps all formatting.
type TheaterActionCommand ¶
type TheaterActionCommand struct { BaseCommand // contains filtered or unexported fields }
func (*TheaterActionCommand) HandleServer ¶
func (m *TheaterActionCommand) HandleServer(s *Server)
type TheaterClient ¶
type TheaterClient Name
func (TheaterClient) Id ¶
func (c TheaterClient) Id() Name
func (TheaterClient) Nick ¶
func (c TheaterClient) Nick() Name
type TheaterIdentifyCommand ¶
type TheaterIdentifyCommand struct { PassCommand // contains filtered or unexported fields }
func (*TheaterIdentifyCommand) HandleServer ¶
func (m *TheaterIdentifyCommand) HandleServer(s *Server)
func (*TheaterIdentifyCommand) LoadPassword ¶
func (m *TheaterIdentifyCommand) LoadPassword(s *Server)
type TheaterPrivMsgCommand ¶
type TheaterPrivMsgCommand struct { BaseCommand // contains filtered or unexported fields }
func (*TheaterPrivMsgCommand) HandleServer ¶
func (m *TheaterPrivMsgCommand) HandleServer(s *Server)
type TheaterSubCommand ¶
type TheaterSubCommand 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 VersionCommand ¶
type VersionCommand struct { BaseCommand // contains filtered or unexported fields }
func (*VersionCommand) HandleServer ¶
func (msg *VersionCommand) HandleServer(server *Server)
type WSContainer ¶
func (WSContainer) SetDeadline ¶
func (this WSContainer) SetDeadline(t time.Time) error
type WhoCommand ¶
type WhoCommand struct { BaseCommand // contains filtered or unexported fields }
func (*WhoCommand) HandleServer ¶
func (msg *WhoCommand) HandleServer(server *Server)
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 {
// 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.
type WhoisCommand ¶
type WhoisCommand struct { BaseCommand // contains filtered or unexported fields }
func (*WhoisCommand) HandleServer ¶
func (m *WhoisCommand) HandleServer(server *Server)