adapter

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2026 License: MIT Imports: 5 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

func NewNonInteractiveConnector added in v0.10.0

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

NewNonInteractiveConnector 创建一个非交互式的 Connector,避免在批量操作中阻塞等待输入

Types

type SSHAdapter

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

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

func NewNonInteractiveSSHAdapter added in v0.10.0

func NewNonInteractiveSSHAdapter(cfgProvider config.ConfigProvider) *SSHAdapter

NewNonInteractiveSSHAdapter 创建非交互式的 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