Documentation ¶
Overview ¶
Package ssh 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
- func AddIncludeToUserConfig(conf string, brevConfigPath string) (string, error)
- func MakeSSHEntry(workspaceIdentifier entity.WorkspaceLocalID, port string, ...) (string, error)
- func MapContainsKey[K comparable, V any](m map[K]V, key K) bool
- func WSLAddIncludeToUserConfig(conf string, brevConfigPath string) string
- type BrevHostValuesSet
- type BrevPorts
- type Config
- type ConfigUpaterFactoryStore
- type ConfigUpdater
- type ConfigUpdaterStore
- type IdentityPortMap
- type JetBrainsGatewayConfig
- func (jbgc *JetBrainsGatewayConfig) GetBrevHostValueSet() BrevHostValuesSet
- func (jbgc *JetBrainsGatewayConfig) GetBrevPorts() (BrevPorts, error)
- func (jbgc *JetBrainsGatewayConfig) GetConfiguredWorkspacePort(workspaceIdentifier entity.WorkspaceLocalID) (string, error)
- func (jbgc *JetBrainsGatewayConfig) Sync(identifierPortMapping IdentityPortMap) error
- type JetBrainsGatewayConfigStore
- type JetbrainsGatewayConfigXML
- type JetbrainsGatewayConfigXMLComponent
- type JetbrainsGatewayConfigXMLConfigs
- type JetbrainsGatewayConfigXMLSSHConfig
- type JetbrainsGatewayConfigXMLSSHOption
- type Reader
- type SSHConfig
- func (s SSHConfig) GetBrevHostValueSet() BrevHostValuesSet
- func (s SSHConfig) GetBrevHostValues() []entity.WorkspaceLocalID
- func (s SSHConfig) GetBrevPorts() (BrevPorts, error)
- func (s SSHConfig) GetConfiguredWorkspacePort(workspaceIdentifier entity.WorkspaceLocalID) (string, error)
- func (s SSHConfig) GetPrivateKeyFilePath() string
- func (s *SSHConfig) PruneInactiveWorkspaces(identityPortMap IdentityPortMap) error
- func (s *SSHConfig) Sync(identifierPortMapping IdentityPortMap) error
- type SSHConfigEntryServiceMesh
- type SSHConfigEntryV2
- type SSHConfigurer
- func (sshConfigurer *SSHConfigurer) GetActiveWorkspaceIdentifiers() []entity.WorkspaceLocalID
- func (sshConfigurer SSHConfigurer) GetConfiguredWorkspacePort(workspaceIdentifier entity.WorkspaceLocalID) (string, error)
- func (sshConfigurer *SSHConfigurer) GetIdentityPortMap() (IdentityPortMap, error)
- func (sshConfigurer SSHConfigurer) GetPrivateKeyPath() (string, error)
- func (sshConfigurer *SSHConfigurer) Sync() error
- type SSHConfigurerJetBrains
- type SSHConfigurerServiceMesh
- type SSHConfigurerStore
- type SSHConfigurerTask
- type SSHConfigurerTaskStore
- type SSHConfigurerV2
- func (s SSHConfigurerV2) CreateNewSSHConfig(workspaces []entity.Workspace) (string, error)
- func (s SSHConfigurerV2) CreateWSLConfig(workspaces []entity.Workspace) (string, error)
- func (s SSHConfigurerV2) EnsureConfigHasInclude() error
- func (s SSHConfigurerV2) EnsureWSLConfigHasInclude() error
- func (s SSHConfigurerV2) Update(workspaces []entity.Workspace) error
- type SSHConfigurerV2Store
- type SSHStore
- type Writer
Constants ¶
View Source
const SSHConfigEntryTemplateServiceMesh = `` /* 140-byte string literal not displayed */
View Source
const SSHConfigEntryTemplateV2 = `` /* 306-byte string literal not displayed */
View Source
const SSHConfigEntryTemplateV3 = `` /* 317-byte string literal not displayed */
Variables ¶
This section is empty.
Functions ¶
func AddIncludeToUserConfig ¶ added in v0.6.35
func MakeSSHEntry ¶
func MapContainsKey ¶ added in v0.6.112
func MapContainsKey[K comparable, V any](m map[K]V, key K) bool
func WSLAddIncludeToUserConfig ¶ added in v0.6.169
Types ¶
type BrevHostValuesSet ¶
type BrevHostValuesSet map[entity.WorkspaceLocalID]bool
type Config ¶ added in v0.6.0
func GetSSHConfigs ¶ added in v0.6.43
func GetSSHConfigs(store SSHConfigurerTaskStore) ([]Config, error)
type ConfigUpaterFactoryStore ¶ added in v0.6.32
type ConfigUpaterFactoryStore interface { ConfigUpdaterStore SSHConfigurerV2Store }
ConfigUpaterFactoryStore prob a better way to do this
type ConfigUpdater ¶ added in v0.6.0
type ConfigUpdater struct { Store ConfigUpdaterStore Configs []Config PrivateKey string }
func NewConfigUpdater ¶ added in v0.6.96
func NewConfigUpdater(store ConfigUpdaterStore, configs []Config, privateKey string) *ConfigUpdater
func (ConfigUpdater) Configure ¶ added in v0.6.24
func (c ConfigUpdater) Configure() error
func (ConfigUpdater) GetTaskSpec ¶ added in v0.6.0
func (c ConfigUpdater) GetTaskSpec() tasks.TaskSpec
func (ConfigUpdater) Run ¶ added in v0.6.0
func (c ConfigUpdater) Run() error
type ConfigUpdaterStore ¶ added in v0.6.0
type ConfigUpdaterStore interface { autostartconf.AutoStartStore GetContextWorkspaces() ([]entity.Workspace, error) WritePrivateKey(pem string) error }
type IdentityPortMap ¶
type IdentityPortMap map[entity.WorkspaceLocalID]string
type JetBrainsGatewayConfig ¶
func NewJetBrainsGatewayConfig ¶
func NewJetBrainsGatewayConfig(store JetBrainsGatewayConfigStore) (*JetBrainsGatewayConfig, error)
func (*JetBrainsGatewayConfig) GetBrevHostValueSet ¶
func (jbgc *JetBrainsGatewayConfig) GetBrevHostValueSet() BrevHostValuesSet
func (*JetBrainsGatewayConfig) GetBrevPorts ¶
func (jbgc *JetBrainsGatewayConfig) GetBrevPorts() (BrevPorts, error)
func (*JetBrainsGatewayConfig) GetConfiguredWorkspacePort ¶
func (jbgc *JetBrainsGatewayConfig) GetConfiguredWorkspacePort(workspaceIdentifier entity.WorkspaceLocalID) (string, error)
func (*JetBrainsGatewayConfig) Sync ¶
func (jbgc *JetBrainsGatewayConfig) Sync(identifierPortMapping IdentityPortMap) error
type JetbrainsGatewayConfigXML ¶
type JetbrainsGatewayConfigXML struct { XMLName xml.Name `xml:"application"` Component JetbrainsGatewayConfigXMLComponent `xml:"component"` }
func ParseJetbrainsGatewayXML ¶ added in v0.6.35
func ParseJetbrainsGatewayXML(config string) (*JetbrainsGatewayConfigXML, error)
type JetbrainsGatewayConfigXMLComponent ¶
type JetbrainsGatewayConfigXMLComponent struct { Configs JetbrainsGatewayConfigXMLConfigs `xml:"configs"` Name string `xml:"name,attr,omitempty"` }
type JetbrainsGatewayConfigXMLConfigs ¶
type JetbrainsGatewayConfigXMLConfigs struct {
SSHConfigs []JetbrainsGatewayConfigXMLSSHConfig `xml:"sshConfig"`
}
type JetbrainsGatewayConfigXMLSSHConfig ¶
type JetbrainsGatewayConfigXMLSSHConfig struct { ID string `xml:"id,attr,omitempty"` CustomName entity.WorkspaceLocalID `xml:"customName,attr,omitempty"` NameFormat string `xml:"nameFormat,attr,omitempty"` UseOpenSSHConfig string `xml:"useOpenSSHConfig,attr,omitempty"` Host string `xml:"host,attr,omitempty"` Port string `xml:"port,attr,omitempty"` KeyPath string `xml:"keyPath,attr,omitempty"` Username string `xml:"username,attr,omitempty"` Options []JetbrainsGatewayConfigXMLSSHOption `xml:"option,omitempty"` }
type Reader ¶
type Reader interface { GetBrevPorts() (BrevPorts, error) GetBrevHostValueSet() BrevHostValuesSet GetConfiguredWorkspacePort(workspaceIdentifier entity.WorkspaceLocalID) (string, error) }
type SSHConfig ¶
type SSHConfig struct {
// contains filtered or unexported fields
}
func NewSSHConfig ¶
func (SSHConfig) GetBrevHostValueSet ¶
func (s SSHConfig) GetBrevHostValueSet() BrevHostValuesSet
func (SSHConfig) GetBrevHostValues ¶
func (s SSHConfig) GetBrevHostValues() []entity.WorkspaceLocalID
Hostname is a loaded term so using values
func (SSHConfig) GetBrevPorts ¶
func (SSHConfig) GetConfiguredWorkspacePort ¶
func (s SSHConfig) GetConfiguredWorkspacePort(workspaceIdentifier entity.WorkspaceLocalID) (string, error)
func (SSHConfig) GetPrivateKeyFilePath ¶
func (*SSHConfig) PruneInactiveWorkspaces ¶
func (s *SSHConfig) PruneInactiveWorkspaces(identityPortMap IdentityPortMap) error
func (*SSHConfig) Sync ¶
func (s *SSHConfig) Sync(identifierPortMapping IdentityPortMap) error
type SSHConfigEntryServiceMesh ¶ added in v0.6.35
type SSHConfigEntryV2 ¶ added in v0.6.0
type SSHConfigurer ¶
type SSHConfigurer struct { Reader Reader Writers []Writer // contains filtered or unexported fields }
func NewSSHConfigurer ¶
func NewSSHConfigurer(workspaces []entity.WorkspaceWithMeta, reader Reader, writers []Writer, store SSHConfigurerStore, privateKey string) *SSHConfigurer
func (*SSHConfigurer) GetActiveWorkspaceIdentifiers ¶
func (sshConfigurer *SSHConfigurer) GetActiveWorkspaceIdentifiers() []entity.WorkspaceLocalID
func (SSHConfigurer) GetConfiguredWorkspacePort ¶
func (sshConfigurer SSHConfigurer) GetConfiguredWorkspacePort(workspaceIdentifier entity.WorkspaceLocalID) (string, error)
func (*SSHConfigurer) GetIdentityPortMap ¶
func (sshConfigurer *SSHConfigurer) GetIdentityPortMap() (IdentityPortMap, error)
func (SSHConfigurer) GetPrivateKeyPath ¶ added in v0.6.24
func (sshConfigurer SSHConfigurer) GetPrivateKeyPath() (string, error)
func (*SSHConfigurer) Sync ¶
func (sshConfigurer *SSHConfigurer) Sync() error
type SSHConfigurerJetBrains ¶ added in v0.6.32
type SSHConfigurerJetBrains struct {
// contains filtered or unexported fields
}
func NewSSHConfigurerJetBrains ¶ added in v0.6.32
func NewSSHConfigurerJetBrains(store SSHConfigurerV2Store) (*SSHConfigurerJetBrains, error)
func (SSHConfigurerJetBrains) CreateNewSSHConfig ¶ added in v0.6.32
func (s SSHConfigurerJetBrains) CreateNewSSHConfig(workspaces []entity.Workspace) (string, error)
type SSHConfigurerServiceMesh ¶ added in v0.6.32
type SSHConfigurerServiceMesh struct {
// contains filtered or unexported fields
}
func NewSSHConfigurerServiceMesh ¶ added in v0.6.32
func NewSSHConfigurerServiceMesh(store SSHConfigurerV2Store) *SSHConfigurerServiceMesh
func (SSHConfigurerServiceMesh) CreateNewSSHConfig ¶ added in v0.6.32
func (s SSHConfigurerServiceMesh) CreateNewSSHConfig(workspaces []entity.Workspace) (string, error)
func (SSHConfigurerServiceMesh) EnsureConfigHasInclude ¶ added in v0.6.35
func (s SSHConfigurerServiceMesh) EnsureConfigHasInclude() error
type SSHConfigurerStore ¶ added in v0.6.2
type SSHConfigurerTask ¶ added in v0.6.35
type SSHConfigurerTask struct {
Store SSHConfigurerTaskStore
}
func NewSSHConfigurerTask ¶ added in v0.6.35
func NewSSHConfigurerTask(store SSHConfigurerTaskStore) SSHConfigurerTask
func (SSHConfigurerTask) Configure ¶ added in v0.6.35
func (sct SSHConfigurerTask) Configure() error
func (SSHConfigurerTask) GetTaskSpec ¶ added in v0.6.35
func (sct SSHConfigurerTask) GetTaskSpec() tasks.TaskSpec
func (SSHConfigurerTask) Run ¶ added in v0.6.35
func (sct SSHConfigurerTask) Run() error
type SSHConfigurerTaskStore ¶ added in v0.6.35
type SSHConfigurerTaskStore interface { ConfigUpdaterStore SSHConfigurerV2Store GetCurrentUserKeys() (*entity.UserKeys, error) }
type SSHConfigurerV2 ¶ added in v0.6.0
type SSHConfigurerV2 struct {
// contains filtered or unexported fields
}
SSHConfigurerV2 speciallizes in configuring ssh config with ProxyCommand
func NewSSHConfigurerV2 ¶ added in v0.6.0
func NewSSHConfigurerV2(store SSHConfigurerV2Store) *SSHConfigurerV2
func (SSHConfigurerV2) CreateNewSSHConfig ¶ added in v0.6.0
func (s SSHConfigurerV2) CreateNewSSHConfig(workspaces []entity.Workspace) (string, error)
func (SSHConfigurerV2) CreateWSLConfig ¶ added in v0.6.162
func (s SSHConfigurerV2) CreateWSLConfig(workspaces []entity.Workspace) (string, error)
func (SSHConfigurerV2) EnsureConfigHasInclude ¶ added in v0.6.0
func (s SSHConfigurerV2) EnsureConfigHasInclude() error
func (SSHConfigurerV2) EnsureWSLConfigHasInclude ¶ added in v0.6.169
func (s SSHConfigurerV2) EnsureWSLConfigHasInclude() error
type SSHConfigurerV2Store ¶ added in v0.6.0
type SSHConfigurerV2Store interface { WriteBrevSSHConfig(config string) error GetUserSSHConfig() (string, error) WriteUserSSHConfig(config string) error GetPrivateKeyPath() (string, error) GetUserSSHConfigPath() (string, error) GetBrevSSHConfigPath() (string, error) GetJetBrainsConfigPath() (string, error) GetJetBrainsConfig() (string, error) WriteJetBrainsConfig(config string) error DoesJetbrainsFilePathExist() (bool, error) GetWSLHostUserSSHConfigPath() (string, error) GetWindowsDir() (string, error) WriteBrevSSHConfigWSL(config string) error GetFileAsString(path string) (string, error) FileExists(path string) (bool, error) GetWSLHostBrevSSHConfigPath() (string, error) GetWSLUserSSHConfig() (string, error) WriteWSLUserSSHConfig(config string) error }
type Writer ¶
type Writer interface {
Sync(IdentityPortMap) error
}
Click to show internal directories.
Click to hide internal directories.