state

package
v0.0.0-...-86b787e Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2020 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const AppStateKey = "AppState"
View Source
const AssetsFolder = "static"
View Source
const FlashFail = "FlashFail"
View Source
const FlashSuccess = "FlashSuccess"
View Source
const FormStateKey = "FormState"
View Source
const SessionName = "_kushtaka"
View Source
const UserStateKey = "UserState"
View Source
const ViewStateKey = "ViewData"

Variables

This section is empty.

Functions

func AcmeProdLocation

func AcmeProdLocation() string

func AcmeTestLocation

func AcmeTestLocation() string

func ClonesLocation

func ClonesLocation() string

func DataDirLocation

func DataDirLocation() string

func DbLocation

func DbLocation() string

func DbLocationWithName

func DbLocationWithName(dbname string) string

func DbSensorLocation

func DbSensorLocation() string

func DbWithLocationWithName

func DbWithLocationWithName(location, dbname string) string

func LogsLocation

func LogsLocation() string

func NewRender

func NewRender(layout string, box *packr.Box) *render.Render

func SensorCfgLocation

func SensorCfgLocation() string

func SensorClonesLocation

func SensorClonesLocation() string

func ServerCfgLocation

func ServerCfgLocation() string

func ServerClonesLocation

func ServerClonesLocation() string

func SessionLocation

func SessionLocation() string

func SetupFileStructure

func SetupFileStructure(box *packr.Box) error

SetupFileStructure makes sure the files on the file system are in the correct state if they are not, the application must fail

func TmpDirLocation

func TmpDirLocation() string

func UpdaterCfgLocation

func UpdaterCfgLocation() string

func Wd

func Wd() string

Wd returns the acting current working directory this path can change for certain configs

Types

type App

type App struct {
	Response  http.ResponseWriter
	Request   *http.Request
	DB        *storm.DB
	Settings  *models.Settings
	Session   *sessions.Session
	FileStore *sessions.FilesystemStore
	Box       *packr.Box
	View      *View
	User      *models.User
	Render    *render.Render
	ServerHub *ServerHub
	Reboot    chan bool
	LE        chan models.LE
}

func NewApp

func NewApp(cfg *Config) (*App, error)

NewApp returns and instance of App App instances live during the lifecycle of a single http request

func Restore

func Restore(r *http.Request) (*App, error)

func (*App) EndSession

func (app *App) EndSession() error

func (*App) Fail

func (app *App) Fail(msg string)

func (*App) NotFound

func (app *App) NotFound(msg string, err error)

func (*App) RestoreFlash

func (app *App) RestoreFlash()

func (*App) RestoreForm

func (app *App) RestoreForm()

func (*App) RestoreState

func (app *App) RestoreState()

func (*App) RestoreURI

func (app *App) RestoreURI()

func (*App) RestoreUser

func (app *App) RestoreUser()

func (*App) Success

func (app *App) Success(msg string)

type Client

type Client struct {
	SensorID int64
	// contains filtered or unexported fields
}

Client is a middleman between the websocket connection and the hub.

type ClientMsg

type ClientMsg struct {
	SensorID int64
	Msg      string
}

type Config

type Config struct {
	Reponse         http.ResponseWriter
	Request         *http.Request
	DB              *storm.DB
	Session         *sessions.Session
	Settings        *models.Settings
	FilesystemStore *sessions.FilesystemStore
	Box             *packr.Box
	Reboot          chan bool
	LE              chan models.LE
}

type Crumb

type Crumb struct {
	Name string
	Link string
}

type Forms

type Forms struct {
	Setup      *models.User
	Login      *models.User
	Smtp       *models.Smtp
	Team       *models.Team
	TeamMember *models.Team
	Token      *models.Token
	Sensor     *models.Sensor
	Service    *models.Service
	User       *models.User
	Clone      *models.Clone
}

func NewForms

func NewForms() *Forms
type Links struct {
	Setup bool
	Login bool

	Dashboard string
	Tokens    string
	Sensors   string
	Users     string
	Teams     string
	Https     string
	Smtp      string
	Clones    string
}

type ServerHub

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

ServerHub maintains the set of active clients and broadcasts messages to the clients.

func NewServerHub

func NewServerHub(db *storm.DB) *ServerHub

func (*ServerHub) Run

func (h *ServerHub) Run()

func (*ServerHub) ServeWs

func (hub *ServerHub) ServeWs(w http.ResponseWriter, r *http.Request)

serveWs handles websocket requests from the peer.

type View

type View struct {
	FlashSuccess   []string
	FlashFail      []string
	Version        string
	Date           string
	Commit         string
	URI            string
	Crumbs         []*Crumb
	User           *models.User
	State          *models.State
	Links          *Links
	Forms          *Forms
	LETests        []models.LETest
	Clones         []models.Clone
	Team           *models.Team
	Teams          []models.Team
	Token          *models.Token
	Tokens         []models.Token
	Sensor         *models.Sensor
	Sensors        []models.Sensor
	Users          []models.User
	SensorServices []models.ServiceCfg
	Events         []events.EventManager
	Pagi           *helpers.Pagi
}

View is built, rendered, and cleared every HTTP request

func NewView

func NewView() *View

func (*View) AddCrumb

func (v *View) AddCrumb(name, link string)

func (*View) Clear

func (v *View) Clear()

Jump to

Keyboard shortcuts

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