ssh

package
v0.0.0-...-ffcb421 Latest Latest
Warning

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

Go to latest
Published: May 12, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const DoNotUseDummyPrivateKey = `` /* 886-byte string literal not displayed */
View Source
const PubKey = `` /* 271-byte string literal not displayed */

Variables

This section is empty.

Functions

func GetLocalIP

func GetLocalIP(ctx context.Context) (net.IP, error)

func GetPublicIPStr

func GetPublicIPStr(ctx context.Context) (string, error)

func GetTestPrivateKey

func GetTestPrivateKey() string

func GetTestPublicKey

func GetTestPublicKey() string

func StartTestSSHServer

func StartTestSSHServer(options TestSSHServerOptions) (func() error, error)

func TrySSHConnect

func TrySSHConnect(ctx context.Context, c ConnectionConfig, options WaitForSSHOptions) error

func WaitForSSH

func WaitForSSH(ctx context.Context, c ConnectionConfig, options WaitForSSHOptions) error

Types

type Client

type Client struct {
	Certificate string
	// contains filtered or unexported fields
}

modified from https://github.com/superfly/flyctl/blob/master/ssh/client.go https://github.com/golang/go/issues/20288#issuecomment-832033017

func ConnectToHost

func ConnectToHost(ctx context.Context, config ConnectionConfig) (*Client, error)

func (*Client) Close

func (c *Client) Close() error

func (*Client) Connect

func (c *Client) Connect(ctx context.Context) error

func (*Client) RunCommand

func (c *Client) RunCommand(ctx context.Context, cmd string) (string, string, error)

type ConnectionConfig

type ConnectionConfig struct {
	User, HostPort, PrivKey string
}

type TestSSHServerOptions

type TestSSHServerOptions struct {
	Port        string
	PubKeyAuth  bool
	PubKeyDelay time.Duration
	ExitCode    int
}

type WaitForSSHOptions

type WaitForSSHOptions struct {
	Timeout           time.Duration
	ConnectionTimeout time.Duration
	CheckCmd          string
	WaitTime          time.Duration
}

func (*WaitForSSHOptions) SetDefault

func (o *WaitForSSHOptions) SetDefault()

Jump to

Keyboard shortcuts

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