package ircproto
import "github.com/hlandau/ircproto"
Package ircproto provides an auto-reconnecting IRC client library including support for IRCv3 capabilities, message tags and SASL.
Index ¶
- Variables
- type Client
- func New(cfg *Config) (*Client, error)
- func (c *Client) Close()
- func (c *Client) Deprecate()
- func (c *Client) NegotiateResult() *ircneg.Result
- func (c *Client) ReadMsg(ctx context.Context) (*ircparse.Msg, error)
- func (c *Client) WriteMsg(ctx context.Context, msg *ircparse.Msg) error
- type Config
Variables ¶
Returned when calling WriteMsg if not currently connected, or when calling either WriteMsg or ReadMsg after the client has been closed.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Reconnecting IRC client.
func New ¶
Create a new IRC client, which maintains a persistent connection to an IRC server and reconnects as necessary.
func (*Client) Close ¶
func (c *Client) Close()
Tears down the current connection, if any. This is an abrupt connection close without sending e.g. a QUIT command; any messages which were queued for transmission which have yet to be processed by the server might be lost. For a clean shutdown, send a QUIT command and call Deprecate() instead.
func (*Client) Deprecate ¶
func (c *Client) Deprecate()
Indicates that a new connection should not be made once the current connection fails. This should be used before sending QUIT in a clean shutdown sequence as otherwise the client would immediately reconnect upon losing its connection to the server.
func (*Client) NegotiateResult ¶
If the client currently has an active connection, return the negotiation result data. Otherwise, returns nil.
func (*Client) ReadMsg ¶
Reads a message from the current connection. If there is no current connection, blocks until a connection is available.
If an error occurs during read, the current connection is destroyed and the error which occurred is returned. Subsequent calls to this method will then block until a new connection is available. In other words, errors being returned indicate the connection has failed and that a new connection is being attempted, and you can then read from the new connection (whenever it is successfully created, which may be some time in the future) by calling ReadMsg() again.
func (*Client) WriteMsg ¶
Writes a message to the current connection. If there is no current connection, returns ErrDisconnected and the message is not queued.
If an error occurs during transmission, the current connection is destroyed and the error which occurred is returned. Expect subsequent calls to WriteMsg() to return ErrDisconnected for a while.
type Config ¶
type Config struct { // Should return a valid config. Called every time a new connection is // made. ConnConfigFunc func() (*ircconn.Config, error) // Should return a valid config. Called every time a new connection is made. NegConfigFunc func() (*ircneg.Config, error) // Return the URLs to connect to. Called every time a new connection is made. URLListFunc func() ([]string, error) // Backoff timer. Backoff unet.Backoff }
Configuration for IRC clients.
func Simple ¶
func (*Config) WithConn ¶
func (*Config) WithNeg ¶
func (*Config) WithURLs ¶
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
egobot | |
egobot/hdlautojoin | Package hdlautojoin provides a handler implementing channel autojoin functionality. |
egobot/hdlctcp | Package hdlctcp provides CTCP VERSION responder functionality. |
egobot/hdlhn | Package hdlhn provides Hacker News tailing functionality. |
egobot/hdlnick | Package hdlnick provides a handler for maintaining an IRC bot's nickname. |
egobot/hdltxbase | Package hdltxbase implements a base transmission driver for the "tx" service. |
egobot/hnapi | Package hnapi provides basic functions for retrieving data from the Hacker News API. |
egobot/hntail | Package hntail provides facilities for being alerted when new HN API events occur, and consuming those events like tailing a log. |
egobot/ircregistry | Package ircregistry provides a service discovery and registration facility for IRC message handling modules. |
ircconn | Package ircconn provides an IRC client protocol connection with the lifetime of a single transport-layer connection. |
ircneg | Package ircneg provides functions for the initial handshaking of new IRC connections. |
ircparse | Package ircparse provides an IRC message parser and serializer supporting RFC1459 and IRCv3 message tags. |
ircsasl | Package ircsasl provides a basic SASL implementation for IRCv3 usage. |
- Version
- v0.0.0-20240529044229-f1af42e426cd (latest)
- Published
- May 29, 2024
- Platform
- linux/amd64
- Imports
- 9 packages
- Last checked
- 1 month ago –
Tools for package owners.