irc

package
v2.0.3 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2020 License: MIT Imports: 20 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultConnectionConfig = ConnectionConfig{
		KeepAlive: 4 * time.Minute,
		Timeout:   1 * time.Minute,
	}
)

Functions

func NewCapabilityHandler

func NewCapabilityHandler(logger *zap.SugaredLogger) *capabilityHandler

func NewDebugHandler

func NewDebugHandler(logger *zap.SugaredLogger) *debugHandler

func NewErrorHandler

func NewErrorHandler() *errorHandler

func NewNickHandler

func NewNickHandler(preferredNickname string, logger *zap.SugaredLogger) *nickHandler

func NewPingHandler

func NewPingHandler() *pingHandler

func NewSupportHandler

func NewSupportHandler() *supportParser

Types

type CapabilityListener

type CapabilityListener interface {
	SubscribeCapAdd(receiver func(*Connection, *CapabilityStruct))
	UnsubscribeCapAdd(receiver func(*Connection, *CapabilityStruct))
	SubscribeCapDel(receiver func(*Connection, *CapabilityStruct))
	UnsubscribeCapDel(receiver func(*Connection, *CapabilityStruct))
}

type CapabilityPublisher

type CapabilityPublisher interface {
	PublishCapAdd(conn *Connection, capability *CapabilityStruct)
	PublishCapDel(conn *Connection, capability *CapabilityStruct)
}

type CapabilityStruct

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

type Channel

type Channel struct {
	Name string
}

type ClientConfig

type ClientConfig struct {
	Server   string
	Nick     string
	User     string
	Password string
	UseTLS   bool
	Realname string
}

type Connection

type Connection struct {
	Server       string
	Password     string
	Nickname     string
	UseTLS       bool
	SASLAuth     bool
	SASLUser     string
	SASLPass     string
	ConnConfig   ConnectionConfig
	ClientConfig ClientConfig

	Finished chan bool

	FloodProfile string
	// contains filtered or unexported fields
}

func NewIRC

func NewIRC(server, password, nickname, realname string, useTLS, useSasl bool, saslUser, saslPass string,
	log *zap.SugaredLogger, floodProfile string, eventManager *EventManager) *Connection

func (*Connection) AddInboundHandler

func (irc *Connection) AddInboundHandler(s string, f func(em *EventManager, c *Connection, m *Message))

func (*Connection) AddInboundHandlers

func (irc *Connection) AddInboundHandlers(handlers map[string]func(em *EventManager, c *Connection, m *Message))

func (*Connection) AddOutboundHandler

func (irc *Connection) AddOutboundHandler(f func(em *EventManager, c *Connection, m string))

func (*Connection) AddRawHandler

func (irc *Connection) AddRawHandler(f func(c *Connection, m RawMessage))

func (*Connection) AddRawHandlers

func (irc *Connection) AddRawHandlers(handlers []func(c *Connection, m RawMessage))

func (*Connection) Connect

func (irc *Connection) Connect() error

func (*Connection) ConnectAndWait

func (irc *Connection) ConnectAndWait() error

func (*Connection) ConnectAndWaitWithRetry

func (irc *Connection) ConnectAndWaitWithRetry(maxRetries int) error

func (*Connection) Init

func (irc *Connection) Init()

func (*Connection) NewRateLimiter

func (irc *Connection) NewRateLimiter(w io.Writer, floodProfile string) *RateLimiter

func (*Connection) Quit

func (irc *Connection) Quit()

func (*Connection) SendRaw

func (irc *Connection) SendRaw(line string)

func (*Connection) SendRawf

func (irc *Connection) SendRawf(formatLine string, args ...interface{})

func (*Connection) Wait

func (irc *Connection) Wait()

type ConnectionConfig

type ConnectionConfig struct {
	KeepAlive time.Duration
	Timeout   time.Duration
}

type EventManager

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

func NewEventManager

func NewEventManager() *EventManager

func (*EventManager) PublishCapAdd

func (irc *EventManager) PublishCapAdd(conn *Connection, capability *CapabilityStruct)

func (*EventManager) PublishCapDel

func (irc *EventManager) PublishCapDel(conn *Connection, capability *CapabilityStruct)

func (*EventManager) PublishChannelMessage

func (irc *EventManager) PublishChannelMessage(message Message)

func (*EventManager) PublishChannelPart

func (irc *EventManager) PublishChannelPart(channel Channel)

func (*EventManager) SubscribeCapAdd

func (irc *EventManager) SubscribeCapAdd(receiver func(*Connection, *CapabilityStruct))

func (*EventManager) SubscribeCapDel

func (irc *EventManager) SubscribeCapDel(receiver func(*Connection, *CapabilityStruct))

func (*EventManager) SubscribeChannelMessage

func (irc *EventManager) SubscribeChannelMessage(receiver func(Message))

func (EventManager) SubscribeChannelPart

func (irc EventManager) SubscribeChannelPart(receiver func(Channel))

func (*EventManager) UnsubscribeCapAdd

func (irc *EventManager) UnsubscribeCapAdd(receiver func(*Connection, *CapabilityStruct))

func (*EventManager) UnsubscribeCapDel

func (irc *EventManager) UnsubscribeCapDel(receiver func(*Connection, *CapabilityStruct))

func (*EventManager) UnsubscribeChannelMessage

func (irc *EventManager) UnsubscribeChannelMessage(receiver func(Message))

func (*EventManager) UnsubscribeChannelPart

func (irc *EventManager) UnsubscribeChannelPart(receiver func(Channel))

type InboundHandler

type InboundHandler struct {
	Verb    string
	Handler func(*Connection, *Message)
}

type Message

type Message struct {
	Raw    string
	Tags   string
	Source string
	Verb   string
	Params []string
}

type RateLimiter

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

func (*RateLimiter) Init

func (r *RateLimiter) Init(profile string)

func (*RateLimiter) Write

func (r *RateLimiter) Write(p []byte) (n int, err error)

type RawMessage

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

type SaslHandler

type SaslHandler struct {
	SASLAuth bool
	SASLUser string
	SASLPass string
	// contains filtered or unexported fields
}

func NewSASLHandler

func NewSASLHandler(useSasl bool, saslUser string, saslPass string, logger *zap.SugaredLogger) *SaslHandler

func (*SaslHandler) Install

func (h *SaslHandler) Install(em *EventManager, c *Connection)

type Sender

type Sender interface {
	SendRaw(string)
	SendRawf(string, ...interface{})
}

Jump to

Keyboard shortcuts

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