Anonymous IRC daemon
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Trevor Slocum f2a5474ad5 Migrate project to GitLab 5 years ago
..
ctcp Update dependencies 6 years ago
internal Initial commit 7 years ago
.travis.yml Switch vendoring mechanism from govendor to godep 6 years ago
LICENSE Initial commit 7 years ago
README.md Initial commit 7 years ago
constants.go Migrate project to GitLab 5 years ago
doc.go Update dependencies 6 years ago
message.go Add/update dependencies 6 years ago
message_test.go Update dependencies 6 years ago
stream.go Update dependencies 6 years ago
stream_test.go Update dependencies 6 years ago

README.md

Go irc package

Build Status GoDoc

Features

Package irc allows your application to speak the IRC protocol.

  • Limited scope, does one thing and does it well.
  • Focus on simplicity and speed.
  • Stable API: updates shouldn't break existing software.
  • Well documented code.

This package does not manage your entire IRC connection. It only translates the protocol to easy to use Go types. It is meant as a single component in a larger IRC library, or for basic IRC bots for which a large IRC package would be overkill.

Usage

import "gopkg.in/sorcix/irc.v2"

Message

The Message and Prefix types provide translation to and from IRC message format.

// Parse the IRC-encoded data and stores the result in a new struct.
message := irc.ParseMessage(raw)

// Returns the IRC encoding of the message.
raw = message.String()

Encoder & Decoder

The Encoder and Decoder types allow working with IRC message streams.

// Create a decoder that reads from given io.Reader
dec := irc.NewDecoder(reader)

// Decode the next IRC message
message, err := dec.Decode()

// Create an encoder that writes to given io.Writer
enc := irc.NewEncoder(writer)

// Send a message to the writer.
enc.Encode(message)

Conn

The Conn type combines an Encoder and Decoder for a duplex connection.

c, err := irc.Dial("irc.server.net:6667")

// Methods from both Encoder and Decoder are available
message, err := c.Decode()