sesssrv

package
v0.0.0-...-cb3ca1d Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2019 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrCodeChannelNotFound    = srv.ErrCodeMax + 1
	ErrCodeBadAuthPassword    = iota
	ErrCodeNonActiveChannel   = iota
	ErrCodeSessionNotFound    = iota
	ErrCodeInvalidProductConf = iota
)

Common error codes for session server.

View Source
const (
	PathAuth   = "/session/auth"
	PathStart  = "/session/start"
	PathStop   = "/session/stop"
	PathUpdate = "/session/update"

	PathProductConfig = "/product/config"
)

Service API paths.

Variables

View Source
var (
	ErrChannelNotFound = &srv.Error{
		Code:    ErrCodeChannelNotFound,
		Message: "channel not found",
	}
	ErrBadAuthPassword = &srv.Error{
		Code:    ErrCodeBadAuthPassword,
		Message: "bad authentication password",
	}
	ErrNonActiveChannel = &srv.Error{
		Code:    ErrCodeNonActiveChannel,
		Message: "non-active channel",
	}
	ErrSessionNotFound = &srv.Error{
		Code:    ErrCodeSessionNotFound,
		Message: "session not found",
	}
	ErrInvalidProductConf = &srv.Error{
		Code:    ErrCodeInvalidProductConf,
		Message: "invalid product configuration",
	}
)

Common session server errors.

Functions

func Post

func Post(conf *srv.Config, username, password, path string,
	args, result interface{}) error

Post posts a request with given arguments and returns a response result.

Types

type AuthArgs

type AuthArgs struct {
	ClientID string `json:"clientId"`
	Password string `json:"password"`
}

AuthArgs is a set of authentication arguments.

type Config

type Config struct {
	*srv.Config
}

Config is a session server configuration.

func NewConfig

func NewConfig() *Config

NewConfig creates a default session server configuration.

type ProductArgs

type ProductArgs struct {
	Config map[string]string `json:"config"`
}

ProductArgs is a set of product arguments.

type Server

type Server struct {
	*srv.Server
	// contains filtered or unexported fields
}

Server is a service session server.

func NewServer

func NewServer(conf *Config, logger *util.Logger, db *reform.DB) *Server

NewServer creates a new session server.

type StartArgs

type StartArgs struct {
	ClientID   string `json:"clientId"`
	ClientIP   string `json:"clientIp"`
	ClientPort uint16 `json:"clientPort"`
}

StartArgs is a set of arguments for session starting.

type StopArgs

type StopArgs = updateStopArgs

StopArgs is a set of arguments for session stopping.

type UpdateArgs

type UpdateArgs = updateStopArgs

UpdateArgs is a set of arguments for session usage update.

Jump to

Keyboard shortcuts

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