irc

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2021 License: BSD-2-Clause Imports: 7 Imported by: 0

Documentation

Overview

Package irc is an IRC-over-websocket client implementation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IRC

type IRC struct {
	Dialer   *websocket.Dialer
	Messages chan *Message // recv
	Outgoing chan string   // send
	// contains filtered or unexported fields
}

IRC is an IRC connection.

func New

func New(ctx context.Context) *IRC

New creates a new IRC instance for a single IRC session.

func (*IRC) Close

func (irc *IRC) Close() error

Close terminates the IRC connection and stops the sender goroutine.

func (*IRC) Connect

func (irc *IRC) Connect(address string) (chan *Message, error)

Connect to an IRC server.

func (*IRC) Err

func (irc *IRC) Err() error

Err returns the first error that occurred, if any.

func (*IRC) Send

func (irc *IRC) Send(message string)

Send queues a message to be sent to the IRC server, blocking if the queue is full.

type Message

type Message struct {
	Tags       map[string]string `json:"tags"`
	Source     string            `json:"source"`
	Command    string            `json:"command"`
	Args       []string          `json:"args"`
	HasTrailer bool              `json:"trailer,omitempty"` // Useful to know.. usually
	// contains filtered or unexported fields
}

func ParseMessage

func ParseMessage(line string) *Message

func (Message) Arg

func (m Message) Arg(i int) string

Arg returns the given argument, even if it is not set.

func (Message) Raw

func (m Message) Raw() string

func (*Message) String

func (m *Message) String() string

func (Message) Trailer

func (m Message) Trailer(i int) string

Trailer returns the argument at position i, even if it is not strictly the final argument.

Jump to

Keyboard shortcuts

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