Documentation
¶
Index ¶
- Constants
- Variables
- func AUTHENTICATE(s *Server, c *client.Client, m *msg.Message) msg.Msg
- func AWAY(s *Server, c *client.Client, m *msg.Message) msg.Msg
- func CAP(s *Server, c *client.Client, m *msg.Message) msg.Msg
- func END(s *Server, c *client.Client, params ...string) msg.Msg
- func ERROR(s *Server, c *client.Client, m *msg.Message) msg.Msg
- func INFO(s *Server, c *client.Client, m *msg.Message) msg.Msg
- func INVITE(s *Server, c *client.Client, m *msg.Message) msg.Msg
- func JOIN(s *Server, c *client.Client, m *msg.Message) msg.Msg
- func KICK(s *Server, c *client.Client, m *msg.Message) msg.Msg
- func LIST(s *Server, c *client.Client, m *msg.Message) msg.Msg
- func LS(s *Server, c *client.Client, params ...string) msg.Msg
- func LUSERS(s *Server, c *client.Client, m *msg.Message) msg.Msg
- func MODE(s *Server, c *client.Client, m *msg.Message) msg.Msg
- func MONITOR(s *Server, c *client.Client, m *msg.Message) msg.Msg
- func MOTD(s *Server, c *client.Client, m *msg.Message) msg.Msg
- func NAMES(s *Server, c *client.Client, m *msg.Message) msg.Msg
- func NICK(s *Server, c *client.Client, m *msg.Message) msg.Msg
- func NOTICE(s *Server, c *client.Client, m *msg.Message) msg.Msg
- func OPER(s *Server, c *client.Client, m *msg.Message) msg.Msg
- func PART(s *Server, c *client.Client, m *msg.Message) msg.Msg
- func PASS(s *Server, c *client.Client, m *msg.Message) msg.Msg
- func PING(s *Server, c *client.Client, m *msg.Message) msg.Msg
- func PONG(s *Server, c *client.Client, m *msg.Message) msg.Msg
- func PRIVMSG(s *Server, c *client.Client, m *msg.Message) msg.Msg
- func QUIT(s *Server, c *client.Client, m *msg.Message) msg.Msg
- func REGISTER(s *Server, c *client.Client, m *msg.Message) msg.Msg
- func REHASH(s *Server, c *client.Client, m *msg.Message) msg.Msg
- func REQ(s *Server, c *client.Client, params ...string) msg.Msg
- func SETNAME(s *Server, c *client.Client, m *msg.Message) msg.Msg
- func TAGMSG(s *Server, c *client.Client, m *msg.Message) msg.Msg
- func TIME(s *Server, c *client.Client, m *msg.Message) msg.Msg
- func TOPIC(s *Server, c *client.Client, m *msg.Message) msg.Msg
- func USER(s *Server, c *client.Client, m *msg.Message) msg.Msg
- func USERHOST(s *Server, c *client.Client, m *msg.Message) msg.Msg
- func WALLOPS(s *Server, c *client.Client, m *msg.Message) msg.Msg
- func WHO(s *Server, c *client.Client, m *msg.Message) msg.Msg
- func WHOIS(s *Server, c *client.Client, m *msg.Message) msg.Msg
- func WHOWAS(s *Server, c *client.Client, m *msg.Message) msg.Msg
- func WriteConfigToPath(c *Config, path string) error
- type Config
- type Server
Constants ¶
View Source
const ( FAIL replyType = "FAIL" WARN replyType = "WARN" NOTE replyType = "NOTE" )
Variables ¶
View Source
var ( RPL_WELCOME = msg.New(nil, "", "", "", "001", []string{"%s", "Welcome to the %s IRC Network %s"}, true) RPL_YOURHOST = msg.New(nil, "", "", "", "002", []string{"%s", "Your host is %s"}, true) RPL_CREATED = msg.New(nil, "", "", "", "003", []string{"%s", "This server was created %s"}, true) RPL_MYINFO = msg.New(nil, "", "", "", "004", []string{"%s", "%s", "%s", "%s", "%s"}, false) RPL_ISUPPORT = msg.New(nil, "", "", "", "005", []string{"%s", "%s", "are supported by this server"}, true) RPL_UMODEIS = msg.New(nil, "", "", "", "221", []string{"%s", "%s"}, false) RPL_LUSERCLIENT = msg.New(nil, "", "", "", "251", []string{"%s", "There are %d users and %d invisible on %d servers"}, true) RPL_LUSEROP = msg.New(nil, "", "", "", "252", []string{"%s", "%d", "operator(s) online"}, true) RPL_LUSERUNKNOWN = msg.New(nil, "", "", "", "253", []string{"%s", "%d", "unknown connection(s)"}, true) RPL_LUSERCHANNELS = msg.New(nil, "", "", "", "254", []string{"%s", "%d", "channels formed"}, true) RPL_LUSERME = msg.New(nil, "", "", "", "255", []string{"%s", "I have %d clients and %d servers"}, true) RPL_LOCALUSERS = msg.New(nil, "", "", "", "265", []string{"%s", "%v", "%v", "Current local users %v, max %v"}, true) RPL_GLOBALUSERS = msg.New(nil, "", "", "", "266", []string{"%s", "%v", "%v", "Current global users %v, max %v"}, true) RPL_WHOISCERTFP = msg.New(nil, "", "", "", "276", []string{"%s", "%s", "has client certificate fingerprint %s"}, true) RPL_AWAY = msg.New(nil, "", "", "", "301", []string{"%s", "%s", "%s"}, true) RPL_USERHOST = msg.New(nil, "", "", "", "302", []string{"%s", "%s"}, true) RPL_UNAWAY = msg.New(nil, "", "", "", "305", []string{"%s", "You are no longer marked as being away"}, true) RPL_NOWAWAY = msg.New(nil, "", "", "", "306", []string{"%s", "You have been marked as being away"}, true) RPL_WHOISUSER = msg.New(nil, "", "", "", "311", []string{"%s", "%s", "%s", "%s", "*", "%s"}, true) RPL_WHOISSERVER = msg.New(nil, "", "", "", "312", []string{"%s", "%s", "%s", "%s"}, true) RPL_WHOISOPERATOR = msg.New(nil, "", "", "", "313", []string{"%s", "%s", "is an IRC operator"}, true) RPL_WHOWASUSER = msg.New(nil, "", "", "", "314", []string{"%s", "%s", "%s", "%s", "*", "%s"}, false) RPL_WHOISIDLE = msg.New(nil, "", "", "", "317", []string{"%s", "%s", "%v", "%v", "seconds idle, signon time"}, true) RPL_ENDOFWHOIS = msg.New(nil, "", "", "", "318", []string{"%s", "%s", "End of /WHOIS list"}, true) RPL_WHOISCHANNELS = msg.New(nil, "", "", "", "319", []string{"%s", "%s%s"}, false) RPL_ENDOFWHO = msg.New(nil, "", "", "", "315", []string{"%s", "%s", "End of WHO list"}, true) RPL_LIST = msg.New(nil, "", "", "", "322", []string{"%s", "%s", "%v", "%s"}, true) RPL_LISTEND = msg.New(nil, "", "", "", "323", []string{"%s", "End of /LIST"}, true) RPL_CHANNELMODEIS = msg.New(nil, "", "", "", "324", []string{"%s", "%s", "%s%s"}, false) RPL_CREATIONTIME = msg.New(nil, "", "", "", "329", []string{"%s", "%s", "%s"}, false) RPL_WHOISACCOUNT = msg.New(nil, "", "", "", "330", []string{"%s", "%s", "%s", "is logged in as"}, true) RPL_NOTOPIC = msg.New(nil, "", "", "", "331", []string{"%s", "%s", "No topic is set"}, true) RPL_TOPIC = msg.New(nil, "", "", "", "332", []string{"%s", "%s", "%s"}, true) RPL_TOPICWHOTIME = msg.New(nil, "", "", "", "333", []string{"%s", "%s", "%s", "%v"}, false) RPL_WHOISBOT = msg.New(nil, "", "", "", "335", []string{"%s", "%s", "bot"}, true) RPL_INVITELIST = msg.New(nil, "", "", "", "336", []string{"%s", "%s"}, false) RPL_ENDOFINVITELIST = msg.New(nil, "", "", "", "337", []string{"%s", "End of /INVITE list"}, true) RPL_INVITING = msg.New(nil, "", "", "", "341", []string{"%s", "%s", "%s"}, false) RPL_INVEXLIST = msg.New(nil, "", "", "", "346", []string{"%s", "%s", "%s"}, false) RPL_ENFOFINVEXLIST = msg.New(nil, "", "", "", "347", []string{"%s", "%s", "End of channel invite list"}, true) RPL_EXCEPTLIST = msg.New(nil, "", "", "", "348", []string{"%s", "%s", "%s"}, false) RPL_ENDOFEXCEPTLIST = msg.New(nil, "", "", "", "349", []string{"%s", "%s", "End of channel exception list"}, true) RPL_WHOREPLY = msg.New(nil, "", "", "", "352", []string{"%s", "%s", "%s", "%s", "%s", "%s", "%s", "0 %s"}, true) RPL_NAMREPLY = msg.New(nil, "", "", "", "353", []string{"%s", "%s", "%s", "%s"}, true) RPL_WHOSPCRPL = msg.New(nil, "", "", "", "354", []string{"%s", "%s"}, false) RPL_ENDOFNAMES = msg.New(nil, "", "", "", "366", []string{"%s", "%s", "End of /NAMES list"}, true) RPL_BANLIST = msg.New(nil, "", "", "", "367", []string{"%s", "%s", "%s"}, false) RPL_ENDOFBANLIST = msg.New(nil, "", "", "", "368", []string{"%s", "%s", "End of channel ban list"}, true) RPL_ENDOFWHOWAS = msg.New(nil, "", "", "", "369", []string{"%s", "%s", "End of WHOWAS"}, true) RPL_MOTDSTART = msg.New(nil, "", "", "", "375", []string{"%s", "- %s Message of the Day -"}, true) RPL_INFO = msg.New(nil, "", "", "", "371", []string{"%s", "%s"}, true) RPL_MOTD = msg.New(nil, "", "", "", "372", []string{"%s", "%s"}, true) RPL_ENDOFINFO = msg.New(nil, "", "", "", "374", []string{"%s", "End of INFO list"}, true) RPL_ENDOFMOTD = msg.New(nil, "", "", "", "376", []string{"%s", "End of /MOTD command"}, true) RPL_YOUREOPER = msg.New(nil, "", "", "", "381", []string{"%s", "You are now an IRC operator"}, true) RPL_REHASHING = msg.New(nil, "", "", "", "382", []string{"%s", "%s", "Rehashing"}, true) RPL_TIME = msg.New(nil, "", "", "", "391", []string{"%s", "%s", "%s"}, true) ERR_NOSUCHNICK = msg.New(nil, "", "", "", "401", []string{"%s", "%s", "No such nick/channel"}, true) ERR_NOSUCHCHANNEL = msg.New(nil, "", "", "", "403", []string{"%s", "%s", "No such channel"}, true) ERR_CANNOTSENDTOCHAN = msg.New(nil, "", "", "", "404", []string{"%s", "%s", "Cannot send to channel"}, true) ERR_WASNOSUCHNICK = msg.New(nil, "", "", "", "406", []string{"%s", "%s", "There was no such nickname"}, true) ERR_INVALIDCAPCMD = msg.New(nil, "", "", "", "410", []string{"%s", "%s", "Invalid CAP command"}, true) ERR_NORECIPIENT = msg.New(nil, "", "", "", "411", []string{"%s", "No recipient given (%s)"}, true) ERR_NOTEXTTOSEND = msg.New(nil, "", "", "", "412", []string{"%s", "No text to send"}, true) ERR_INPUTTOOLONG = msg.New(nil, "", "", "", "417", []string{"%s", "Input line was too long"}, true) ERR_UNKNOWNCOMMAND = msg.New(nil, "", "", "", "421", []string{"%s", "%s", "Unknown command"}, true) ERR_NOMOTD = msg.New(nil, "", "", "", "422", []string{"%s", "MOTD file is missing"}, true) ERR_NONICKNAMEGIVEN = msg.New(nil, "", "", "", "431", []string{"%s", "No nickname given"}, true) ERR_ERRONEUSNICKNAME = msg.New(nil, "", "", "", "432", []string{"%s", "Erroneous nickname"}, true) ERR_NICKNAMEINUSE = msg.New(nil, "", "", "", "433", []string{"%s", "%s", "Nickname is already in use"}, true) ERR_USERNOTINCHANNEL = msg.New(nil, "", "", "", "441", []string{"%s", "%s", "%s", "They aren't on that channel"}, true) ERR_NOTONCHANNEL = msg.New(nil, "", "", "", "442", []string{"%s", "%s", "You're not on that channel"}, true) ERR_USERONCHANNEL = msg.New(nil, "", "", "", "443", []string{"%s", "%s", "%s", "is already on channel"}, true) ERR_NOTREGISTERED = msg.New(nil, "", "", "", "451", []string{"%s", "You have not registered"}, true) ERR_NEEDMOREPARAMS = msg.New(nil, "", "", "", "461", []string{"%s", "%s", "Not enough parameters"}, true) ERR_ALREADYREGISTRED = msg.New(nil, "", "", "", "462", []string{"%s", "You may not reregister"}, true) ERR_PASSWDMISMATCH = msg.New(nil, "", "", "", "464", []string{"%s", "Password Incorrect"}, true) ERR_CHANNELISFULL = msg.New(nil, "", "", "", "471", []string{"%s", "%s", "Cannot join channel (+l)"}, true) ERR_UNKNOWNMODE = msg.New(nil, "", "", "", "472", []string{"%s", "%s", "is unknown mode char to me for %s"}, true) ERR_INVITEONLYCHAN = msg.New(nil, "", "", "", "473", []string{"%s", "%s", "Cannot join channel (+i)"}, true) ERR_BANNEDFROMCHAN = msg.New(nil, "", "", "", "474", []string{"%s", "%s", "Cannot join channel (+b)"}, true) ERR_BADCHANNELKEY = msg.New(nil, "", "", "", "475", []string{"%s", "%s", "Cannot join channel (+k)"}, true) ERR_NOPRIVILEGES = msg.New(nil, "", "", "", "481", []string{"%s", "Permission Denied - You're not an IRC operator"}, true) ERR_CHANOPRIVSNEEDED = msg.New(nil, "", "", "", "482", []string{"%s", "%s", "You're not a channel operator"}, true) ERR_UMODEUNKNOWNFLAG = msg.New(nil, "", "", "", "501", []string{"%s", "Unknown MODE flag"}, true) ERR_USERSDONTMATCH = msg.New(nil, "", "", "", "502", []string{"%s", "Can't change mode for other users"}, true) ERR_INVALIDKEY = msg.New(nil, "", "", "", "525", []string{"%s", "%s", "Key is not well-formed"}, true) RPL_WHOISSECURE = msg.New(nil, "", "", "", "671", []string{"%s", "%s", "is using a secure connection"}, true) RPL_MONONLINE = msg.New(nil, "", "", "", "730", []string{"%s", "%s"}, true) RPL_MONOFFLINE = msg.New(nil, "", "", "", "731", []string{"%s", "%s"}, true) RPL_MONLIST = msg.New(nil, "", "", "", "732", []string{"%s", "%s"}, true) RPL_ENDOFMONLIST = msg.New(nil, "", "", "", "733", []string{"%s", "End of MONITOR list"}, true) RPL_LOGGEDIN = msg.New(nil, "", "", "", "900", []string{"%s", "%s", "%s", "You are now logged in as %s"}, true) RPL_LOGGEDOUT = msg.New(nil, "", "", "", "901", []string{"%s", "%s", "You are not logged out"}, true) ERR_NICKLOCKED = msg.New(nil, "", "", "", "902", []string{"%s", "You must use a nick assigned to you"}, true) RPL_SASLSUCCESS = msg.New(nil, "", "", "", "903", []string{"%s", "SASL authentication successful"}, true) ERR_SASLFAIL = msg.New(nil, "", "", "", "904", []string{"%s", "SASL authentication failed"}, true) ERR_SASLTOOLONG = msg.New(nil, "", "", "", "905", []string{"%s", "SASL message too long"}, true) ERR_SASLABORTED = msg.New(nil, "", "", "", "906", []string{"%s", "SASL authentication aborted"}, true) ERR_SASLALREADY = msg.New(nil, "", "", "", "907", []string{"%s", "You have already authenticated using SASL"}, true) RPL_SASLMECHS = msg.New(nil, "", "", "", "908", []string{"%s", "%s", "are available SASL mechanisms"}, true) )
View Source
var ( ErrPingTimeout = errors.New("Closing Link: PING timeout (300 seconds)") ErrRegistrationTimeout = errors.New("Closing Link: Client failed to register in allotted time (10 seconds)") )
Functions ¶
func ERROR ¶
this is currently a noop, as a server should only accept ERROR commands from other servers
func LS ¶
list capabilities that server supports TODO (only for CAP302 clients): when server capabilties take up too much message space, split up into multiple responses like
CAP * LS * : CAP * LS :
func MODE ¶
TODO: support commands like this that intersperse the modechar and modem.Params MODE &oulu +b *!*@*.edu +e *!*@*.bu.edu
func REGISTER ¶
REGISTER is nonstandard for now, username is assumed to be the same as the current client's nick REGISTER PASS <pass> REGISTER CERT REGISTER <channel>
func WHOIS ¶
we only support the <mask> *( "," <mask> ) parameter, target seems pointless with only one server in the tree
func WriteConfigToPath ¶
Types ¶
type Config ¶
type Config struct { Debug bool `json:"-"` // The name of the network associated with the server Network string `json:"network"` // The name of this server Name string `json:"name"` Password []byte `json:"password"` Port string `json:"port"` Proxy struct { Enabled bool `json:"enabled,omitempty"` Whitelist []string `json:"whitelist,omitempty"` } `json:"proxy,omitempty"` // Location of sqlite db. If nil, assume :memory: Datasource string `json:"datasource"` TLS struct { *tls.Config `json:"-"` Enabled bool `json:"enabled"` Port string `json:"port"` // A path to the server's public key Pubkey string `json:"pubkey"` // A path to the server's private key Privkey string `json:"privkey"` Proxy struct { Enabled bool `json:"enabled,omitempty"` Whitelist []string `json:"whitelist,omitempty"` } `json:"proxy,omitempty"` STS struct { // Enables strict transport security, which provides opportunistic // TLS client connection upgrades Enabled bool `json:"enabled"` // The port that clients should be told to connect to. This defaults // to TLS.Port if not set. Port string `json:"port"` // The time that is advertised to clients about how long they should // stay connected with TLS. This defaults to the difference between // the current time and the `NotAfter` property of the server's // certificate. Duration time.Duration `json:"duration"` // https://ircv3.net/specs/extensions/sts#the-preload-key // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Strict-Transport-Security#preloading_strict_transport_security // Tell clients that this server should be included in STS preload // lists (promise that your server will always offer a secure // connection to clients) Preload bool `json:"preload"` } `json:"sts,omitempty"` } `json:"tls,omitempty"` // A path to a file containg the server's message of the day. A MOTD // is divided when encountering a newline. If a line is too long, it // may run over the 512 byte message limit. MOTD string `json:"motd"` // A map where operator names are the keys and pass is the value Ops map[string][]byte `json:"ops,omitempty"` // contains filtered or unexported fields }
Click to show internal directories.
Click to hide internal directories.