goweb

package module
v1.2.7 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2021 License: BSD-2-Clause Imports: 17 Imported by: 0

README

goweb

Web server implementation

Documentation

Index

Constants

View Source
const (
	CommandStart   = "start"
	CommandStop    = "stop"
	CommandRestart = "restart"
	CommandStatus  = "status"
	CommandWeb     = "web"
)

Variables

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{}

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
	}
}

Config Web configuration

type ConnectionBindings

type ConnectionBindings struct {
	// contains filtered or unexported fields
}

Bindings

func NewConnectionBindings

func NewConnectionBindings() *ConnectionBindings

New bindings

func (*ConnectionBindings) Bind

Associate connection with id

func (*ConnectionBindings) GetBindingId

Get participantId by connection id

func (*ConnectionBindings) GetBindingIdentifiers added in v1.2.2

func (cb *ConnectionBindings) GetBindingIdentifiers() []BindingIdentifier

Get all bindings identifiers

func (*ConnectionBindings) GetConnectionId

Get connection Id by id

func (*ConnectionBindings) UnBind

Unbind connection with id

type ConnectionEvent

type ConnectionEvent struct {
	// Name of the event
	Name ConnectionEventName
	// Mark when event happens
	Done chan struct{}
}

Events that can be

type ConnectionEventListeners

type ConnectionEventListeners struct {
	// contains filtered or unexported fields
}

Listeners struct

func NewConnectionEventListeners

func NewConnectionEventListeners() *ConnectionEventListeners

New Connection event Listener

func (*ConnectionEventListeners) Dispatch

Dispatch event

func (*ConnectionEventListeners) Get

Get events

func (*ConnectionEventListeners) Register

func (cel *ConnectionEventListeners) Register(id ConnectionIdentifier, name ConnectionEventName) <-chan struct{}

Register connection listener

func (*ConnectionEventListeners) Unregister

Unregister connection event listener

func (*ConnectionEventListeners) UnregisterConnection

Unregister connection listener

type ConnectionEventName

type ConnectionEventName string

Event Name

type ConnectionIdentifier

type ConnectionIdentifier string

Connection unique identifier

type Connections

type Connections struct {
	// contains filtered or unexported fields
}

Connections

func NewConnections

func NewConnections() *Connections

Init tcp connection pool

func (*Connections) Get

Get connection if exists

func (*Connections) GetIdentifiers added in v1.2.1

func (cs *Connections) GetIdentifiers() []ConnectionIdentifier

Get all identifiers

func (*Connections) Len

func (cs *Connections) Len() int

Connections len

func (*Connections) Set

Set connection

func (*Connections) Unset

Unset connection if exists

Jump to

Keyboard shortcuts

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