adapter

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: May 30, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewConnector

func NewConnector(cfgProvider config.ConfigProvider) *ssh.Connector

NewConnector 是一个辅助方法,快速创建组装好 Adapter 的 ssh.Connector

Types

type SSHAdapter

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

SSHAdapter 实现 ssh.ConfigStore 和 ssh.InteractionHandler 接口,作为业务模型与底层 SSH 的防腐层

func NewSSHAdapter

func NewSSHAdapter(cfgProvider config.ConfigProvider) *SSHAdapter

NewSSHAdapter 创建 SSH 适配器

func (*SSHAdapter) ConfirmHostKey

func (a *SSHAdapter) ConfirmHostKey(hostname string, fingerprint string) (bool, error)

ConfirmHostKey 通过命令行终端请求确认 HostKey

func (*SSHAdapter) GetConfig

func (a *SSHAdapter) GetConfig(nodeID string) (*ssh.ClientConfig, error)

GetConfig 获取底层 SSH 客户端需要的配置

func (*SSHAdapter) PromptPassword

func (a *SSHAdapter) PromptPassword(prompt string) (string, error)

PromptPassword 通过命令行终端获取密码输入

func (*SSHAdapter) UpdateAuth

func (a *SSHAdapter) UpdateAuth(nodeID string, password, keyPath, passphrase string) error

UpdateAuth 处理密码或私钥密码的回写

func (*SSHAdapter) UpdateSudo

func (a *SSHAdapter) UpdateSudo(nodeID string, mode ssh.SudoMode, suPwd string) error

UpdateSudo 处理提权密码和模式的回写

Jump to

Keyboard shortcuts

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