Documentation
¶
Index ¶
- Constants
- type ChanUserMap
- type Channel
- type Server
- func (s *Server) Channel(name string) *Channel
- func (s *Server) ConnectTNC(addr string, tncport int) error
- func (s *Server) Exit(err error)
- func (s *Server) Load(path string) error
- func (s *Server) Nick(nick string) *User
- func (s *Server) Notice(sender *User, target string, msg string)
- func (s *Server) OpenTNC(path string) error
- func (s *Server) PersistState(path string)
- func (s *Server) PingPong()
- func (s *Server) Privmsg(sender *User, target string, msg string)
- func (s *Server) Save(path string) error
- func (s *Server) Serve(listenAddr string) error
- type User
- type UserMap
Constants ¶
const ( RPL_WELCOME = "001" // Welcome to the Internet Relay Network RPL_YOURHOST = "002" // Your host is running version... RPL_CREATED = "003" // Server creation date RPL_MYINFO = "004" // Server information RPL_ISUPPORT = "005" // Supported server features RPL_BOUNCE = "010" // Bounce to a different server RPL_USERHOST = "302" // User host information RPL_ISON = "303" // ISON response RPL_AWAY = "301" // Away message RPL_UNAWAY = "305" // You are no longer marked as away RPL_NOWAWAY = "306" // You have been marked as away RPL_WHOISUSER = "311" // WHOIS user information RPL_WHOISSERVER = "312" // WHOIS server information RPL_WHOISOPERATOR = "313" // WHOIS operator status RPL_WHOISIDLE = "317" // WHOIS idle time RPL_ENDOFWHOIS = "318" // End of WHOIS list RPL_WHOISCHANNELS = "319" // Channels the user is on RPL_LISTSTART = "321" // Start of channel listing RPL_LIST = "322" // Channel listing RPL_LISTEND = "323" // End of channel listing RPL_CHANNELMODEIS = "324" // Channel mode RPL_CREATIONTIME = "329" // Channel creation time RPL_NOTOPIC = "331" // No topic is set RPL_TOPIC = "332" // Channel topic RPL_TOPICWHOTIME = "333" // Who set the topic and when (often non-standard) RPL_INVITING = "341" // Invitation to channel RPL_SUMMONING = "342" // Summoning a user (obsolete) RPL_VERSION = "351" // Server version RPL_WHOREPLY = "352" // WHO reply RPL_ENDOFWHO = "315" // End of WHO list RPL_NAMREPLY = "353" // Names in a channel RPL_ENDOFNAMES = "366" // End of NAMES list RPL_LINKS = "364" // Links list RPL_ENDOFLINKS = "365" // End of LINKS list RPL_BANLIST = "367" // Ban list RPL_ENDOFBANLIST = "368" // End of ban list RPL_INFO = "371" // INFO response RPL_MOTD = "372" // Message of the Day RPL_ENDOFINFO = "374" // End of INFO list RPL_MOTDSTART = "375" // Start of MOTD RPL_ENDOFMOTD = "376" // End of MOTD RPL_YOUREOPER = "381" // You are now an IRC operator RPL_REHASHING = "382" // Rehashing server configuration RPL_TIME = "391" // Server time RPL_USERSTART = "392" // Start of user listing (obsolete) RPL_USERS = "393" // User list (obsolete) RPL_ENDOFUSERS = "394" // End of user listing (obsolete) RPL_NOUSERS = "395" // No users (obsolete) )
IRC RPL_ numeric constants
const ( ERR_NOSUCHNICK = "401" ERR_NOSUCHCHANNEL = "403" ERR_UNKNOWNCOMMAND = "421" ERR_NONICKNAMEGIVEN = "431" ERR_NICKNAMEINUSE = "433" ERR_NOTONCHANNEL = "442" ERR_NOTREGISTERED = "451" ERR_NEEDMOREPARAMS = "461" ERR_ALREADYREGISTERED = "462" ERR_UNKNOWNMODE = "472" ERR_CHANOPRIVSNEEDED = "482" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChanUserMap ¶
func (ChanUserMap) MarshalJSON ¶
func (ucm ChanUserMap) MarshalJSON() ([]byte, error)
func (*ChanUserMap) UnmarshalJSON ¶
func (ucm *ChanUserMap) UnmarshalJSON(data []byte) error
type Channel ¶
type Channel struct { *sync.Mutex `json:"-"` Name string Users ChanUserMap Topic string TopicTime time.Time TopicWho string }
Channel represents an IRC channel
func NewChannel ¶
type Server ¶
type Server struct { *sync.Mutex `json:"-"` Name string Users UserMap Channels map[string]*Channel MOTD func() string `json:"-"` // AutoJoin causes Local() users to automatically join channels they // get messages for. AutoJoin bool // contains filtered or unexported fields }
Server represents the IRC server
func (*Server) ConnectTNC ¶
ConnectTNC connects to a TNC (let's be honest here, it's direwolf) via tcp.
func (*Server) OpenTNC ¶
OpenTNC opens a file (likely a pty) for a TNC. This can be used for a real hardware serial port TNC, or direwolf's pty interface to its kiss TNC.
func (*Server) PersistState ¶
type User ¶
type User struct { Nick string Callsign string RealName string LastSeen time.Time // contains filtered or unexported fields }
User represents a connected IRC client
func (*User) ID ¶
ID generates a user id in the form of <nick>!<user>@<Real Name>. ID converts spaces to underscores for Real Name.
func (*User) Local ¶
Local returns true if the user is connected via TCP. This is used to distinguish users sending messages via radio. Local() for radio users will return false.
func (*User) Parse ¶
Parse breaks apart a nick!user@host identifier into its constituent parts and populates the User struct with the values. Since The majority of users should be remote via TNC/Radio, tracking hostname doesn't make much sense, so we use the host field to store the Real Name. When we encode a user identifier via the ID() method, spaces are converted to underscores.