mcxircd

package
v0.0.0-...-2b5d22d Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2017 License: BSD-2-Clause Imports: 11 Imported by: 0

Documentation

Overview

IRC server

Index

Constants

View Source
const (
	TIMEOUT_HANDSHAKE = 60
	TIMEOUT_PING      = 5 * 60
	TIMEOUT_PONG      = 3 * 60
)

Variables

This section is empty.

Functions

func ERR_BADCHANNELKEY

func ERR_BADCHANNELKEY(nick, channel string) string

func ERR_BANNEDFROMCHAN

func ERR_BANNEDFROMCHAN(nick, channel string) string

func ERR_CHANOPRIVSNEEDED

func ERR_CHANOPRIVSNEEDED(nick, channel string) string

func ERR_ERRONEUSNICKNAME

func ERR_ERRONEUSNICKNAME(nick, badNick string) string

func ERR_NEEDMOREPARAMS

func ERR_NEEDMOREPARAMS(nick, command string) string

func ERR_NICKCOLLISION

func ERR_NICKCOLLISION(nick string) string

func ERR_NICKNAMEINUSE

func ERR_NICKNAMEINUSE(currentNick, desiredNick string) string

func ERR_NOPRIVILEGES

func ERR_NOPRIVILEGES(nick string) string

func ERR_NOSUCHCHANNEL

func ERR_NOSUCHCHANNEL(nick, channel string) string

func ERR_NOSUCHNICK

func ERR_NOSUCHNICK(nick, nonExistant string) string

func ERR_NOSUCHSERVER

func ERR_NOSUCHSERVER(nick, nonExistant string) string

func ERR_NOTONCHANNEL

func ERR_NOTONCHANNEL(nick, channel string) string

func ERR_PASSWDMISMATCH

func ERR_PASSWDMISMATCH(nick string) string

func ERR_TOOMANYTARGETS

func ERR_TOOMANYTARGETS(nick, someClue string) string

func ERR_UMODEUNKNOWNFLAG

func ERR_UMODEUNKNOWNFLAG(nick string) string

func ERR_UNKNOWNMODE

func ERR_UNKNOWNMODE(nick, channel string, badMode string) string

func ERR_USERNOTINCHANNEL

func ERR_USERNOTINCHANNEL(nick, notPresent, channel string) string

func ERR_USERSDONTMATCH

func ERR_USERSDONTMATCH(nick string) string

func ERR_WASNOSUCHNICK

func ERR_WASNOSUCHNICK(nick, target string) string

func JOIN

func JOIN(nick, channel string) string

func KICK

func KICK(nick, douchebag, channel, reason string) string

func MODE

func MODE(nick, target, modeString string) string

func NICK

func NICK(oldNick, newNick string) string

func PART

func PART(nick, channel string) string

func PRIVMSG

func PRIVMSG(from, to, message string) string

func RPL_BANLIST

func RPL_BANLIST(nick, channel, banMask string) string

func RPL_CHANNELMODEIS

func RPL_CHANNELMODEIS(nick, channel, modeString string) string

func RPL_CREATED

func RPL_CREATED(nick string) string

func RPL_ENDOFBANLIST

func RPL_ENDOFBANLIST(nick, channel string) string

func RPL_ENDOFEXCEPTLIST

func RPL_ENDOFEXCEPTLIST(nick, channel string) string

func RPL_ENDOFINFO

func RPL_ENDOFINFO(nick string) string

func RPL_ENDOFINVITELIST

func RPL_ENDOFINVITELIST(nick, channel string) string

func RPL_ENDOFMOTD

func RPL_ENDOFMOTD(nick string) string

func RPL_ENDOFNAMES

func RPL_ENDOFNAMES(nick, channel string) string

func RPL_ENDOFWHO

func RPL_ENDOFWHO(nick, itemName string) string

func RPL_ENDOFWHOIS

func RPL_ENDOFWHOIS(nick, target string) string

func RPL_EXCEPTLIST

func RPL_EXCEPTLIST(nick, channel, exceptionMask string) string

func RPL_INFO

func RPL_INFO(nick string) string

func RPL_INVITELIST

func RPL_INVITELIST(nick, channel, inviteMask string) string

func RPL_LIST

func RPL_LIST(nick, channel, topic string, numVisible int) string

func RPL_LISTEND

func RPL_LISTEND(nick string) string

func RPL_MAYBETOPIC

func RPL_MAYBETOPIC(nick, channel, topic string) string

func RPL_MOTD

func RPL_MOTD(nick string) string

func RPL_MOTDSTART

func RPL_MOTDSTART(nick string) string

func RPL_MYINFO

func RPL_MYINFO(nick string) string

func RPL_NAMREPLY

func RPL_NAMREPLY(nick, channel string, nicknames []string) string

func RPL_NOTOPIC

func RPL_NOTOPIC(nick, channel string) string

func RPL_NOWAWAY

func RPL_NOWAWAY(nick string) string

func RPL_REHASHING

func RPL_REHASHING(nick string) string

