connection

package
v0.0.0-...-df918ef Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2022 License: ISC Imports: 13 Imported by: 1

Documentation

Overview

Package connection implements the most basic parts of an IRC connection

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Host                  string // Hostname of the target server
	Port                  string // Server port
	TLS                   bool   // Use TLS
	InsecureSkipVerifyTLS bool   // Skip verifying TLS Certificates
	TLSCertPath           string
	TLSKeyPath            string
	RawLog                bool // Log raw messages
}

Config contains all the configuration options used by Server

type Connection

type Connection struct {
	ISupport *isupport.ISupport
	// contains filtered or unexported fields
}

Connection implements the barebones required to make a connection to an IRC server.

It expects that you do EVERYTHING yourself. It simply is a nice frontend for the socket.

func NewConnection

func NewConnection(config *Config) *Connection

NewConnection creates a new Server instance ready for use

func NewSimpleServer

func NewSimpleServer(host, port string, useTLS bool) *Connection

NewSimpleServer is a nice wrapper that creates a ServerConfig for you

func (*Connection) Connect

func (s *Connection) Connect(ctx context.Context) error

Connect connects the Server instance to IRC. It does NOT block.

func (*Connection) Done

func (s *Connection) Done() <-chan struct{}

Done returns a channel that is closed when the connection is closed.

func (*Connection) LineChan

func (s *Connection) LineChan() <-chan *ircmsg.Message

LineChan returns a read only channel that will have messages from the server sent to it

func (*Connection) Stop

func (s *Connection) Stop(msg string)

Stop stops the connection to IRC

func (*Connection) Write

func (s *Connection) Write(b []byte) (int, error)

func (*Connection) WriteLine

func (s *Connection) WriteLine(command string, args ...string) error

WriteLine constructs an ircmsg.Message and sends it to the server

func (*Connection) WriteString

func (s *Connection) WriteString(m string) (int, error)

WriteString implements io.StringWriter

Jump to

Keyboard shortcuts

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