models

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2026 License: MIT Imports: 4 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

This section is empty.

Types

type ChallengeAnswerSource added in v0.16.0

type ChallengeAnswerSource string

ChallengeAnswerSource 定义 keyboard-interactive 规则的答案来源类型。

const (
	ChallengeSourceOTP           ChallengeAnswerSource = "otp"
	ChallengeSourceLoginPassword ChallengeAnswerSource = "login_password"
	ChallengeSourceSecret        ChallengeAnswerSource = "secret"
	ChallengeSourceCommand       ChallengeAnswerSource = "command"
)

type ChallengeRule added in v0.16.0

type ChallengeRule struct {
	Name               string                `yaml:"name,omitempty" json:"name,omitempty"`
	PromptPattern      string                `yaml:"prompt_pattern" json:"prompt_pattern"`
	InstructionPattern string                `yaml:"instruction_pattern,omitempty" json:"instruction_pattern,omitempty"`
	Source             ChallengeAnswerSource `yaml:"source" json:"source"`
	SecretRef          *credential.Ref       `yaml:"secret_ref,omitempty" json:"secret_ref,omitempty"`
	Command            string                `yaml:"command,omitempty" json:"command,omitempty"`
	Args               []string              `yaml:"args,omitempty" json:"args,omitempty"`
	Timeout            time.Duration         `yaml:"timeout,omitempty" json:"timeout,omitempty"`
}

ChallengeRule 定义单条 keyboard-interactive 问题正则匹配与自动应答规则。

func (ChallengeRule) Clone added in v0.16.0

func (r ChallengeRule) Clone() ChallengeRule

Clone returns a deep copy of ChallengeRule.

func (ChallengeRule) Equal added in v0.16.0

func (r ChallengeRule) Equal(other ChallengeRule) bool

Equal reports whether two ChallengeRule values are structurally equal.

type Host

type Host struct {
	Alias   []string `yaml:"alias,omitempty"`
	Address string   `yaml:"address"` // IP 或 域名
	Port    uint16   `yaml:"port"`
}

Host 定义网络连接信息

type Identity

type Identity struct {
	User                string                     `yaml:"user"`
	KeyPath             string                     `yaml:"key_path,omitempty"`
	KeyFingerprint      string                     `yaml:"key_fingerprint,omitempty"`
	Passphrase          string                     `yaml:"passphrase,omitempty"` // 私钥密码(Schema v1)
	Password            string                     `yaml:"password,omitempty"`   // 登录密码(Schema v1)
	AuthType            string                     `yaml:"auth_type"`            // "key", "password", "agent", "auto", "otp", "keyboard-interactive"
	LoginPasswordRef    *credential.Ref            `yaml:"login_password_ref,omitempty"`
	PassphraseRef       *credential.Ref            `yaml:"passphrase_ref,omitempty"`
	OTP                 *OTPConfig                 `yaml:"otp,omitempty"`
	KeyboardInteractive *KeyboardInteractiveConfig `yaml:"keyboard_interactive,omitempty"`
}

Identity 定义认证信息

func (Identity) Clone added in v0.16.0

func (i Identity) Clone() Identity

Clone returns a deep copy of Identity.

func (Identity) Equal added in v0.16.0

func (i Identity) Equal(other Identity) bool

Equal reports whether two Identity values are structurally equal.

type KeyboardInteractiveConfig added in v0.16.0

type KeyboardInteractiveConfig struct {
	Rules []ChallengeRule `yaml:"rules,omitempty" json:"rules,omitempty"`
}

KeyboardInteractiveConfig 定义 keyboard-interactive 自动应答规则集。

func (*KeyboardInteractiveConfig) Clone added in v0.16.0

Clone returns a deep copy of KeyboardInteractiveConfig.

func (*KeyboardInteractiveConfig) Equal added in v0.16.0

Equal reports whether two KeyboardInteractiveConfig values are structurally equal.

type Node

type Node struct {
	Alias []string `yaml:"alias,omitempty"`
	Tags  []string `yaml:"tags,omitempty"` // 用于分组

	// 引用解耦
	HostRef     string `yaml:"host_ref"`
	IdentityRef string `yaml:"identity_ref"`

	// 高级网络配置
	ProxyJump string `yaml:"proxy_jump,omitempty"` // 指向另一个 Node 的 Name

	// 提权配置
	SudoMode             SudoMode        `yaml:"sudo_mode"` // 使用 SudoMode 枚举
	SuPwd                string          `yaml:"su_pwd,omitempty"`
	PrivilegePasswordRef *credential.Ref `yaml:"privilege_password_ref,omitempty"`

	// 交互式拦截配置
	PasswordPromptPattern string `yaml:"password_prompt_pattern,omitempty"` // 节点级自定义密码提示正则

	// 执行环境配置
	Execution *ssh.ExecutionConfig `yaml:"execution,omitempty" json:"execution,omitempty"`

	// OpenSSH 客户端选项配置(支持连接复用、超时、主机密钥策略、算法与认证控制等)
	SSHOptions *ssh.Options `yaml:"ssh_options,omitempty" json:"ssh_options,omitempty"`

	// OpenSSHAlias 记录运行时从 ~/.ssh/config 具体 Host 块派生该节点时的源别名(不序列化落盘)
	OpenSSHAlias string `yaml:"-" json:"-"`
}

Node 是用户操作的最小单元,聚合了 Host 和 Identity

type NodeFilter

type NodeFilter struct {
	Names []string // 精确匹配 Name
	Tags  []string // 包含任意 Tag 即匹配
}

NodeFilter 用于批量操作时筛选节点

type OTPConfig added in v0.16.0

type OTPConfig struct {
	TOTPSecretRef *credential.Ref `yaml:"totp_secret_ref,omitempty" json:"totp_secret_ref,omitempty"`
	Command       string          `yaml:"command,omitempty" json:"command,omitempty"`
	Args          []string        `yaml:"args,omitempty" json:"args,omitempty"`
	Timeout       time.Duration   `yaml:"timeout,omitempty" json:"timeout,omitempty"`
	PromptPattern string          `yaml:"prompt_pattern,omitempty" json:"prompt_pattern,omitempty"`
}

OTPConfig 定义身份的显式 OTP 自动化配置(支持托管 TOTP 种子或外部获取命令)。

func (*OTPConfig) Clone added in v0.16.0

func (c *OTPConfig) Clone() *OTPConfig

Clone returns a deep copy of OTPConfig.

func (*OTPConfig) Equal added in v0.16.0

func (c *OTPConfig) Equal(other *OTPConfig) bool

Equal reports whether two OTPConfig values are structurally equal.

type SudoMode added in v0.2.0

type SudoMode string

SudoMode 定义提权模式

const (
	SudoModeNone   SudoMode = "none"
	SudoModeSudo   SudoMode = "sudo"
	SudoModeSudoer SudoMode = "sudoer"
	SudoModeSu     SudoMode = "su"
	SudoModeRoot   SudoMode = "root"
	SudoModeAuto   SudoMode = "auto"
)

Jump to

Keyboard shortcuts

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