Documentation
¶
Overview ¶
Package inventory 提供 XOps v2 纯函数领域核的资产实体模型、封闭认证/来源代数和类型、 跨命名空间 Tarjan ProxyJump DAG 环路校验器、5 位置引用检查器与格式无关导入包 ImportBundle。
本包恪守 100% 纯数学与零副作用铁律(零 os、零 net、零 context、零 sync/sync/atomic、零反射), 并严格遵循 ADR-006(100% 零 v1 兼容与迁移代码)。
Index ¶
- Constants
- Variables
- func EqualAuthMethod(a, b AuthMethod) bool
- func EqualChallengeRule(a, b ChallengeRule) bool
- func EqualNodeOrigin(a, b NodeOrigin) bool
- func MarshalAuthMethodTo(e *jsontext.Encoder, a AuthMethod) error
- func MarshalChallengeRuleTo(e *jsontext.Encoder, r ChallengeRule) error
- func MarshalNodeOriginTo(e *jsontext.Encoder, o NodeOrigin) error
- func ToOptionOriginKind(origin NodeOrigin) option.OriginKind
- func WriteAuthMethodCanonical(w io.Writer, m AuthMethod) error
- type AgentSpec
- type Alias
- func (t Alias) AppendText(b []byte) ([]byte, error)
- func (a Alias) Compare(o Alias) int
- func (a Alias) Equal(o Alias) bool
- func (t Alias) IsValid() bool
- func (t Alias) IsZero() bool
- func (t Alias) MarshalText() ([]byte, error)
- func (t Alias) String() string
- func (a *Alias) UnmarshalText(b []byte) error
- type AssetRefLocation
- type AssetReference
- type AuthAgent
- type AuthComposite
- type AuthKeyboardInteractive
- type AuthMethod
- type AuthMethodKind
- type AuthPassword
- type AuthPrivateKey
- func (a *AuthPrivateKey) CertPaths() []CertPathSpec
- func (a *AuthPrivateKey) IsValid() bool
- func (a *AuthPrivateKey) KeyPaths() algebraic.NonEmpty[KeyPathSpec]
- func (a *AuthPrivateKey) Kind() AuthMethodKind
- func (a AuthPrivateKey) MarshalJSONTo(e *jsontext.Encoder) error
- func (a *AuthPrivateKey) Passphrase() algebraic.Option[KeyPassphraseBinding]
- type CertPathSpec
- func (t CertPathSpec) AppendText(b []byte) ([]byte, error)
- func (c CertPathSpec) Compare(o CertPathSpec) int
- func (c CertPathSpec) Equal(o CertPathSpec) bool
- func (t CertPathSpec) IsValid() bool
- func (t CertPathSpec) IsZero() bool
- func (t CertPathSpec) MarshalText() ([]byte, error)
- func (t CertPathSpec) String() string
- func (c *CertPathSpec) UnmarshalText(b []byte) error
- type ChallengeRule
- type ChallengeRuleKind
- func (k ChallengeRuleKind) AppendText(b []byte) ([]byte, error)
- func (k ChallengeRuleKind) IsValid() bool
- func (k ChallengeRuleKind) IsZero() bool
- func (k ChallengeRuleKind) MarshalText() ([]byte, error)
- func (k ChallengeRuleKind) String() string
- func (k *ChallengeRuleKind) UnmarshalText(b []byte) error
- type ChallengeRuleMeta
- type DAGCycle
- type DAGReport
- type Graph
- func (g Graph) AllSecretReferences(extraPending ...PendingSecretRef) []SecretReference
- func (g Graph) CanDeleteHost(id HostID) (bool, []AssetReference)
- func (g Graph) CanDeleteIdentity(id IdentityID) (bool, []AssetReference)
- func (g Graph) CanDeleteNode(id NodeID) (bool, []AssetReference)
- func (g Graph) CanGCSecret(ref secret.Ref, extraPending ...PendingSecretRef) (bool, []SecretReference)
- func (g Graph) FindHostReferences(id HostID) []AssetReference
- func (g Graph) FindIdentityReferences(id IdentityID) []AssetReference
- func (g Graph) FindNodeReferences(id NodeID) []AssetReference
- func (g Graph) FindSecretReferences(target secret.Ref, extraPending ...PendingSecretRef) []SecretReference
- func (g Graph) FindStoreReferences(storeID string, extraPending ...PendingSecretRef) []SecretReference
- func (g Graph) Hosts() []Host
- func (g Graph) Identities() []Identity
- func (g Graph) IsValid() bool
- func (g Graph) KnownStores() []string
- func (g Graph) Nodes() []Node
- func (g Graph) OpenSSHNodes() []OpenSSHJumpNode
- func (g Graph) ValidateSecretStores(knownStores []string, extraPending ...PendingSecretRef) error
- type GraphSpec
- type Host
- func (h Host) Alias() algebraic.Option[Alias]
- func (h Host) Description() string
- func (h Host) Endpoint() netaddr.Endpoint
- func (h Host) Equal(o Host) bool
- func (h Host) ID() HostID
- func (h Host) IsValid() bool
- func (h Host) IsZero() bool
- func (h Host) MarshalJSONTo(e *jsontext.Encoder) error
- func (h Host) Tags() []Tag
- func (h *Host) UnmarshalJSONFrom(d *jsontext.Decoder) error
- type HostID
- func (t HostID) AppendText(b []byte) ([]byte, error)
- func (id HostID) Compare(o HostID) int
- func (id HostID) Equal(o HostID) bool
- func (t HostID) IsValid() bool
- func (t HostID) IsZero() bool
- func (t HostID) MarshalText() ([]byte, error)
- func (t HostID) String() string
- func (id *HostID) UnmarshalText(b []byte) error
- type HostSpec
- type Identity
- func (id Identity) Auth() AuthMethod
- func (id Identity) Description() string
- func (id Identity) Equal(o Identity) bool
- func (id Identity) ID() IdentityID
- func (id Identity) IsValid() bool
- func (id Identity) IsZero() bool
- func (id Identity) MarshalJSONTo(e *jsontext.Encoder) error
- func (id Identity) Tags() []Tag
- func (id *Identity) UnmarshalJSONFrom(d *jsontext.Decoder) error
- func (id Identity) User() option.Username
- type IdentityID
- func (t IdentityID) AppendText(b []byte) ([]byte, error)
- func (id IdentityID) Compare(o IdentityID) int
- func (id IdentityID) Equal(o IdentityID) bool
- func (t IdentityID) IsValid() bool
- func (t IdentityID) IsZero() bool
- func (t IdentityID) MarshalText() ([]byte, error)
- func (t IdentityID) String() string
- func (id *IdentityID) UnmarshalText(b []byte) error
- type IdentitySpec
- type ImportActionKind
- type ImportBundle
- func (b ImportBundle) Equal(o ImportBundle) bool
- func (b ImportBundle) Hosts() []Host
- func (b ImportBundle) Identities() []Identity
- func (b ImportBundle) IsValid() bool
- func (b ImportBundle) IsZero() bool
- func (b ImportBundle) MarshalJSONTo(e *jsontext.Encoder) error
- func (b ImportBundle) Nodes() []Node
- func (b ImportBundle) SourceFormat() string
- func (b *ImportBundle) UnmarshalJSONFrom(d *jsontext.Decoder) error
- func (b ImportBundle) Warnings() []ImportWarning
- type ImportBundleSpec
- type ImportEntry
- type ImportReport
- type ImportWarning
- func (w ImportWarning) Code() string
- func (w ImportWarning) Equal(o ImportWarning) bool
- func (w ImportWarning) IsValid() bool
- func (w ImportWarning) MarshalJSONTo(e *jsontext.Encoder) error
- func (w ImportWarning) Message() string
- func (w ImportWarning) Subject() string
- func (w *ImportWarning) UnmarshalJSONFrom(d *jsontext.Decoder) error
- type KeyFingerprint
- func (f KeyFingerprint) AppendText(b []byte) ([]byte, error)
- func (f KeyFingerprint) Equal(o KeyFingerprint) bool
- func (f KeyFingerprint) IsValid() bool
- func (f KeyFingerprint) IsZero() bool
- func (f KeyFingerprint) MarshalText() ([]byte, error)
- func (f KeyFingerprint) String() string
- func (f *KeyFingerprint) UnmarshalText(b []byte) error
- type KeyPassphraseBinding
- func (b KeyPassphraseBinding) Equal(o KeyPassphraseBinding) bool
- func (b KeyPassphraseBinding) IsValid() bool
- func (b KeyPassphraseBinding) IsZero() bool
- func (b KeyPassphraseBinding) KeyFingerprint() KeyFingerprint
- func (b KeyPassphraseBinding) MarshalJSONTo(enc *jsontext.Encoder) error
- func (b KeyPassphraseBinding) PassphraseRef() secret.Ref
- func (b *KeyPassphraseBinding) UnmarshalJSONFrom(dec *jsontext.Decoder) error
- type KeyPathSpec
- func (t KeyPathSpec) AppendText(b []byte) ([]byte, error)
- func (k KeyPathSpec) Compare(o KeyPathSpec) int
- func (k KeyPathSpec) Equal(o KeyPathSpec) bool
- func (t KeyPathSpec) IsValid() bool
- func (t KeyPathSpec) IsZero() bool
- func (t KeyPathSpec) MarshalText() ([]byte, error)
- func (t KeyPathSpec) String() string
- func (k *KeyPathSpec) UnmarshalText(b []byte) error
- type NamespaceKind
- type Node
- func (n Node) Aliases() []Alias
- func (n Node) Description() string
- func (n Node) EffectiveProxy() option.ProxyRoute
- func (n Node) Equal(o Node) bool
- func (n Node) Execution() algebraic.Option[execution.LaunchProfile]
- func (n Node) HostRef() HostID
- func (n Node) ID() NodeID
- func (n Node) IdentityRef() IdentityID
- func (n Node) IsValid() bool
- func (n Node) IsZero() bool
- func (n Node) MarshalJSONTo(e *jsontext.Encoder) error
- func (n Node) Options() option.OptionLayer
- func (n Node) Origin() NodeOrigin
- func (n Node) OriginKind() option.OriginKind
- func (n Node) PrivilegePasswordRef() algebraic.Option[secret.Ref]
- func (n Node) Proxy() option.ProxyRoute
- func (n Node) Tags() []Tag
- func (n *Node) UnmarshalJSONFrom(d *jsontext.Decoder) error
- type NodeID
- func (t NodeID) AppendText(b []byte) ([]byte, error)
- func (id NodeID) Compare(o NodeID) int
- func (id NodeID) Equal(o NodeID) bool
- func (t NodeID) IsValid() bool
- func (t NodeID) IsZero() bool
- func (t NodeID) MarshalText() ([]byte, error)
- func (t NodeID) String() string
- func (id *NodeID) UnmarshalText(b []byte) error
- type NodeOrigin
- type NodeSpec
- type OpenSSHJumpNode
- type OriginAdHoc
- type OriginManaged
- type OriginOpenSSHDerived
- func (o *OriginOpenSSHDerived) AllowsFullOpenSSHConfig() bool
- func (o *OriginOpenSSHDerived) BaseAlias() string
- func (o *OriginOpenSSHDerived) IsValid() bool
- func (o *OriginOpenSSHDerived) Kind() option.OriginKind
- func (o OriginOpenSSHDerived) MarshalJSONTo(e *jsontext.Encoder) error
- func (o *OriginOpenSSHDerived) SourceFile() string
- type OriginOpenSSHVirtual
- func (o *OriginOpenSSHVirtual) AllowsFullOpenSSHConfig() bool
- func (o *OriginOpenSSHVirtual) HostPattern() string
- func (o *OriginOpenSSHVirtual) IsValid() bool
- func (o *OriginOpenSSHVirtual) Kind() option.OriginKind
- func (o OriginOpenSSHVirtual) MarshalJSONTo(e *jsontext.Encoder) error
- func (o *OriginOpenSSHVirtual) SourceFile() string
- type PendingSecretRef
- type RuleCommand
- func (r *RuleCommand) Args() []string
- func (r *RuleCommand) Command() string
- func (r *RuleCommand) InstructionPattern() string
- func (r *RuleCommand) IsValid() bool
- func (r *RuleCommand) Kind() ChallengeRuleKind
- func (r RuleCommand) MarshalJSONTo(e *jsontext.Encoder) error
- func (r *RuleCommand) Matches(inst, p string) bool
- func (r *RuleCommand) Name() string
- func (r *RuleCommand) PromptPattern() string
- func (r *RuleCommand) Timeout() algebraic.Option[algebraic.Duration]
- type RuleLoginPassword
- func (r *RuleLoginPassword) InstructionPattern() string
- func (r *RuleLoginPassword) IsValid() bool
- func (r *RuleLoginPassword) Kind() ChallengeRuleKind
- func (r RuleLoginPassword) MarshalJSONTo(e *jsontext.Encoder) error
- func (r *RuleLoginPassword) Matches(inst, p string) bool
- func (r *RuleLoginPassword) Name() string
- func (r *RuleLoginPassword) PromptPattern() string
- type RuleSecretRef
- func (r *RuleSecretRef) InstructionPattern() string
- func (r *RuleSecretRef) IsValid() bool
- func (r *RuleSecretRef) Kind() ChallengeRuleKind
- func (r RuleSecretRef) MarshalJSONTo(e *jsontext.Encoder) error
- func (r *RuleSecretRef) Matches(inst, p string) bool
- func (r *RuleSecretRef) Name() string
- func (r *RuleSecretRef) PromptPattern() string
- func (r *RuleSecretRef) SecretRef() secret.Ref
- type RuleTOTP
- func (r *RuleTOTP) InstructionPattern() string
- func (r *RuleTOTP) IsValid() bool
- func (r *RuleTOTP) Kind() ChallengeRuleKind
- func (r RuleTOTP) MarshalJSONTo(e *jsontext.Encoder) error
- func (r *RuleTOTP) Matches(inst, p string) bool
- func (r *RuleTOTP) Name() string
- func (r *RuleTOTP) PromptPattern() string
- func (r *RuleTOTP) TOTPSecretRef() secret.Ref
- type SecretRefLocation
- func (l SecretRefLocation) AppendText(b []byte) ([]byte, error)
- func (l SecretRefLocation) IsValid() bool
- func (l SecretRefLocation) IsZero() bool
- func (l SecretRefLocation) MarshalText() ([]byte, error)
- func (l SecretRefLocation) String() string
- func (l *SecretRefLocation) UnmarshalText(b []byte) error
- type SecretReference
- type Tag
- type TargetKey
- func (k TargetKey) AppendText(b []byte) ([]byte, error)
- func (k TargetKey) Compare(o TargetKey) int
- func (k TargetKey) Equal(o TargetKey) bool
- func (k TargetKey) IsValid() bool
- func (k TargetKey) IsZero() bool
- func (k TargetKey) MarshalText() ([]byte, error)
- func (k TargetKey) Name() string
- func (k TargetKey) Namespace() NamespaceKind
- func (k TargetKey) String() string
- func (k *TargetKey) UnmarshalText(text []byte) error
Constants ¶
const (
// DefaultMaxJumpDepth 表示默认允许的最大 ProxyJump 跳板深度。
DefaultMaxJumpDepth = 16
)
Variables ¶
var ( ErrInvalidID = errors.New("inventory: 无效的资产标识符") ErrInvalidKeySpec = errors.New("inventory: 无效的私钥、证书或指纹规格") ErrInvalidChallengeRule = errors.New("inventory: 无效的 keyboard-interactive 质询应答规则") ErrInvalidAuthMethod = errors.New("inventory: 无效的认证方式 AuthMethod") ErrAuthCompositeTooDeep = errors.New("inventory: AuthComposite 嵌套深度超限") ErrInvalidNodeOrigin = errors.New("inventory: 无效的节点来源 NodeOrigin") ErrInvalidHost = errors.New("inventory: 无效的主机实体 Host") ErrInvalidIdentity = errors.New("inventory: 无效的身份实体 Identity") ErrInvalidNode = errors.New("inventory: 无效的节点实体 Node") ErrInvalidGraph = errors.New("inventory: 无效的资产配置图 Graph") ErrDuplicateAssetID = errors.New("inventory: 存在重复的资产标识或别名碰撞") ErrMissingAssetRef = errors.New("inventory: 节点引用了不存在的 Host 或 Identity") ErrMissingProxyHop = errors.New("inventory: ProxyJump 引用了不存在的跳板目标") ErrProxyJumpCycle = errors.New("inventory: 检测到跨命名空间 ProxyJump 环路") ErrProxyJumpDepthExceeded = errors.New("inventory: ProxyJump 跳板链深度超过上限") ErrUnknownSecretStore = errors.New("inventory: 凭据引用指向未注册的凭据存储") ErrInvalidImportBundle = errors.New("inventory: 无效的格式无关导入包 ImportBundle") ErrNilWriter = errors.New("inventory: WriteCanonical 或编码目标不能为 nil") ErrNilReceiver = errors.New("inventory: 反序列化目标接收者不能为 nil") )
本包导出的规范哨兵错误,所有非法输入、环路、缺失引用与 JSON null 均严格失败关闭。
Functions ¶
func EqualAuthMethod ¶
func EqualAuthMethod(a, b AuthMethod) bool
EqualAuthMethod 严格按值比对两个 AuthMethod 是否均有效且结构完全等价。
func EqualChallengeRule ¶
func EqualChallengeRule(a, b ChallengeRule) bool
EqualChallengeRule 严格比对两条 ChallengeRule 是否均有效且语义一致。
func EqualNodeOrigin ¶
func EqualNodeOrigin(a, b NodeOrigin) bool
EqualNodeOrigin 严格比对两个 NodeOrigin 是否均有效且完全一致(nil 或零值恒返回 false)。
func MarshalAuthMethodTo ¶
func MarshalAuthMethodTo(e *jsontext.Encoder, a AuthMethod) error
func MarshalChallengeRuleTo ¶
func MarshalChallengeRuleTo(e *jsontext.Encoder, r ChallengeRule) error
MarshalChallengeRuleTo..UnmarshalNodeOriginFrom 为全部封闭和类型提供多态 JSON/v2 确定性编解码。
func MarshalNodeOriginTo ¶
func MarshalNodeOriginTo(e *jsontext.Encoder, o NodeOrigin) error
func ToOptionOriginKind ¶
func ToOptionOriginKind(origin NodeOrigin) option.OriginKind
ToOptionOriginKind 穷尽地将 NodeOrigin 投影为 option.OriginKind;nil 或无效变体返回 option.OriginInvalid。
func WriteAuthMethodCanonical ¶
func WriteAuthMethodCanonical(w io.Writer, m AuthMethod) error
WriteAuthMethodCanonical 以零反射、零明文的方式写入 AuthMethod 规范摘要字节流,供 plan.HopSpec 计算认证摘要。
Types ¶
type AgentSpec ¶
type AgentSpec struct {
// contains filtered or unexported fields
}
func ParseAgentSpec ¶
func (AgentSpec) MarshalText ¶
func (*AgentSpec) UnmarshalText ¶
type Alias ¶
type Alias struct {
// contains filtered or unexported fields
}
func ParseAlias ¶
func (Alias) AppendText ¶
func (Alias) MarshalText ¶
func (*Alias) UnmarshalText ¶
type AssetRefLocation ¶
type AssetRefLocation uint8
AssetRefLocation 与 SecretRefLocation 分别标识资产图引用与 5 位置凭据引用类别(零值失败关闭)。
const ( AssetRefLocationInvalid AssetRefLocation = iota // 无效资产引用位置(零值失败关闭) AssetRefNodeHost // Node.HostRef -> Host AssetRefNodeIdentity // Node.IdentityRef -> Identity AssetRefNodeProxyJump // Node.ProxyJump -> Node/Alias )
func ParseAssetRefLocation ¶
func ParseAssetRefLocation(raw string) (AssetRefLocation, error)
ParseAssetRefLocation 与 ParseSecretRefLocation 严格解析规范小写引用位置文本。
func (AssetRefLocation) AppendText ¶
func (l AssetRefLocation) AppendText(b []byte) ([]byte, error)
func (AssetRefLocation) IsValid ¶
func (l AssetRefLocation) IsValid() bool
func (AssetRefLocation) IsZero ¶
func (l AssetRefLocation) IsZero() bool
func (AssetRefLocation) MarshalText ¶
func (l AssetRefLocation) MarshalText() ([]byte, error)
func (AssetRefLocation) String ¶
func (l AssetRefLocation) String() string
func (*AssetRefLocation) UnmarshalText ¶
func (l *AssetRefLocation) UnmarshalText(b []byte) error
type AssetReference ¶
type AssetReference struct {
Location AssetRefLocation `json:"location"`
FromNode NodeID `json:"from_node"`
Target string `json:"target"`
ViaAlias string `json:"via_alias,omitzero"`
}
AssetReference、SecretReference、PendingSecretRef 与 GraphSpec 描述资产与凭据引用检查模型。
type AuthAgent ¶
type AuthAgent struct {
// contains filtered or unexported fields
}
func (*AuthAgent) Kind ¶
func (a *AuthAgent) Kind() AuthMethodKind
type AuthComposite ¶
type AuthComposite struct {
// contains filtered or unexported fields
}
func NewAuthComposite ¶
func NewAuthComposite(methods algebraic.NonEmpty[AuthMethod]) (*AuthComposite, error)
func (*AuthComposite) IsValid ¶
func (a *AuthComposite) IsValid() bool
func (*AuthComposite) Kind ¶
func (a *AuthComposite) Kind() AuthMethodKind
func (AuthComposite) MarshalJSONTo ¶
func (a AuthComposite) MarshalJSONTo(e *jsontext.Encoder) error
func (*AuthComposite) Methods ¶
func (a *AuthComposite) Methods() []AuthMethod
type AuthKeyboardInteractive ¶
type AuthKeyboardInteractive struct {
// contains filtered or unexported fields
}
func NewAuthKeyboardInteractive ¶
func NewAuthKeyboardInteractive(rules algebraic.NonEmpty[ChallengeRule]) (*AuthKeyboardInteractive, error)
func (*AuthKeyboardInteractive) IsValid ¶
func (a *AuthKeyboardInteractive) IsValid() bool
func (*AuthKeyboardInteractive) Kind ¶
func (a *AuthKeyboardInteractive) Kind() AuthMethodKind
func (AuthKeyboardInteractive) MarshalJSONTo ¶
func (a AuthKeyboardInteractive) MarshalJSONTo(e *jsontext.Encoder) error
func (*AuthKeyboardInteractive) Rules ¶
func (a *AuthKeyboardInteractive) Rules() []ChallengeRule
type AuthMethod ¶
type AuthMethod interface {
Kind() AuthMethodKind
IsValid() bool
// contains filtered or unexported methods
}
AuthMethod 是 SSH 认证方式的封闭代数和类型(RFC §3.6): *AuthPassword | *AuthPrivateKey | *AuthAgent | *AuthKeyboardInteractive | *AuthComposite。
func UnmarshalAuthMethodFrom ¶
func UnmarshalAuthMethodFrom(d *jsontext.Decoder) (AuthMethod, error)
type AuthMethodKind ¶
type AuthMethodKind uint8
AuthMethodKind 标识 SSH 认证方式判别类别;零值 AuthMethodKindInvalid 失败关闭。
const ( AuthMethodKindInvalid AuthMethodKind = iota // 无效认证方式(零值失败关闭) AuthMethodKindPassword // 密码凭据引用认证 AuthMethodKindPrivateKey // 私钥与可选证书/绑定口令认证 AuthMethodKindAgent // SSH Agent 认证 AuthMethodKindKeyboardInteractive // RFC 4256 质询应答认证 AuthMethodKindComposite // 多因素或有序组合认证 )
func ParseAuthMethodKind ¶
func ParseAuthMethodKind(raw string) (AuthMethodKind, error)
ParseAuthMethodKind 严格解析认证方式类别文本。
func (AuthMethodKind) AppendText ¶
func (k AuthMethodKind) AppendText(b []byte) ([]byte, error)
func (AuthMethodKind) IsValid ¶
func (k AuthMethodKind) IsValid() bool
func (AuthMethodKind) IsZero ¶
func (k AuthMethodKind) IsZero() bool
func (AuthMethodKind) MarshalText ¶
func (k AuthMethodKind) MarshalText() ([]byte, error)
func (AuthMethodKind) String ¶
func (k AuthMethodKind) String() string
func (*AuthMethodKind) UnmarshalText ¶
func (k *AuthMethodKind) UnmarshalText(text []byte) error
type AuthPassword ¶
type AuthPassword struct {
// contains filtered or unexported fields
}
AuthPassword、AuthPrivateKey、AuthAgent、AuthKeyboardInteractive 与 AuthComposite 为全部不可变封闭认证变体。
func NewAuthPassword ¶
func NewAuthPassword(ref secret.Ref) (*AuthPassword, error)
NewAuthPassword、NewAuthPrivateKey、NewAuthAgent、NewAuthKeyboardInteractive 与 NewAuthComposite 构造不可变认证方式。
func (*AuthPassword) IsValid ¶
func (a *AuthPassword) IsValid() bool
五类认证变体的零值与 nil 安全只读访问器(切片返回防御性副本)。
func (*AuthPassword) Kind ¶
func (a *AuthPassword) Kind() AuthMethodKind
func (AuthPassword) MarshalJSONTo ¶
func (a AuthPassword) MarshalJSONTo(e *jsontext.Encoder) error
func (*AuthPassword) PasswordRef ¶
func (a *AuthPassword) PasswordRef() secret.Ref
type AuthPrivateKey ¶
type AuthPrivateKey struct {
// contains filtered or unexported fields
}
func NewAuthPrivateKey ¶
func NewAuthPrivateKey(keyPaths algebraic.NonEmpty[KeyPathSpec], passphrase algebraic.Option[KeyPassphraseBinding], certPaths []CertPathSpec) (*AuthPrivateKey, error)
func (*AuthPrivateKey) CertPaths ¶
func (a *AuthPrivateKey) CertPaths() []CertPathSpec
func (*AuthPrivateKey) IsValid ¶
func (a *AuthPrivateKey) IsValid() bool
func (*AuthPrivateKey) KeyPaths ¶
func (a *AuthPrivateKey) KeyPaths() algebraic.NonEmpty[KeyPathSpec]
func (*AuthPrivateKey) Kind ¶
func (a *AuthPrivateKey) Kind() AuthMethodKind
func (AuthPrivateKey) MarshalJSONTo ¶
func (a AuthPrivateKey) MarshalJSONTo(e *jsontext.Encoder) error
func (*AuthPrivateKey) Passphrase ¶
func (a *AuthPrivateKey) Passphrase() algebraic.Option[KeyPassphraseBinding]
type CertPathSpec ¶
type CertPathSpec struct {
// contains filtered or unexported fields
}
func ParseCertPathSpec ¶
func ParseCertPathSpec(raw string) (CertPathSpec, error)
func (CertPathSpec) AppendText ¶
func (CertPathSpec) Compare ¶
func (c CertPathSpec) Compare(o CertPathSpec) int
func (CertPathSpec) Equal ¶
func (c CertPathSpec) Equal(o CertPathSpec) bool
func (CertPathSpec) MarshalText ¶
func (*CertPathSpec) UnmarshalText ¶
func (c *CertPathSpec) UnmarshalText(b []byte) error
type ChallengeRule ¶
type ChallengeRule interface {
Kind() ChallengeRuleKind
Name() string
PromptPattern() string
InstructionPattern() string
Matches(instruction, prompt string) bool
IsValid() bool
// contains filtered or unexported methods
}
ChallengeRule 是 keyboard-interactive 质询应答规则的封闭和类型(RFC §3.6): *RuleTOTP | *RuleSecretRef | *RuleCommand | *RuleLoginPassword。
func UnmarshalChallengeRuleFrom ¶
func UnmarshalChallengeRuleFrom(d *jsontext.Decoder) (ChallengeRule, error)
type ChallengeRuleKind ¶
type ChallengeRuleKind uint8
ChallengeRuleKind 标识 keyboard-interactive 质询应答规则类别;零值 ChallengeRuleKindInvalid 失败关闭。
const ( ChallengeRuleKindInvalid ChallengeRuleKind = iota // 无效规则类别(零值失败关闭) ChallengeRuleKindTOTP // 托管 TOTP 种子引用规则 ChallengeRuleKindSecretRef // 静态机密凭据引用规则 ChallengeRuleKindCommand // 外部可执行命令提供者规则 ChallengeRuleKindLoginPassword // 复用身份登录密码规则 )
func ParseChallengeRuleKind ¶
func ParseChallengeRuleKind(raw string) (ChallengeRuleKind, error)
ParseChallengeRuleKind 严格解析质询规则类别文本(totp/secret_ref/command/login_password)。
func (ChallengeRuleKind) AppendText ¶
func (k ChallengeRuleKind) AppendText(b []byte) ([]byte, error)
func (ChallengeRuleKind) IsValid ¶
func (k ChallengeRuleKind) IsValid() bool
func (ChallengeRuleKind) IsZero ¶
func (k ChallengeRuleKind) IsZero() bool
func (ChallengeRuleKind) MarshalText ¶
func (k ChallengeRuleKind) MarshalText() ([]byte, error)
func (ChallengeRuleKind) String ¶
func (k ChallengeRuleKind) String() string
func (*ChallengeRuleKind) UnmarshalText ¶
func (k *ChallengeRuleKind) UnmarshalText(b []byte) error
type ChallengeRuleMeta ¶
type ChallengeRuleMeta struct{ Name, PromptPattern, InstructionPattern string }
ChallengeRuleMeta 承载全部质询规则共用的命名与正则匹配元数据。
type DAGCycle ¶
type DAGCycle struct {
Nodes []TargetKey `json:"nodes"`
}
DAGCycle 与 DAGReport 分别表示 Tarjan SCC 检测到的强连通环路与跨命名空间 ProxyJump 校验报告。
type DAGReport ¶
type DAGReport struct {
MaxObservedDepth int `json:"max_observed_depth"`
TopoOrder []TargetKey `json:"topo_order,omitzero"`
Cycles []DAGCycle `json:"cycles,omitzero"`
}
DAGCycle 与 DAGReport 分别表示 Tarjan SCC 检测到的强连通环路与跨命名空间 ProxyJump 校验报告。
func ValidateProxyDAG ¶
func ValidateProxyDAG(nodes []Node, openSSH []OpenSSHJumpNode, maxDepth int) (DAGReport, error)
ValidateProxyDAG 对托管节点与 OpenSSH 虚拟节点集合执行确定性跨命名空间 ProxyJump 校验: 检测重复 ID/别名碰撞、缺失跳板、Tarjan SCC 自环/多跳环以及最大跳板深度限制。
type Graph ¶
type Graph struct {
// contains filtered or unexported fields
}
Graph 表示经过完整全图不变量校验(INV-F1)的不可变资产配置图快照;零值恒无效。
func NewGraph ¶
NewGraph 校验全图唯一性(含 Host.Alias 冲突)、引用完整性、跨命名空间 Tarjan DAG 与可选凭据存储表,构造不可变 Graph。 仅 spec.MaxJumpDepth == 0 时采用 DefaultMaxJumpDepth,负数严格失败关闭。
func (Graph) AllSecretReferences ¶
func (g Graph) AllSecretReferences(extraPending ...PendingSecretRef) []SecretReference
AllSecretReferences、FindSecretReferences、FindStoreReferences 与 ValidateSecretStores 实现全图 5 位置凭据检查。
func (Graph) CanDeleteHost ¶
func (g Graph) CanDeleteHost(id HostID) (bool, []AssetReference)
CanDeleteHost、CanDeleteIdentity、CanDeleteNode 与 CanGCSecret 为安全删除与 Vault 回收提供失败关闭谓词。
func (Graph) CanDeleteIdentity ¶
func (g Graph) CanDeleteIdentity(id IdentityID) (bool, []AssetReference)
func (Graph) CanDeleteNode ¶
func (g Graph) CanDeleteNode(id NodeID) (bool, []AssetReference)
func (Graph) CanGCSecret ¶
func (g Graph) CanGCSecret(ref secret.Ref, extraPending ...PendingSecretRef) (bool, []SecretReference)
func (Graph) FindHostReferences ¶
func (g Graph) FindHostReferences(id HostID) []AssetReference
FindHostReferences、FindIdentityReferences 与 FindNodeReferences 执行纯资产图反向引用查询。
func (Graph) FindIdentityReferences ¶
func (g Graph) FindIdentityReferences(id IdentityID) []AssetReference
func (Graph) FindNodeReferences ¶
func (g Graph) FindNodeReferences(id NodeID) []AssetReference
func (Graph) FindSecretReferences ¶
func (g Graph) FindSecretReferences(target secret.Ref, extraPending ...PendingSecretRef) []SecretReference
func (Graph) FindStoreReferences ¶
func (g Graph) FindStoreReferences(storeID string, extraPending ...PendingSecretRef) []SecretReference
func (Graph) Identities ¶
func (Graph) KnownStores ¶
func (Graph) OpenSSHNodes ¶
func (g Graph) OpenSSHNodes() []OpenSSHJumpNode
func (Graph) ValidateSecretStores ¶
func (g Graph) ValidateSecretStores(knownStores []string, extraPending ...PendingSecretRef) error
type GraphSpec ¶
type GraphSpec struct {
Hosts []Host
Identities []Identity
Nodes []Node
OpenSSHNodes []OpenSSHJumpNode
KnownStores []string
MaxJumpDepth int
}
AssetReference、SecretReference、PendingSecretRef 与 GraphSpec 描述资产与凭据引用检查模型。
type Host ¶
type Host struct {
// contains filtered or unexported fields
}
Host、Identity 与 Node 分别为资产图中的不可变主机端点、认证身份与目标节点实体;零值恒无效并失败关闭。
func (Host) Description ¶
func (Host) MarshalJSONTo ¶
Host、Identity、Node、ImportWarning 与 ImportBundle 的 Go 1.27 JSON/v2 确定性编解码方法。
type HostID ¶
type HostID struct {
// contains filtered or unexported fields
}
HostID、IdentityID、NodeID、Alias、Tag、KeyPathSpec、CertPathSpec 与 AgentSpec 为强类型不透明值对象(零值失败关闭)。
func ParseHostID ¶
ParseHostID..ParseAgentSpec 校验并构造强类型资产标识与凭据路径规格(失败返回零值)。
func (HostID) AppendText ¶
func (HostID) MarshalText ¶
func (*HostID) UnmarshalText ¶
type HostSpec ¶
type HostSpec struct {
ID HostID
Endpoint netaddr.Endpoint
Alias algebraic.Option[Alias]
Description string
Tags []Tag
}
HostSpec、IdentitySpec 与 NodeSpec 是构造不可变核心资产实体的显式入参规格。
type Identity ¶
type Identity struct {
// contains filtered or unexported fields
}
func NewIdentity ¶
func NewIdentity(spec IdentitySpec) (Identity, error)
NewIdentity 校验身份标识、用户名、不可变认证方式与标签并构造不可变 Identity。
func (Identity) Auth ¶
func (id Identity) Auth() AuthMethod
func (Identity) Description ¶
func (Identity) ID ¶
func (id Identity) ID() IdentityID
func (*Identity) UnmarshalJSONFrom ¶
type IdentityID ¶
type IdentityID struct {
// contains filtered or unexported fields
}
func ParseIdentityID ¶
func ParseIdentityID(raw string) (IdentityID, error)
func (IdentityID) AppendText ¶
func (IdentityID) Compare ¶
func (id IdentityID) Compare(o IdentityID) int
func (IdentityID) Equal ¶
func (id IdentityID) Equal(o IdentityID) bool
func (IdentityID) MarshalText ¶
func (*IdentityID) UnmarshalText ¶
func (id *IdentityID) UnmarshalText(b []byte) error
type IdentitySpec ¶
type IdentitySpec struct {
ID IdentityID
User option.Username
Auth AuthMethod
Description string
Tags []Tag
}
HostSpec、IdentitySpec 与 NodeSpec 是构造不可变核心资产实体的显式入参规格。
type ImportActionKind ¶
type ImportActionKind uint8
ImportActionKind 标识导入预检对单条资产的分类决策;零值 ImportActionInvalid 失败关闭。
const ( ImportActionInvalid ImportActionKind = iota // 无效决策(零值失败关闭) ImportActionAdd // 新增资产 ImportActionUnchanged // 与现有资产完全一致(幂等跳过) ImportActionConflict // 存在标识/别名/引用或合并环路冲突 )
func ParseImportActionKind ¶
func ParseImportActionKind(raw string) (ImportActionKind, error)
ParseImportActionKind 严格解析规范小写导入预检决策("add"、"unchanged"、"conflict")。
func (ImportActionKind) AppendText ¶
func (k ImportActionKind) AppendText(b []byte) ([]byte, error)
func (ImportActionKind) IsValid ¶
func (k ImportActionKind) IsValid() bool
func (ImportActionKind) IsZero ¶
func (k ImportActionKind) IsZero() bool
func (ImportActionKind) MarshalText ¶
func (k ImportActionKind) MarshalText() ([]byte, error)
func (ImportActionKind) String ¶
func (k ImportActionKind) String() string
func (*ImportActionKind) UnmarshalText ¶
func (k *ImportActionKind) UnmarshalText(b []byte) error
type ImportBundle ¶
type ImportBundle struct {
// contains filtered or unexported fields
}
ImportBundle 是面向 FormatImporter 的格式无关资产导入容器(如 openssh/csv); 构造期强制去重排序并校验包内 ID/别名唯一性,零值恒无效并失败关闭。
func NewImportBundle ¶
func NewImportBundle(spec ImportBundleSpec) (ImportBundle, error)
NewImportBundle 校验格式标识、资产集合唯一性与告警并构造不可变 ImportBundle。
func (ImportBundle) Equal ¶
func (b ImportBundle) Equal(o ImportBundle) bool
func (ImportBundle) Hosts ¶
func (b ImportBundle) Hosts() []Host
func (ImportBundle) Identities ¶
func (b ImportBundle) Identities() []Identity
func (ImportBundle) IsValid ¶
func (b ImportBundle) IsValid() bool
func (ImportBundle) IsZero ¶
func (b ImportBundle) IsZero() bool
func (ImportBundle) MarshalJSONTo ¶
func (b ImportBundle) MarshalJSONTo(e *jsontext.Encoder) error
func (ImportBundle) Nodes ¶
func (b ImportBundle) Nodes() []Node
func (ImportBundle) SourceFormat ¶
func (b ImportBundle) SourceFormat() string
func (*ImportBundle) UnmarshalJSONFrom ¶
func (b *ImportBundle) UnmarshalJSONFrom(d *jsontext.Decoder) error
func (ImportBundle) Warnings ¶
func (b ImportBundle) Warnings() []ImportWarning
type ImportBundleSpec ¶
type ImportBundleSpec struct {
SourceFormat string
Hosts []Host
Identities []Identity
Nodes []Node
Warnings []ImportWarning
}
ImportBundleSpec 是构造格式无关 ImportBundle 的入参规格(ADR-006 100% 零 v1 代码)。
type ImportEntry ¶
type ImportEntry struct {
AssetKind string `json:"asset_kind"`
AssetID string `json:"asset_id"`
Action ImportActionKind `json:"action"`
Reason string `json:"reason,omitzero"`
}
ImportEntry 与 ImportReport 描述 PlanImport 产出的不可变确定性冲突与合并分析报告。
type ImportReport ¶
type ImportReport struct {
SourceFormat string `json:"source_format"`
AddCount int `json:"add_count"`
UnchangedCount int `json:"unchanged_count"`
ConflictCount int `json:"conflict_count"`
Entries []ImportEntry `json:"entries,omitzero"`
Warnings []ImportWarning `json:"warnings,omitzero"`
}
ImportEntry 与 ImportReport 描述 PlanImport 产出的不可变确定性冲突与合并分析报告。
func PlanImport ¶
func PlanImport(existing Graph, bundle ImportBundle) (ImportReport, error)
PlanImport 对现有资产图 existing 与导入包 bundle 执行纯函数确定性冲突与合并预检: 逐项分类 Host(含 Host.Alias 冲突)/Identity/Node,校验跨集合引用、别名碰撞、合并 ProxyJump DAG 与 KnownStores。
func (ImportReport) HasConflicts ¶
func (r ImportReport) HasConflicts() bool
HasConflicts 报告导入合并计划是否存在任意冲突项。
type ImportWarning ¶
type ImportWarning struct {
// contains filtered or unexported fields
}
ImportWarning 描述格式导入过程中产生的非致命诊断告警(已校验单行纯文本)。
func NewImportWarning ¶
func NewImportWarning(code, subject, message string) (ImportWarning, error)
NewImportWarning 校验告警码、主题与消息并构造不可变 ImportWarning。
func (ImportWarning) Code ¶
func (w ImportWarning) Code() string
func (ImportWarning) Equal ¶
func (w ImportWarning) Equal(o ImportWarning) bool
func (ImportWarning) IsValid ¶
func (w ImportWarning) IsValid() bool
func (ImportWarning) MarshalJSONTo ¶
func (w ImportWarning) MarshalJSONTo(e *jsontext.Encoder) error
func (ImportWarning) Message ¶
func (w ImportWarning) Message() string
func (ImportWarning) Subject ¶
func (w ImportWarning) Subject() string
func (*ImportWarning) UnmarshalJSONFrom ¶
func (w *ImportWarning) UnmarshalJSONFrom(d *jsontext.Decoder) error
type KeyFingerprint ¶
type KeyFingerprint struct {
// contains filtered or unexported fields
}
KeyFingerprint 表示经严格校验的 OpenSSH SHA-256 公钥指纹("SHA256:<43位无填充Base64>");零值恒无效。
func KeyFingerprintFromSHA256 ¶
func KeyFingerprintFromSHA256(sum [sha256.Size]byte) KeyFingerprint
KeyFingerprintFromSHA256 与 ParseKeyFingerprint 构造或解析规范 OpenSSH 公钥指纹。
func ParseKeyFingerprint ¶
func ParseKeyFingerprint(raw string) (KeyFingerprint, error)
func (KeyFingerprint) AppendText ¶
func (f KeyFingerprint) AppendText(b []byte) ([]byte, error)
func (KeyFingerprint) Equal ¶
func (f KeyFingerprint) Equal(o KeyFingerprint) bool
func (KeyFingerprint) IsValid ¶
func (f KeyFingerprint) IsValid() bool
func (KeyFingerprint) IsZero ¶
func (f KeyFingerprint) IsZero() bool
func (KeyFingerprint) MarshalText ¶
func (f KeyFingerprint) MarshalText() ([]byte, error)
func (KeyFingerprint) String ¶
func (f KeyFingerprint) String() string
func (*KeyFingerprint) UnmarshalText ¶
func (f *KeyFingerprint) UnmarshalText(b []byte) error
type KeyPassphraseBinding ¶
type KeyPassphraseBinding struct {
// contains filtered or unexported fields
}
KeyPassphraseBinding 在类型级结构化强制 INV-F1 / RFC §3.6 不变量:私钥口令凭据引用必绑已校验公钥指纹。
func NewKeyPassphraseBinding ¶
func NewKeyPassphraseBinding(ref secret.Ref, fp KeyFingerprint) (KeyPassphraseBinding, error)
NewKeyPassphraseBinding 校验口令凭据引用与公钥指纹均有效后构造不可变 KeyPassphraseBinding。
func (KeyPassphraseBinding) Equal ¶
func (b KeyPassphraseBinding) Equal(o KeyPassphraseBinding) bool
func (KeyPassphraseBinding) IsValid ¶
func (b KeyPassphraseBinding) IsValid() bool
func (KeyPassphraseBinding) IsZero ¶
func (b KeyPassphraseBinding) IsZero() bool
func (KeyPassphraseBinding) KeyFingerprint ¶
func (b KeyPassphraseBinding) KeyFingerprint() KeyFingerprint
func (KeyPassphraseBinding) MarshalJSONTo ¶
func (b KeyPassphraseBinding) MarshalJSONTo(enc *jsontext.Encoder) error
func (KeyPassphraseBinding) PassphraseRef ¶
func (b KeyPassphraseBinding) PassphraseRef() secret.Ref
func (*KeyPassphraseBinding) UnmarshalJSONFrom ¶
func (b *KeyPassphraseBinding) UnmarshalJSONFrom(dec *jsontext.Decoder) error
type KeyPathSpec ¶
type KeyPathSpec struct {
// contains filtered or unexported fields
}
func ParseKeyPathSpec ¶
func ParseKeyPathSpec(raw string) (KeyPathSpec, error)
func (KeyPathSpec) AppendText ¶
func (KeyPathSpec) Compare ¶
func (k KeyPathSpec) Compare(o KeyPathSpec) int
func (KeyPathSpec) Equal ¶
func (k KeyPathSpec) Equal(o KeyPathSpec) bool
func (KeyPathSpec) MarshalText ¶
func (*KeyPathSpec) UnmarshalText ¶
func (k *KeyPathSpec) UnmarshalText(b []byte) error
type NamespaceKind ¶
type NamespaceKind uint8
NamespaceKind 标识跨命名空间 ProxyJump 资产图中的命名空间类别;零值 NamespaceInvalid 失败关闭。
const ( NamespaceInvalid NamespaceKind = iota // 无效命名空间(零值失败关闭) NamespaceManaged // XOps 托管配置节点命名空间 NamespaceOpenSSH // ~/.ssh/config 只读虚拟节点命名空间 )
func ParseNamespaceKind ¶
func ParseNamespaceKind(raw string) (NamespaceKind, error)
ParseNamespaceKind 严格解析命名空间文本("managed" 或 "openssh")。
func (NamespaceKind) AppendText ¶
func (k NamespaceKind) AppendText(b []byte) ([]byte, error)
func (NamespaceKind) IsValid ¶
func (k NamespaceKind) IsValid() bool
func (NamespaceKind) IsZero ¶
func (k NamespaceKind) IsZero() bool
func (NamespaceKind) MarshalText ¶
func (k NamespaceKind) MarshalText() ([]byte, error)
func (NamespaceKind) String ¶
func (k NamespaceKind) String() string
func (*NamespaceKind) UnmarshalText ¶
func (k *NamespaceKind) UnmarshalText(text []byte) error
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
func (Node) Description ¶
func (Node) EffectiveProxy ¶
func (n Node) EffectiveProxy() option.ProxyRoute
func (Node) IdentityRef ¶
func (n Node) IdentityRef() IdentityID
func (Node) Options ¶
func (n Node) Options() option.OptionLayer
func (Node) Origin ¶
func (n Node) Origin() NodeOrigin
func (Node) OriginKind ¶
func (n Node) OriginKind() option.OriginKind
func (Node) PrivilegePasswordRef ¶
func (Node) Proxy ¶
func (n Node) Proxy() option.ProxyRoute
type NodeID ¶
type NodeID struct {
// contains filtered or unexported fields
}
func ParseNodeID ¶
func (NodeID) AppendText ¶
func (NodeID) MarshalText ¶
func (*NodeID) UnmarshalText ¶
type NodeOrigin ¶
type NodeOrigin interface {
Kind() option.OriginKind
AllowsFullOpenSSHConfig() bool
IsValid() bool
// contains filtered or unexported methods
}
NodeOrigin 是节点来源分类的封闭代数和类型(RFC §3.6 / INV-D2): *OriginManaged | *OriginOpenSSHVirtual | *OriginOpenSSHDerived | *OriginAdHoc。
func UnmarshalNodeOriginFrom ¶
func UnmarshalNodeOriginFrom(d *jsontext.Decoder) (NodeOrigin, error)
type NodeSpec ¶
type NodeSpec struct {
ID NodeID
HostRef HostID
IdentityRef IdentityID
Aliases []Alias
Tags []Tag
Proxy option.ProxyRoute
Execution algebraic.Option[execution.LaunchProfile]
Options option.OptionLayer
PrivilegePasswordRef algebraic.Option[secret.Ref]
Origin NodeOrigin
Description string
}
HostSpec、IdentitySpec 与 NodeSpec 是构造不可变核心资产实体的显式入参规格。
type OpenSSHJumpNode ¶
type OpenSSHJumpNode struct {
// contains filtered or unexported fields
}
OpenSSHJumpNode 表示来自 ~/.ssh/config 只读视图的代理跳板图顶点(供跨命名空间环路检测使用)。
func NewOpenSSHJumpNode ¶
func NewOpenSSHJumpNode(alias string, proxy option.ProxyRoute) (OpenSSHJumpNode, error)
NewOpenSSHJumpNode 校验 OpenSSH Host 别名与 ProxyRoute 并构造 OpenSSHJumpNode。
func (OpenSSHJumpNode) Alias ¶
func (n OpenSSHJumpNode) Alias() string
func (OpenSSHJumpNode) IsValid ¶
func (n OpenSSHJumpNode) IsValid() bool
func (OpenSSHJumpNode) Proxy ¶
func (n OpenSSHJumpNode) Proxy() option.ProxyRoute
type OriginAdHoc ¶
type OriginAdHoc struct {
// contains filtered or unexported fields
}
func NewOriginAdHoc ¶
func NewOriginAdHoc(parentNode algebraic.Option[NodeID]) (*OriginAdHoc, error)
func (*OriginAdHoc) AllowsFullOpenSSHConfig ¶
func (*OriginAdHoc) AllowsFullOpenSSHConfig() bool
func (*OriginAdHoc) IsValid ¶
func (o *OriginAdHoc) IsValid() bool
func (*OriginAdHoc) Kind ¶
func (o *OriginAdHoc) Kind() option.OriginKind
func (OriginAdHoc) MarshalJSONTo ¶
func (o OriginAdHoc) MarshalJSONTo(e *jsontext.Encoder) error
func (*OriginAdHoc) ParentNode ¶
func (o *OriginAdHoc) ParentNode() algebraic.Option[NodeID]
type OriginManaged ¶
type OriginManaged struct {
// contains filtered or unexported fields
}
OriginManaged、OriginOpenSSHVirtual、OriginOpenSSHDerived 与 OriginAdHoc 为全部封闭来源变体(不可变)。
func NewOriginManaged ¶
func NewOriginManaged() *OriginManaged
NewOriginManaged、NewOriginOpenSSHVirtual、NewOriginOpenSSHDerived 与 NewOriginAdHoc 构造节点来源。
func (*OriginManaged) AllowsFullOpenSSHConfig ¶
func (*OriginManaged) AllowsFullOpenSSHConfig() bool
func (*OriginManaged) Kind ¶
func (o *OriginManaged) Kind() option.OriginKind
func (OriginManaged) MarshalJSONTo ¶
func (o OriginManaged) MarshalJSONTo(e *jsontext.Encoder) error
type OriginOpenSSHDerived ¶
type OriginOpenSSHDerived struct {
// contains filtered or unexported fields
}
func NewOriginOpenSSHDerived ¶
func NewOriginOpenSSHDerived(baseAlias, sourceFile string) (*OriginOpenSSHDerived, error)
func (*OriginOpenSSHDerived) AllowsFullOpenSSHConfig ¶
func (o *OriginOpenSSHDerived) AllowsFullOpenSSHConfig() bool
func (*OriginOpenSSHDerived) BaseAlias ¶
func (o *OriginOpenSSHDerived) BaseAlias() string
func (*OriginOpenSSHDerived) IsValid ¶
func (o *OriginOpenSSHDerived) IsValid() bool
func (*OriginOpenSSHDerived) Kind ¶
func (o *OriginOpenSSHDerived) Kind() option.OriginKind
func (OriginOpenSSHDerived) MarshalJSONTo ¶
func (o OriginOpenSSHDerived) MarshalJSONTo(e *jsontext.Encoder) error
func (*OriginOpenSSHDerived) SourceFile ¶
func (o *OriginOpenSSHDerived) SourceFile() string
type OriginOpenSSHVirtual ¶
type OriginOpenSSHVirtual struct {
// contains filtered or unexported fields
}
func NewOriginOpenSSHVirtual ¶
func NewOriginOpenSSHVirtual(hostPattern, sourceFile string) (*OriginOpenSSHVirtual, error)
func (*OriginOpenSSHVirtual) AllowsFullOpenSSHConfig ¶
func (o *OriginOpenSSHVirtual) AllowsFullOpenSSHConfig() bool
func (*OriginOpenSSHVirtual) HostPattern ¶
func (o *OriginOpenSSHVirtual) HostPattern() string
func (*OriginOpenSSHVirtual) IsValid ¶
func (o *OriginOpenSSHVirtual) IsValid() bool
func (*OriginOpenSSHVirtual) Kind ¶
func (o *OriginOpenSSHVirtual) Kind() option.OriginKind
func (OriginOpenSSHVirtual) MarshalJSONTo ¶
func (o OriginOpenSSHVirtual) MarshalJSONTo(e *jsontext.Encoder) error
func (*OriginOpenSSHVirtual) SourceFile ¶
func (o *OriginOpenSSHVirtual) SourceFile() string
type PendingSecretRef ¶
AssetReference、SecretReference、PendingSecretRef 与 GraphSpec 描述资产与凭据引用检查模型。
type RuleCommand ¶
type RuleCommand struct {
// contains filtered or unexported fields
}
func NewRuleCommand ¶
func NewRuleCommand(meta ChallengeRuleMeta, command string, args []string, timeout algebraic.Option[algebraic.Duration]) (*RuleCommand, error)
func (*RuleCommand) Args ¶
func (r *RuleCommand) Args() []string
func (*RuleCommand) Command ¶
func (r *RuleCommand) Command() string
func (*RuleCommand) InstructionPattern ¶
func (r *RuleCommand) InstructionPattern() string
func (*RuleCommand) IsValid ¶
func (r *RuleCommand) IsValid() bool
func (*RuleCommand) Kind ¶
func (r *RuleCommand) Kind() ChallengeRuleKind
func (RuleCommand) MarshalJSONTo ¶
func (r RuleCommand) MarshalJSONTo(e *jsontext.Encoder) error
func (*RuleCommand) Matches ¶
func (r *RuleCommand) Matches(inst, p string) bool
func (*RuleCommand) Name ¶
func (r *RuleCommand) Name() string
func (*RuleCommand) PromptPattern ¶
func (r *RuleCommand) PromptPattern() string
type RuleLoginPassword ¶
type RuleLoginPassword struct {
// contains filtered or unexported fields
}
func NewRuleLoginPassword ¶
func NewRuleLoginPassword(meta ChallengeRuleMeta) (*RuleLoginPassword, error)
func (*RuleLoginPassword) InstructionPattern ¶
func (r *RuleLoginPassword) InstructionPattern() string
func (*RuleLoginPassword) IsValid ¶
func (r *RuleLoginPassword) IsValid() bool
func (*RuleLoginPassword) Kind ¶
func (r *RuleLoginPassword) Kind() ChallengeRuleKind
func (RuleLoginPassword) MarshalJSONTo ¶
func (r RuleLoginPassword) MarshalJSONTo(e *jsontext.Encoder) error
func (*RuleLoginPassword) Matches ¶
func (r *RuleLoginPassword) Matches(inst, p string) bool
func (*RuleLoginPassword) Name ¶
func (r *RuleLoginPassword) Name() string
func (*RuleLoginPassword) PromptPattern ¶
func (r *RuleLoginPassword) PromptPattern() string
type RuleSecretRef ¶
type RuleSecretRef struct {
// contains filtered or unexported fields
}
func NewRuleSecretRef ¶
func NewRuleSecretRef(meta ChallengeRuleMeta, ref secret.Ref) (*RuleSecretRef, error)
func (*RuleSecretRef) InstructionPattern ¶
func (r *RuleSecretRef) InstructionPattern() string
func (*RuleSecretRef) IsValid ¶
func (r *RuleSecretRef) IsValid() bool
func (*RuleSecretRef) Kind ¶
func (r *RuleSecretRef) Kind() ChallengeRuleKind
func (RuleSecretRef) MarshalJSONTo ¶
func (r RuleSecretRef) MarshalJSONTo(e *jsontext.Encoder) error
func (*RuleSecretRef) Matches ¶
func (r *RuleSecretRef) Matches(inst, p string) bool
func (*RuleSecretRef) Name ¶
func (r *RuleSecretRef) Name() string
func (*RuleSecretRef) PromptPattern ¶
func (r *RuleSecretRef) PromptPattern() string
func (*RuleSecretRef) SecretRef ¶
func (r *RuleSecretRef) SecretRef() secret.Ref
type RuleTOTP ¶
type RuleTOTP struct {
// contains filtered or unexported fields
}
RuleTOTP、RuleSecretRef、RuleCommand 与 RuleLoginPassword 为 ChallengeRule 全部封闭不可变变体。
func NewRuleTOTP ¶
func NewRuleTOTP(meta ChallengeRuleMeta, ref secret.Ref) (*RuleTOTP, error)
func (*RuleTOTP) InstructionPattern ¶
func (*RuleTOTP) Kind ¶
func (r *RuleTOTP) Kind() ChallengeRuleKind
func (RuleTOTP) MarshalJSONTo ¶
MarshalJSONTo 为全部封闭变体提供值接收者 json/v2 编码(零值失败关闭)。
func (*RuleTOTP) PromptPattern ¶
func (*RuleTOTP) TOTPSecretRef ¶
type SecretRefLocation ¶
type SecretRefLocation uint8
const ( SecretLocInvalid SecretRefLocation = iota // 无效凭据引用位置(零值失败关闭) SecretLocAuthPassword // 位置 1:Identity.Auth -> AuthPassword SecretLocPrivateKeyPassphrase // 位置 2:Identity.Auth -> AuthPrivateKey.PassphraseBinding SecretLocChallengeTOTP // 位置 3:Identity.Auth -> KeyboardInteractive -> RuleTOTP SecretLocChallengeSecret // 位置 4:Identity.Auth -> KeyboardInteractive -> RuleSecretRef SecretLocNodePrivilege // 位置 5:Node.PrivilegePasswordRef SecretLocPending // 扩展位置:待确认会话 / 运行期覆盖引用 )
func ParseSecretRefLocation ¶
func ParseSecretRefLocation(raw string) (SecretRefLocation, error)
func (SecretRefLocation) AppendText ¶
func (l SecretRefLocation) AppendText(b []byte) ([]byte, error)
func (SecretRefLocation) IsValid ¶
func (l SecretRefLocation) IsValid() bool
func (SecretRefLocation) IsZero ¶
func (l SecretRefLocation) IsZero() bool
func (SecretRefLocation) MarshalText ¶
func (l SecretRefLocation) MarshalText() ([]byte, error)
func (SecretRefLocation) String ¶
func (l SecretRefLocation) String() string
func (*SecretRefLocation) UnmarshalText ¶
func (l *SecretRefLocation) UnmarshalText(b []byte) error
type SecretReference ¶
type SecretReference struct {
Location SecretRefLocation `json:"location"`
OwnerID string `json:"owner_id"`
RuleName string `json:"rule_name,omitzero"`
Ref secret.Ref `json:"ref"`
}
AssetReference、SecretReference、PendingSecretRef 与 GraphSpec 描述资产与凭据引用检查模型。
type Tag ¶
type Tag struct {
// contains filtered or unexported fields
}
func (Tag) AppendText ¶
func (Tag) MarshalText ¶
func (*Tag) UnmarshalText ¶
type TargetKey ¶
type TargetKey struct {
// contains filtered or unexported fields
}
TargetKey 是跨命名空间代理图中的强类型节点顶点键(杜绝依赖 "openssh:" 字符串前缀猜测)。
func NewTargetKey ¶
func NewTargetKey(ns NamespaceKind, name string) (TargetKey, error)
NewTargetKey 校验命名空间与目标名称并构造不可变 TargetKey。
func ParseTargetKey ¶
ParseTargetKey 解析规范文本 "<namespace>:<name>"(如 "managed:web-01"、"openssh:prod_db")为 TargetKey。
func ResolveJumpDAG ¶
func ResolveJumpDAG(nodes []Node, openSSH []OpenSSHJumpNode, start TargetKey, maxDepth int) ([]TargetKey, error)
ResolveJumpDAG 校验全图无环且深度合规后,按拓扑去重顺序解析 start 的上游到目标跳板链 [bastion..., start](O(V+E))。
func (TargetKey) MarshalText ¶
func (TargetKey) Namespace ¶
func (k TargetKey) Namespace() NamespaceKind