Documentation ¶
Overview ¶
Package tetra implements the core for a TS6 pseudoserver. It also has lua and moonscript loading support to add functionality at runtime.
Index ¶
- Constants
- Variables
- func Auth()
- func Burst()
- func Connect(host, port string) (err error)
- func DelHandler(verb string, uuid string) (err error)
- func DelHook(hook *Hook) (err error)
- func DelService(service string) (err error)
- func GetChannelStats(...interface{})
- func GetNetworkStats(...interface{})
- func GetYo(name string) (client *yo.Client, err error)
- func Main()
- func NewTetra(cpath string)
- func NextUID() string
- func ProcessLine(line string)
- func Quit()
- func RunHook(verb string, args ...interface{}) (err error)
- func StickConfig()
- func UnloadScript(name string) error
- func WebApp()
- type ChanUser
- type Channel
- type Client
- func (r *Client) Chghost(target *Client, newhost string) (err error)
- func (r *Client) Euid() string
- func (r *Client) IsChannel() bool
- func (r *Client) IsOper() bool
- func (r *Client) Join(channame string)
- func (r *Client) Kill(target *Client, reason string)
- func (c *Client) NewCommand(verb string, handler func(*Client, Targeter, []string) string) (cmd *Command, err error)
- func (r *Client) Notice(destination Targeter, message string)
- func (r *Client) OperLog(message string)
- func (r *Client) Part(channame string) bool
- func (r *Client) Privmsg(destination Targeter, message string)
- func (r *Client) Quit()
- func (r *Client) ServicesLog(message string)
- func (r *Client) Target() string
- type ClientSet
- type Command
- type Connection
- type Handler
- type Hook
- type Invocation
- type Script
- func (script *Script) AddLuaCommand(verb string, name string) error
- func (script *Script) AddLuaHook(verb string, name string) error
- func (script *Script) AddLuaProtohook(verb string, name string) error
- func (s *Script) Call(command string, source *Client, dest Targeter, args []string) (string, error)
- type Server
- type Targeter
Constants ¶
const ( INV_COMMAND = 0x0001 INV_NAMHOOK = 0x0002 INV_PROHOOK = 0x0004 )
The different kinds of invocations that can be called upon.
Variables ¶
var ( Conn *Connection Info *Server Clients *ClientSet Channels map[string]*Channel Bursted bool Handlers map[string]map[string]*Handler Services map[string]*Client Servers map[string]*Server Scripts map[string]*Script Hooks map[string][]*Hook ActiveConfig *config.Config Log *log.Logger Uplink *Server Etcd *etcd.Client Atheme *atheme.Atheme Cron *cron.Cron )
Struct Tetra contains all fields for
var (
Libraries map[string]luar.Map
)
Functions ¶
func DelHandler ¶
DelHandler deletes a handler for a given protocol verb by the UUID of the handler.
func DelService ¶
DelService deletes a service from the network or returns an error.
func GetChannelStats ¶
func GetChannelStats(...interface{})
func GetNetworkStats ¶
func GetNetworkStats(...interface{})
func GetYo ¶
GetYo returns an instance of yo.Client based on the username being present in the apikeys section of the configuration file.
func NewTetra ¶
func NewTetra(cpath string)
NewTetra returns a new instance of Tetra based on a config file located at cpath. This also kicks off the worker goroutines and statistics collection, as well as seeding basic protocol verb handlers.
func ProcessLine ¶
func ProcessLine(line string)
ProcessLine processes a line as if it came from the server.
func RunHook ¶
RunHook runs a hook in parallel across multiple goroutines, one per implementaion of the hook. Returns error if there is no such hook.
func StickConfig ¶
func StickConfig()
StickConfig creates Clients based off of the config file and handles module autoloads.
func UnloadScript ¶
Unload a script and delete its commands and handlers
Types ¶
type ChanUser ¶
Struct ChanUser is a wrapper around a Channel and a Client to represent membership in a Channel.
type Channel ¶
type Channel struct { Name string Ts int64 Modes int Clients map[string]*ChanUser Lists map[int][]string Gauge metrics.Gauge Metadata map[string]string // contains filtered or unexported fields }
Struct Channel holds all the relevant data for an IRC channel. A lot of this is not just things defined in RFC 1459, but extensions like the TS. This implements Targeter
func NewChannel ¶
NewChannel creates a new channel with a given name and ts.
func (*Channel) AddChanUser ¶
AddChanUser adds a client to the channel, returning the membership.
func (*Channel) DelChanUser ¶
DelChanUser deletes a client from a channel or returns an error.
type Client ¶
type Client struct { Nick string User string Host string VHost string Ip string Account string Uid string Gecos string Permissions int Umodes int Kind string Ts int64 Channels map[string]*Channel Server *Server Commands map[string]*Command Certfp string Metadata map[string]string // contains filtered or unexported fields }
Struct Client holds information about a client on the IRC network.
func AddService ¶
AddService adds a new service Client to the network.
func (*Client) NewCommand ¶
func (c *Client) NewCommand(verb string, handler func(*Client, Targeter, []string) string) (cmd *Command, err error)
NewCommand returns a new command instance.
func (*Client) ServicesLog ¶
ServicesLog logs a given message to the services snoop channel.
type ClientSet ¶
Struct Clients defines the set of clients on the network, indexed by either nickname (in capital letters) or UID.
func (*ClientSet) ChangeNick ¶
ChangeNick changes a client's nickname and updates the ByNick map.
type Command ¶
type Command struct { Impl func(*Client, Targeter, []string) string Uuid string Script *Script Verb string Owner *Client NeedsOper bool }
Struct command holds everything needed for a bot command.
type Connection ¶
type Connection struct { Conn net.Conn Log *log.Logger Reader *bufio.Reader Tp *textproto.Reader Buffer chan string Debug bool // contains filtered or unexported fields }
Struct Connection contains everything needed for the socket connection Tetra uses.
func (*Connection) GetLine ¶
func (c *Connection) GetLine() (line string, err error)
GetLine returns a new line from the server.
func (*Connection) SendLine ¶
func (c *Connection) SendLine(line string, stuff ...interface{})
SendLine buffers a line to be sent to the server.
type Handler ¶
Struct Handler defines a raw protocol verb handler. Please do not use this unless you have good reason to.
func AddHandler ¶
AddHandler adds a handler for a given verb.
type Hook ¶
type Hook struct { Uuid string Owner *Script Verb string // contains filtered or unexported fields }
Struct Hook defines a command hook for Tetra. This can be used for hooking on events (like being yo'd).
type Invocation ¶
type Invocation struct { Kind int Args []interface{} Reply chan string Function *luar.LuaObject Client *Client Target Targeter Line *r1459.RawLine }
Struct Invocation represents an event from Go->Lua.
type Script ¶
type Script struct { Name string L *lua.State Log *log.Logger Handlers map[string]*Handler Commands map[string]*Command Hooks []*Hook Service string Client *Client Uuid string Kind string Trigger chan []interface{} }
Struct Script implements a Lua scripting interface to Tetra.
func LoadScript ¶
LoadScript finds and loads the appropriate script by a given short name (tetra/die).
func (*Script) AddLuaCommand ¶
AddLuaCommand adds a new command to a script from a lua context.
func (*Script) AddLuaHook ¶
AddLuaHook adds a named hook from lua.
func (*Script) AddLuaProtohook ¶
AddLuaProtohook adds a lua function as a protocol hook.
type Server ¶
type Server struct { Sid string Name string Gecos string Links []*Server Count int Counter metrics.Gauge Hops int Capab []string }
Struct Server holds information for a TS6 server.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package config holds the configuration for Tetra.
|
Package config holds the configuration for Tetra. |
Package modes contains a bunch of constants and lookup tables that are a pain to use without this file.
|
Package modes contains a bunch of constants and lookup tables that are a pain to use without this file. |
Package script is for the resuable lua scripting engine that Tetra uses.
|
Package script is for the resuable lua scripting engine that Tetra uses. |
charybdis
Package charybdis contains wrapped functions taken directly from the charybdis source tree.
|
Package charybdis contains wrapped functions taken directly from the charybdis source tree. |
crypto
Package crypto is for cryptographic or similar kinds of functions.
|
Package crypto is for cryptographic or similar kinds of functions. |
strings
Package strings contains Tetra's string manipulation functions that are exposed to lua scripts.
|
Package strings contains Tetra's string manipulation functions that are exposed to lua scripts. |
Package web is a series of negroni middlewares for Tetra.
|
Package web is a series of negroni middlewares for Tetra. |