targetparse

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: 8 Imported by: 0 modules, 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 targetparse 提供纯无状态的 SSH 目标字符串解析与 CLI ProxyJump 上游选项投影(INV-D3), 供 core/internal/usecase/inventory 在目标解析与多跳跳板展开中复用。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractCLIJumpAuthFallback

func ExtractCLIJumpAuthFallback(cli option.OptionLayer) option.OptionLayer

ExtractCLIJumpAuthFallback 仅提取供临时 AdHoc ProxyJump 跳板兜底复用的 CLI 密钥认证项, 避免覆盖托管节点跳板显式绑定的 IdentityFile/CertificateFile/IdentitiesOnly。

func ExtractCLIJumpPolicy

func ExtractCLIJumpPolicy(cli option.OptionLayer) option.OptionLayer

ExtractCLIJumpPolicy 提取依 INV-D3 须对全部 ProxyJump 上游跳板(含托管与临时跳板)生效的 CLI 安全、非交互、信任库与传输算法覆写,绝不污染目标专用 HostName/Port/User/Proxy/Forward/Session/LocalCommand。

func NormalizeNonPersistedNodeLabel added in v1.5.0

func NormalizeNonPersistedNodeLabel(origHost option.OriginalHostSpec) string

NormalizeNonPersistedNodeLabel 对非持久化临时目标(OriginAdHoc)的 DNS 主机名标签执行小写规范化, 防止调用方以大写域名(如 "PROD.EXAMPLE.COM")绕过大小写敏感的 guardrail.node_overrides 规则; IP 字面量与非 DNS 符号别名原样保留。

Types

type ParsedTarget

type ParsedTarget struct {
	User     algebraic.Option[option.Username]
	OrigHost option.OriginalHostSpec
	Port     algebraic.Option[uint16]
}

ParsedTarget 保存解析 [user@]host[:port] 或托管节点别名后得到的强类型原始目标要素。

func ParseHopSpec

func ParseHopSpec(h option.HopTarget, invalidErr error) (pt ParsedTarget, err error)

ParseHopSpec 将已校验的 option.HopTarget 转换为统一的 ParsedTarget 供递归跳板解析复用。

func ParseSpec

func ParseSpec(raw string, invalidErr error) (ParsedTarget, error)

ParseSpec 解析用户传入的目标字符串(支持 [user@]host[:port]、[ipv6][:port]、裸 IPv6 与符号别名), 严格拒绝空串、空白、控制/格式字符、多个 '@' 与前导零/越界端口。

func ParseSpecWithManaged added in v1.5.0

func ParseSpecWithManaged(raw string, isManagedSymbol func(string) bool, invalidErr error) (ParsedTarget, error)

ParseSpecWithManaged 在 ParseSpec 基础上支持受管符号名回退:当常规 ParseOriginalHost 因单段纯数字形态拒载时, 若 isManagedSymbol 明确确认该主干精确命中当前托管资产索引(NodeID / Node.Aliases / HostID / Host.Aliases), 则以 option.ParseManagedOriginalHost(CanonicalHost=None,零 AdHoc SSRF 风险)放行。

func (ParsedTarget) InlineLayer

func (p ParsedTarget) InlineLayer() option.OptionLayer

InlineLayer 将解析得到的行内用户名与端口投影为最高优先级 OptionLayer。

Jump to

Keyboard shortcuts

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