airdispatch-go: github.com/airdispatch/airdispatch-go/server Index | Files | Directories

package server

import "github.com/airdispatch/airdispatch-go/server"

The Airdispatch Server framework provides a simple way to create an Airdispatch server.

It defines a common protocol that allows the common code to function without worrying about the storage mechanism of Airdispatch primatives.

Index

Package Files

basic.go doc.go handler.go messages.go server.go

Constants

const (
    Reset      = "\x1b[0m"
    Bright     = "\x1b[1m"
    Dim        = "\x1b[2m"
    Underscore = "\x1b[4m"
    Blink      = "\x1b[5m"
    Reverse    = "\x1b[7m"
    Hidden     = "\x1b[8m"

    FgBlack   = "\x1b[30m"
    FgRed     = "\x1b[31m"
    FgGreen   = "\x1b[32m"
    FgYellow  = "\x1b[33m"
    FgBlue    = "\x1b[34m"
    FgMagenta = "\x1b[35m"
    FgCyan    = "\x1b[36m"
    FgWhite   = "\x1b[37m"

    BgBlack   = "\x1b[40m"
    BgRed     = "\x1b[41m"
    BgGreen   = "\x1b[42m"
    BgYellow  = "\x1b[43m"
    BgBlue    = "\x1b[44m"
    BgMagenta = "\x1b[45m"
    BgCyan    = "\x1b[46m"
    BgWhite   = "\x1b[47m"
)

type BasicServer Uses

type BasicServer struct {
    ServerDelegate
}

func (BasicServer) HandleError Uses

func (BasicServer) HandleError(err *ServerError)

func (BasicServer) LogMessage Uses

func (BasicServer) LogMessage(toLog ...string)

type Handler Uses

type Handler interface {
    HandlesType(typ string) bool
    HandleMessage(typ string, data []byte, h message.Header, conn net.Conn) ([]message.Message, error)
}

type MessageDescription Uses

type MessageDescription struct {
    Name     string
    Location string
    Nonce    uint64
    // contains filtered or unexported fields
}

func CreateMessageDescription Uses

func CreateMessageDescription(name string, location string, from *identity.Address, to *identity.Address) *MessageDescription

func CreateMessageDescriptionFromBytes Uses

func CreateMessageDescriptionFromBytes(by []byte, h message.Header) (*MessageDescription, error)

func (*MessageDescription) GenerateTransferRequest Uses

func (m *MessageDescription) GenerateTransferRequest() *TransferMessage

func (*MessageDescription) Header Uses

func (m *MessageDescription) Header() message.Header

func (*MessageDescription) ToBytes Uses

func (m *MessageDescription) ToBytes() []byte

func (*MessageDescription) Type Uses

func (m *MessageDescription) Type() string

type MessageList Uses

type MessageList struct {
    Length uint64
    // contains filtered or unexported fields
}

--- Multi-Messages ---

func CreateMessageList Uses

func CreateMessageList(from *identity.Address, to *identity.Address) *MessageList

func CreateMessageListFromBytes Uses

func CreateMessageListFromBytes(b []byte, h message.Header) (*MessageList, error)

func (*MessageList) Header Uses

func (m *MessageList) Header() message.Header

func (*MessageList) ToBytes Uses

func (m *MessageList) ToBytes() []byte

func (*MessageList) Type Uses

func (m *MessageList) Type() string

type Server Uses

type Server struct {
    LocationName string
    Key          *identity.Identity
    Delegate     ServerDelegate
    Handlers     []Handler
    Router       routing.Router
    // Control Channels
    Start chan bool
    Quit  chan bool
}

The server structure tahat holds all of the necessary instance variables

func (*Server) StartServer Uses

func (s *Server) StartServer(port string) error

Function that starts the server on a specific port

type ServerDelegate Uses

type ServerDelegate interface {
    HandleError(err *ServerError)
    LogMessage(toLog ...string)

    SaveMessageDescription(desc *message.EncryptedMessage)

    RetrieveDataForUser(id string, author *identity.Address, forAddr *identity.Address) (*message.EncryptedMessage, io.ReadCloser)
    RetrieveMessageForUser(id string, author *identity.Address, forAddr *identity.Address) *message.EncryptedMessage
    RetrieveMessageListForUser(since uint64, author *identity.Address, forAddr *identity.Address) []*message.EncryptedMessage
}

This interface defines the functions that an Airdispatch server must respond to in order to properly function

type ServerError Uses

type ServerError struct {
    Location string
    Error    error
}

A structure that stores any errors generated by the Server framework

type TransferMessage Uses

type TransferMessage struct {
    Name   string
    Author *identity.Address
    Data   bool
    // contains filtered or unexported fields
}

func CreateTransferMessage Uses

func CreateTransferMessage(name string, from *identity.Address, to *identity.Address, author *identity.Address) *TransferMessage

func CreateTransferMessageFromBytes Uses

func CreateTransferMessageFromBytes(by []byte, h message.Header) (*TransferMessage, error)

func (*TransferMessage) Header Uses

func (m *TransferMessage) Header() message.Header

func (*TransferMessage) ToBytes Uses

func (m *TransferMessage) ToBytes() []byte

func (*TransferMessage) Type Uses

func (m *TransferMessage) Type() string

type TransferMessageList Uses

type TransferMessageList struct {
    Author *identity.Address
    Since  uint64
    // contains filtered or unexported fields
}

func CreateTransferMessageList Uses

func CreateTransferMessageList(since uint64, from *identity.Address, to *identity.Address, author *identity.Address) *TransferMessageList

func CreateTransferMessageListFromBytes Uses

func CreateTransferMessageListFromBytes(by []byte, h message.Header) (*TransferMessageList, error)

func (*TransferMessageList) Header Uses

func (m *TransferMessageList) Header() message.Header

func (*TransferMessageList) ToBytes Uses

func (m *TransferMessageList) ToBytes() []byte

func (*TransferMessageList) Type Uses

func (m *TransferMessageList) Type() string

Directories

PathSynopsis
server

Package server imports 13 packages (graph). Updated 2016-07-15. Refresh now. Tools for package owners. This is an inactive package (no imports and no commits in at least two years).