server

package
v0.0.0-...-1c136e6 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2016 License: BSD-2-Clause Imports: 16 Imported by: 0

Documentation

Overview

Package server contains the server functionality.

Index

Constants

View Source
const (
	// SoftwareName is the server software's name.
	SoftwareName = "excessiveircd"

	// SoftwareVersion is the server's software version.
	SoftwareVersion = "0.0.1"
)

Variables

This section is empty.

Functions

func Start

func Start()

Start starts the primary server. This blocks until the server stops. This should only be called once.

Types

type CClose

type CClose struct {
	Reason string
}

CClose is used to inform the Client that it must immediately close the connection. Reason is used in QUIT messages and sent to the connection, if possible.

type CInitialize

type CInitialize struct{}

CInitialize is used to inform the Client that it needs to initialize. These include pre-registration tasks such as looking up the hostname and checking identd.

type CMessage

type CMessage struct {
	Message *irc.Message
}

CMessage is used to inform the Client of an incoming message that has been parsed and is ready to be acted upon.

type Client

type Client struct {
	ID     uuid.UUID
	Server *Server
	Logger *log.Logger

	Info struct {
		*irc.Prefix

		// Client's real name/GECOS
		Real string

		// The time at which the client began owning this nickname. This is
		// primarily used for collision resolution.
		ChangeTime time.Time
	}

	// The time at which this client finished registration.
	ConnectTime time.Time

	Registered bool
	Closed     bool

	IP net.IP

	Events chan interface{}

	*sync.RWMutex
	// contains filtered or unexported fields
}

Client represents a client connection.

func NewClient

func NewClient(conn net.Conn, server *Server) *Client

NewClient creates and initializes a new Client. Once done initializing, it registers the new client with the given Server.

type Command

type Command struct {
	Func func(client *Client, message *irc.Message) *CommandError

	MinimumParams int

	Registered   bool
	Unregistered bool
}

Command represents a command specification.

type CommandError

type CommandError struct {
	// Numeric is the numeric to use when sending the CommandError to the
	// Client.
	// If Numeric is an empty string, Param[0] is sent as a server notification
	// instead of a numeric.
	Numeric string
	Params  []string
}

CommandError is an error returned by a Command Func.

type ListenPort

type ListenPort struct {
	IP   net.IP
	Port uint16

	TLS *tls.Config
}

ListenPort represents a port to be listened on. IP specifies the local IP address to listen on. Port specifies the port number to listen on. TLS specifies the TLS configuration to use. If nil, the port listens for cleartext traffic.

type SChangeNick

type SChangeNick struct {
	NewNick string
	Client  *Client
	Reply   chan bool
}

SChangeNick is used to inform the server that a client has changed their nickname and needs to be reregistered.

type SDeregisterClient

type SDeregisterClient struct {
	Client *Client
	Reply  chan struct{}
}

SDeregisterClient is used to inform the server that a client has disconnected and registration information needs to be discarded.

type SRegisterClient

type SRegisterClient struct {
	Client *Client
	Reply  chan bool
}

SRegisterClient is used to inform the server that a client has sent all registration information and is ready to be registered. A boolean is sent on the reply channel stating whether or not this registration was successful.

type Server

type Server struct {
	ID      uuid.UUID
	Name    string
	Network string

	Logger *log.Logger

	Events chan interface{}

	Clients map[string]*Client

	Listeners []net.Listener
}

Server represents a local server.

func (*Server) FriendlyName

func (s *Server) FriendlyName() string

FriendlyName is a convenience function to return the server's display name.

func (*Server) Start

func (s *Server) Start() error

Start starts the server's event loop and all of its listeners.

Jump to

Keyboard shortcuts

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