Documentation ¶
Index ¶
- Constants
- Variables
- func HasChanPrefix(chname string) bool
- func NewError(numeric string, params ...string) error
- type Chan
- func (c *Chan) Join(src *Client, key string) error
- func (c *Chan) Members() []*Client
- func (c *Chan) Mode(src *Client) ([]Mode, error)
- func (c *Chan) Name() string
- func (c *Chan) Names() []string
- func (c *Chan) Part(src *Client, reason string) error
- func (c *Chan) PrivMsg(src *Client, text string) error
- func (c *Chan) Quit(src *Client)
- func (c *Chan) SetMode(src *Client) ChanModeCmds
- func (c *Chan) SetTopic(src *Client, topic string) error
- func (c *Chan) Status() string
- func (c *Chan) Topic(src *Client) (string, error)
- type ChanModeCmds
- func (cmd *ChanModeCmds) Ban(action string, who string) error
- func (cmd ChanModeCmds) Done()
- func (cmd *ChanModeCmds) Keylock(action string, key string) error
- func (cmd *ChanModeCmds) Limit(action string, strlimit string) error
- func (cmd *ChanModeCmds) Moderated(action string) error
- func (cmd *ChanModeCmds) NoExternalMsgs(action string) error
- func (cmd *ChanModeCmds) Oper(action string, name string) error
- func (cmd *ChanModeCmds) TopicLock(action string) error
- func (cmd *ChanModeCmds) Voice(action string, name string) error
- type ChanModes
- type Client
- func (c *Client) Quit()
- func (c *Client) Relay(o Origin, cmd string, params ...string) *Client
- func (c *Client) Reply(cmd string, params ...string) *Client
- func (c *Client) Send(cmd string, params ...string) *Client
- func (c *Client) SendError(err error) *Client
- func (c *Client) SendMessage(m Message)
- func (c *Client) SetRegistered()
- type Command
- type DefaultHandler
- type Error
- type Handler
- type Message
- type Mode
- type NewHandlerFunc
- type Nicks
- type Origin
- type Server
- type Service
- func (s *Service) Chan(name string) (*Chan, error)
- func (s *Service) Join(c *Client, name string, key string) (*Chan, error)
- func (s *Service) Login(c *Client)
- func (s *Service) Mode(src *Client) *UserModeCmds
- func (s *Service) Nick(c *Client, nick string) error
- func (s *Service) Oper(c *Client, nick string, plaintext string) error
- func (s *Service) Origin() string
- func (s *Service) Part(c *Client, name string, reason string) error
- func (s *Service) PrivMsg(src *Client, dest string, text string) error
- func (s *Service) Quit(src *Client, reason string)
- type User
- type UserID
- type UserModeCmds
- type UserModes
Constants ¶
View Source
const ( ChanPrefixNetwork = "#" ChanPrefixLocal = "&" )
View Source
const ( CapCmd = "CAP" CapLsCmd = "LS" CapReqCmd = "REQ" CapEndCmd = "END" JoinCmd = "JOIN" ModeCmd = "MODE" NamesCmd = "NAMES" NickCmd = "NICK" OperCmd = "OPER" PartCmd = "PART" PassCmd = "PASS" PingCmd = "PING" PongCmd = "PONG" PrivMsgCmd = "PRIVMSG" TopicCmd = "TOPIC" UserCmd = "USER" QuitCmd = "QUIT" WhoCmd = "WHO" )
View Source
const ( ErrAlreadyRegistered = "462" ErrBadChannelKey = "475" ErrCannotSendToChan = "404" ErrChannelIsFull = "471" ErrChanOpPrivsNeeded = "482" ErrInvalidCapCmd = "410" ErrNeedMoreParams = "461" ErrNickNameInUse = "433" ErrNoMotd = "422" ErrNoNickNameGiven = "431" ErrNoSuchChannel = "403" ErrNoSuchNick = "401" ErrNotOnChannel = "442" ErrNotRegistered = "451" ErrPasswordMismatch = "464" ErrUModeUnknownFlag = "501" ErrUnknownMode = "472" ErrUsersDontMatch = "502" )
View Source
const ( ModeGrant = "+" ModeRevoke = "-" )
View Source
const ( ChanModeBan = "b" ChanModeBanException = "e" ChanModeInviteOnly = "i" ChanModeInvitationMask = "I" ChanModeKeylock = "k" ChanModeLimit = "l" ChanModeModerated = "m" ChanModeNoExternalMsgs = "n" ChanModeOper = "o" ChanModePrivate = "p" ChanModeSecret = "s" ChanModeTopicLock = "t" ChanModeVoice = "v" )
View Source
const ( UserModeAway = "a" UserModeInvisible = "i" UserModeGlobalOperator = "o" UserModeLocalOperator = "O" )
View Source
const ( NickMaxLen = 40 NickExpireDelay = 10 * time.Minute NickReapInterval = 1 * time.Minute )
View Source
const ( RplBanList = "367" RplChannelModeIs = "324" RplCreated = "003" RplEndOfBanList = "368" RplEndOfMotd = "376" RplEndOfNames = "366" RplEndOfWho = "315" RplMotdStart = "375" RplMyInfo = "004" RplNameReply = "353" RplNoTopic = "331" RplTopic = "332" RplWelcome = "001" RplWhoReply = "352" RplYoureOper = "381" RplYourHost = "002" )
View Source
const MessageMaxLen = 512
View Source
const (
Version = "chatty-0"
)
Variables ¶
View Source
var ( BucketConfig = []byte("config") BucketOpers = []byte("opers") )
View Source
var ( ConfigPass = []byte("pass") ConfigSalt = []byte("salt") ConfigCert = []byte("cert") ConfigKey = []byte("key") )
View Source
var ( OperPass = []byte("pass") OperSalt = []byte("salt") )
View Source
var ( Addr = ":6697" ServerName = "localhost" )
View Source
var Buckets [][]byte = [][]byte{ BucketConfig, BucketOpers, }
View Source
var DefaultOper = []byte("irc")
View Source
var ErrorText = map[string]string{ ErrAlreadyRegistered: "Unauthorized command (already registered)", ErrBadChannelKey: "Cannot join channel (+k)", ErrCannotSendToChan: "Cannot send to channel", ErrChannelIsFull: "Cannot join channel (+l)", ErrChanOpPrivsNeeded: "You're not channel operator", ErrInvalidCapCmd: "Invalid CAP command", ErrNeedMoreParams: "Not enough parameters", ErrNickNameInUse: "Nickname is already in use", ErrNoNickNameGiven: "No nickname given", ErrNoSuchChannel: "No such channel", ErrNoSuchNick: "No such nick/channel", ErrNotOnChannel: "You're not on that channel", ErrNotRegistered: "You have not registered", ErrPasswordMismatch: "Password incorrect", ErrUModeUnknownFlag: "Unknown MODE flag", ErrUnknownMode: "is unknown mode char to me", ErrUsersDontMatch: "Cannot change mode for other users", }
View Source
var Quit = errors.New("quit")
View Source
var RplText = map[string]string{ RplEndOfBanList: "End of Channel Ban List", RplEndOfNames: "End of NAMES list.", RplEndOfWho: "End of WHO list.", RplNoTopic: "No topic is set.", RplYoureOper: "You are now an IRC Operator", }
Functions ¶
func HasChanPrefix ¶
Types ¶
type Chan ¶
type Chan struct {
// contains filtered or unexported fields
}
func (*Chan) SetMode ¶
func (c *Chan) SetMode(src *Client) ChanModeCmds
type ChanModeCmds ¶
type ChanModeCmds struct {
// contains filtered or unexported fields
}
func (ChanModeCmds) Done ¶
func (cmd ChanModeCmds) Done()
func (*ChanModeCmds) Moderated ¶
func (cmd *ChanModeCmds) Moderated(action string) error
func (*ChanModeCmds) NoExternalMsgs ¶
func (cmd *ChanModeCmds) NoExternalMsgs(action string) error
func (*ChanModeCmds) TopicLock ¶
func (cmd *ChanModeCmds) TopicLock(action string) error
type ChanModes ¶
type ChanModes struct { Bans []string BanExceptions []string InviteOnly bool InviationMasks []string Key string Limit int Moderated bool NoExternalMsgs bool Operators map[UserID]bool Private bool Secret bool TopicLock bool Voiced map[UserID]bool }
https://www.alien.net.au/irc/chanmodes.html
func NewChanModes ¶
func NewChanModes() *ChanModes
func (ChanModes) UserPrefix ¶
type Client ¶
func (*Client) SendMessage ¶
func (*Client) SetRegistered ¶
func (c *Client) SetRegistered()
type DefaultHandler ¶
type DefaultHandler struct {
// contains filtered or unexported fields
}
func (*DefaultHandler) Handle ¶
func (h *DefaultHandler) Handle(cmd Command) error
type Handler ¶
func NewDefaultHandler ¶
type NewHandlerFunc ¶
type Nicks ¶
type Nicks struct {
// contains filtered or unexported fields
}
func (*Nicks) Unregister ¶
type Server ¶
type Server struct { Name string Addr string Debug bool Insecure bool DataFile string NewHandlerFunc NewHandlerFunc RegistrationDeadline time.Duration // contains filtered or unexported fields }
func (*Server) ListenAndServe ¶
type UserModeCmds ¶
type UserModeCmds struct {
// contains filtered or unexported fields
}
func (UserModeCmds) Done ¶
func (cmd UserModeCmds) Done()
func (*UserModeCmds) Invisible ¶
func (cmd *UserModeCmds) Invisible(action string) error
Click to show internal directories.
Click to hide internal directories.