Documentation
¶
Overview ¶
Package ircmsg parses and serializes IRC protocol messages, including IRCv3 message tags.
Index ¶
Constants ¶
const IRCv3TagCap = 8191
IRCv3TagCap is the maximum allowed length of the encoded tag section.
Variables ¶
var ( // ErrLineTooLong indicates that a message exceeds the maximum allowed length. ErrLineTooLong = errors.New("ircmsg: line exceeds maximum length") // ErrInvalidMessage indicates that a message is malformed. ErrInvalidMessage = errors.New("ircmsg: malformed message") // ErrInvalidTag indicates that a message tag is malformed. ErrInvalidTag = errors.New("ircmsg: malformed tag") // ErrTooManyParams indicates that a message has more than 15 parameters. ErrTooManyParams = errors.New("ircmsg: too many parameters (>15)") )
Functions ¶
func EscapeTagValue ¶
EscapeTagValue escapes a tag value for the wire per the IRCv3 tag encoding.
func TruncateUTF8Safe ¶
TruncateUTF8Safe returns the longest prefix of s within maxBytes that ends on a rune boundary.
func UnescapeTagValue ¶
UnescapeTagValue unescapes a wire-form tag value per the IRCv3 tag encoding.
Types ¶
type Message ¶
Message represents a single IRC protocol message.
func ParseLineStrict ¶
ParseLineStrict parses a single IRC message, requiring each token separator to be a single space.
func (*Message) Bytes ¶
Bytes serializes the message to its wire form, returning an error if it is malformed or exceeds maxLen.
func (*Message) GetTag ¶
GetTag returns the value of the tag with the given key and reports whether it is present.
func (*Message) IsClientOnlyTag ¶
IsClientOnlyTag reports whether the given tag key denotes a client-only tag.
func (*Message) NickUserHost ¶
func (m *Message) NickUserHost() (NickUserHost, error)
NickUserHost parses the message source into its nick, user, and host components.
type NickUserHost ¶
NickUserHost represents the nick, user, and host components of an IRC source.
func (*NickUserHost) String ¶
func (n *NickUserHost) String() string