database

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2022 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Overview

Package database provides methods for working with the bbolt DB.

Package database provides methods for working with the bbolt DB.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB struct {
	*bolt.DB
}

DB is a wrapper around *bbolt.DB.

func Open

func Open(dbLoc, hostname string) (*DB, error)

Open opens a connection pool to the bbolt DB.

func (*DB) FetchAll

func (d *DB) FetchAll(hostname string) (map[string]Host, error)

FetchAll returns a map containing information on all hosts in the DB.

func (*DB) FetchAllItemsString

func (d *DB) FetchAllItemsString(hostname string) ([]string, error)

FetchAllItemsString returns a slice of strings with all hosts in the DB.

func (*DB) GetHostInfo

func (d *DB) GetHostInfo(hostname string, host []byte) (Host, error)

GetHostInfo returns information on a single host entry from the DB.

func (*DB) RemoveHost

func (d *DB) RemoveHost(hostname string, host []byte) error

RemoveHost removes the named host from the DB.

func (*DB) Write

func (d *DB) Write(hostname string, key, val []byte) error

type DataStore

type DataStore interface {
	Write(string, []byte, []byte) error
	FetchAllItemsString(string) ([]string, error)
	GetHostInfo(string, []byte) (Host, error)
	FetchAll(string) (map[string]Host, error)
	RemoveHost(string, []byte) error
}

DataStore provides an interface for working with the DB.

type Host

type Host struct {
	// Hostname or alias for the server
	Host []string
	// Fully qualified hostname or IP address to connect
	HostName string
	// Port number that the SSH daemon is listening on
	Port int
	// The name of the remote user to connect as
	User              string
	ProxyCommand      string
	HostKeyAlgorithms string
	// Path the SSH key that should be used when connecting
	IdentityFile string
	// Interval that the ServerKeepAlive command should be passed to the server
	KeepAlive int8
}

Host contains the configuration details for a SSH Host.

func (Host) String

func (h Host) String() string

String returns the host information as a string.

type Hosts

type Hosts []Host

Hosts is a slice of Host.

Jump to

Keyboard shortcuts

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