server

package
v0.0.0-...-8d63230 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2024 License: GPL-3.0 Imports: 42 Imported by: 0

Documentation

Overview

Package server generated by go-bindata.// sources: web/static/favicon.png web/static/fonts/Roboto-Black.ttf web/static/fonts/Roboto-BlackItalic.ttf web/static/fonts/Roboto-Bold.ttf web/static/fonts/Roboto-BoldItalic.ttf web/static/fonts/Roboto-Italic.ttf web/static/fonts/Roboto-Light.ttf web/static/fonts/Roboto-LightItalic.ttf web/static/fonts/Roboto-Medium.ttf web/static/fonts/Roboto-MediumItalic.ttf web/static/fonts/Roboto-Regular.ttf web/static/fonts/Roboto-Thin.ttf web/static/fonts/Roboto-ThinItalic.ttf web/static/jquery.min.js web/static/jquery.simple.websocket.js web/static/roboto.css web/static/script.js web/static/semantic/semantic.min.css web/static/semantic/semantic.min.js web/static/semantic/themes/default/assets/fonts/brand-icons.eot web/static/semantic/themes/default/assets/fonts/brand-icons.svg web/static/semantic/themes/default/assets/fonts/brand-icons.ttf web/static/semantic/themes/default/assets/fonts/brand-icons.woff web/static/semantic/themes/default/assets/fonts/brand-icons.woff2 web/static/semantic/themes/default/assets/fonts/icons.eot web/static/semantic/themes/default/assets/fonts/icons.otf web/static/semantic/themes/default/assets/fonts/icons.svg web/static/semantic/themes/default/assets/fonts/icons.ttf web/static/semantic/themes/default/assets/fonts/icons.woff web/static/semantic/themes/default/assets/fonts/icons.woff2 web/static/semantic/themes/default/assets/fonts/outline-icons.eot web/static/semantic/themes/default/assets/fonts/outline-icons.svg web/static/semantic/themes/default/assets/fonts/outline-icons.ttf web/static/semantic/themes/default/assets/fonts/outline-icons.woff web/static/semantic/themes/default/assets/fonts/outline-icons.woff2 web/static/semantic/themes/default/assets/images/flags.png web/static/style.css web/static/thor.png web/static/thor.svg web/templates/configure.html web/templates/footer.html web/templates/forgot.html web/templates/header.html web/templates/index.html web/templates/profile/connect.html web/templates/profile/delete.html web/templates/settings.html web/templates/signin.html web/templates/user/delete.html web/templates/user/edit.html

Index

Constants

View Source
const (
	MAX_AUTH_FAILURES  = 1
	MAX_USES           = 1
	EXPIRY_TABLE       = "expiry"
	FAILURES_TABLE     = "failures"
	DEVICES_TABLE      = "devices"
	CERTIFICATES_TABLE = "certificates"
	EX_EMPLOYEES_TABLE = "ex-employees"
	SHASUM             = "shasum"
	AGENT_PORT         = 7468
)

Variables

This section is empty.

Functions

func Asset

func Asset(name string) ([]byte, error)

Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetDir

func AssetDir(name string) ([]string, error)

AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:

data/
  foo.txt
  img/
    a.png
    b.png

then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("nonexistent") would return an error AssetDir("") will return []string{"data"}.

func AssetInfo

func AssetInfo(name string) (os.FileInfo, error)

AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetNames

func AssetNames() []string

AssetNames returns the names of the assets.

func Logger

func Logger(logger log.FieldLogger, notLogged ...string) gin.HandlerFunc

func MustAsset

func MustAsset(name string) []byte

MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.

func RestoreAsset

func RestoreAsset(dir, name string) error

RestoreAsset restores an asset under the given directory

func RestoreAssets

func RestoreAssets(dir, name string) error

RestoreAssets restores an asset under the given directory recursively

Types

type ApiResult

type ApiResult struct {
	Status  string `json:"status"`
	Message string `json:"message"`
}

type BinFileSystem

type BinFileSystem struct {
	FileSystem http.FileSystem
	Root       string
}

BinFileSystem : Binary file system for serving compiled assets

func GetBinFileSystem

func GetBinFileSystem(root string) *BinFileSystem

GetBinFileSystem : Get the binary filesystem object

func (*BinFileSystem) Collection

func (binFS *BinFileSystem) Collection(c *gin.Context)

