Documentation
¶
Index ¶
- Variables
- func CreateSQLite3Database() (*sql.DB, error)
- func ExpandTilde(path string) (string, error)
- func FixSSHKeyData(sshkey string) []byte
- func GetNote(db *sql.DB, historyIDs []int, title string, comment string) (string, error)
- func GetUsernameProjectIfPresent(entry string) (string, string, string)
- func ReadNote(username string, pk string, projectId string, ip string, port string) error
- func SHA256SUM(data string) string
- func SendNote(note string, username string, pk string, projectId string, ip string, ...) error
- func SetLogger(filepath string) *logrus.Logger
- type ClientWrapper
- func (c *ClientWrapper) Close()
- func (c *ClientWrapper) Create(filePath string) (io.ReadWriteCloser, error)
- func (c *ClientWrapper) Download(filePath string) (io.ReadCloser, error)
- func (c *ClientWrapper) Info(filePath string) (os.FileInfo, error)
- func (c *ClientWrapper) Upload(source io.Reader, destination io.Writer, size int) error
- type FormatterHook
- type HistoryOutput
- type HistorySelection
- type SFTPConfig
Constants ¶
This section is empty.
Variables ¶
var ContextKeyFilepath = &contextKey{"note-filepath"}
var ContextKeyProjectId = &contextKey{"project-id"}
var Logger *logrus.Logger
Functions ¶
func CreateSQLite3Database ¶
func ExpandTilde ¶
ExpandTilde expands the tilde in the given path to the user's home directory.
func FixSSHKeyData ¶
Types ¶
type ClientWrapper ¶
type ClientWrapper struct {
// contains filtered or unexported fields
}
ClientWrapper provides basic functionality to interact with a SFTP server.
func NewSFTPClientWrapper ¶
func NewSFTPClientWrapper(config SFTPConfig) (*ClientWrapper, error)
New initialises SSH and SFTP clients and returns Client type to use.
func (*ClientWrapper) Create ¶
func (c *ClientWrapper) Create(filePath string) (io.ReadWriteCloser, error)
Create creates a remote/destination file for I/O.
func (*ClientWrapper) Download ¶
func (c *ClientWrapper) Download(filePath string) (io.ReadCloser, error)
Download returns remote/destination file for reading.
type FormatterHook ¶
FormatterHook is a hook that writes logs of specified LogLevels with a formatter to specified Writer
func (*FormatterHook) Fire ¶
func (hook *FormatterHook) Fire(entry *logrus.Entry) error
Fire will be called when some logging function is called with current hook It will format log entry and write it to appropriate writer
func (*FormatterHook) Levels ¶
func (hook *FormatterHook) Levels() []logrus.Level
Levels define on which log levels this hook would trigger
type HistoryOutput ¶
type HistoryOutput struct {
Executable string
Command string
Environment string
ExitCode int
Stdout string
Stderr string
}
HistoryOutput represents the combined result of history and output tables
type HistorySelection ¶
func GetHistory ¶
func GetHistory(db *sql.DB, limit int) ([]HistorySelection, error)