inventory

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2026 License: MIT Imports: 15 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 纯函数领域核的资产实体模型(Host/Identity/Profile/Node/Graph)、 封闭认证/来源代数和类型、ProxyJump Tarjan DAG 环路与深度校验器(含孤立 Profile 虚拟顶点)、 多 Profile 组合代数、6 位置凭据与资产引用检查器以及格式无关声明式幂等同步计划(PlanImportWithOptions)。

本包、公开只读叶包 invval 及无环内部叶包 internal/invgraph 恪守 100% 纯数学与零副作用铁律(零 os、零 net、 零 context、零 sync/sync/atomic、零反射),并严格遵循 ADR-006(100% 零 v1 兼容与迁移代码)与 ADR-021。

Index

Constants

View Source
const (
	MaxPrivilegePromptPatternBytes = invval.MaxPrivilegePromptPatternBytes
	MaxNodeProfiles                = invval.MaxNodeProfiles
	MaxAdHocRules                  = invval.MaxAdHocRules
	MaxAdHocRuleCIDRs              = invval.MaxAdHocRuleCIDRs
	MaxAdHocRuleDomains            = invval.MaxAdHocRuleDomains

	ChallengeRuleKindInvalid       = invval.ChallengeRuleKindInvalid
	ChallengeRuleKindTOTP          = invval.ChallengeRuleKindTOTP
	ChallengeRuleKindSecretRef     = invval.ChallengeRuleKindSecretRef
	ChallengeRuleKindCommand       = invval.ChallengeRuleKindCommand
	ChallengeRuleKindLoginPassword = invval.ChallengeRuleKindLoginPassword

	AuthMethodKindInvalid             = invval.AuthMethodKindInvalid
	AuthMethodKindPassword            = invval.AuthMethodKindPassword
	AuthMethodKindPrivateKey          = invval.AuthMethodKindPrivateKey
	AuthMethodKindAgent               = invval.AuthMethodKindAgent
	AuthMethodKindKeyboardInteractive = invval.AuthMethodKindKeyboardInteractive
	AuthMethodKindComposite           = invval.AuthMethodKindComposite

	PrivilegePolicyInvalid = invval.PrivilegePolicyInvalid
	PrivilegePolicyNone    = invval.PrivilegePolicyNone
	PrivilegePolicySudo    = invval.PrivilegePolicySudo
	PrivilegePolicySu      = invval.PrivilegePolicySu
	PrivilegePolicyDoas    = invval.PrivilegePolicyDoas
	PrivilegePolicyAuto    = invval.PrivilegePolicyAuto

	NamespaceInvalid = invval.NamespaceInvalid
	NamespaceManaged = invval.NamespaceManaged

	AssetRefLocationInvalid      = invval.AssetRefLocationInvalid
	AssetRefNodeHost             = invval.AssetRefNodeHost
	AssetRefNodeIdentity         = invval.AssetRefNodeIdentity
	AssetRefNodeProxyJump        = invval.AssetRefNodeProxyJump
	AssetRefNodeParent           = invval.AssetRefNodeParent
	AssetRefGlobalProxyJump      = invval.AssetRefGlobalProxyJump
	AssetRefNodeProfile          = invval.AssetRefNodeProfile
	AssetRefProfileIdentity      = invval.AssetRefProfileIdentity
	AssetRefProfileProxyJump     = invval.AssetRefProfileProxyJump
	AssetRefGraphDefaultIdentity = invval.AssetRefGraphDefaultIdentity
	AssetRefAdHocRuleProfile     = invval.AssetRefAdHocRuleProfile

	SecretLocInvalid              = invval.SecretLocInvalid
	SecretLocAuthPassword         = invval.SecretLocAuthPassword
	SecretLocPrivateKeyPassphrase = invval.SecretLocPrivateKeyPassphrase
	SecretLocChallengeTOTP        = invval.SecretLocChallengeTOTP
	SecretLocChallengeSecret      = invval.SecretLocChallengeSecret
	SecretLocNodePrivilege        = invval.SecretLocNodePrivilege
	SecretLocProfilePrivilege     = invval.SecretLocProfilePrivilege
	SecretLocPending              = invval.SecretLocPending

	ImportActionInvalid   = invval.ImportActionInvalid
	ImportActionAdd       = invval.ImportActionAdd
	ImportActionUnchanged = invval.ImportActionUnchanged
	ImportActionConflict  = invval.ImportActionConflict
	ImportActionUpdate    = invval.ImportActionUpdate
	ImportActionPrune     = invval.ImportActionPrune

	ImportSyncInvalid = invval.ImportSyncInvalid
	ImportSyncAddOnly = invval.ImportSyncAddOnly
	ImportSyncUpsert  = invval.ImportSyncUpsert
	ImportSyncPrune   = invval.ImportSyncPrune

	ImportMergeInvalid            = invval.ImportMergeInvalid
	ImportMergePreserveManual     = invval.ImportMergePreserveManual
	ImportMergeSyncNativeMetadata = invval.ImportMergeSyncNativeMetadata
)

持久化提权策略、模板/规则上限、引用位置、命名空间、导入决策、同步模式与合并策略枚举常量重导出。

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

Variables

本包专属的规范哨兵错误,所有非法输入、环路、缺失引用与 JSON null 均严格失败关闭; 与 invval 共享的哨兵错误由 invval_aliases.go 跨包同源只读重导出。

View Source
var (
	ErrInvalidID            = invval.ErrInvalidID
	ErrInvalidKeySpec       = invval.ErrInvalidKeySpec
	ErrInvalidChallengeRule = invval.ErrInvalidChallengeRule
	ErrInvalidAuthMethod    = invval.ErrInvalidAuthMethod
	ErrInvalidNode          = invval.ErrInvalidNode
	ErrInvalidProfile       = invval.ErrInvalidProfile
	ErrInvalidSyncSource    = invval.ErrInvalidSyncSource
	ErrInvalidAdHocRule     = invval.ErrInvalidAdHocRule
	ErrInvalidGraph         = invval.ErrInvalidGraph
	ErrInvalidImportBundle  = invval.ErrInvalidImportBundle
	ErrNilWriter            = invval.ErrNilWriter
	ErrNilReceiver          = invval.ErrNilReceiver
)

跨包只读重导出 invval 共享规范哨兵错误,确保 errors.Is 指针同一性。

Functions

func DetectNodeIDEndpointMismatch added in v1.5.0

func DetectNodeIDEndpointMismatch(id NodeID, user option.Username, ep netaddr.Endpoint) (string, bool)

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 IsBareIPLiteral added in v1.5.0

func IsBareIPLiteral(raw string) bool

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 ProfilePrivSecretRefs added in v1.5.0

func ProfilePrivSecretRefs(p Profile) []secret.Ref

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 AdHocRule added in v1.5.0

type AdHocRule = invval.AdHocRule

强类型资产标识、凭据路径、公钥指纹、持久化提权策略、Profile、SyncSource、AdHocRule、DAG/引用与叶子导入值对象的精确 Go 类型别名。

func NewAdHocRule added in v1.5.0

func NewAdHocRule(spec AdHocRuleSpec) (AdHocRule, error)

type AdHocRuleSet added in v1.5.0

type AdHocRuleSet = invval.AdHocRuleSet

强类型资产标识、凭据路径、公钥指纹、持久化提权策略、Profile、SyncSource、AdHocRule、DAG/引用与叶子导入值对象的精确 Go 类型别名。

func EmptyAdHocRuleSet added in v1.5.0

func EmptyAdHocRuleSet() AdHocRuleSet

func NewAdHocRuleSet added in v1.5.0

func NewAdHocRuleSet(rules []AdHocRule) (AdHocRuleSet, error)

type AdHocRuleSpec added in v1.5.0

type AdHocRuleSpec = invval.AdHocRuleSpec

强类型资产标识、凭据路径、公钥指纹、持久化提权策略、Profile、SyncSource、AdHocRule、DAG/引用与叶子导入值对象的精确 Go 类型别名。

type AgentSpec

type AgentSpec = invval.AgentSpec

强类型资产标识、凭据路径、公钥指纹、持久化提权策略、Profile、SyncSource、AdHocRule、DAG/引用与叶子导入值对象的精确 Go 类型别名。

func ParseAgentSpec

func ParseAgentSpec(raw string) (AgentSpec, error)

type Alias

type Alias = invval.Alias

强类型资产标识、凭据路径、公钥指纹、持久化提权策略、Profile、SyncSource、AdHocRule、DAG/引用与叶子导入值对象的精确 Go 类型别名。

func ParseAlias

func ParseAlias(raw string) (Alias, error)

type AssetRefLocation

type AssetRefLocation = invval.AssetRefLocation

强类型资产标识、凭据路径、公钥指纹、持久化提权策略、Profile、SyncSource、AdHocRule、DAG/引用与叶子导入值对象的精确 Go 类型别名。

func ParseAssetRefLocation

func ParseAssetRefLocation(raw string) (AssetRefLocation, error)

type AssetReference

type AssetReference = invval.AssetReference

强类型资产标识、凭据路径、公钥指纹、持久化提权策略、Profile、SyncSource、AdHocRule、DAG/引用与叶子导入值对象的精确 Go 类型别名。

type AuthAgent

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

func NewAuthAgent

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

func NewAuthAgentWithFilter added in v1.3.0

func NewAuthAgentWithFilter(spec algebraic.Option[AgentSpec], allowedFingerprints []KeyFingerprint, identitiesOnly bool) (*AuthAgent, error)

NewAuthAgentWithFilter 构造带可选公钥指纹过滤列表与 IdentitiesOnly 标志的不可变 AuthAgent(防御性拷贝并保序去重)。

func (*AuthAgent) AllowedFingerprints added in v1.3.0

func (a *AuthAgent) AllowedFingerprints() []KeyFingerprint

func (*AuthAgent) IdentitiesOnly added in v1.3.0

func (a *AuthAgent) IdentitiesOnly() bool

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 = invval.AuthMethodKind

