Documentation ¶
Index ¶
- Constants
- Variables
- func AddrLookupHostname(addr net.Addr) string
- func Casefold(str string) (string, error)
- func CasefoldChannel(name string) (string, error)
- func CasefoldName(name string) (string, error)
- func ComparePassword(hash, password []byte) error
- func DecodePasswordHash(encoded string) (decoded []byte, err error)
- func ExpandUserHost(userhost string) (expanded string)
- func GenerateEncodedPassword(passwd string) (encoded string, err error)
- func GenerateHelpIndex(forOpers bool) string
- func GetClientOnlyTags(tags map[string]ircmsg.TagValue) *map[string]ircmsg.TagValue
- func IPString(addr net.Addr) string
- func InitDB(path string)
- func IsHostname(name string) bool
- func LookupHostname(addr string) string
- func NewSalt() ([]byte, error)
- func SplitChannelMembershipPrefixes(target string) (prefixes string, name string)
- func UpgradeDB(path string)
- type AccountCredentials
- type AccountRegistration
- type AccountRegistrationConfig
- type CapState
- type CapVersion
- type Capability
- type CapabilitySet
- type Channel
- func (channel *Channel) CanSpeak(client *Client) bool
- func (channel *Channel) CheckKey(key string) bool
- func (channel *Channel) ClientIsAtLeast(client *Client, permission Mode) bool
- func (channel *Channel) GetTopic(client *Client)
- 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 string)
- func (channel *Channel) Names(client *Client)
- func (channel *Channel) Part(client *Client, message string)
- func (channel *Channel) Quit(client *Client, friends *ClientSet)
- func (channel *Channel) SetTopic(client *Client, topic string)
- func (channel *Channel) ShowMaskList(client *Client, mode Mode)
- func (channel *Channel) SplitNotice(msgid string, minPrefix *Mode, clientOnlyTags *map[string]ircmsg.TagValue, ...)
- func (channel *Channel) SplitPrivMsg(msgid string, minPrefix *Mode, clientOnlyTags *map[string]ircmsg.TagValue, ...)
- func (channel *Channel) TagMsg(msgid string, minPrefix *Mode, clientOnlyTags *map[string]ircmsg.TagValue, ...)
- type ChannelNameMap
- type ChannelRegistrationConfig
- type ChannelSet
- type Client
- func (client *Client) Active()
- func (client *Client) AllNickmasks() []string
- func (client *Client) ChanServNotice(text string)
- func (client *Client) ChangeNickname(nickname string) error
- func (client *Client) Friends(Capabilities ...Capability) ClientSet
- func (client *Client) HasCapabs(capabs ...string) bool
- func (client *Client) HasNick() bool
- func (client *Client) HasUsername() bool
- func (client *Client) IP() net.IP
- func (client *Client) IPString() string
- func (client *Client) IdleSeconds() uint64
- func (client *Client) IdleTime() time.Duration
- func (client *Client) LoginToAccount(account *ClientAccount)
- func (client *Client) ModeString() (str string)
- func (client *Client) Notice(text string)
- func (client *Client) Quit(message string)
- func (client *Client) Register()
- func (client *Client) RplISupport()
- func (target *Client) RplList(channel *Channel)
- func (target *Client) RplWhoReplyNoMutex(channel *Channel, client *Client)
- func (client *Client) Send(tags *map[string]ircmsg.TagValue, prefix string, command string, ...) error
- func (client *Client) SendFromClient(msgid string, from *Client, tags *map[string]ircmsg.TagValue, command string, ...) error
- func (client *Client) SendSplitMsgFromClient(msgid string, from *Client, tags *map[string]ircmsg.TagValue, ...)
- func (client *Client) SetNickname(nickname string) error
- func (client *Client) SignonTime() int64
- func (client *Client) Touch()
- func (client *Client) WhoisChannelsNames(target *Client) []string
- type ClientAccount
- type ClientLookupSet
- func (clients *ClientLookupSet) Add(client *Client, nick string) error
- func (clients *ClientLookupSet) AllWithCaps(caps ...Capability) (set ClientSet)
- func (clients *ClientLookupSet) Count() int
- func (clients *ClientLookupSet) Find(userhost string) *Client
- func (clients *ClientLookupSet) FindAll(userhost string) (set ClientSet)
- func (clients *ClientLookupSet) Get(nick string) *Client
- func (clients *ClientLookupSet) Has(nick string) bool
- func (clients *ClientLookupSet) Remove(client *Client) error
- func (clients *ClientLookupSet) Replace(oldNick, newNick string, client *Client) error
- type ClientSet
- type Command
- type Config
- type ConnectionLimits
- type ConnectionLimitsConfig
- type ConnectionThrottle
- type ConnectionThrottleConfig
- type DLineManager
- func (dm *DLineManager) AddIP(addr net.IP, length *IPRestrictTime, reason string, operReason string)
- func (dm *DLineManager) AddNetwork(network net.IPNet, length *IPRestrictTime, reason string, operReason string)
- func (dm *DLineManager) AllBans() map[string]IPBanInfo
- func (dm *DLineManager) CheckIP(addr net.IP) (isBanned bool, info *IPBanInfo)
- func (dm *DLineManager) RemoveIP(addr net.IP)
- func (dm *DLineManager) RemoveNetwork(network net.IPNet)
- type HelpEntry
- type HelpEntryType
- type IPBanInfo
- type IPRestrictTime
- type ISupportList
- type KLineInfo
- type KLineManager
- type Limits
- type LineLenConfig
- type LineLenLimits
- type ListenerEvent
- type ListenerEventType
- type ListenerInterface
- type LoggingConfig
- type MemberSet
- type Mode
- type ModeChange
- type ModeChanges
- type ModeOp
- type ModeSet
- type Modes
- type Oper
- type OperClass
- type OperClassConfig
- type OperConfig
- type PassConfig
- type PasswordManager
- type RegisteredChannel
- type RestAPIConfig
- type STSConfig
- type Server
- type SnoManager
- type Socket
- func (socket *Socket) CertFP() (string, error)
- func (socket *Socket) Close()
- func (socket *Socket) IsClosed() bool
- func (socket *Socket) Read() (string, error)
- func (socket *Socket) RunSocketWriter()
- func (socket *Socket) SetFinalData(data string)
- func (socket *Socket) Write(data string) error
- func (socket *Socket) WriteLine(line string) error
- type SplitMessage
- type StackImpactConfig
- type TLSListenConfig
- type ThrottleDetails
- type UserMaskSet
- type WSContainer
- type WhoWas
- type WhoWasList
Constants ¶
const ( // IdleTimeout is how long without traffic before a client's considered idle. IdleTimeout = time.Minute + time.Second*30 // QuitTimeout is how long without traffic (after they're considered idle) that clients are killed. QuitTimeout = time.Minute // IdentTimeoutSeconds is how many seconds before our ident (username) check times out. IdentTimeoutSeconds = 5 )
const ( RPL_WELCOME = "001" RPL_YOURHOST = "002" RPL_CREATED = "003" RPL_MYINFO = "004" RPL_ISUPPORT = "005" RPL_SNOMASKIS = "008" RPL_BOUNCE = "010" RPL_TRACELINK = "200" RPL_TRACECONNECTING = "201" RPL_TRACEHANDSHAKE = "202" RPL_TRACEUNKNOWN = "203" RPL_TRACEOPERATOR = "204" RPL_TRACEUSER = "205" RPL_TRACESERVER = "206" RPL_TRACESERVICE = "207" RPL_TRACENEWTYPE = "208" RPL_TRACECLASS = "209" RPL_TRACERECONNECT = "210" RPL_STATSLINKINFO = "211" RPL_STATSCOMMANDS = "212" RPL_ENDOFSTATS = "219" RPL_UMODEIS = "221" RPL_SERVLIST = "234" RPL_SERVLISTEND = "235" RPL_STATSUPTIME = "242" RPL_STATSOLINE = "243" RPL_LUSERCLIENT = "251" RPL_LUSEROP = "252" RPL_LUSERUNKNOWN = "253" RPL_LUSERCHANNELS = "254" RPL_LUSERME = "255" RPL_ADMINME = "256" RPL_ADMINLOC1 = "257" RPL_ADMINLOC2 = "258" RPL_ADMINEMAIL = "259" RPL_TRACELOG = "261" RPL_TRACEEND = "262" RPL_TRYAGAIN = "263" RPL_WHOISCERTFP = "276" RPL_AWAY = "301" RPL_USERHOST = "302" RPL_ISON = "303" RPL_UNAWAY = "305" RPL_NOWAWAY = "306" RPL_WHOISUSER = "311" RPL_WHOISSERVER = "312" RPL_WHOISOPERATOR = "313" RPL_WHOWASUSER = "314" RPL_ENDOFWHO = "315" RPL_WHOISIDLE = "317" RPL_ENDOFWHOIS = "318" RPL_WHOISCHANNELS = "319" RPL_LIST = "322" RPL_LISTEND = "323" RPL_CHANNELMODEIS = "324" RPL_UNIQOPIS = "325" RPL_CHANNELCREATED = "329" RPL_NOTOPIC = "331" RPL_TOPIC = "332" RPL_TOPICTIME = "333" RPL_WHOISACTUALLY = "338" RPL_INVITING = "341" RPL_SUMMONING = "342" RPL_INVITELIST = "346" RPL_ENDOFINVITELIST = "347" RPL_EXCEPTLIST = "348" RPL_ENDOFEXCEPTLIST = "349" RPL_VERSION = "351" RPL_WHOREPLY = "352" RPL_NAMREPLY = "353" RPL_LINKS = "364" RPL_ENDOFLINKS = "365" RPL_ENDOFNAMES = "366" RPL_BANLIST = "367" RPL_ENDOFBANLIST = "368" RPL_ENDOFWHOWAS = "369" RPL_INFO = "371" RPL_MOTD = "372" RPL_ENDOFINFO = "374" RPL_MOTDSTART = "375" RPL_ENDOFMOTD = "376" RPL_YOUREOPER = "381" RPL_REHASHING = "382" RPL_YOURESERVICE = "383" RPL_TIME = "391" RPL_USERSSTART = "392" RPL_USERS = "393" RPL_ENDOFUSERS = "394" RPL_NOUSERS = "395" ERR_UNKNOWNERROR = "400" ERR_NOSUCHNICK = "401" ERR_NOSUCHSERVER = "402" ERR_NOSUCHCHANNEL = "403" ERR_CANNOTSENDTOCHAN = "404" ERR_TOOMANYCHANNELS = "405" ERR_WASNOSUCHNICK = "406" ERR_TOOMANYTARGETS = "407" ERR_NOSUCHSERVICE = "408" ERR_NOORIGIN = "409" ERR_INVALIDCAPCMD = "410" ERR_NORECIPIENT = "411" ERR_NOTEXTTOSEND = "412" ERR_NOTOPLEVEL = "413" ERR_WILDTOPLEVEL = "414" ERR_BADMASK = "415" ERR_UNKNOWNCOMMAND = "421" ERR_NOMOTD = "422" ERR_NOADMININFO = "423" ERR_FILEERROR = "424" ERR_NONICKNAMEGIVEN = "431" ERR_ERRONEUSNICKNAME = "432" ERR_NICKNAMEINUSE = "433" ERR_NICKCOLLISION = "436" ERR_UNAVAILRESOURCE = "437" ERR_REG_UNAVAILABLE = "440" ERR_USERNOTINCHANNEL = "441" ERR_NOTONCHANNEL = "442" ERR_USERONCHANNEL = "443" ERR_NOLOGIN = "444" ERR_SUMMONDISABLED = "445" ERR_USERSDISABLED = "446" ERR_NOTREGISTERED = "451" ERR_NEEDMOREPARAMS = "461" ERR_ALREADYREGISTRED = "462" ERR_NOPERMFORHOST = "463" ERR_PASSWDMISMATCH = "464" ERR_YOUREBANNEDCREEP = "465" ERR_YOUWILLBEBANNED = "466" ERR_KEYSET = "467" ERR_CHANNELISFULL = "471" ERR_UNKNOWNMODE = "472" ERR_INVITEONLYCHAN = "473" ERR_BANNEDFROMCHAN = "474" ERR_BADCHANNELKEY = "475" ERR_BADCHANMASK = "476" ERR_NOCHANMODES = "477" ERR_BANLISTFULL = "478" ERR_NOPRIVILEGES = "481" ERR_CHANOPRIVSNEEDED = "482" ERR_CANTKILLSERVER = "483" ERR_RESTRICTED = "484" ERR_UNIQOPPRIVSNEEDED = "485" ERR_NOOPERHOST = "491" ERR_UMODEUNKNOWNFLAG = "501" ERR_USERSDONTMATCH = "502" ERR_HELPNOTFOUND = "524" ERR_CANNOTSENDRP = "573" RPL_WHOISSECURE = "671" RPL_HELPSTART = "704" RPL_HELPTXT = "705" RPL_ENDOFHELP = "706" ERR_NOPRIVS = "723" RPL_MONONLINE = "730" RPL_MONOFFLINE = "731" RPL_MONLIST = "732" RPL_ENDOFMONLIST = "733" ERR_MONLISTFULL = "734" RPL_LOGGEDIN = "900" RPL_LOGGEDOUT = "901" ERR_NICKLOCKED = "902" RPL_SASLSUCCESS = "903" ERR_SASLFAIL = "904" ERR_SASLTOOLONG = "905" ERR_SASLABORTED = "906" ERR_SASLALREADY = "907" RPL_SASLMECHS = "908" RPL_REGISTRATION_SUCCESS = "920" ERR_ACCOUNT_ALREADY_EXISTS = "921" ERR_REG_UNSPECIFIED_ERROR = "922" RPL_VERIFYSUCCESS = "923" ERR_ACCOUNT_ALREADY_VERIFIED = "924" ERR_ACCOUNT_INVALID_VERIFY_CODE = "925" RPL_REG_VERIFICATION_REQUIRED = "927" ERR_REG_INVALID_CRED_TYPE = "928" ERR_REG_INVALID_CALLBACK = "929" )
const (
// SemVer is the semantic version of Oragono.
SemVer = "0.8.2"
)
Variables ¶
var ( // EnabledSaslMechanisms contains the SASL mechanisms that exist and that we support. // This can be moved to some other data structure/place if we need to load/unload mechs later. EnabledSaslMechanisms = map[string]func(*Server, *Client, string, []byte) bool{ "PLAIN": authPlainHandler, "EXTERNAL": authExternalHandler, } // NoAccount is a placeholder which means that the user is not logged into an account. NoAccount = ClientAccount{ Name: "*", } )
var ( // SupportedCapabilities are the caps we advertise. SupportedCapabilities = CapabilitySet{ AccountTag: true, AccountNotify: true, AwayNotify: true, CapNotify: true, ChgHost: true, EchoMessage: true, ExtendedJoin: true, InviteNotify: true, MessageIDs: true, MessageTags: true, MultiPrefix: true, Rename: true, ServerTime: true, UserhostInNames: true, } // CapValues are the actual values we advertise to v3.2 clients. CapValues = map[Capability]string{ SASL: "PLAIN,EXTERNAL", } )
var ( // TimeoutStatedSeconds is how many seconds before clients are timed out (IdleTimeout plus QuitTimeout). TimeoutStatedSeconds = strconv.Itoa(int((IdleTimeout + QuitTimeout).Seconds())) // ErrNickAlreadySet is a weird error that's sent when the server's consistency has been compromised. ErrNickAlreadySet = errors.New("Nickname is already set") )
var ( ErrNickMissing = errors.New("nick missing") ErrNicknameInUse = errors.New("nickname in use") ErrNicknameMismatch = errors.New("nickname mismatch") )
var ( ChannelFounder Mode = 'q' // arg ChannelAdmin Mode = 'a' // arg ChannelOperator Mode = 'o' // arg Halfop Mode = 'h' // arg Voice Mode = 'v' // arg // SupportedChannelModes are the channel modes that we support. SupportedChannelModes = Modes{ BanMask, ExceptMask, InviteMask, InviteOnly, Key, NoOutside, OpOnlyTopic, Secret, UserLimit, ChanRoleplaying, } // DefaultChannelModes are enabled on brand new channels when they're created. DefaultChannelModes = Modes{ NoOutside, OpOnlyTopic, } // ChannelPrivModes holds the list of modes that are privileged, ie founder/op/halfop, in order. // voice is not in this list because it cannot perform channel operator actions. ChannelPrivModes = Modes{ ChannelFounder, ChannelAdmin, ChannelOperator, Halfop, } ChannelModePrefixes = map[Mode]string{ ChannelFounder: "~", ChannelAdmin: "&", ChannelOperator: "@", Halfop: "%", Voice: "+", } )
var Commands = map[string]Command{ "ACC": { // contains filtered or unexported fields }, "AMBIANCE": { // contains filtered or unexported fields }, "AUTHENTICATE": { // contains filtered or unexported fields }, "AWAY": { // contains filtered or unexported fields }, "CAP": { // contains filtered or unexported fields }, "CHANSERV": { // contains filtered or unexported fields }, "CS": { // contains filtered or unexported fields }, "DEBUG": { // contains filtered or unexported fields }, "DLINE": { // contains filtered or unexported fields }, "HELP": { // contains filtered or unexported fields }, "HELPOP": { // contains filtered or unexported fields }, "INVITE": { // contains filtered or unexported fields }, "ISON": { // contains filtered or unexported fields }, "JOIN": { // contains filtered or unexported fields }, "KICK": { // contains filtered or unexported fields }, "KILL": { // contains filtered or unexported fields }, "KLINE": { // contains filtered or unexported fields }, "LIST": { // contains filtered or unexported fields }, "LUSERS": { // contains filtered or unexported fields }, "MODE": { // contains filtered or unexported fields }, "MONITOR": { // contains filtered or unexported fields }, "MOTD": { // contains filtered or unexported fields }, "NAMES": { // contains filtered or unexported fields }, "NICK": { // contains filtered or unexported fields }, "NICKSERV": { // contains filtered or unexported fields }, "NOTICE": { // contains filtered or unexported fields }, "NPC": { // contains filtered or unexported fields }, "NPCA": { // contains filtered or unexported fields }, "NS": { // contains filtered or unexported fields }, "OPER": { // contains filtered or unexported fields }, "PART": { // contains filtered or unexported fields }, "PASS": { // contains filtered or unexported fields }, "PING": { // contains filtered or unexported fields }, "PONG": { // contains filtered or unexported fields }, "PRIVMSG": { // contains filtered or unexported fields }, "RENAME": { // contains filtered or unexported fields }, "SANICK": { // contains filtered or unexported fields }, "SAMODE": { // contains filtered or unexported fields }, "SCENE": { // contains filtered or unexported fields }, "TAGMSG": { // contains filtered or unexported fields }, "QUIT": { // contains filtered or unexported fields }, "REHASH": { // contains filtered or unexported fields }, "TIME": { // contains filtered or unexported fields }, "TOPIC": { // contains filtered or unexported fields }, "UNDLINE": { // contains filtered or unexported fields }, "UNKLINE": { // contains filtered or unexported fields }, "USER": { // contains filtered or unexported fields }, "USERHOST": { // contains filtered or unexported fields }, "VERSION": { // contains filtered or unexported fields }, "WHO": { // contains filtered or unexported fields }, "WHOIS": { // contains filtered or unexported fields }, "WHOWAS": { // contains filtered or unexported fields }, }
Commands holds all commands executable by a client connected to us.
var ( // ErrEmptyPassword means that an empty password was given. ErrEmptyPassword = errors.New("empty password") )
var Help = map[string]HelpEntry{ "acc": { // contains filtered or unexported fields }, "ambiance": { // contains filtered or unexported fields }, "authenticate": { // contains filtered or unexported fields }, "away": { // contains filtered or unexported fields }, "cap": { // contains filtered or unexported fields }, "chanserv": { // contains filtered or unexported fields }, "cs": { // contains filtered or unexported fields }, "debug": { // contains filtered or unexported fields }, "dline": { // contains filtered or unexported fields }, "help": { // contains filtered or unexported fields }, "helpop": { // contains filtered or unexported fields }, "invite": { // contains filtered or unexported fields }, "ison": { // contains filtered or unexported fields }, "join": { // contains filtered or unexported fields }, "kick": { // contains filtered or unexported fields }, "kill": { // contains filtered or unexported fields }, "kline": { // contains filtered or unexported fields }, "list": { // contains filtered or unexported fields }, "lusers": { // contains filtered or unexported fields }, "mode": { // contains filtered or unexported fields }, "monitor": { // contains filtered or unexported fields }, "motd": { // contains filtered or unexported fields }, "names": { // contains filtered or unexported fields }, "nick": { // contains filtered or unexported fields }, "nickserv": { // contains filtered or unexported fields }, "notice": { // contains filtered or unexported fields }, "npc": { // contains filtered or unexported fields }, "npca": { // contains filtered or unexported fields }, "ns": { // contains filtered or unexported fields }, "oper": { // contains filtered or unexported fields }, "part": { // contains filtered or unexported fields }, "pass": { // contains filtered or unexported fields }, "ping": { // contains filtered or unexported fields }, "pong": { // contains filtered or unexported fields }, "privmsg": { // contains filtered or unexported fields }, "rename": { // contains filtered or unexported fields }, "sanick": { // contains filtered or unexported fields }, "samode": { // contains filtered or unexported fields }, "scene": { // contains filtered or unexported fields }, "tagmsg": { // contains filtered or unexported fields }, "quit": { // contains filtered or unexported fields }, "rehash": { // contains filtered or unexported fields }, "time": { // contains filtered or unexported fields }, "topic": { // contains filtered or unexported fields }, "undline": { // contains filtered or unexported fields }, "unkline": { // contains filtered or unexported fields }, "user": { // contains filtered or unexported fields }, "userhost": { // contains filtered or unexported fields }, "version": { // contains filtered or unexported fields }, "who": { // contains filtered or unexported fields }, "whois": { // contains filtered or unexported fields }, "whowas": { // contains filtered or unexported fields }, "modes": { // contains filtered or unexported fields }, "cmode": { // contains filtered or unexported fields }, "cmodes": { // contains filtered or unexported fields }, "umode": { // contains filtered or unexported fields }, "umodes": { // contains filtered or unexported fields }, "snomask": { // contains filtered or unexported fields }, "snomasks": { // contains filtered or unexported fields }, "casemapping": { // contains filtered or unexported fields }, "prefix": { // contains filtered or unexported fields }, }
Help contains the help strings distributed with the IRCd.
var HelpIndex = "list of all help topics for regular users"
HelpIndex contains the list of all help topics for regular users.
var HelpIndexOpers = "list of all help topics for opers"
HelpIndexOpers contains the list of all help topics for opers.
var ( // ServerExitSignals are the signals the server will exit on. ServerExitSignals = []os.Signal{ syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT, } )
var ( // SupportedUserModes are the user modes that we actually support (modifying). SupportedUserModes = Modes{ Away, Invisible, Operator, ServerNotice, UserRoleplaying, } )
var ( // Ver is the full version of Oragono, used in responses to clients. Ver = fmt.Sprintf("oragono-%s", SemVer) )
Functions ¶
func AddrLookupHostname ¶
AddrLookupHostname returns the hostname (if possible) or address for the given `net.Addr`.
func Casefold ¶ added in v0.2.0
Casefold returns a casefolded string, without doing any name or channel character checks.
func CasefoldChannel ¶ added in v0.2.0
CasefoldChannel returns a casefolded version of a channel name.
func CasefoldName ¶ added in v0.2.0
CasefoldName returns a casefolded version of a nick/user name.
func ComparePassword ¶
ComparePassword compares a given password with the given hash.
func DecodePasswordHash ¶ added in v0.2.0
DecodePasswordHash takes a base64-encoded password hash and returns the appropriate bytes.
func ExpandUserHost ¶
ExpandUserHost takes a userhost, and returns an expanded version.
func GenerateEncodedPassword ¶
GenerateEncodedPassword returns an encrypted password, encoded into a string with base64.
func GenerateHelpIndex ¶ added in v0.8.0
GenerateHelpIndex is used to generate HelpIndex.
func GetClientOnlyTags ¶ added in v0.2.0
GetClientOnlyTags takes a tag map and returns a map containing just the client-only tags from it.
func IsHostname ¶
IsHostname returns whether we consider `name` a valid hostname.
func LookupHostname ¶
LookupHostname returns the hostname for `addr` if it has one. Otherwise, just returns `addr`.
func SplitChannelMembershipPrefixes ¶ added in v0.3.0
SplitChannelMembershipPrefixes takes a target and returns the prefixes on it, then the name.
Types ¶
type AccountCredentials ¶
type AccountCredentials struct { PassphraseSalt []byte PassphraseHash []byte Certificate string // fingerprint }
AccountCredentials stores the various methods for verifying accounts.
type AccountRegistration ¶
type AccountRegistration struct { Enabled bool EnabledCallbacks []string EnabledCredentialTypes []string }
AccountRegistration manages the registration of accounts.
func NewAccountRegistration ¶
func NewAccountRegistration(config AccountRegistrationConfig) (accountReg AccountRegistration)
NewAccountRegistration returns a new AccountRegistration, configured correctly.
type AccountRegistrationConfig ¶
type AccountRegistrationConfig struct { Enabled bool EnabledCallbacks []string `yaml:"enabled-callbacks"` Callbacks struct { Mailto struct { Server string Port int TLS struct { Enabled bool InsecureSkipVerify bool `yaml:"insecure_skip_verify"` ServerName string `yaml:"servername"` } Username string Password string Sender string VerifyMessageSubject string `yaml:"verify-message-subject"` VerifyMessage string `yaml:"verify-message"` } } }
AccountRegistrationConfig controls account registration.
type CapState ¶
type CapState uint
CapState shows whether we're negotiating caps, finished, etc for connection registration.
const ( // CapNone means CAP hasn't been negotiated at all. CapNone CapState = iota // CapNegotiating means CAP is being negotiated and registration should be paused. CapNegotiating CapState = iota // CapNegotiated means CAP negotiation has been successfully ended and reg should complete. CapNegotiated CapState = iota )
type CapVersion ¶ added in v0.2.0
type CapVersion uint
CapVersion is used to select which max version of CAP the client supports.
const ( // Cap301 refers to the base CAP spec. Cap301 CapVersion = 301 // Cap302 refers to the IRCv3.2 CAP spec. Cap302 CapVersion = 302 )
type Capability ¶
type Capability string
Capability represents an optional feature that a client may request from the server.
const ( // AccountNotify is this IRCv3 capability: http://ircv3.net/specs/extensions/account-notify-3.1.html AccountNotify Capability = "account-notify" // AccountTag is this IRCv3 capability: http://ircv3.net/specs/extensions/account-tag-3.2.html AccountTag Capability = "account-tag" // AwayNotify is this IRCv3 capability: http://ircv3.net/specs/extensions/away-notify-3.1.html AwayNotify Capability = "away-notify" // CapNotify is this IRCv3 capability: http://ircv3.net/specs/extensions/cap-notify-3.2.html CapNotify Capability = "cap-notify" // ChgHost is this IRCv3 capability: http://ircv3.net/specs/extensions/chghost-3.2.html ChgHost Capability = "chghost" // EchoMessage is this IRCv3 capability: http://ircv3.net/specs/extensions/echo-message-3.2.html EchoMessage Capability = "echo-message" // ExtendedJoin is this IRCv3 capability: http://ircv3.net/specs/extensions/extended-join-3.1.html ExtendedJoin Capability = "extended-join" // InviteNotify is this IRCv3 capability: http://ircv3.net/specs/extensions/invite-notify-3.2.html InviteNotify Capability = "invite-notify" // MaxLine is this proposed capability: https://github.com/DanielOaks/ircv3-specifications/blob/master+line-lengths/extensions/line-lengths.md MaxLine Capability = "draft/maxline" // MessageIDs is this draft IRCv3 capability: http://ircv3.net/specs/extensions/message-ids.html MessageIDs Capability = "draft/message-ids" // MessageTags is this draft IRCv3 capability: http://ircv3.net/specs/core/message-tags-3.3.html MessageTags Capability = "draft/message-tags-0.2" // MultiPrefix is this IRCv3 capability: http://ircv3.net/specs/extensions/multi-prefix-3.1.html MultiPrefix Capability = "multi-prefix" // Rename is this proposed capability: https://github.com/SaberUK/ircv3-specifications/blob/rename/extensions/rename.md Rename Capability = "draft/rename" // SASL is this IRCv3 capability: http://ircv3.net/specs/extensions/sasl-3.2.html SASL Capability = "sasl" // ServerTime is this IRCv3 capability: http://ircv3.net/specs/extensions/server-time-3.2.html ServerTime Capability = "server-time" // STS is this draft IRCv3 capability: http://ircv3.net/specs/core/sts-3.3.html STS Capability = "draft/sts" // UserhostInNames is this IRCv3 capability: http://ircv3.net/specs/extensions/userhost-in-names-3.2.html UserhostInNames Capability = "userhost-in-names" )
func (Capability) String ¶
func (capability Capability) String() string
type CapabilitySet ¶
type CapabilitySet map[Capability]bool
CapabilitySet is used to track supported, enabled, and existing caps.
func (CapabilitySet) String ¶
func (set CapabilitySet) String(version CapVersion) string
type Channel ¶
type Channel struct {
// contains filtered or unexported fields
}
Channel represents a channel that clients can join.
func NewChannel ¶
NewChannel creates a new channel from a `Server` and a `name` string, which must be unique on the server.
func (*Channel) ClientIsAtLeast ¶ added in v0.3.0
ClientIsAtLeast returns whether the client has at least the given channel privilege.
func (*Channel) Join ¶
Join joins the given client to this channel (if they can be joined). TODO(dan): /SAJOIN and maybe a ForceJoin function?
func (*Channel) Quit ¶
Quit removes the given client from the channel, and also updates friends with the latest client list.
func (*Channel) SetTopic ¶
SetTopic sets the topic of this channel, if the client is allowed to do so.
func (*Channel) ShowMaskList ¶
ShowMaskList shows the given list to the client.
func (*Channel) SplitNotice ¶ added in v0.6.0
func (channel *Channel) SplitNotice(msgid string, minPrefix *Mode, clientOnlyTags *map[string]ircmsg.TagValue, client *Client, message SplitMessage)
SplitNotice sends a private message to everyone in this channel.
func (*Channel) SplitPrivMsg ¶ added in v0.6.0
func (channel *Channel) SplitPrivMsg(msgid string, minPrefix *Mode, clientOnlyTags *map[string]ircmsg.TagValue, client *Client, message SplitMessage)
SplitPrivMsg sends a private message to everyone in this channel.
type ChannelNameMap ¶
ChannelNameMap is a map that converts channel names to actual channel objects.
func NewChannelNameMap ¶ added in v0.7.2
func NewChannelNameMap() *ChannelNameMap
NewChannelNameMap returns a new ChannelNameMap.
func (*ChannelNameMap) Add ¶
func (channels *ChannelNameMap) Add(channel *Channel) error
Add adds the given channel to our map.
func (*ChannelNameMap) Get ¶
func (channels *ChannelNameMap) Get(name string) *Channel
Get returns the given channel if it exists.
func (*ChannelNameMap) Len ¶ added in v0.7.2
func (channels *ChannelNameMap) Len() int
Len returns how many channels we have.
func (*ChannelNameMap) Remove ¶
func (channels *ChannelNameMap) Remove(channel *Channel) error
Remove removes the given channel from our map.
type ChannelRegistrationConfig ¶ added in v0.7.0
type ChannelRegistrationConfig struct {
Enabled bool
}
ChannelRegistrationConfig controls channel registration.
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
}
Client is an IRC client.
func (*Client) Active ¶
func (client *Client) Active()
Active updates when the client was last 'active' (i.e. the user should be sitting in front of their client).
func (*Client) AllNickmasks ¶ added in v0.6.0
AllNickmasks returns all the possible nickmasks for the client.
func (*Client) ChanServNotice ¶ added in v0.7.0
ChanServNotice sends the client a notice from ChanServ.
func (*Client) ChangeNickname ¶
ChangeNickname changes the existing nickname of the client.
func (*Client) Friends ¶
func (client *Client) Friends(Capabilities ...Capability) ClientSet
Friends refers to clients that share a channel with this client.
func (*Client) HasCapabs ¶ added in v0.4.0
HasCapabs returns true if client has the given (role) capabilities.
func (*Client) HasNick ¶
HasNick returns true if the client's nickname is set (used in registration).
func (*Client) HasUsername ¶
HasUsername returns true if the client's username is set (used in registration).
func (*Client) IPString ¶ added in v0.8.1
IPString returns the IP address of this client as a string.
func (*Client) IdleSeconds ¶
IdleSeconds returns the number of seconds this client's been idle.
func (*Client) LoginToAccount ¶ added in v0.7.0
func (client *Client) LoginToAccount(account *ClientAccount)
LoginToAccount logs the client into the given account.
func (*Client) ModeString ¶
ModeString returns the mode string for this client.
func (*Client) Register ¶
func (client *Client) Register()
Register sets the client details as appropriate when entering the network.
func (*Client) RplISupport ¶
func (client *Client) RplISupport()
RplISupport outputs our ISUPPORT lines to the client. This is used on connection and in VERSION responses.
func (*Client) RplWhoReplyNoMutex ¶ added in v0.7.0
RplWhoReplyNoMutex returns the WHO reply between one user and another channel/user. <channel> <user> <host> <server> <nick> ( "H" / "G" ) ["*"] [ ( "@" / "+" ) ] :<hopcount> <real name>
func (*Client) Send ¶
func (client *Client) Send(tags *map[string]ircmsg.TagValue, prefix string, command string, params ...string) error
Send sends an IRC line to the client.
func (*Client) SendFromClient ¶
func (client *Client) SendFromClient(msgid string, from *Client, tags *map[string]ircmsg.TagValue, command string, params ...string) error
SendFromClient sends an IRC line coming from a specific client. Adds account-tag to the line as well.
func (*Client) SendSplitMsgFromClient ¶ added in v0.6.0
func (client *Client) SendSplitMsgFromClient(msgid string, from *Client, tags *map[string]ircmsg.TagValue, command, target string, message SplitMessage)
SendSplitMsgFromClient sends an IRC PRIVMSG/NOTICE coming from a specific client. Adds account-tag to the line as well.
func (*Client) SetNickname ¶
SetNickname sets the very first nickname for the client.
func (*Client) SignonTime ¶
SignonTime returns this client's signon time as a unix timestamp.
func (*Client) Touch ¶
func (client *Client) Touch()
Touch marks the client as alive (as it it has a connection to us and we can receive messages from it), and resets when we'll send the client a keepalive PING.
func (*Client) WhoisChannelsNames ¶
WhoisChannelsNames returns the common channel names between two users.
type ClientAccount ¶
type ClientAccount struct { // Name of the account. Name string // RegisteredAt represents the time that the account was registered. RegisteredAt time.Time // Clients that are currently logged into this account (useful for notifications). Clients []*Client }
ClientAccount represents a user account.
type ClientLookupSet ¶
ClientLookupSet represents a way to store, search and lookup clients.
func NewClientLookupSet ¶
func NewClientLookupSet() *ClientLookupSet
NewClientLookupSet returns a new lookup set.
func (*ClientLookupSet) Add ¶
func (clients *ClientLookupSet) Add(client *Client, nick string) error
Add adds a client to the lookup set.
func (*ClientLookupSet) AllWithCaps ¶ added in v0.3.0
func (clients *ClientLookupSet) AllWithCaps(caps ...Capability) (set ClientSet)
AllWithCaps returns all clients with the given capabilities.
func (*ClientLookupSet) Count ¶ added in v0.5.0
func (clients *ClientLookupSet) Count() int
Count returns how many clients are in the lookup set.
func (*ClientLookupSet) Find ¶
func (clients *ClientLookupSet) Find(userhost string) *Client
Find returns the first client that matches the given userhost mask.
func (*ClientLookupSet) FindAll ¶
func (clients *ClientLookupSet) FindAll(userhost string) (set ClientSet)
FindAll returns all clients that match the given userhost mask.
func (*ClientLookupSet) Get ¶
func (clients *ClientLookupSet) Get(nick string) *Client
Get retrieves a client from the set, if they exist.
func (*ClientLookupSet) Has ¶ added in v0.2.0
func (clients *ClientLookupSet) Has(nick string) bool
Has returns whether or not the given client exists. TODO(dan): This seems like ripe ground for a race, if code does Has then Get, and assumes the Get will return a client.
func (*ClientLookupSet) Remove ¶
func (clients *ClientLookupSet) Remove(client *Client) error
Remove removes a client from the lookup set.
type Command ¶
type Command struct {
// contains filtered or unexported fields
}
Command represents a command accepted from a client.
type Config ¶
type Config struct { Network struct { Name string } Server struct { PassConfig Password string Name string Listen []string Wslisten string `yaml:"ws-listen"` TLSListeners map[string]*TLSListenConfig `yaml:"tls-listeners"` STS STSConfig RestAPI RestAPIConfig `yaml:"rest-api"` CheckIdent bool `yaml:"check-ident"` MOTD string MaxSendQString string `yaml:"max-sendq"` MaxSendQBytes uint64 ConnectionLimits ConnectionLimitsConfig `yaml:"connection-limits"` ConnectionThrottle ConnectionThrottleConfig `yaml:"connection-throttling"` } Datastore struct { Path string } Accounts struct { Registration AccountRegistrationConfig AuthenticationEnabled bool `yaml:"authentication-enabled"` } Channels struct { Registration ChannelRegistrationConfig } OperClasses map[string]*OperClassConfig `yaml:"oper-classes"` Opers map[string]*OperConfig Logging []LoggingConfig Debug struct { StackImpact StackImpactConfig } Limits struct { AwayLen uint `yaml:"awaylen"` ChanListModes uint `yaml:"chan-list-modes"` ChannelLen uint `yaml:"channellen"` KickLen uint `yaml:"kicklen"` MonitorEntries uint `yaml:"monitor-entries"` NickLen uint `yaml:"nicklen"` TopicLen uint `yaml:"topiclen"` WhowasEntries uint `yaml:"whowas-entries"` LineLen LineLenConfig `yaml:"linelen"` } }
Config defines the overall configuration.
func LoadConfig ¶
LoadConfig loads the given YAML configuration file.
func (*Config) OperatorClasses ¶ added in v0.4.0
OperatorClasses returns a map of assembled operator classes from the given config.
type ConnectionLimits ¶ added in v0.4.0
type ConnectionLimits struct {
// contains filtered or unexported fields
}
ConnectionLimits manages the automated client connection limits.
func NewConnectionLimits ¶ added in v0.4.0
func NewConnectionLimits(config ConnectionLimitsConfig) (*ConnectionLimits, error)
NewConnectionLimits returns a new connection limit handler.
func (*ConnectionLimits) AddClient ¶ added in v0.4.0
func (cl *ConnectionLimits) AddClient(addr net.IP, force bool) error
AddClient adds a client to our population if possible. If we can't, throws an error instead. 'force' is used to add already-existing clients (i.e. ones that are already on the network).
func (*ConnectionLimits) RemoveClient ¶ added in v0.4.0
func (cl *ConnectionLimits) RemoveClient(addr net.IP)
RemoveClient removes the given address from our population
type ConnectionLimitsConfig ¶ added in v0.4.0
type ConnectionLimitsConfig struct { Enabled bool CidrLenIPv4 int `yaml:"cidr-len-ipv4"` CidrLenIPv6 int `yaml:"cidr-len-ipv6"` IPsPerCidr int `yaml:"ips-per-subnet"` Exempted []string }
ConnectionLimitsConfig controls the automated connection limits.
type ConnectionThrottle ¶ added in v0.6.0
type ConnectionThrottle struct { // used by the server to ban clients that go over this limit BanDuration time.Duration BanMessage string BanMessageBytes []byte // contains filtered or unexported fields }
ConnectionThrottle manages automated client connection throttling.
func NewConnectionThrottle ¶ added in v0.6.0
func NewConnectionThrottle(config ConnectionThrottleConfig) (*ConnectionThrottle, error)
NewConnectionThrottle returns a new client connection throttler.
func (*ConnectionThrottle) AddClient ¶ added in v0.6.0
func (ct *ConnectionThrottle) AddClient(addr net.IP) error
AddClient introduces a new client connection if possible. If we can't, throws an error instead.
func (*ConnectionThrottle) ResetFor ¶ added in v0.6.0
func (ct *ConnectionThrottle) ResetFor(addr net.IP)
ResetFor removes any existing count for the given address.
type ConnectionThrottleConfig ¶ added in v0.6.0
type ConnectionThrottleConfig struct { Enabled bool CidrLenIPv4 int `yaml:"cidr-len-ipv4"` CidrLenIPv6 int `yaml:"cidr-len-ipv6"` ConnectionsPerCidr int `yaml:"max-connections"` DurationString string `yaml:"duration"` Duration time.Duration `yaml:"duration-time"` BanDurationString string `yaml:"ban-duration"` BanDuration time.Duration BanMessage string `yaml:"ban-message"` Exempted []string }
ConnectionThrottleConfig controls the automated connection throttling.
type DLineManager ¶ added in v0.5.0
type DLineManager struct {
// contains filtered or unexported fields
}
DLineManager manages and dlines.
func NewDLineManager ¶ added in v0.5.0
func NewDLineManager() *DLineManager
NewDLineManager returns a new DLineManager.
func (*DLineManager) AddIP ¶ added in v0.5.0
func (dm *DLineManager) AddIP(addr net.IP, length *IPRestrictTime, reason string, operReason string)
AddIP adds an IP address to the blocked list.
func (*DLineManager) AddNetwork ¶ added in v0.5.0
func (dm *DLineManager) AddNetwork(network net.IPNet, length *IPRestrictTime, reason string, operReason string)
AddNetwork adds a network to the blocked list.
func (*DLineManager) AllBans ¶ added in v0.5.0
func (dm *DLineManager) AllBans() map[string]IPBanInfo
AllBans returns all bans (for use with APIs, etc).
func (*DLineManager) CheckIP ¶ added in v0.5.0
func (dm *DLineManager) CheckIP(addr net.IP) (isBanned bool, info *IPBanInfo)
CheckIP returns whether or not an IP address was banned, and how long it is banned for.
func (*DLineManager) RemoveIP ¶ added in v0.5.0
func (dm *DLineManager) RemoveIP(addr net.IP)
RemoveIP removes an IP from the blocked list.
func (*DLineManager) RemoveNetwork ¶ added in v0.5.0
func (dm *DLineManager) RemoveNetwork(network net.IPNet)
RemoveNetwork removes a network from the blocked list.
type HelpEntry ¶ added in v0.2.0
type HelpEntry struct {
// contains filtered or unexported fields
}
HelpEntry represents an entry in the Help map.
type HelpEntryType ¶ added in v0.8.0
type HelpEntryType int
HelpEntryType represents the different sorts of help entries that can exist.
const ( // CommandHelpEntry is a help entry explaining a client command. CommandHelpEntry HelpEntryType = 0 // InformationHelpEntry is a help entry explaining general server info. InformationHelpEntry HelpEntryType = 1 // ISupportHelpEntry is a help entry explaining a specific RPL_ISUPPORT token. ISupportHelpEntry HelpEntryType = 2 )
type IPBanInfo ¶ added in v0.5.0
type IPBanInfo struct { // Reason is the ban reason. Reason string `json:"reason"` // OperReason is an oper ban reason. OperReason string `json:"oper_reason"` // Time holds details about the duration, if it exists. Time *IPRestrictTime `json:"time"` }
IPBanInfo holds info about an IP/net ban.
type IPRestrictTime ¶ added in v0.5.0
type IPRestrictTime struct { // Duration is how long this block lasts for. Duration time.Duration `json:"duration"` // Expires is when this block expires. Expires time.Time `json:"expires"` }
IPRestrictTime contains the expiration info about the given IP.
func (*IPRestrictTime) IsExpired ¶ added in v0.5.0
func (iptime *IPRestrictTime) IsExpired() bool
IsExpired returns true if the time has expired.
type ISupportList ¶
ISupportList holds a list of ISUPPORT tokens
func NewISupportList ¶
func NewISupportList() *ISupportList
NewISupportList returns a new ISupportList
func (*ISupportList) Add ¶
func (il *ISupportList) Add(name string, value string)
Add adds an RPL_ISUPPORT token to our internal list
func (*ISupportList) AddNoValue ¶
func (il *ISupportList) AddNoValue(name string)
AddNoValue adds an RPL_ISUPPORT token that does not have a value
func (*ISupportList) GetDifference ¶ added in v0.3.0
func (il *ISupportList) GetDifference(newil *ISupportList) [][]string
GetDifference returns the difference between two token lists.
func (*ISupportList) RegenerateCachedReply ¶
func (il *ISupportList) RegenerateCachedReply()
RegenerateCachedReply regenerates the cached RPL_ISUPPORT reply
type KLineInfo ¶ added in v0.6.0
type KLineInfo struct { // Mask that is blocked. Mask string // Matcher, to facilitate fast matching. Matcher ircmatch.Matcher // Info contains information on the ban. Info IPBanInfo }
KLineInfo contains the address itself and expiration time for a given network.
type KLineManager ¶ added in v0.6.0
type KLineManager struct {
// contains filtered or unexported fields
}
KLineManager manages and klines.
func NewKLineManager ¶ added in v0.6.0
func NewKLineManager() *KLineManager
NewKLineManager returns a new KLineManager.
func (*KLineManager) AddMask ¶ added in v0.6.0
func (km *KLineManager) AddMask(mask string, length *IPRestrictTime, reason string, operReason string)
AddMask adds to the blocked list.
func (*KLineManager) AllBans ¶ added in v0.6.0
func (km *KLineManager) AllBans() map[string]IPBanInfo
AllBans returns all bans (for use with APIs, etc).
func (*KLineManager) CheckMasks ¶ added in v0.6.0
func (km *KLineManager) CheckMasks(masks ...string) (isBanned bool, info *IPBanInfo)
CheckMasks returns whether or not the hostmask(s) are banned, and how long they are banned for.
func (*KLineManager) RemoveMask ¶ added in v0.6.0
func (km *KLineManager) RemoveMask(mask string)
RemoveMask removes a mask from the blocked list.
type Limits ¶
type Limits struct { AwayLen int ChannelLen int KickLen int MonitorEntries int NickLen int TopicLen int ChanListModes int LineLen LineLenLimits }
Limits holds the maximum limits for various things such as topic lengths.
type LineLenConfig ¶ added in v0.6.0
LineLenConfig controls line lengths.
type LineLenLimits ¶ added in v0.6.0
LineLenLimits holds the maximum limits for IRC lines.
type ListenerEvent ¶ added in v0.3.0
type ListenerEvent struct { Type ListenerEventType NewConfig *tls.Config }
ListenerEvent is an event that's passed to the listener.
type ListenerEventType ¶ added in v0.3.0
type ListenerEventType int
ListenerEventType is the type of event this is.
const ( // DestroyListener instructs the listener to destroy itself. DestroyListener ListenerEventType = iota // UpdateListener instructs the listener to update itself (grab new certs, etc). UpdateListener = iota )
type ListenerInterface ¶ added in v0.3.0
type ListenerInterface struct { Listener net.Listener Events chan ListenerEvent }
ListenerInterface represents an interface for a listener.
type LoggingConfig ¶ added in v0.7.0
type LoggingConfig struct { Method string MethodStdout bool MethodStderr bool MethodFile bool Filename string TypeString string `yaml:"type"` Types []string `yaml:"real-types"` ExcludedTypes []string `yaml:"real-excluded-types"` LevelString string `yaml:"level"` Level logger.Level `yaml:"level-real"` }
LoggingConfig controls a single logging method.
type MemberSet ¶
func (MemberSet) AnyHasMode ¶
type Mode ¶ added in v0.7.0
type Mode rune
Mode represents a user/channel/server mode
const ( Away Mode = 'a' Invisible Mode = 'i' LocalOperator Mode = 'O' Operator Mode = 'o' Restricted Mode = 'r' ServerNotice Mode = 's' TLS Mode = 'Z' UserRoleplaying Mode = 'E' WallOps Mode = 'w' )
User Modes
const ( BanMask Mode = 'b' // arg ChanRoleplaying Mode = 'E' // flag ExceptMask Mode = 'e' // arg InviteMask Mode = 'I' // arg InviteOnly Mode = 'i' // flag Key Mode = 'k' // flag arg Moderated Mode = 'm' // flag NoOutside Mode = 'n' // flag OpOnlyTopic Mode = 't' // flag RegisteredOnly Mode = 'r' // flag Secret Mode = 's' // flag UserLimit Mode = 'l' // flag arg )
Channel Modes
func GetLowestChannelModePrefix ¶ added in v0.3.0
GetLowestChannelModePrefix returns the lowest channel prefix mode out of the given prefixes.
type ModeChange ¶
type ModeChange struct {
// contains filtered or unexported fields
}
ModeChange is a single mode changing
func (*ModeChange) String ¶
func (change *ModeChange) String() (str string)
type ModeChanges ¶
type ModeChanges []ModeChange
ModeChanges are a collection of 'ModeChange's
func ApplyChannelModeChanges ¶ added in v0.7.0
func ApplyChannelModeChanges(channel *Channel, client *Client, isSamode bool, changes ModeChanges) ModeChanges
ApplyChannelModeChanges applies a given set of mode changes.
func ParseChannelModeChanges ¶ added in v0.7.0
func ParseChannelModeChanges(params ...string) (ModeChanges, map[rune]bool)
ParseChannelModeChanges returns the valid changes, and the list of unknown chars.
func ParseUserModeChanges ¶ added in v0.8.0
func ParseUserModeChanges(params ...string) (ModeChanges, map[rune]bool)
ParseUserModeChanges returns the valid changes, and the list of unknown chars.
func (ModeChanges) String ¶
func (changes ModeChanges) String() string
type ModeSet ¶ added in v0.7.0
type OperClass ¶ added in v0.4.0
type OperClass struct { Title string WhoisLine string `yaml:"whois-line"` Capabilities map[string]bool // map to make lookups much easier }
OperClass defines an assembled operator class.
type OperClassConfig ¶ added in v0.4.0
OperClassConfig defines a specific operator class.
type OperConfig ¶ added in v0.4.0
type OperConfig struct { Class string Vhost string WhoisLine string `yaml:"whois-line"` Password string Modes string }
OperConfig defines a specific operator's configuration.
func (*OperConfig) PasswordBytes ¶ added in v0.4.0
func (conf *OperConfig) PasswordBytes() []byte
PasswordBytes returns the bytes represented by the password hash.
type PassConfig ¶
type PassConfig struct {
Password string
}
PassConfig holds the connection password.
func (*PassConfig) PasswordBytes ¶
func (conf *PassConfig) PasswordBytes() []byte
PasswordBytes returns the bytes represented by the password hash.
type PasswordManager ¶
type PasswordManager struct {
// contains filtered or unexported fields
}
PasswordManager supports the hashing and comparing of passwords with the given salt.
func NewPasswordManager ¶
func NewPasswordManager(salt []byte) PasswordManager
NewPasswordManager returns a new PasswordManager with the given salt.
func (*PasswordManager) CompareHashAndPassword ¶
func (pwm *PasswordManager) CompareHashAndPassword(hashedPassword []byte, specialSalt []byte, password string) error
CompareHashAndPassword compares a hashed password with its possible plaintext equivalent. Returns nil on success, or an error on failure.
func (*PasswordManager) GenerateFromPassword ¶
func (pwm *PasswordManager) GenerateFromPassword(specialSalt []byte, password string) ([]byte, error)
GenerateFromPassword encrypts the given password.
type RegisteredChannel ¶ added in v0.7.0
type RegisteredChannel struct { // Name of the channel. Name string // RegisteredAt represents the time that the channel was registered. RegisteredAt time.Time // Founder indicates the founder of the channel. Founder string // Topic represents the channel topic. Topic string // TopicSetBy represents the host that set the topic. TopicSetBy string // TopicSetTime represents the time the topic was set. TopicSetTime time.Time // Banlist represents the bans set on the channel. Banlist []string // Exceptlist represents the exceptions set on the channel. Exceptlist []string // Invitelist represents the invite exceptions set on the channel. Invitelist []string }
RegisteredChannel holds details about a given registered channel.
type RestAPIConfig ¶ added in v0.5.0
RestAPIConfig controls the integrated REST API.
type STSConfig ¶ added in v0.7.0
type STSConfig struct { Enabled bool Duration time.Duration `yaml:"duration-real"` DurationString string `yaml:"duration"` Port int Preload bool }
STSConfig controls the STS configuration/
type Server ¶
type Server struct { MaxSendQBytes uint64 // contains filtered or unexported fields }
Server is the main Oragono server.
type SnoManager ¶ added in v0.8.0
type SnoManager struct {
// contains filtered or unexported fields
}
SnoManager keeps track of which clients to send snomasks to.
func NewSnoManager ¶ added in v0.8.0
func NewSnoManager() *SnoManager
NewSnoManager returns a new SnoManager
func (*SnoManager) AddMasks ¶ added in v0.8.0
func (m *SnoManager) AddMasks(client *Client, masks ...sno.Mask)
AddMasks adds the given snomasks to the client.
func (*SnoManager) RemoveClient ¶ added in v0.8.0
func (m *SnoManager) RemoveClient(client *Client)
RemoveClient removes the given client from all of our lists.
func (*SnoManager) RemoveMasks ¶ added in v0.8.0
func (m *SnoManager) RemoveMasks(client *Client, masks ...sno.Mask)
RemoveMasks removes the given snomasks from the client.
func (*SnoManager) Send ¶ added in v0.8.0
func (m *SnoManager) Send(mask sno.Mask, content string)
Send sends the given snomask to all users signed up for it.
func (*SnoManager) String ¶ added in v0.8.0
func (m *SnoManager) String(client *Client) string
String returns the snomasks currently enabled.
type Socket ¶
type Socket struct { MaxSendQBytes uint64 // contains filtered or unexported fields }
Socket represents an IRC socket.
func (*Socket) Close ¶
func (socket *Socket) Close()
Close stops a Socket from being able to send/receive any more data.
func (*Socket) RunSocketWriter ¶ added in v0.7.0
func (socket *Socket) RunSocketWriter()
RunSocketWriter starts writing messages to the outgoing socket.
func (*Socket) SetFinalData ¶ added in v0.8.0
SetFinalData sets the final data to send when the SocketWriter closes.
type SplitMessage ¶ added in v0.6.0
SplitMessage represents a message that's been split for sending.
type StackImpactConfig ¶ added in v0.8.0
type StackImpactConfig struct { Enabled bool AgentKey string `yaml:"agent-key"` AppName string `yaml:"app-name"` }
StackImpactConfig is the config used for StackImpact's profiling.
type TLSListenConfig ¶
TLSListenConfig defines configuration options for listening on TLS.
type ThrottleDetails ¶ added in v0.6.0
ThrottleDetails holds the connection-throttling details for a subnet/IP.
type UserMaskSet ¶
type UserMaskSet struct {
// contains filtered or unexported fields
}
TODO(dan): move this over to generally using glob syntax instead? kinda more expected in normal ban/etc masks, though regex is useful (probably as an extban?)
func NewUserMaskSet ¶
func NewUserMaskSet() *UserMaskSet
func (*UserMaskSet) Add ¶
func (set *UserMaskSet) Add(mask string) bool
func (*UserMaskSet) AddAll ¶
func (set *UserMaskSet) AddAll(masks []string) (added bool)
func (*UserMaskSet) Match ¶
func (set *UserMaskSet) Match(userhost string) bool
func (*UserMaskSet) Remove ¶
func (set *UserMaskSet) Remove(mask string) bool
func (*UserMaskSet) String ¶
func (set *UserMaskSet) String() string
type WSContainer ¶
WSContainer holds the websocket.
func (WSContainer) Read ¶
func (ws WSContainer) Read(msg []byte) (int, error)
Read reads new incoming messages.
func (WSContainer) SetDeadline ¶
func (ws WSContainer) SetDeadline(t time.Time) error
SetDeadline sets the read and write deadline on this websocket.
type WhoWas ¶
type WhoWas struct {
// contains filtered or unexported fields
}
WhoWas is an entry in the WhoWasList.
type WhoWasList ¶
type WhoWasList struct {
// contains filtered or unexported fields
}
WhoWasList holds our list of prior clients (for use with the WHOWAS command).
func NewWhoWasList ¶
func NewWhoWasList(size uint) *WhoWasList
NewWhoWasList returns a new WhoWasList
func (*WhoWasList) Append ¶
func (list *WhoWasList) Append(client *Client)
Append adds an entry to the WhoWasList.
func (*WhoWasList) Each ¶
func (list *WhoWasList) Each() <-chan *WhoWas
Each iterates the WhoWasList in reverse.
Source Files ¶
- accountreg.go
- accounts.go
- capability.go
- channel.go
- channelreg.go
- chanserv.go
- client.go
- client_lookup_set.go
- commands.go
- config.go
- connection_limits.go
- connection_throttling.go
- constants.go
- database.go
- debug.go
- dline.go
- help.go
- isupport.go
- kline.go
- message_tags.go
- modes.go
- monitor.go
- net.go
- nickname.go
- nickserv.go
- numerics.go
- password.go
- password_salted.go
- rest_api.go
- roleplay.go
- server.go
- snomanager.go
- socket.go
- strings.go
- types.go
- util.go
- websocket.go
- whowas.go