brevssh

package
v0.4.5 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package brevssh exists to provide an api to configure and read from an ssh file

brev ssh host file entry format:

Host <workspace-dns-name>
	Hostname 0.0.0.0
	IdentityFile /home//.brev/brev.pem
	User brev
	Port <some-available-port>

also think that file stuff should probably live in files package TODO migrate to using dns name for hostname

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultSSHConfigurer

type DefaultSSHConfigurer struct {
	// contains filtered or unexported fields
}

func NewDefaultSSHConfigurer

func NewDefaultSSHConfigurer(workspaces []entity.WorkspaceWithMeta, sshStore SSHStore, privateKey string) (*DefaultSSHConfigurer, error)

func (*DefaultSSHConfigurer) Config

func (s *DefaultSSHConfigurer) Config() error
	[x] 0. writes private key to disk
	[x] 1. gets a list of the current user's workspaces
	[x] 2. finds the user's ssh config file,
	[x] 3. looks at entries in the ssh config file and:
        for each active workspace from brev delpoy
           create ssh config entry if it does not exist
	[x] 4. After creating the ssh config entries, prune entries from workspaces
       that exist in the ssh config but not as active workspaces.
	[ ] 5. Check for and remove duplicates?
	[x] 6. truncate old config and write new config back to disk (making backup of original copy first)

func (*DefaultSSHConfigurer) CreateBrevSSHConfigEntries

func (s *DefaultSSHConfigurer) CreateBrevSSHConfigEntries() error

func (*DefaultSSHConfigurer) GetActiveWorkspaceIdentifiers added in v0.4.3

func (s *DefaultSSHConfigurer) GetActiveWorkspaceIdentifiers() []string

func (DefaultSSHConfigurer) GetBrevHostValues

func (s DefaultSSHConfigurer) GetBrevHostValues() []string

Hostname is a loaded term so using values

func (DefaultSSHConfigurer) GetBrevPorts added in v0.4.3

func (s DefaultSSHConfigurer) GetBrevPorts(hostnames []string) (map[string]bool, error)

func (DefaultSSHConfigurer) GetConfiguredWorkspacePort

func (s DefaultSSHConfigurer) GetConfiguredWorkspacePort(workspace entity.Workspace) (string, error)

func (*DefaultSSHConfigurer) Init added in v0.4.3

func (s *DefaultSSHConfigurer) Init() error

func (*DefaultSSHConfigurer) PruneInactiveWorkspaces

func (s *DefaultSSHConfigurer) PruneInactiveWorkspaces() error

type SSHStore

type SSHStore interface {
	GetSSHConfig() (string, error)
	WriteSSHConfig(config string) error
	CreateNewSSHConfigBackup() error
	WritePrivateKey(pem string) error
	GetPrivateKeyFilePath() string
}

Jump to

Keyboard shortcuts

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