irc

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 14, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package irc is a minimal, in-process IRC client for the `irc@` route: it connects a member to the BBS's own (members-only) Ergo network and drives a Bubble Tea TUI (see tui.go). It runs inside the agentbbs process on the host, so it reaches Ergo's loopback listener directly and — unlike running a third-party client like irssi in a pod — offers no /exec shell escape.

The member is already authenticated to the BBS by their SSH key; we present their account name to Ergo over SASL PLAIN. Ergo's auth-script approves the login on membership alone (the passphrase is ignored, by design), so we send a placeholder.

Index

Constants

View Source
const DefaultAddr = "127.0.0.1:6667"

DefaultAddr is the host-local plaintext Ergo listener (loopback only; the public front door is 6697/TLS). Overridable for dev hosts.

View Source
const DefaultChannel = "#lobby"

DefaultChannel is joined automatically when a member enters via irc@.

Variables

This section is empty.

Functions

func Run

func Run(s ssh.Session, c *Client) error

Run drives the IRC TUI over the SSH session until the member leaves; leaving ends the session (irc@ is a dedicated route, like agent@).

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a single member's connection to the network.

func Dial

func Dial(ctx context.Context, addr, nick string) (*Client, error)

Dial connects to addr, performs the SASL PLAIN handshake as nick, and blocks until the server welcomes us (001) or the attempt fails. On success the read loop is running and Events() is live.

func (*Client) Close

func (c *Client) Close() error

Close quits cleanly and tears down the socket.

func (*Client) Events

func (c *Client) Events() <-chan Event

Events is the stream the TUI consumes. It is closed when the connection ends.

func (*Client) Join

func (c *Client) Join(ch string) error

Join joins a channel.

func (*Client) Nick

func (c *Client) Nick() string

Nick reports the connection's current nickname.

func (*Client) Part

func (c *Client) Part(ch string) error

Part leaves a channel.

func (*Client) Privmsg

func (c *Client) Privmsg(target, text string) error

Privmsg sends a message to a channel or nick.

func (*Client) Raw

func (c *Client) Raw(line string) error

Raw sends a pre-formed IRC command (for /-commands the TUI doesn't model).

type Event

type Event struct {
	Kind EventKind
	// Channel is the conversation the event belongs to ("" = server/status).
	Channel string
	Nick    string
	Text    string
}

Event is one thing that happened on the connection, already formatted for display. Kind groups them so the TUI can colorize.

type EventKind

type EventKind int
const (
	EvMessage EventKind = iota // a PRIVMSG to a channel or to us
	EvNotice                   // a NOTICE (often from services)
	EvJoin
	EvPart
	EvQuit
	EvNick
	EvSystem // numerics, topics, names, errors, our own status lines
	EvClosed // the connection ended; Text carries the reason
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL