inventory

package
v1.1.1 Latest Latest
Warning

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

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

Overview

Package inventory 提供 XOps v2 纯函数领域核的资产实体模型、封闭认证/来源代数和类型、 跨命名空间 Tarjan ProxyJump DAG 环路校验器、5 位置引用检查器与格式无关导入包 ImportBundle。

本包恪守 100% 纯数学与零副作用铁律(零 os、零 net、零 context、零 sync/sync/atomic、零反射), 并严格遵循 ADR-006(100% 零 v1 兼容与迁移代码)。

Index

Constants

View Source
const (
	// DefaultMaxJumpDepth 表示默认允许的最大 ProxyJump 跳板深度。
	DefaultMaxJumpDepth = 16
)

Variables

本包导出的规范哨兵错误,所有非法输入、环路、缺失引用与 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 ParseAgentSpec(raw string) (AgentSpec, error)

func (AgentSpec) AppendText

func (a AgentSpec) AppendText(b []byte) ([]byte, error)

func (AgentSpec) Equal

func (a AgentSpec) Equal(o AgentSpec) bool

func (AgentSpec) IsValid

func (a AgentSpec) IsValid() bool

func (AgentSpec) IsZero

func (a AgentSpec) IsZero() bool

func (AgentSpec) MarshalText

func (a AgentSpec) MarshalText() ([]byte, error)

func (AgentSpec) String

func (a AgentSpec) String() string

func (*AgentSpec) UnmarshalText

func (a *AgentSpec) UnmarshalText(b []byte) error

type Alias

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

func ParseAlias

func ParseAlias(raw string) (Alias, error)

func (Alias) AppendText

func (t Alias) AppendText(b []byte) ([]byte, error)

func (Alias) Compare

func (a Alias) Compare(o Alias) int

func (Alias) Equal

func (a Alias) Equal(o Alias) bool

func (Alias) IsValid

func (t Alias) IsValid() bool

func (Alias) IsZero

func (t Alias) IsZero() bool

func (Alias) MarshalText

func (t Alias) MarshalText() ([]byte, error)

func (Alias) String

func (t Alias) String() string

func (*Alias) UnmarshalText

func (a *Alias) UnmarshalText(b []byte) error

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 NewAuthAgent

func NewAuthAgent(spec algebraic.Option[AgentSpec]) (*AuthAgent, error)

func (*AuthAgent) IsValid

func (a *AuthAgent) IsValid() bool

func (*AuthAgent) Kind

func (a *AuthAgent) Kind() AuthMethodKind

func (AuthAgent) MarshalJSONTo

func (a AuthAgent) MarshalJSONTo(e *jsontext.Encoder) error

func (*AuthAgent) Spec

func (a *AuthAgent) Spec() algebraic.Option[AgentSpec]

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 (*AuthKeyboardInteractive) IsValid

func (a *AuthKeyboardInteractive) IsValid() bool

func (*AuthKeyboardInteractive) Kind

func (AuthKeyboardInteractive) MarshalJSONTo

func (a AuthKeyboardInteractive) MarshalJSONTo(e *jsontext.Encoder) error

func (*AuthKeyboardInteractive) Rules

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 (*AuthPrivateKey) Kind

func (a *AuthPrivateKey) Kind() AuthMethodKind

func (AuthPrivateKey) MarshalJSONTo

func (a AuthPrivateKey) MarshalJSONTo(e *jsontext.Encoder) error

func (*AuthPrivateKey) Passphrase

type CertPathSpec

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

func ParseCertPathSpec

func ParseCertPathSpec(raw string) (CertPathSpec, error)

func (CertPathSpec) AppendText

func (t CertPathSpec) AppendText(b []byte) ([]byte, error)

func (CertPathSpec) Compare

func (c CertPathSpec) Compare(o CertPathSpec) int

func (CertPathSpec) Equal

func (c CertPathSpec) Equal(o CertPathSpec) bool

func (CertPathSpec) IsValid

func (t CertPathSpec) IsValid() bool

func (CertPathSpec) IsZero

func (t CertPathSpec) IsZero() bool

func (CertPathSpec) MarshalText

func (t CertPathSpec) MarshalText() ([]byte, error)

func (CertPathSpec) String

func (t CertPathSpec) String() string

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 EmptyGraph

func EmptyGraph() Graph

EmptyGraph 返回合法的空资产图快照。

func NewGraph

func NewGraph(spec GraphSpec) (Graph, error)

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) Hosts

func (g Graph) Hosts() []Host

func (Graph) Identities

func (g Graph) Identities() []Identity

func (Graph) IsValid

func (g Graph) IsValid() bool

Graph 只读访问器(全部返回防御性拷贝)。

func (Graph) KnownStores

func (g Graph) KnownStores() []string

func (Graph) Nodes

func (g Graph) Nodes() []Node

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 NewHost

func NewHost(spec HostSpec) (Host, error)

NewHost 校验主机标识、端点、可选别名(不得与自身 HostID 同名)、描述与标签并构造不可变 Host。

func (Host) Alias

func (h Host) Alias() algebraic.Option[Alias]

func (Host) Description

