Documentation
¶
Index ¶
- Constants
- Variables
- func DecomposeCommand(command *gocli.Command) (action string, arguments []gocli.Argument, e porterr.IError)
- func NewMiddlewareCollection(config Config, app gocli.Application, maxLogBodySize int64) *middlewareCollection
- type Application
- type BindingIdentifier
- type Config
- type ConnectionBindings
- func (cb *ConnectionBindings) Bind(bId BindingIdentifier, id ConnectionIdentifier) *ConnectionBindings
- func (cb *ConnectionBindings) GetBindingId(id ConnectionIdentifier) BindingIdentifier
- func (cb *ConnectionBindings) GetBindingIdentifiers() []BindingIdentifier
- func (cb *ConnectionBindings) GetConnectionId(bId BindingIdentifier) ConnectionIdentifier
- func (cb *ConnectionBindings) UnBind(bId BindingIdentifier, id ConnectionIdentifier) *ConnectionBindings
- type ConnectionEvent
- type ConnectionEventListeners
- func (cel *ConnectionEventListeners) Dispatch(id ConnectionIdentifier, name ConnectionEventName) *ConnectionEventListeners
- func (cel *ConnectionEventListeners) Get(id ConnectionIdentifier) []ConnectionEvent
- func (cel *ConnectionEventListeners) Register(id ConnectionIdentifier, name ConnectionEventName) <-chan struct{}
- func (cel *ConnectionEventListeners) Unregister(id ConnectionIdentifier, name ConnectionEventName) *ConnectionEventListeners
- func (cel *ConnectionEventListeners) UnregisterConnection(id ConnectionIdentifier) *ConnectionEventListeners
- type ConnectionEventName
- type ConnectionIdentifier
- type Connections
- func (cs *Connections) Get(id ConnectionIdentifier) net.Conn
- func (cs *Connections) GetIdentifiers() []ConnectionIdentifier
- func (cs *Connections) Len() int
- func (cs *Connections) Set(id ConnectionIdentifier, conn net.Conn) *Connections
- func (cs *Connections) Unset(id ConnectionIdentifier) *Connections
- type TLSConfig
Constants ¶
const ( CommandStart = "start" CommandStop = "stop" CommandRestart = "restart" CommandStatus = "status" CommandWeb = "web" )
Variables ¶
var CommandActions = []string{ CommandStart, CommandStop, CommandRestart, CommandStatus, }
Functions ¶
func DecomposeCommand ¶ added in v1.2.0
func DecomposeCommand(command *gocli.Command) (action string, arguments []gocli.Argument, e porterr.IError)
DecomposeCommand Parse gocli.Command
func NewMiddlewareCollection ¶
func NewMiddlewareCollection(config Config, app gocli.Application, maxLogBodySize int64) *middlewareCollection
NewMiddlewareCollection New Middleware Collection Init Method
Types ¶
type Application ¶
type Application struct {
// The console application base interface.
// Required for start
gocli.Application
// contains filtered or unexported fields
}
Application Web Application struct
func NewApplication ¶
func NewApplication(config Config, app gocli.Application, connState func(net.Conn, http.ConnState)) *Application
NewApplication Init Web Application
func (*Application) Listen ¶
func (a *Application) Listen(routes http.Handler)
Listen Make server and listen
func (*Application) WebCommander ¶ added in v1.2.0
func (a *Application) WebCommander(command *gocli.Command)
WebCommander Web command processor
type BindingIdentifier ¶
type BindingIdentifier interface{}
BindingIdentifier Identifier for bind with connection
type Config ¶
type Config struct {
// Web application port
Port int
// Web application server host
Host string
// Web application url. For logging
Url string
// Server timeouts
Timeout struct {
// Timeout read
Read int
// Timeout write
Write int
// Timeout idle
Idle int
}
// Web debug flag
Debug bool
// TLS config
Security TLSConfig
}
Config Web configuration
type ConnectionBindings ¶
type ConnectionBindings struct {
// contains filtered or unexported fields
}
ConnectionBindings Bindings
func NewConnectionBindings ¶
func NewConnectionBindings() *ConnectionBindings
NewConnectionBindings New bindings
func (*ConnectionBindings) Bind ¶
func (cb *ConnectionBindings) Bind(bId BindingIdentifier, id ConnectionIdentifier) *ConnectionBindings
Bind Associate connection with id
func (*ConnectionBindings) GetBindingId ¶
func (cb *ConnectionBindings) GetBindingId(id ConnectionIdentifier) BindingIdentifier
GetBindingId Get participantId by connection id
func (*ConnectionBindings) GetBindingIdentifiers ¶ added in v1.2.2
func (cb *ConnectionBindings) GetBindingIdentifiers() []BindingIdentifier
GetBindingIdentifiers Get all bindings identifiers
func (*ConnectionBindings) GetConnectionId ¶
func (cb *ConnectionBindings) GetConnectionId(bId BindingIdentifier) ConnectionIdentifier
GetConnectionId Get connection identifier by id
func (*ConnectionBindings) UnBind ¶
func (cb *ConnectionBindings) UnBind(bId BindingIdentifier, id ConnectionIdentifier) *ConnectionBindings
UnBind connection with id
type ConnectionEvent ¶
type ConnectionEvent struct {
// Name of the event
Name ConnectionEventName
// Mark when event happens
Done chan struct{}
}
ConnectionEvent Events that can be
type ConnectionEventListeners ¶
type ConnectionEventListeners struct {
// contains filtered or unexported fields
}
ConnectionEventListeners Listeners struct
func NewConnectionEventListeners ¶
func NewConnectionEventListeners() *ConnectionEventListeners
NewConnectionEventListeners New Connection event listener
func (*ConnectionEventListeners) Dispatch ¶
func (cel *ConnectionEventListeners) Dispatch(id ConnectionIdentifier, name ConnectionEventName) *ConnectionEventListeners
Dispatch event
func (*ConnectionEventListeners) Get ¶
func (cel *ConnectionEventListeners) Get(id ConnectionIdentifier) []ConnectionEvent
Get events
func (*ConnectionEventListeners) Register ¶
func (cel *ConnectionEventListeners) Register(id ConnectionIdentifier, name ConnectionEventName) <-chan struct{}
Register connection listener
func (*ConnectionEventListeners) Unregister ¶
func (cel *ConnectionEventListeners) Unregister(id ConnectionIdentifier, name ConnectionEventName) *ConnectionEventListeners
Unregister connection event listener
func (*ConnectionEventListeners) UnregisterConnection ¶
func (cel *ConnectionEventListeners) UnregisterConnection(id ConnectionIdentifier) *ConnectionEventListeners
UnregisterConnection unregister connection listener
type ConnectionIdentifier ¶
type ConnectionIdentifier string
ConnectionIdentifier Connection unique identifier
type Connections ¶
type Connections struct {
// contains filtered or unexported fields
}
Connections contains connection map
func (*Connections) Get ¶
func (cs *Connections) Get(id ConnectionIdentifier) net.Conn
Get connection if exists
func (*Connections) GetIdentifiers ¶ added in v1.2.1
func (cs *Connections) GetIdentifiers() []ConnectionIdentifier
GetIdentifiers get all identifiers
func (*Connections) Set ¶
func (cs *Connections) Set(id ConnectionIdentifier, conn net.Conn) *Connections
Set connection
func (*Connections) Unset ¶
func (cs *Connections) Unset(id ConnectionIdentifier) *Connections
Unset connection if exists