util

package
v0.0.0-...-f080756 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2018 License: MIT Imports: 17 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// FileList - list of files that were parsed from the provided config
	FileList []string
)

Store - secure cookie store

Functions

func GenerateSecureKey

func GenerateSecureKey() string

GenerateSecureKey - Key for CSRF Tokens

func IndexFiles

func IndexFiles(fileList []string) error

IndexFiles - takes argument as a list of files and directories and returns a list of absolute file strings to be tailed

func IsWhitelisted

func IsWhitelisted(username string) bool

IsWhitelisted - returns if a username is in ACL or not If the ACL list is empty, it assumes no ACL

func Login

func Login(r *http.Request) (bool, string, error)

Login - tries to authenticate the user via PAM

func MakeAndStartCron

func MakeAndStartCron(repeat time.Duration, run func(...interface{}) error, v ...interface{})

MakeAndStartCron - Creates a ticket with an interval of 'repeat' and pushes in a channel being read by the for loop in the function. Every time a value is pushed, the Cron executes the function passed

func PamAauthenticate

func PamAauthenticate(username, password string) int

PamAauthenticate - authenticates a user based on local PAM based authentication

func ParseConfig

func ParseConfig(dir []string, forceAuth bool, whitelist, cron string) error

ParseConfig - function to manage config

func TailFile

func TailFile(conn *websocket.Conn, fileName string)

TailFile - Accepts a websocket connection and a filename and tails the file and writes the changes into the connection. Recommended to run on a thread as this is blocking in nature

Types

type Config

type Config struct {
	Dir       []string
	ForceAuth bool
	Whitelist map[string]bool
	Cron      string
}

Config - struct to hold the config

var Conf Config

Conf global config

Jump to

Keyboard shortcuts

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