func (h Host) Description() string

func (Host) Endpoint

func (h Host) Endpoint() netaddr.Endpoint

func (Host) Equal

func (h Host) Equal(o Host) bool

func (Host) ID

func (h Host) ID() HostID

func (Host) IsValid

func (h Host) IsValid() bool

Host、Identity 与 Node 只读访问器与值等价判定。

func (Host) IsZero

func (h Host) IsZero() bool

func (Host) MarshalJSONTo

func (h Host) MarshalJSONTo(e *jsontext.Encoder) error

Host、Identity、Node、ImportWarning 与 ImportBundle 的 Go 1.27 JSON/v2 确定性编解码方法。

func (Host) Tags

func (h Host) Tags() []Tag

func (*Host) UnmarshalJSONFrom

func (h *Host) UnmarshalJSONFrom(d *jsontext.Decoder) error

type HostID

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

HostID、IdentityID、NodeID、Alias、Tag、KeyPathSpec、CertPathSpec 与 AgentSpec 为强类型不透明值对象(零值失败关闭)。

func ParseHostID

func ParseHostID(raw string) (HostID, error)

ParseHostID..ParseAgentSpec 校验并构造强类型资产标识与凭据路径规格(失败返回零值)。

func (HostID) AppendText

func (t HostID) AppendText(b []byte) ([]byte, error)

func (HostID) Compare

func (id HostID) Compare(o HostID) int

func (HostID) Equal

func (id HostID) Equal(o HostID) bool

强类型标识与路径规格的等价比较、全序与文本反序列化方法。

func (HostID) IsValid

func (t HostID) IsValid() bool

func (HostID) IsZero

func (t HostID) IsZero() bool

func (HostID) MarshalText

func (t HostID) MarshalText() ([]byte, error)

func (HostID) String

func (t HostID) String() string

func (*HostID) UnmarshalText

func (id *HostID) UnmarshalText(b []byte) error

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 (id Identity) Description() string

func (Identity) Equal

func (id Identity) Equal(o Identity) bool

func (Identity) ID

func (id Identity) ID() IdentityID

func (Identity) IsValid

func (id Identity) IsValid() bool

func (Identity) IsZero

func (id Identity) IsZero() bool

func (Identity) MarshalJSONTo

func (id Identity) MarshalJSONTo(e *jsontext.Encoder) error

func (Identity) Tags

func (id Identity) Tags() []Tag

func (*Identity) UnmarshalJSONFrom

func (id *Identity) UnmarshalJSONFrom(d *jsontext.Decoder) error

func (Identity) User

func (id Identity) User() option.Username

type IdentityID

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

func ParseIdentityID

func ParseIdentityID(raw string) (IdentityID, error)

func (IdentityID) AppendText

func (t IdentityID) AppendText(b []byte) ([]byte, error)

func (IdentityID) Compare

func (id IdentityID) Compare(o IdentityID) int

func (IdentityID) Equal

func (id IdentityID) Equal(o IdentityID) bool

func (IdentityID) IsValid

func (t IdentityID) IsValid() bool

func (IdentityID) IsZero

func (t IdentityID) IsZero() bool

func (IdentityID) MarshalText

func (t IdentityID) MarshalText() ([]byte, error)

func (IdentityID) String

func (t IdentityID) String() string

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 描述格式导入过程中产生的非致命诊断告警(已校验单行纯文本); 可选携带延迟渲染的结构化本地化消息(仅内存使用,不参与 JSON 线协议编解码与规范相等性比对)。

func NewImportWarning

func NewImportWarning(code, subject, message string) (ImportWarning, error)

NewImportWarning 校验告警码、主题与消息并构造不可变 ImportWarning。

func NewLocalizedImportWarning added in v1.1.0

func NewLocalizedImportWarning(code, subject string, msg domi18n.Message) (ImportWarning, error)

NewLocalizedImportWarning 校验告警码、主题与结构化本地化消息并构造不可变 ImportWarning, 自动以 msg.Canonical() 填充规范英文 message 字段,并保留 msg 供人类可读终端按语种渲染。

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) LocalizedMessage added in v1.1.0

func (w ImportWarning) LocalizedMessage() algebraic.Option[domi18n.Message]