强类型资产标识、凭据路径、公钥指纹、持久化提权策略、Profile、SyncSource、AdHocRule、DAG/引用与叶子导入值对象的精确 Go 类型别名。

func ParseAuthMethodKind

func ParseAuthMethodKind(raw string) (AuthMethodKind, 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、NewAuthPasswordPrompt、NewAuthPrivateKey、NewAuthAgent、NewAuthKeyboardInteractive 与 NewAuthComposite 构造不可变认证方式。

func NewAuthPasswordPrompt added in v1.3.0

func NewAuthPasswordPrompt() *AuthPassword

NewAuthPasswordPrompt 构造不绑定持久化凭据引用的交互式密码认证变体(运行期按需触发惰性 PasswordCallback)。

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() algebraic.Option[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 = invval.CertPathSpec

强类型资产标识、凭据路径、公钥指纹、持久化提权策略、Profile、SyncSource、AdHocRule、DAG/引用与叶子导入值对象的精确 Go 类型别名。

func ParseCertPathSpec

func ParseCertPathSpec(raw string) (CertPathSpec, 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 = invval.ChallengeRuleKind

强类型资产标识、凭据路径、公钥指纹、持久化提权策略、Profile、SyncSource、AdHocRule、DAG/引用与叶子导入值对象的精确 Go 类型别名。

func ParseChallengeRuleKind

func ParseChallengeRuleKind(raw string) (ChallengeRuleKind, error)

持久化提权策略、认证/质询类别、端点 ID 派生、DAG/引用位置、Profile、SyncSource、AdHocRule 与叶子导入类型构造单行转发函数。

type ChallengeRuleMeta

type ChallengeRuleMeta struct{ Name, PromptPattern, InstructionPattern string }

ChallengeRuleMeta 承载全部质询规则共用的命名与正则匹配元数据。

type DAGCycle

type DAGCycle = invval.DAGCycle

强类型资产标识、凭据路径、公钥指纹、持久化提权策略、Profile、SyncSource、AdHocRule、DAG/引用与叶子导入值对象的精确 Go 类型别名。

type DAGReport

type DAGReport = invval.DAGReport

强类型资产标识、凭据路径、公钥指纹、持久化提权策略、Profile、SyncSource、AdHocRule、DAG/引用与叶子导入值对象的精确 Go 类型别名。

func ValidateProxyDAG

func ValidateProxyDAG(nodes []Node, profiles []Profile, maxDepth int) (DAGReport, error)

ValidateProxyDAG 对托管节点(按组合后的 EffectiveNodeProxy 构边)与带 ProxyJumpChain 的 Profile(作为无入边虚拟顶点) 执行确定性 Tarjan SCC 环路检测、跳板存在性校验与最大跳板深度检查(ADR-021 R-M1)。

type Graph

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

Graph 表示经过完整全图不变量校验(INV-F1 / ADR-021)的不可变资产配置图快照;零值恒无效。

func EmptyGraph

func EmptyGraph() Graph

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

func NewGraph

func NewGraph(spec GraphSpec) (Graph, error)

NewGraph 校验全图唯一性(含 Host.Aliases 冲突与索引)、Profile/DefaultIdentity/Node 引用完整性、 静态必解 EffectiveNodeIdentity、ProxyJump Tarjan DAG(含孤立 Profile 虚拟顶点)与 6 位置凭据存储表,构造不可变 Graph。 仅 spec.MaxJumpDepth == 0 时采用 DefaultMaxJumpDepth,负数严格失败关闭。

func (Graph) AllSecretReferences

func (g Graph) AllSecretReferences(extraPending ...PendingSecretRef) []SecretReference

AllSecretReferences、FindSecretReferences、FindStoreReferences 与 ValidateSecretStores 实现全图 6 位置凭据检查。

func (Graph) CanDeleteHost

func (g Graph) CanDeleteHost(id HostID) (bool, []AssetReference)

CanDeleteHost、CanDeleteIdentity、CanDeleteNode、CanDeleteProfile 与 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) CanDeleteProfile added in v1.5.0

func (g Graph) CanDeleteProfile(id ProfileID, extraAdHocRules ...AdHocRuleSet) (bool, []AssetReference)

func (Graph) CanGCSecret

func (g Graph) CanGCSecret(ref secret.Ref, extraPending ...PendingSecretRef) (bool, []SecretReference)

func (Graph) DefaultIdentity added in v1.5.0

func (g Graph) DefaultIdentity() algebraic.Option[IdentityID]

func (Graph) EffectiveNodeExecution added in v1.5.0

func (g Graph) EffectiveNodeExecution(n Node) algebraic.Option[execution.LaunchProfile]

EffectiveNodeExecution 在 [Node, Profiles[0..k-1]] 中选取首个声明 Execution 的层。

func (Graph) EffectiveNodeIdentity added in v1.5.0

func (g Graph) EffectiveNodeIdentity(n Node) (IdentityID, bool)

EffectiveNodeIdentity 按 Node > Profiles[0..k-1] > Graph.DefaultIdentity 顺序解析节点有效身份;失败关闭返回 false。

func (Graph) EffectiveNodeOptions added in v1.5.0

func (g Graph) EffectiveNodeOptions(n Node) option.OptionLayer

EffectiveNodeOptions 按 [Node.Options, Profiles[0..k-1].Options] 折叠节点及模板全部选项层。

func (Graph) EffectiveNodePrivilege added in v1.5.0

func (g Graph) EffectiveNodePrivilege(n Node) (algebraic.Option[PrivilegePolicy], algebraic.Option[secret.Ref])

EffectiveNodePrivilege 按 ADR-021 R-M1 成对原子组合节点及有序模板的提权策略与提权凭据: 首个声明 Privilege 的层原子决定 (Privilege, Ref),绝不从更低层拼接 Ref;若 Node 未设 Privilege 仅设 Ref 而胜出模板为 PrivilegePolicyNone,强制清零 Ref;若 Node 自身为 PrivilegePolicyNone 亦清零 Ref。

func (Graph) EffectiveNodeProfileOptions added in v1.5.0

func (g Graph) EffectiveNodeProfileOptions(n Node) option.OptionLayer

EffectiveNodeProfileOptions 仅折叠 [Profiles[0..k-1].Options],供 4 槽选项求解器第 3 槽位使用。

func (Graph) EffectiveNodeProxy added in v1.5.0

func (g Graph) EffectiveNodeProxy(n Node) option.ProxyRoute

EffectiveNodeProxy 折叠 [Node.Proxy, Profiles[0..k-1].Proxy](区分 ProxyDisabled 与 ProxyJumpDisabled);无效返回 NewProxyDisabled()。

func (Graph) EffectiveNodeTags added in v1.5.0

func (g Graph) EffectiveNodeTags(n Node) []Tag

EffectiveNodeTags 计算节点有效标签并集 Node.Tags ∪ Union(Profiles[i].Tags) ∪ Host.Tags(字典序去重)。

func (Graph) FindAliasReferences added in v1.5.0

func (g Graph) FindAliasReferences(nodeID NodeID, removedAliases []Alias) []AssetReference

FindAliasReferences 查找全图中通过指定被移除别名(removedAliases)经 Node.Proxy 或 Profile.Proxy 引用 nodeID 的全部下游条目。

func (Graph) FindHostReferences

func (g Graph) FindHostReferences(id HostID) []AssetReference

FindHostReferences、FindIdentityReferences、FindNodeReferences、FindAliasReferences 与 FindProfileReferences 执行纯资产图反向引用查询。

func (Graph) FindIdentityReferences

func (g Graph) FindIdentityReferences(id IdentityID) []AssetReference

func (Graph) FindNodeReferences

func (g Graph) FindNodeReferences(id NodeID) []AssetReference

func (Graph) FindProfileReferences added in v1.5.0

func (g Graph) FindProfileReferences(id ProfileID, extraAdHocRules ...AdHocRuleSet) []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) HostIndex added in v1.3.0

func (g Graph) HostIndex() HostIndex

HostIndex 返回全图主机的不可变 O(1) 查找索引防御性副本;零值图返回无效零值 HostIndex。

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) LookupHost added in v1.3.0

