Documentation ¶
Overview ¶
Package connection implements the most basic parts of an IRC connection
Index ¶
- type Config
- type Connection
- func (s *Connection) Connect(ctx context.Context) error
- func (s *Connection) Done() <-chan struct{}
- func (s *Connection) LineChan() <-chan *ircmsg.Message
- func (s *Connection) Stop(msg string)
- func (s *Connection) Write(b []byte) (int, error)
- func (s *Connection) WriteLine(command string, args ...string) error
- func (s *Connection) WriteString(m string) (int, error)
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 ¶
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) 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