Documentation ¶
Overview ¶
Package ssh implements SSH transport.
Index ¶
- func DialConnCtx(ctx context.Context, conn net.Conn, addr string, config *ssh.ClientConfig) (*ssh.Client, error)
- func DialCtx(ctx context.Context, network, addr string, config *ssh.ClientConfig) (*ssh.Client, error)
- type Endpoint
- type SSHSignersLogger
- type SSHSignersLoggerAlgorithmSigner
- type SSHTunnel
- type SSHTunnelOption
- type Streamer
- func (m *Streamer) Close()
- func (m *Streamer) Cmd(ctx context.Context, cmd string) (gcmd.CmdRes, error)
- func (m *Streamer) Download(filePaths []string, recurse bool) (map[string]streamer.File, error)
- func (m *Streamer) EnableSFTP()
- func (m *Streamer) GetConfig(ctx context.Context) (*ssh.ClientConfig, error)
- func (m *Streamer) GetCredentials() credentials.Credentials
- func (m *Streamer) HasFeature(feature streamer.Const) bool
- func (m *Streamer) Init(ctx context.Context) error
- func (m *Streamer) InitAgentForward() error
- func (m *Streamer) Read(ctx context.Context, size int) ([]byte, error)
- func (m *Streamer) ReadTo(ctx context.Context, expr expr.Expr) (streamer.ReadRes, error)
- func (m *Streamer) SFTPSudoTry()
- func (m *Streamer) SetCredentialsInterceptor(inter func(credentials.Credentials) credentials.Credentials)
- func (m *Streamer) SetReadTimeout(timeout time.Duration) time.Duration
- func (m *Streamer) SetTerminalSize(w, h int)
- func (m *Streamer) SetTrace(cb trace.CB)
- func (m *Streamer) Upload(filePaths map[string]streamer.File) error
- func (m *Streamer) WithCloseSessionCallback(fn func(*ssh.Session) error)
- func (m *Streamer) WithOpenSessionCallback(fn func(*ssh.Session) error)
- func (m *Streamer) Write(text []byte) error
- type StreamerOption
- func WithEnv(key, value string) StreamerOption
- func WithKnownHostsFiles(files ...string) (StreamerOption, error)
- func WithLogger(log *zap.Logger) StreamerOption
- func WithPort(port int) StreamerOption
- func WithProgram(program, programData string) StreamerOption
- func WithSSHNetconf() StreamerOption
- func WithSSHTunnel(tunnel Tunnel) StreamerOption
- func WithTrace(trace trace.CB) StreamerOption
- type Tunnel
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DialConnCtx ¶
Types ¶
type Endpoint ¶
func NewEndpoint ¶
type SSHSignersLogger ¶
type SSHSignersLogger struct {
// contains filtered or unexported fields
}
SSHSignersLogger wraps ssh.Signer interface in order to log actions relateds to keys
func NewSSHSignersLogger ¶
func NewSSHSignersLogger(s ssh.Signer, logger *zap.Logger) *SSHSignersLogger
func (SSHSignersLogger) PublicKey ¶
func (m SSHSignersLogger) PublicKey() ssh.PublicKey
type SSHSignersLoggerAlgorithmSigner ¶
type SSHSignersLoggerAlgorithmSigner struct {
// contains filtered or unexported fields
}
func NewSSHSignersAlgorithmSignerLogger ¶
func NewSSHSignersAlgorithmSignerLogger(s ssh.AlgorithmSigner, logger *zap.Logger) *SSHSignersLoggerAlgorithmSigner
func (SSHSignersLoggerAlgorithmSigner) PublicKey ¶
func (m SSHSignersLoggerAlgorithmSigner) PublicKey() ssh.PublicKey
func (SSHSignersLoggerAlgorithmSigner) SignWithAlgorithm ¶
type SSHTunnel ¶
type SSHTunnel struct { Server *Endpoint Config *ssh.ClientConfig // contains filtered or unexported fields }
func NewSSHTunnel ¶
func NewSSHTunnel(tunnel string, credentials credentials.Credentials, opts ...SSHTunnelOption) *SSHTunnel
func (*SSHTunnel) IsConnected ¶
type SSHTunnelOption ¶
type SSHTunnelOption func(m *SSHTunnel)
func SSHTunnelWithLogger ¶
func SSHTunnelWithLogger(log *zap.Logger) SSHTunnelOption
type Streamer ¶
type Streamer struct {
// contains filtered or unexported fields
}
func NewNetconfStreamer ¶
func NewNetconfStreamer(host string, credentials credentials.Credentials, opts ...StreamerOption) *Streamer
func NewStreamer ¶
func NewStreamer(host string, credentials credentials.Credentials, opts ...StreamerOption) *Streamer
func (*Streamer) EnableSFTP ¶
func (m *Streamer) EnableSFTP()
func (*Streamer) GetCredentials ¶
func (m *Streamer) GetCredentials() credentials.Credentials
func (*Streamer) InitAgentForward ¶
func (*Streamer) SFTPSudoTry ¶ added in v1.0.6
func (m *Streamer) SFTPSudoTry()
func (*Streamer) SetCredentialsInterceptor ¶
func (m *Streamer) SetCredentialsInterceptor(inter func(credentials.Credentials) credentials.Credentials)
func (*Streamer) SetReadTimeout ¶
func (*Streamer) SetTerminalSize ¶ added in v1.0.11
func (*Streamer) WithCloseSessionCallback ¶
func (*Streamer) WithOpenSessionCallback ¶
type StreamerOption ¶
type StreamerOption func(*Streamer)
func WithEnv ¶
func WithEnv(key, value string) StreamerOption
func WithKnownHostsFiles ¶
func WithKnownHostsFiles(files ...string) (StreamerOption, error)
func WithLogger ¶
func WithLogger(log *zap.Logger) StreamerOption
func WithPort ¶
func WithPort(port int) StreamerOption
func WithProgram ¶
func WithProgram(program, programData string) StreamerOption
func WithSSHNetconf ¶
func WithSSHNetconf() StreamerOption
func WithSSHTunnel ¶
func WithSSHTunnel(tunnel Tunnel) StreamerOption
WithSSHTunnel sets tunnel as ssh proxy. We do not close after usage because it can be shared with other connections.
func WithTrace ¶
func WithTrace(trace trace.CB) StreamerOption
Click to show internal directories.
Click to hide internal directories.