func (g Graph) LookupHost(idOrAlias string) (Host, bool)

LookupHost 按 Host.ID() 或任意 Host.Aliases() 在全图主机索引中执行 O(1) 查找;零值图或未命中返回 (Host{}, false)。

func (Graph) LookupProfile added in v1.5.0

func (g Graph) LookupProfile(id ProfileID) (Profile, bool)

func (Graph) Nodes

func (g Graph) Nodes() []Node

func (Graph) Profiles added in v1.5.0

func (g Graph) Profiles() []Profile

Profiles、DefaultIdentity 与 LookupProfile 提供资产图模板与默认兜底身份的只读访问。

func (Graph) ValidateSecretStores

func (g Graph) ValidateSecretStores(knownStores []string, extraPending ...PendingSecretRef) error

type GraphSpec

type GraphSpec struct {
	Hosts           []Host
	Identities      []Identity
	Profiles        []Profile
	DefaultIdentity algebraic.Option[IdentityID]
	Nodes           []Node
	KnownStores     []string
	MaxJumpDepth    int
}

GraphSpec 是构造不可变全图快照 Graph 的显式入参规格。

type Host

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

Host、Identity 与 Node 分别为资产图中的不可变主机端点、认证身份与目标节点实体;零值恒无效并失败关闭。

func NewHost

func NewHost(spec HostSpec) (Host, error)

NewHost 校验主机标识、端点、规范排序去重别名(上限约束且不得与自身 HostID 同名)、描述、标签与可选 SyncSource 并构造不可变 Host。

func (Host) Aliases added in v1.3.0

func (h Host) Aliases() []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) HasAlias added in v1.3.0

func (h Host) HasAlias(alias Alias) 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 与 ImportBundle 的 Go 1.27 JSON/v2 确定性编解码方法。

func (Host) SyncSource added in v1.5.0

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

func (Host) Tags

func (h Host) Tags() []Tag

func (*Host) UnmarshalJSONFrom

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

type HostID

type HostID = invval.HostID

强类型资产标识、凭据路径、公钥指纹、持久化提权策略、Profile、SyncSource、AdHocRule、DAG/引用与叶子导入值对象的精确 Go 类型别名。

func DeriveSyncedHostID added in v1.5.0

func DeriveSyncedHostID(current HostID, oldNodeID, newNodeID NodeID, oldEP, newEP netaddr.Endpoint) (HostID, bool)

func ParseHostID

func ParseHostID(raw string) (HostID, error)

强类型资产标识与凭据路径规格构造单行转发函数。

type HostIndex added in v1.3.0

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

HostIndex 提供基于主机 ID 与全部 Host.Aliases() 的不可变 O(1) 主机查找索引; 构造期强制校验所有主机合法、HostID 唯一且全部主机别名不与主机 ID 或其他主机别名碰撞;零值恒无效并失败关闭。

func NewHostIndex added in v1.3.0

func NewHostIndex(hosts []Host) (HostIndex, error)

NewHostIndex 校验主机集合唯一性与多别名无碰撞并构造不可变 HostIndex(与 Node 命名空间严格隔离)。

func (HostIndex) Hosts added in v1.3.0

func (idx HostIndex) Hosts() []Host

func (HostIndex) IsValid added in v1.3.0

func (idx HostIndex) IsValid() bool

func (HostIndex) IsZero added in v1.3.0

func (idx HostIndex) IsZero() bool

func (HostIndex) Lookup added in v1.3.0

func (idx HostIndex) Lookup(idOrAlias string) (Host, bool)

Lookup 按 Host.ID() 或任意 Host.Aliases() 在 O(1) 内查找目标主机;零值索引或未命中返回 (Host{}, false)。

func (HostIndex) LookupByAlias added in v1.3.0

func (idx HostIndex) LookupByAlias(alias Alias) (Host, bool)

LookupByAlias 仅按强类型 Alias 查找声明该别名的主机(排除仅命中主键 ID 的情况)。

func (HostIndex) LookupByID added in v1.3.0

func (idx HostIndex) LookupByID(id HostID) (Host, bool)

LookupByID 仅按强类型 HostID 精确查找主机(排除仅命中别名的情况)。

type HostSpec

type HostSpec struct {
	ID          HostID
	Endpoint    netaddr.Endpoint
	Aliases     []Alias
	Description string
	Tags        []Tag
	SyncSource  algebraic.Option[SyncSource]
}

HostSpec、IdentitySpec 与 NodeSpec 是构造不可变核心资产实体的显式入参规格。

type Identity

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

func NewIdentity

func NewIdentity(spec IdentitySpec) (Identity, error)

NewIdentity 校验身份标识、用户名、不可变认证方式、描述、标签与可选 SyncSource 并构造不可变 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) SyncSource added in v1.5.0

func (id Identity) SyncSource() algebraic.Option[SyncSource]

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 = invval.IdentityID

强类型资产标识、凭据路径、公钥指纹、持久化提权策略、Profile、SyncSource、AdHocRule、DAG/引用与叶子导入值对象的精确 Go 类型别名。

func DeriveSyncedIdentityID added in v1.5.0

func DeriveSyncedIdentityID(current IdentityID, oldNodeID, newNodeID NodeID, oldUser option.Username, oldEP netaddr.Endpoint, newUser option.Username, newEP netaddr.Endpoint) (IdentityID, bool)

func ParseIdentityID

func ParseIdentityID(raw string) (IdentityID, error)

type IdentitySpec

type IdentitySpec struct {
	ID          IdentityID
	User        option.Username
	Auth        AuthMethod
	Description string
	Tags        []Tag
	SyncSource  algebraic.Option[SyncSource]
}

HostSpec、IdentitySpec 与 NodeSpec 是构造不可变核心资产实体的显式入参规格。

type ImportActionKind

type ImportActionKind = invval.ImportActionKind

强类型资产标识、凭据路径、公钥指纹、持久化提权策略、Profile、SyncSource、AdHocRule、DAG/引用与叶子导入值对象的精确 Go 类型别名。

func ParseImportActionKind

func ParseImportActionKind(raw string) (ImportActionKind, 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 = invval.ImportEntry

强类型资产标识、凭据路径、公钥指纹、持久化提权策略、Profile、SyncSource、AdHocRule、DAG/引用与叶子导入值对象的精确 Go 类型别名。

type ImportMergePolicy added in v1.5.0

type ImportMergePolicy = invval.ImportMergePolicy

强类型资产标识、凭据路径、公钥指纹、持久化提权策略、Profile、SyncSource、AdHocRule、DAG/引用与叶子导入值对象的精确 Go 类型别名。

func ParseImportMergePolicy added in v1.5.0

func ParseImportMergePolicy(raw string) (ImportMergePolicy, error)

type ImportPlanOptions added in v1.5.0

type ImportPlanOptions struct {
	SyncMode          ImportSyncMode                      // 同步模式(必填;零值 ImportSyncInvalid 失败关闭)
	SyncScope         algebraic.Option[SyncScope]         // 规范根同步作用域 (Format, SourceKey);Upsert/Prune 必填
	MaxJumpDepth      int                                 // 合并后 ProxyJump DAG 最大跳数;0 采用 DefaultMaxJumpDepth,负数失败关闭
	GlobalProxy       option.ProxyRoute                   // 可选顶层全局 options.proxy,防裁剪且终态校验全跳板可达
	ActiveEnrollNodes map[NodeID]bool                     // 可选活跃首连租约节点集合,防止 Prune 裁剪在途节点
	AdHocRules        algebraic.Option[AdHocRuleSet]      // 可选顶层只读 adhoc_rules(供合法性核验与引用保护)
	MergePolicy       algebraic.Option[ImportMergePolicy] // 可选显式合并策略;None 时按格式自动选择(csv 同步原生列,其余保留人工字段)
}

ImportPlanOptions 承载声明式幂等同步规划(PlanImportWithOptions / ComputeImportPlan)的策略与外部受保护引用(ADR-021 R-B5/R-B8)。

type ImportPlanResult added in v1.5.0

type ImportPlanResult struct {
	Report          ImportReport
	Hosts           []Host
	Identities      []Identity
	Nodes           []Node
	AffectedNodeIDs []NodeID
}

ImportPlanResult 承载 ComputeImportPlan 产出的确定性报告、合并后资产切片及受影响现有节点列表(供 ApplyImport 门控校验)。

func ComputeImportPlan added in v1.5.0

func ComputeImportPlan(existing Graph, bundle ImportBundle, opts ImportPlanOptions) (ImportPlanResult, error)

ComputeImportPlan 执行与 PlanImportWithOptions 同源的声明式合并规划,同时产出合并后资产切片与直接/间接变更节点列表。

type ImportReport

type ImportReport = invval.ImportReport

强类型资产标识、凭据路径、公钥指纹、持久化提权策略、Profile、SyncSource、AdHocRule、DAG/引用与叶子导入值对象的精确 Go 类型别名。

func PlanImport

func PlanImport(existing Graph, bundle ImportBundle) (ImportReport, error)

PlanImport 对现有资产图 existing 与导入包 bundle 执行默认只增模式(ImportSyncAddOnly)的确定性冲突与合并预检。

func PlanImportWithOptions added in v1.5.0

func PlanImportWithOptions(existing Graph, bundle ImportBundle, opts ImportPlanOptions) (ImportReport, error)

PlanImportWithOptions 对现有资产图 existing 与导入包 bundle 执行声明式幂等导入/同步/两阶段安全裁剪预检(ADR-021 R-B5/R-B8)。

type ImportSyncMode added in v1.5.0

type ImportSyncMode = invval.ImportSyncMode

强类型资产标识、凭据路径、公钥指纹、持久化提权策略、Profile、SyncSource、AdHocRule、DAG/引用与叶子导入值对象的精确 Go 类型别名。

func ParseImportSyncMode added in v1.5.0

func ParseImportSyncMode(raw string) (ImportSyncMode, error)

type ImportWarning

type ImportWarning = invval.ImportWarning

强类型资产标识、凭据路径、公钥指纹、持久化提权策略、Profile、SyncSource、AdHocRule、DAG/引用与叶子导入值对象的精确 Go 类型别名。

func NewImportWarning

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

func NewLocalizedImportWarning added in v1.1.0

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

type KeyFingerprint

type KeyFingerprint = invval.KeyFingerprint

强类型资产标识、凭据路径、公钥指纹、持久化提权策略、Profile、SyncSource、AdHocRule、DAG/引用与叶子导入值对象的精确 Go 类型别名。

func KeyFingerprintFromSHA256

func KeyFingerprintFromSHA256(sum [sha256.Size]byte) KeyFingerprint

func ParseKeyFingerprint

func ParseKeyFingerprint(raw string) (KeyFingerprint, error)

type KeyPassphraseBinding

type KeyPassphraseBinding = invval.KeyPassphraseBinding

强类型资产标识、凭据路径、公钥指纹、持久化提权策略、Profile、SyncSource、AdHocRule、DAG/引用与叶子导入值对象的精确 Go 类型别名。

func NewKeyPassphraseBinding

func NewKeyPassphraseBinding(ref secret.Ref, fp KeyFingerprint) (KeyPassphraseBinding, error)

type KeyPathSpec

type KeyPathSpec = invval.KeyPathSpec

强类型资产标识、凭据路径、公钥指纹、持久化提权策略、Profile、SyncSource、AdHocRule、DAG/引用与叶子导入值对象的精确 Go 类型别名。

func ParseKeyPathSpec

func ParseKeyPathSpec(raw string) (KeyPathSpec, error)

type NamespaceKind

type NamespaceKind = invval.NamespaceKind

强类型资产标识、凭据路径、公钥指纹、持久化提权策略、Profile、SyncSource、AdHocRule、DAG/引用与叶子导入值对象的精确 Go 类型别名。

func ParseNamespaceKind

func ParseNamespaceKind(raw string) (NamespaceKind, error)

type Node

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

func NewNode

func NewNode(spec NodeSpec) (Node, error)

NewNode 校验节点关联标识、有序去重模板列表(上限 8)、别名/标签、代理路由、执行配置、选项层、持久化提权策略、 提权凭据、来源与可选 SyncSource,构造不可变 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

EffectiveProxy 仅返回节点自身声明的代理路由(不含 Profiles 折叠;无效零值失败关闭返回 NewProxyDisabled())。 需要计算节点与模板的组合代理时必须调用 Graph.EffectiveNodeProxy(n)。

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() algebraic.Option[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) Privilege added in v1.3.0

func (n Node) Privilege() algebraic.Option[PrivilegePolicy]

func (Node) PrivilegePasswordRef

func (n Node) PrivilegePasswordRef() algebraic.Option[secret.Ref]

func (Node) Profiles added in v1.5.0

func (n Node) Profiles() []ProfileID

func (Node) Proxy

func (n Node) Proxy() option.ProxyRoute

func (Node) SyncSource added in v1.5.0

func (n Node) SyncSource() algebraic.Option[SyncSource]

func (Node) Tags

func (n Node) Tags() []Tag

func (*Node) UnmarshalJSONFrom

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

type NodeID

type NodeID = invval.NodeID

强类型资产标识、凭据路径、公钥指纹、持久化提权策略、Profile、SyncSource、AdHocRule、DAG/引用与叶子导入值对象的精确 Go 类型别名。

func DeriveNodeIDFromTemplate added in v1.5.0

func DeriveNodeIDFromTemplate(current NodeID, oldUser option.Username, oldEP netaddr.Endpoint, newUser option.Username, newEP netaddr.Endpoint) (NodeID, bool)

func DeriveSyncedNodeID added in v1.5.0

func DeriveSyncedNodeID(current NodeID, oldUser option.Username, oldEP netaddr.Endpoint, newUser option.Username, newEP netaddr.Endpoint) (NodeID, bool)

func ParseNodeID

func ParseNodeID(raw string) (NodeID, error)

type NodeOrigin

type NodeOrigin interface {
	Kind() option.OriginKind
	IsValid() bool
	// contains filtered or unexported methods
}

NodeOrigin 是节点来源分类的封闭代数和类型(ADR-021 收敛为二态): *OriginManaged | *OriginAdHoc。

func UnmarshalNodeOriginFrom

func UnmarshalNodeOriginFrom(d *jsontext.Decoder) (NodeOrigin, error)

type NodeSpec

type NodeSpec struct {
	ID                   NodeID
	HostRef              HostID
	IdentityRef          algebraic.Option[IdentityID]
	Profiles             []ProfileID
	Aliases              []Alias
	Tags                 []Tag
	Proxy                option.ProxyRoute
	Execution            algebraic.Option[execution.LaunchProfile]
	Options              option.OptionLayer
	Privilege            algebraic.Option[PrivilegePolicy]
	PrivilegePasswordRef algebraic.Option[secret.Ref]
	Origin               NodeOrigin
	SyncSource           algebraic.Option[SyncSource]
	Description          string
}

HostSpec、IdentitySpec 与 NodeSpec 是构造不可变核心资产实体的显式入参规格。

type OriginAdHoc

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

func NewOriginAdHoc

func NewOriginAdHoc(parentNode algebraic.Option[NodeID]) (*OriginAdHoc, error)

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 与 OriginAdHoc 为全部封闭来源变体(不可变)。

func NewOriginManaged

func NewOriginManaged() *OriginManaged

NewOriginManaged 与 NewOriginAdHoc 构造节点来源。

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 PendingSecretRef

type PendingSecretRef = invval.PendingSecretRef

强类型资产标识、凭据路径、公钥指纹、持久化提权策略、Profile、SyncSource、AdHocRule、DAG/引用与叶子导入值对象的精确 Go 类型别名。

type PrivilegePolicy added in v1.3.0

type PrivilegePolicy = invval.PrivilegePolicy

强类型资产标识、凭据路径、公钥指纹、持久化提权策略、Profile、SyncSource、AdHocRule、DAG/引用与叶子导入值对象的精确 Go 类型别名。

func NewPrivilegePolicy added in v1.3.0

func NewPrivilegePolicy(spec PrivilegePolicySpec) (PrivilegePolicy, error)

type PrivilegePolicyKind added in v1.3.0

type PrivilegePolicyKind = invval.PrivilegePolicyKind

强类型资产标识、凭据路径、公钥指纹、持久化提权策略、Profile、SyncSource、AdHocRule、DAG/引用与叶子导入值对象的精确 Go 类型别名。

func ParsePrivilegePolicyKind added in v1.3.0

func ParsePrivilegePolicyKind(raw string) (PrivilegePolicyKind, error)

type PrivilegePolicySpec added in v1.3.0

type PrivilegePolicySpec = invval.PrivilegePolicySpec

强类型资产标识、凭据路径、公钥指纹、持久化提权策略、Profile、SyncSource、AdHocRule、DAG/引用与叶子导入值对象的精确 Go 类型别名。

type Profile added in v1.5.0

type Profile = invval.Profile

强类型资产标识、凭据路径、公钥指纹、持久化提权策略、Profile、SyncSource、AdHocRule、DAG/引用与叶子导入值对象的精确 Go 类型别名。

func NewProfile added in v1.5.0

func NewProfile(spec ProfileSpec) (Profile, error)

type ProfileID added in v1.5.0

type ProfileID = invval.ProfileID

强类型资产标识、凭据路径、公钥指纹、持久化提权策略、Profile、SyncSource、AdHocRule、DAG/引用与叶子导入值对象的精确 Go 类型别名。

func ParseProfileID added in v1.5.0

func ParseProfileID(raw string) (ProfileID, error)

type ProfileSpec added in v1.5.0

type ProfileSpec = invval.ProfileSpec

强类型资产标识、凭据路径、公钥指纹、持久化提权策略、Profile、SyncSource、AdHocRule、DAG/引用与叶子导入值对象的精确 Go 类型别名。

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 = invval.SecretRefLocation

强类型资产标识、凭据路径、公钥指纹、持久化提权策略、Profile、SyncSource、AdHocRule、DAG/引用与叶子导入值对象的精确 Go 类型别名。

func ParseSecretRefLocation

func ParseSecretRefLocation(raw string) (SecretRefLocation, error)

type SecretReference

type SecretReference = invval.SecretReference

强类型资产标识、凭据路径、公钥指纹、持久化提权策略、Profile、SyncSource、AdHocRule、DAG/引用与叶子导入值对象的精确 Go 类型别名。

type SyncScope added in v1.5.0

type SyncScope = invval.SyncScope

强类型资产标识、凭据路径、公钥指纹、持久化提权策略、Profile、SyncSource、AdHocRule、DAG/引用与叶子导入值对象的精确 Go 类型别名。

func NewSyncScope added in v1.5.0

func NewSyncScope(format, sourceKey string) (SyncScope, error)

type SyncSource added in v1.5.0

type SyncSource = invval.SyncSource

强类型资产标识、凭据路径、公钥指纹、持久化提权策略、Profile、SyncSource、AdHocRule、DAG/引用与叶子导入值对象的精确 Go 类型别名。

func NewSyncSource added in v1.5.0

func NewSyncSource(spec SyncSourceSpec) (SyncSource, error)

type SyncSourceSpec added in v1.5.0

type SyncSourceSpec = invval.SyncSourceSpec

强类型资产标识、凭据路径、公钥指纹、持久化提权策略、Profile、SyncSource、AdHocRule、DAG/引用与叶子导入值对象的精确 Go 类型别名。

type Tag

type Tag = invval.Tag

强类型资产标识、凭据路径、公钥指纹、持久化提权策略、Profile、SyncSource、AdHocRule、DAG/引用与叶子导入值对象的精确 Go 类型别名。

func ParseTag

func ParseTag(raw string) (Tag, error)

type TargetKey

type TargetKey = invval.TargetKey

强类型资产标识、凭据路径、公钥指纹、持久化提权策略、Profile、SyncSource、AdHocRule、DAG/引用与叶子导入值对象的精确 Go 类型别名。

func NewTargetKey

func NewTargetKey(ns NamespaceKind, name string) (TargetKey, error)

func ParseTargetKey

func ParseTargetKey(raw string) (TargetKey, error)

func ResolveJumpDAG

func ResolveJumpDAG(nodes []Node, profiles []Profile, start TargetKey, maxDepth int) ([]TargetKey, error)

ResolveJumpDAG 校验全图无环且深度合规后,按拓扑去重顺序解析 start 的上游到目标跳板链 [bastion..., start](O(V+E))。

Directories

Path Synopsis
internal
invgraph
Package invgraph 为 core/domain/inventory 提供无环叶级纯函数算子: 涵盖资产标识符/密钥路径/指纹/正则字符集归一化、托管节点与模板虚拟顶点的 ProxyJump Tarjan SCC 环路与深度校验、 拓扑跳板链求解、导入冲突与别名碰撞检测,以及通用编解码与规范二进制写入原语。
Package invgraph 为 core/domain/inventory 提供无环叶级纯函数算子: 涵盖资产标识符/密钥路径/指纹/正则字符集归一化、托管节点与模板虚拟顶点的 ProxyJump Tarjan SCC 环路与深度校验、 拓扑跳板链求解、导入冲突与别名碰撞检测,以及通用编解码与规范二进制写入原语。
Package invval 提供 core/domain/inventory 拆分的不可变资产标识、持久化提权策略、复用模板 Profile、 同步来源元数据 SyncSource、临时主机规则 AdHocRule 与叶子导入值对象公开子包。
Package invval 提供 core/domain/inventory 拆分的不可变资产标识、持久化提权策略、复用模板 Profile、 同步来源元数据 SyncSource、临时主机规则 AdHocRule 与叶子导入值对象公开子包。

Jump to

Keyboard shortcuts

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