core

package
Version: v2.1.1+incompatible Latest Latest
Warning

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

Go to latest
Published: May 22, 2020 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrTimeout = errors.New("Timeout error")

ErrTimeout describes an error related to timing out

View Source
var ErrUnexpected = errors.New("Unexpected error")

ErrUnexpected describes an unexpected error

Functions

func SetupLogger

func SetupLogger(spec *config.Specification)

SetupLogger sets the logger for the proper settings based on the environment

Types

type Controller

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

Controller holds all handler functions for the API

func NewController

func NewController(spec *config.Specification, fileServer http.Handler) *Controller

NewController creates a new instance of Controller

func (*Controller) ExitPreHook

func (c *Controller) ExitPreHook() chan bool

ExitPreHook is a function that can recognise when the application is being closed and cleans up all background running processes

func (*Controller) ListStreamHandler

func (c *Controller) ListStreamHandler(w http.ResponseWriter, r *http.Request, _ httprouter.Params)

ListStreamHandler is the HTTP handler of the GET /list call

func (*Controller) StartStreamHandler

func (c *Controller) StartStreamHandler(w http.ResponseWriter, r *http.Request, _ httprouter.Params)

StartStreamHandler is an HTTP handler for the POST /start endpoint

func (*Controller) StaticFileHandler

func (c *Controller) StaticFileHandler(w http.ResponseWriter, req *http.Request, ps httprouter.Params)

StaticFileHandler is HTTP handler for direct file requests

func (*Controller) StopStreamHandler

func (c *Controller) StopStreamHandler(w http.ResponseWriter, r *http.Request, p httprouter.Params)

StopStreamHandler is the HTTP handler of the stop stream request - POST /stop

type IController

type IController interface {
	ListStreamHandler(w http.ResponseWriter, r *http.Request, _ httprouter.Params)  // handler - GET /list
	StartStreamHandler(w http.ResponseWriter, r *http.Request, _ httprouter.Params) // handler - POST /start
	StaticFileHandler(w http.ResponseWriter, r *http.Request, _ httprouter.Params)  // handler - GET /stream/{id}/{file}
	StopStreamHandler(w http.ResponseWriter, r *http.Request, _ httprouter.Params)  // handler - POST /stop
	ExitPreHook() chan bool                                                         // runs before the application exits to clean up
	// contains filtered or unexported methods
}

IController describes main functions for the controller

type StopDTO

type StopDTO struct {
	ID     string `json:"id"`
	Alias  string `json:"alias"`
	Wait   bool   `json:"wait"`
	Remove bool   `json:"remove"`
}

StopDTO describes a DTO for the /remove and /stop endpoints

type StreamDTO

type StreamDTO struct {
	URI   string `json:"uri"`
	Alias string `json:"alias"`
}

StreamDTO describes an uri where the client can access the stream

type SummariseDTO

type SummariseDTO struct {
	Running bool   `json:"running"`
	URI     string `json:"uri"`
	ID      string `json:"id"`
	Alias   string `json:"alias"`
}

SummariseDTO describes each stream and their state of running

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL