configuration

package
v0.0.0-...-23032f1 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2016 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

Package configuration handles the configuration of bashistdb.

Index

Constants

View Source
const (
	FORMAT_BASH_HISTORY = "restore"
	FORMAT_ALL          = "all"
	FORMAT_COMMAND_LINE = "command_line"
	FORMAT_TIMESTAMP    = "timestamp"
	FORMAT_LOG          = "log"
	FORMAT_JSON         = "json"
	FORMAT_EXPORT       = "export"
	FORMAT_ROWS         = "rows"
	FORMAT_DEFAULT      = FORMAT_COMMAND_LINE
)

Output Formats

View Source
const (
	MODE_SERVER
	MODE_CLIENT
	MODE_LOCAL
	MODE_PRINT_VERSION // version flag overrides anything else
	MODE_INIT
	MODE_ERROR
	MODE_HELP
)

Run Modes, you may only add entries at the end. If many are set, precedence should be PRINT_VERSION > INIT > SERVER > CLIENT > LOCAL It is ok that we use ints because these are not communicated between client and server.

View Source
const (
	OP_IMPORT // Import history from stdin
	OP_QUERY  // Run a query
)

Operations, you may only add entries at the end.

View Source
const (
	QUERY         = "query"   // A normal search (grep)
	QUERY_LASTK   = "lastk"   // K most recent commands
	QUERY_TOPK    = "topk"    // K most used commands
	QUERY_USERS   = "users"   // users@host in database
	QUERY_CLIENTS = "clients" // unique clients connected
	QUERY_DEMO    = "demo"    // Run some demo queries
	QUERY_ROW     = "row"     // Return a plain single row given its rowid
	QUERY_CONTENT = "content" // Content search (n lines before, after or both)
	DELETE        = "delete"  // Delete rows given their rowid
)

Available query types Since we implement a protocol and client/server could have different versions, hardcoded strings instead of Go's autoincrement is better.

Variables

View Source
var (
	Mode      int          // Mode of operation (local, server, client, etc)
	Operation int          // function (read, restore, et)
	Log       *llog.Logger // Log is the mail logger to log to
	Address   string       // Address is the remote server's address for client mode or server's address for server mode
	Database  string       // Database is the filename of the sqlite database
	Key       []byte       // Key it the user passphrase to generate keys for net comms
	User      string       // User is the username detected or explicitly set
	Error     error        // Will contain an error message if configuration setup failed
	Hostname  string       // Hostname is the hostname detected or explicitly set
	QParams   QueryParams  // Parameters to query
)

Exported fields are global settings.

Functions

func PrintHelp

func PrintHelp(w io.Writer)

PrintHelp prints the help text.

Types

type QueryParams

type QueryParams struct {
	Type          string // Query type
	Kappa         int    // If topk or lastk, we store k here
	User          string // Search User
	Host          string // Search Host
	Format        string // Return format
	Command       string // Search Term for command line field
	Unique        bool   // Return unique command lines
	Rows          []int  // Rowids
	Regex         bool   // Search is a regular expression
	AfterContent  int    // Return also this many lines after match
	BeforeContent int    // Return also this many lines before match
}

A QueryParams contains parameters that are used to run a query. Depending on query type, some fields may not be used.

Jump to

Keyboard shortcuts

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