ssh

package
v0.5.19 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2024 License: MPL-2.0 Imports: 30 Imported by: 28

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MarkerStartPrefix = "# DevPod Start "
	MarkerEndPrefix   = "# DevPod End "
)
View Source
var (
	DevPodSSHHostKeyFile    = "id_devpod_rsa_host"
	DevPodSSHPrivateKeyFile = "id_devpod_rsa"
	DevPodSSHPublicKeyFile  = "id_devpod_rsa.pub"
)

Functions

func AddPrivateKeysToAgent added in v0.3.4

func AddPrivateKeysToAgent(ctx context.Context, log log.Logger) error

func ConfigFromKeyBytes

func ConfigFromKeyBytes(keyBytes []byte) (*ssh.ClientConfig, error)

func ConfigureSSHConfig

func ConfigureSSHConfig(sshConfigPath, context, workspace, user, workdir string, gpgagent bool, log log.Logger) error

func FindPrivateKeys added in v0.3.4

func FindPrivateKeys() ([]string, error)

func GetDevPodHostKey

func GetDevPodHostKey() (string, error)

func GetDevPodKeysDir

func GetDevPodKeysDir() string

func GetDevPodPrivateKeyRaw

func GetDevPodPrivateKeyRaw() ([]byte, error)

func GetDevPodPublicKey

func GetDevPodPublicKey() (string, error)

func GetHostKey

func GetHostKey(context, workspaceID string) (string, error)

func GetHostKeyBase

func GetHostKeyBase(dir string) (string, error)

func GetPrivateKeyRaw

func GetPrivateKeyRaw(context, workspaceID string) ([]byte, error)

func GetPrivateKeyRawBase

func GetPrivateKeyRawBase(dir string) ([]byte, error)

func GetPublicKey

func GetPublicKey(context, workspaceID string) (string, error)

func GetPublicKeyBase

func GetPublicKeyBase(dir string) (string, error)

func GetUser

func GetUser(workspaceID string, sshConfigPath string) (string, error)

func NewSSHClient

func NewSSHClient(user, addr string, keyBytes []byte) (*ssh.Client, error)

func NewSSHPassClient added in v0.0.3

func NewSSHPassClient(user, addr, password string) (*ssh.Client, error)

func PortForward

func PortForward(
	ctx context.Context,
	client *ssh.Client,
	localNetwork, localAddr, remoteNetwork, remoteAddr string,
	exitAfterTimeout time.Duration,
	log log.Logger,
) error

func RemoveFromConfig

func RemoveFromConfig(workspaceID string, sshConfigPath string, log log.Logger) error

func ResolveSSHConfigPath added in v0.5.0

func ResolveSSHConfigPath(sshConfigPath string) (string, error)

func ReversePortForward added in v0.4.0

func ReversePortForward(
	ctx context.Context,
	client *ssh.Client,
	remoteNetwork, remoteAddr, localNetwork, localAddr string,
	exitAfterTimeout time.Duration,
	log log.Logger,
) error

func Run

func Run(ctx context.Context, client *ssh.Client, command string, stdin io.Reader, stdout io.Writer, stderr io.Writer) error

func StdioClient added in v0.2.0

func StdioClient(reader io.Reader, writer io.WriteCloser, exitOnClose bool) (*ssh.Client, error)

func StdioClientFromKeyBytesWithUser

func StdioClientFromKeyBytesWithUser(keyBytes []byte, reader io.Reader, writer io.WriteCloser, user string, exitOnClose bool) (*ssh.Client, error)

func StdioClientWithUser added in v0.2.0

func StdioClientWithUser(reader io.Reader, writer io.WriteCloser, user string, exitOnClose bool) (*ssh.Client, error)

func WatchWindowSize

func WatchWindowSize(ctx context.Context) <-chan os.Signal

Types

type DevPodSSHEntry

type DevPodSSHEntry struct {
	Host      string
	User      string
	Workspace string
}

type ForwardingFunction added in v0.4.0

type ForwardingFunction func(
	net.Conn,
	*ssh.Client,
	string,
	string,
	log.Logger,
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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