func RPL_SIMPLEWHOISUSER

func RPL_SIMPLEWHOISUSER(nick, target string) string

func RPL_SIMPLEWHOREPLY

func RPL_SIMPLEWHOREPLY(nick, channel, target string, hasOp bool) string

func RPL_TOPIC

func RPL_TOPIC(nick, channel, topic string) string

func RPL_UMODEIS

func RPL_UMODEIS(nick, umode string) string

func RPL_UNAWAY

func RPL_UNAWAY(nick string) string

func RPL_VERSION

func RPL_VERSION(nick string) string

func RPL_WELCOME

func RPL_WELCOME(nick string) string

func RPL_WHOISUSER

func RPL_WHOISUSER(nick, target, user, host, realName string) string

func RPL_WHOREPLY

func RPL_WHOREPLY(nick, channel, user, host, usersServer, target, weirdsymbols, realName string, hopcount int) string

func RPL_YOUREOPER

func RPL_YOUREOPER(nick string) string

func RPL_YOURHOST

func RPL_YOURHOST(nick string) string

func StartIRCServer

func StartIRCServer()

Creates a new IRC server. Assumes the presence of a mcxconfig that has been initiated.

func TOPIC

func TOPIC(nick, channel, topic string) string

Types

type IRCUser

type IRCUser struct {
	// The Nickname is the username is the pseudonym of the user
	Nickname string

	// Connection that is associated with the user.
	Conn net.Conn

	// Sending True to this will violently but cleanly disconnect the user
	Kill chan (bool)

	// Waitgroup that will block until this IRC user has disconnected or in any
	// way stopped existing.
	WaitForDeath sync.WaitGroup

	// user flags
	IsOperator bool // The only flag that is used by mcxircd! All other are ignored.
	Away       bool
	Invisible  bool
	Wallops    bool
	Restricted bool
	ModeS      bool
	// contains filtered or unexported fields
}

Represents an IRC user. This struct contains values that are hidden. You should never write to this structure.

func Handshake

func Handshake(conn net.Conn) (*IRCUser, bool)

handshake performs handshakes with connecting entities. In theory it figures out if the connecting entity is a user, a server, a service or something else, and creates such an object after the handshake is complete, but right now it can only handle users.

func NewIRCUser

func NewIRCUser(conn net.Conn, nickname string) (*IRCUser, bool)

Creates a new IRCUser. Everything written to the net.Conn will be parsed as user IRC commands and replies will be sent back. Returns the datastruct and true if successful.

func (*IRCUser) Identifier

func (myself *IRCUser) Identifier() string

Implements namedIRCItem

func (*IRCUser) RefAttach

func (myself *IRCUser) RefAttach() bool

Implements namedIRCItem

func (*IRCUser) RefDeattach

func (myself *IRCUser) RefDeattach()

Implements namedIRCItem

func (*IRCUser) SendMessage

func (myself *IRCUser) SendMessage(from string, bytes []byte) bool

Implements namedIRCItem

func (*IRCUser) SetSpamProtection

func (myself *IRCUser) SetSpamProtection(enable bool)

Enables or disables spam protection for this user. Useful for bots that are known to be friendly, and need to handle a lot of users!

type NSAddRequest

type NSAddRequest struct {
	Key     string
	Value   namedIRCItem
	ReplyTo chan (bool)
}

type NSDelRequest

type NSDelRequest struct {
	Key     string
	ReplyTo chan (bool)
}

type NSLookupRequest

type NSLookupRequest struct {
	Key     string
	ReplyTo chan (namedIRCItem)
}

type NSReplaceRequest

type NSReplaceRequest struct {
	Key     string
	NewKey  string
	ReplyTo chan (bool)
}

type NameSpaceStruct

type NameSpaceStruct struct {
	Lookup  chan (*NSLookupRequest)
	Add     chan (*NSAddRequest)
	Del     chan (*NSDelRequest)
	Replace chan (*NSReplaceRequest)
	Map     map[string]namedIRCItem
}
var NameSpace NameSpaceStruct

* Namespace is a singleton object that has a map[string]namedIRCItem, that * contains all named items in the known IRC-world. That is, users and channels. * Whenever anything needs to send a message to something else, and it does not * have a direct pointer to use, it looks it up using the namespace. * * Maybe this would be more effective with a mutex. Reads happen a lot more * often, and multiple reads can happen simultaneously. *

type ScanWordsOrCUTObj

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

func (*ScanWordsOrCUTObj) CUT

func (s *ScanWordsOrCUTObj) CUT() []byte

func (*ScanWordsOrCUTObj) ScanWordsOrCUT

func (s *ScanWordsOrCUTObj) ScanWordsOrCUT(data []byte, atEOF bool) (advance int, token []byte, err error)

type UserModeUpdate

type UserModeUpdate struct {
	User        *IRCUser
	ModeCommand string
	ReplyTo     chan (string)
}

Can be sent to IRCUser's when others than themselves change their modes. (OPERS or bots for example)

Jump to

Keyboard shortcuts

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