Collection : Load a collection of files from the filsystem and send them back over the assigned gin.Context

func (*BinFileSystem) Exists

func (binFS *BinFileSystem) Exists(prefix string, filepath string) bool

Exists : Check if a given file exists in the filesystem

func (*BinFileSystem) Open

func (binFS *BinFileSystem) Open(name string) (http.File, error)

Open : Open a given file from compiled binary file system

type RegistrationRequest

type RegistrationRequest struct {
	Registration string `json:"registration_request"`
	Namespace    string `json:"namespace"`
	ShaSum       string `json:"shasum"`
}

type Result

type Result struct {

	// HTTP response code
	Code int `json:"code"`

	// HTTP Result string - normally one of OK | Error
	Result string `json:"result"`

	// The request message being returned
	Message interface{} `json:"message"`
}
type Search struct {
	SearchType string
	Password   string
	Email      string
	Namespace  string
	VaultToken string

	Results interface{}
}

type Server

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

func NewServer

func NewServer() *Server

func (*Server) AddDevices

func (server *Server) AddDevices(c *gin.Context)

TODO This method has no authentication system on it. Before we can use it in a production environment, we must authenticate the endpoint and devices connecting to it to prevent it being abused by external actors

func (*Server) AddShaSum

func (server *Server) AddShaSum(c *gin.Context)

TODO This is something of a duplication of the method above. Would be worth abstracting the common functionality to make the code a little more readable

func (*Server) AdminQR

func (server *Server) AdminQR(c *gin.Context)

Get a QR Code for admin access

func (*Server) Configure

func (server *Server) Configure(c *gin.Context)

Handler function for loading the configuration page

Only accessible when server is first loaded

func (*Server) Decrypt

func (server *Server) Decrypt(c *gin.Context)

func (*Server) Error

func (server *Server) Error(c *gin.Context, code int, err error)

Display any errors back to the user

func (*Server) Index

func (server *Server) Index(c *gin.Context)

Handler function for the index page

func (*Server) Init

func (server *Server) Init() bool

func (*Server) Register

func (server *Server) Register(c *gin.Context)

func (*Server) RequireAccount

func (server *Server) RequireAccount(c *gin.Context)

func (*Server) Rotate

func (server *Server) Rotate(c *gin.Context)

func (*Server) Run

func (server *Server) Run() int

func (*Server) Search

func (server *Server) Search(c *gin.Context)

func (*Server) Settings

func (server *Server) Settings(c *gin.Context)

Handler function for the Admin settings page

func (*Server) Signin

func (server *Server) Signin(c *gin.Context)

func (*Server) Signout

func (server *Server) Signout(c *gin.Context)

func (*Server) Sso

func (server *Server) Sso(c *gin.Context)

Starts the authoriasation flow for Single Signon

func (*Server) Token

func (server *Server) Token(c *gin.Context)

func (*Server) ValidateSession

func (server *Server) ValidateSession(session sessions.Session) error

func (*Server) Wakeup

func (server *Server) Wakeup()

func (*Server) WhatsMyIP

func (server *Server) WhatsMyIP(c *gin.Context)

type ShaSums

type ShaSums struct {
	Shasums []shaSum `json:"shas"`
}

type TokenRequest

type TokenRequest struct {
	Token     string   `json:"token_request"`
	Namespace string   `json:"namespace"`
	Paths     []string `json:"paths"`
}

type TplEngine

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

func NewTplEngine

func NewTplEngine(config *config.Config) *TplEngine

func (TplEngine) FuncMap

func (tplEngine TplEngine) FuncMap() template.FuncMap

func (TplEngine) LoadTemplates

func (tplEngine TplEngine) LoadTemplates(paths ...string) *template.Template

LoadTemplates : Load HTML template files

type Web

type Web struct {

	// Default
	Backlink  string
	Version   string
	Request   *http.Request
	Section   string
	Time      time.Time
	Admin     bool
	SamlM     *samlsp.Middleware
	Saml      config.SamlConfig
	Info      config.Admin
	User      config.User
	Errors    []string
	WebSocket string

	SemanticTheme string
	TempTotpKey   *otp.Key

	Search *Search
	// contains filtered or unexported fields
}

func NewWeb

func NewWeb(c *gin.Context, conf *config.Config) *Web

func (*Web) Error

func (w *Web) Error(err error)

Jump to

Keyboard shortcuts

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