server

package
v0.0.0-...-e7db92f Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2024 License: MPL-2.0 Imports: 33 Imported by: 0

Documentation

Overview

Package server generated by go-bindata.// sources: assets/files/css/dashboard.css assets/files/fonts/FontAwesome.otf assets/files/fonts/fontawesome-webfont.ttf assets/files/fonts/fontawesome-webfont.woff assets/files/fonts/fontawesome-webfont.woff2 assets/files/img/clear.png assets/files/img/container/R.svg assets/files/img/container/dockerfile.svg assets/files/img/container/golang.svg assets/files/img/container/groovy.svg assets/files/img/container/javascript.svg assets/files/img/container/jupyter.svg assets/files/img/container/perl.svg assets/files/img/container/php.svg assets/files/img/container/python.svg assets/files/img/container/ruby.svg assets/files/img/container/sh.svg assets/files/img/dashboard-logo-white.svg assets/files/img/dashboard-logo.svg assets/files/img/eclipse.svg assets/files/img/kubernetes/daemonset.svg assets/files/img/kubernetes/deployment.svg assets/files/img/kubernetes/statefulset.svg assets/files/img/pulse.svg assets/files/img/source/directory.svg assets/files/img/source/file.svg assets/files/img/source/stream.svg assets/files/js/api.js assets/files/js/collections/collection.js assets/files/js/collections/container.js assets/files/js/collections/kubernetes.js assets/files/js/collections/link.js assets/files/js/collections/source.js assets/files/js/lib/jquery.editable.min.js assets/files/js/page.js assets/files/js/pipeline.js assets/files/js/router.js assets/templates/configure.tpl assets/templates/error.tpl assets/templates/footer.html assets/templates/header.html assets/templates/index.tpl assets/templates/login.tpl

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.

Package server : A webserver base GUI and API for managing a server.apiDB

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.

Index

Constants

View Source
const (
	USERS_T        = "users"
	USERGROUPS_T   = "groups"
	PASSW_T        = "passwords"
	TOTP_T         = "totp"
	GROUP_T        = "group"
	GROUP_PERMS_T  = "groupperms"
	ACL_T          = "acl"
	PERM_T         = "permissions"
	MACHINE_TOKENS = "machines"
	MACHINE_HMAC   = "hmac"
)

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 LoadTemplates

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

LoadTemplates : Load HTML template files

func Logger

func Logger(logfile string, 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 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 Group

type Group struct {
	ID          string
	Name        string
	Permissions []Permission
}

type Lockable

type Lockable struct {
	sync.Mutex
	Db *bolt.DB
}

type Permission

type Permission struct {
	ID         string
	Permission string
}

type Server

type Server struct {

	// The name of the database file
	Dbname string

	// The port to listen on
	Port string

	// The address of the server component
	Address string
	// contains filtered or unexported fields
}

Server : The principle server component

func NewServer

func NewServer() *Server

NewServer : Create a new Server instance

func (*Server) AddGroup

func (s *Server) AddGroup(group *Group) error

func (*Server) AddMachine

func (s *Server) AddMachine(address string) string

func (*Server) AddPermission

func (s *Server) AddPermission(name string) (string, error)

func (*Server) AddUser

func (s *Server) AddUser(user *User) error

func (*Server) Configure

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

func (*Server) CreateTables

func (s *Server) CreateTables() error

func (*Server) DeleteGroup

func (s *Server) DeleteGroup(name string) error

func (*Server) DeletePermission

func (s *Server) DeletePermission(name string) error

func (*Server) DeleteUser

func (s *Server) DeleteUser(user *User) error

func (*Server) Engine

func (server *Server) Engine() *gin.Engine

func (*Server) Error

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

Display any errors back to the user

func (*Server) FindGroup

func (s *Server) FindGroup(name string) (*Group, error)

func (*Server) FindGroupByID

func (s *Server) FindGroupByID(id string) (*Group, error)

func (*Server) FindMachine

func (s *Server) FindMachine(address string) string

func (*Server) FindUser

func (s *Server) FindUser(email string) (*User, error)

func (*Server) Index

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

Index : Render the index page back on the GIN context

TODO : Make this a little more versatile and use SSR to render

more of the page than relying on JS and a one page website

func (*Server) Init

func (server *Server) Init()

Init : initialises the server environment

func (*Server) RequireAccount

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

func (*Server) Run

func (server *Server) Run() int

Run : runs the server component when activated via main

func (*Server) Signin

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

func (*Server) Signout

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

func (*Server) ValidateSession

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

type User

type User struct {
	ID       string
	Email    string
	Password string
	Groups   []Group
	TotpKey  string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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