config

package
v0.0.0-...-3339666 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2013 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	HandshakeTimeout time.Duration
	HttpAddr         string
	Auth             evthandler.Authenticator
	ErrorHandler     evthandler.ErrorHandler
	// contains filtered or unexported fields
}

func Parse

func Parse(reader io.Reader) (config *Config, err error)

func ParseFile

func ParseFile(filename string) (config *Config, err error)

func (*Config) AllServices

func (self *Config) AllServices() []string

func (*Config) Authenticate

func (self *Config) Authenticate(srv, usr, connId, token, addr string) (bool, []string, error)

func (*Config) OnError

func (self *Config) OnError(addr net.Addr, err error)

func (*Config) ReadConfig

func (self *Config) ReadConfig(srv string) *ServiceConfig

type ServiceConfig

type ServiceConfig struct {
	ServiceName       string
	MaxNrConns        int
	MaxNrUsers        int
	MaxNrConnsPerUser int

	MsgCache msgcache.Cache

	LoginHandler          evthandler.LoginHandler
	LogoutHandler         evthandler.LogoutHandler
	MessageHandler        evthandler.MessageHandler
	ForwardRequestHandler evthandler.ForwardRequestHandler
	ErrorHandler          evthandler.ErrorHandler

	// Push related web hooks
	SubscribeHandler   evthandler.SubscribeHandler
	UnsubscribeHandler evthandler.UnsubscribeHandler

	PushService push.Push
}

func (*ServiceConfig) Cache

func (self *ServiceConfig) Cache() msgcache.Cache

func (*ServiceConfig) CacheMessage

func (self *ServiceConfig) CacheMessage(username string, mc *rpc.MessageContainer, ttl time.Duration) (string, error)

func (*ServiceConfig) OnError

func (self *ServiceConfig) OnError(c connDescriptor, err error)

func (*ServiceConfig) OnLogin

func (self *ServiceConfig) OnLogin(c connDescriptor)

func (*ServiceConfig) OnLogout

func (self *ServiceConfig) OnLogout(c connDescriptor, reason error)

func (*ServiceConfig) OnMessage

func (self *ServiceConfig) OnMessage(c connDescriptor, msg *rpc.Message)

func (*ServiceConfig) Push

func (self *ServiceConfig) Push(username, senderService, senderName string, info map[string]string, msgId string, size int)

func (*ServiceConfig) ShouldForward

func (self *ServiceConfig) ShouldForward(fwdreq *rpc.ForwardRequest) (shouldForward, shouldPush bool, pushInfo map[string]string)

func (*ServiceConfig) Subscribe

func (self *ServiceConfig) Subscribe(req *rpc.SubscribeRequest)

Jump to

Keyboard shortcuts

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