LocalizedMessage 返回告警可选的延迟本地化结构化消息;零值、无效或经 JSON 反序列化后的告警返回 None。

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 (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 (t KeyPathSpec) AppendText(b []byte) ([]byte, error)

func (KeyPathSpec) Compare

func (k KeyPathSpec) Compare(o KeyPathSpec) int

func (KeyPathSpec) Equal

func (k KeyPathSpec) Equal(o KeyPathSpec) bool

func (KeyPathSpec) IsValid

func (t KeyPathSpec) IsValid() bool

func (KeyPathSpec) IsZero

func (t KeyPathSpec) IsZero() bool

func (KeyPathSpec) MarshalText

func (t KeyPathSpec) MarshalText() ([]byte, error)

func (KeyPathSpec) String

func (t KeyPathSpec) String() string

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 NewNode

func NewNode(spec NodeSpec) (Node, error)

NewNode 校验节点关联标识、别名/标签、代理路由、执行配置、选项层、提权凭据与来源,构造不可变 Node。

func (Node) Aliases

func (n Node) Aliases() []Alias

func (Node) Description

func (n Node) Description() string

func (Node) EffectiveProxy

func (n Node) EffectiveProxy() option.ProxyRoute

func (Node) Equal

func (n Node) Equal(o Node) bool

func (Node) Execution

func (n Node) Execution() algebraic.Option[execution.LaunchProfile]

func (Node) HostRef

func (n Node) HostRef() HostID

func (Node) ID

func (n Node) ID() NodeID

func (Node) IdentityRef

func (n Node) IdentityRef() IdentityID

func (Node) IsValid

func (n Node) IsValid() bool

func (Node) IsZero

func (n Node) IsZero() bool

func (Node) MarshalJSONTo

func (n Node) MarshalJSONTo(e *jsontext.Encoder) error

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 (n Node) PrivilegePasswordRef() algebraic.Option[secret.Ref]

func (Node) Proxy

func (n Node) Proxy() option.ProxyRoute

func (Node) Tags

func (n Node) Tags() []Tag

func (*Node) UnmarshalJSONFrom

func (n *Node) UnmarshalJSONFrom(d *jsontext.Decoder) error

type NodeID

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

func ParseNodeID

func ParseNodeID(raw string) (NodeID, error)

func (NodeID) AppendText

func (t NodeID) AppendText(b []byte) ([]byte, error)

func (NodeID) Compare

func (id NodeID) Compare(o NodeID) int

func (NodeID) Equal

func (id NodeID) Equal(o NodeID) bool

func (NodeID) IsValid

func (t NodeID) IsValid() bool

func (NodeID) IsZero

func (t NodeID) IsZero() bool

func (NodeID) MarshalText

func (t NodeID) MarshalText() ([]byte, error)

func (NodeID) String

func (t NodeID) String() string

func (*NodeID) UnmarshalText

func (id *NodeID) UnmarshalText(b []byte) error

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) IsValid

func (o *OriginManaged) IsValid() bool

四类节点来源变体的零值与 nil 安全只读访问器。

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 (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 (OriginOpenSSHVirtual) MarshalJSONTo

func (o OriginOpenSSHVirtual) MarshalJSONTo(e *jsontext.Encoder) error

func (*OriginOpenSSHVirtual) SourceFile

func (o *OriginOpenSSHVirtual) SourceFile() string

type PendingSecretRef

type PendingSecretRef struct {
	OwnerID string     `json:"owner_id"`
	Ref     secret.Ref `json:"ref"`
}

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

func (*RuleCommand) Timeout

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 (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 (r *RuleTOTP) InstructionPattern() string

func (*RuleTOTP) IsValid

func (r *RuleTOTP) IsValid() bool

func (*RuleTOTP) Kind

func (r *RuleTOTP) Kind() ChallengeRuleKind

func (RuleTOTP) MarshalJSONTo

func (r RuleTOTP) MarshalJSONTo(e *jsontext.Encoder) error

MarshalJSONTo 为全部封闭变体提供值接收者 json/v2 编码(零值失败关闭)。

func (*RuleTOTP) Matches

func (r *RuleTOTP) Matches(inst, p string) bool

func (*RuleTOTP) Name

func (r *RuleTOTP) Name() string

func (*RuleTOTP) PromptPattern

func (r *RuleTOTP) PromptPattern() string

func (*RuleTOTP) TOTPSecretRef

func (r *RuleTOTP) TOTPSecretRef() secret.Ref

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 ParseTag

func ParseTag(raw string) (Tag, error)

func (Tag) AppendText

func (t Tag) AppendText(b []byte) ([]byte, error)

func (Tag) Compare

func (t Tag) Compare(o Tag) int

func (Tag) Equal

func (t Tag) Equal(o Tag) bool

func (Tag) IsValid

func (t Tag) IsValid() bool

func (Tag) IsZero

func (t Tag) IsZero() bool

func (Tag) MarshalText

func (t Tag) MarshalText() ([]byte, error)

func (Tag) String

func (t Tag) String() string

func (*Tag) UnmarshalText

func (t *Tag) UnmarshalText(b []byte) error

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

func ParseTargetKey(raw string) (TargetKey, error)

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) AppendText

func (k TargetKey) AppendText(b []byte) ([]byte, error)

func (TargetKey) Compare

func (k TargetKey) Compare(o TargetKey) int

func (TargetKey) Equal

func (k TargetKey) Equal(o TargetKey) bool

func (TargetKey) IsValid

func (k TargetKey) IsValid() bool

func (TargetKey) IsZero

func (k TargetKey) IsZero() bool

func (TargetKey) MarshalText

func (k TargetKey) MarshalText() ([]byte, error)

func (TargetKey) Name

func (k TargetKey) Name() string

func (TargetKey) Namespace

func (k TargetKey) Namespace() NamespaceKind

func (TargetKey) String

func (k TargetKey) String() string

func (*TargetKey) UnmarshalText

func (k *TargetKey) UnmarshalText(text []byte) error

Jump to

Keyboard shortcuts

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