Documentation
¶
Overview ¶
Package option 提供 XOps v2 纯函数领域核的 OpenSSH 四层选项幺半群、协议级 %C 哈希与唯一纯策略求解器。
本包、公开只读叶包 optval 及无环内部叶包 internal/optparse 恪守 100% 纯数学与零副作用铁律(零 os、零 net、零 context、 零 sync/sync/atomic、零反射),并经 archbound 独占获准导入标准库 crypto/sha1 专供 OpenSSH ssh_config(5) %C 连接哈希计算。
核心代数结构(严格对齐校准后 RFC §3.6、ADR-018 §3.5 与 ADR-019 v2.1,注册全部 57 项 OpenSSH 选项):
- (PathList, Compose, Unset):专用于 IdentityFile/CertificateFile 单指令单路径多行累积的三态路径幺半群;
- (KnownHostsList, Compose, Unset):专用于 UserKnownHostsFile/GlobalKnownHostsFile 的独立不透明 FirstWins 幺半群;
- (AlgoPolicy, Compose, Unset):单指令算法算子(exact/+/-(独占通配)/^),跨指令与跨层按 FirstWins 合并;
- (ProxyRoute, ComposeProxyRoute, ProxyUnset):封闭和类型与双槽遮蔽代数(ProxyJump 与 ProxyCommand);
- (ControlPolicy, Compose, Unset):三槽 FirstWins 直积幺半群(!Path().IsEnabled() 时运行期投影归零);
- (EnvFilter, Compose, Unset):SendEnv 模式列表与 -PATTERN 通配减法幺半群;
- (EnvSet, Compose, Unset):SetEnv KEY=VALUE 首条指令胜出(FirstWins)幺半群;
- (ForwardList/DynamicForwardList, Compose, Unset):LocalForward/RemoteForward/DynamicForward 保序去重追加幺半群;
- (CanonicalDomains/CanonicalizePermittedCNAMEs, Compose, Unset):主机规范化后缀与 CNAME 白名单三态 FirstWins 幺半群;
- ForwardAgentSpec 与 CommandTemplate:四态 Agent 转发规格与 E3/C2 两阶段零 Shell 命令模板解析展开器;
- (OptionLayer, Compose, Unset) 与纯求解入口 ResolveEffectivePolicy / ResolveEffectivePolicyWithOptions。
Index ¶
- Constants
- Variables
- func ComputeConnectionHash(localHost, targetHost string, port uint16, user, jumpHost string) (string, error)
- func ComputePercentC(localHost, targetHost string, port uint16, user string) (string, error)
- func DefaultCiphers() []string
- func DefaultHostKeyAlgorithms() []string
- func DefaultKexAlgorithms() []string
- func DefaultMACs() []string
- func EqualProxyRoute(a, b ProxyRoute) bool
- func ExpandLocalCommand(c SanitizedCmd, ctx TokenContext, env func(string) (string, bool)) ([]string, error)
- func ExpandPathTokens(template string, ctx TokenContext) (string, error)
- func ExpandProxyCommand(c SanitizedCmd, ctx TokenContext, env func(string) (string, bool)) ([]string, error)
- func ExpandTokens(template string, ctx TokenContext) (string, error)
- func MarshalProxyRouteTo(enc *jsontext.Encoder, route ProxyRoute) error
- func ValidateProxyRoute(route ProxyRoute) error
- type AddressFamily
- type AlgoOp
- type AlgoPolicy
- func (p AlgoPolicy) Apply(defaults []string) ([]string, error)
- func (p AlgoPolicy) Compose(lower AlgoPolicy) AlgoPolicy
- func (p AlgoPolicy) Equal(o AlgoPolicy) bool
- func (p AlgoPolicy) IsExact() bool
- func (p AlgoPolicy) IsIdentity() bool
- func (p AlgoPolicy) IsUnset() bool
- func (p AlgoPolicy) IsZero() bool
- func (p AlgoPolicy) MarshalJSONTo(e *jsontext.Encoder) error
- func (p AlgoPolicy) Op() AlgoOp
- func (p AlgoPolicy) String() string
- func (p AlgoPolicy) Tokens() []string
- func (p AlgoPolicy) Transform(defaults []string) []string
- func (p *AlgoPolicy) UnmarshalJSONFrom(d *jsontext.Decoder) error
- type CNAMEPermittedRule
- type CanonicalDomains
- type CanonicalizeMode
- type CanonicalizePermittedCNAMEs
- func DisabledCanonicalizePermittedCNAMEs() CanonicalizePermittedCNAMEs
- func FoldCanonicalizePermittedCNAMEs(ls ...CanonicalizePermittedCNAMEs) CanonicalizePermittedCNAMEs
- func NewCanonicalizePermittedCNAMEs(r ...CNAMEPermittedRule) (CanonicalizePermittedCNAMEs, error)
- func ParseCanonicalizePermittedCNAMEs(t []string) (CanonicalizePermittedCNAMEs, error)
- func UnsetCanonicalizePermittedCNAMEs() CanonicalizePermittedCNAMEs
- type CommandTemplate
- type ControlMasterMode
- type ControlPathKind
- type ControlPathSpec
- type ControlPersistKind
- type ControlPersistSpec
- type ControlPolicy
- type DynamicForwardList
- type EffectivePolicy
- func ResolveEffectivePolicy(origin OriginKind, endpoint netaddr.Endpoint, t1, t2, t3, t4 OptionLayer) (EffectivePolicy, error)
- func ResolveEffectivePolicyWithOptions(origin OriginKind, endpoint netaddr.Endpoint, t1, t2, t3, t4 OptionLayer, ...) (EffectivePolicy, error)
- func ResolveEffectivePolicyWithOriginalHost(origin OriginKind, originalHost OriginalHostSpec, defaultPort uint16, ...) (EffectivePolicy, error)
- func ResolveEffectivePolicyWithOriginalHostOptions(origin OriginKind, originalHost OriginalHostSpec, defaultPort uint16, ...) (EffectivePolicy, error)
- func (p EffectivePolicy) AddressFamily() AddressFamily
- func (p EffectivePolicy) BatchMode() bool
- func (p EffectivePolicy) CanonicalDomains() CanonicalDomains
- func (p EffectivePolicy) CanonicalizeFallbackLocal() bool
- func (p EffectivePolicy) CanonicalizeHostname() CanonicalizeMode
- func (p EffectivePolicy) CanonicalizeMaxDots() int
- func (p EffectivePolicy) CanonicalizePermittedCNAMEs() CanonicalizePermittedCNAMEs
- func (p EffectivePolicy) CertificateFiles() PathList
- func (p EffectivePolicy) Ciphers() []string
- func (p EffectivePolicy) ClearAllForwardings() bool
- func (p EffectivePolicy) ConnectTimeout() algebraic.Option[algebraic.Duration]
- func (p EffectivePolicy) Control() ControlPolicy
- func (p EffectivePolicy) DynamicForwards() DynamicForwardList
- func (p EffectivePolicy) Endpoint() netaddr.Endpoint
- func (p EffectivePolicy) Equal(o EffectivePolicy) bool
- func (p EffectivePolicy) EscapeChar() EscapeCharSpec
- func (p EffectivePolicy) ExitOnForwardFailure() bool
- func (p EffectivePolicy) ForIntermediateHop() EffectivePolicy
- func (p EffectivePolicy) ForkAfterAuthentication() bool
- func (p EffectivePolicy) ForwardAgent() bool
- func (p EffectivePolicy) ForwardAgentSpec() ForwardAgentSpec
- func (p EffectivePolicy) GatewayPorts() GatewayPortsMode
- func (p EffectivePolicy) GlobalKnownHostsFiles() KnownHostsList
- func (p EffectivePolicy) HashKnownHosts() bool
- func (p EffectivePolicy) HostKeyAlgorithms() []string
- func (p EffectivePolicy) IdentitiesOnly() bool
- func (p EffectivePolicy) IdentityAgent() algebraic.Option[IdentityAgentSpec]
- func (p EffectivePolicy) IdentityFiles() PathList
- func (p EffectivePolicy) IsValid() bool
- func (p EffectivePolicy) KbdInteractiveAuthentication() bool
- func (p EffectivePolicy) KexAlgorithms() []string
- func (p EffectivePolicy) LocalCommand() algebraic.Option[SanitizedCmd]
- func (p EffectivePolicy) LocalForwards() ForwardList
- func (p EffectivePolicy) MACs() []string
- func (p EffectivePolicy) MarshalJSONTo(enc *jsontext.Encoder) error
- func (p EffectivePolicy) Options() OptionLayer
- func (p EffectivePolicy) Origin() OriginKind
- func (p EffectivePolicy) OriginalHost() OriginalHostSpec
- func (p EffectivePolicy) PasswordAuthentication() bool
- func (p EffectivePolicy) PercentC(localHost, fallbackUser string) (string, error)
- func (p EffectivePolicy) PermitLocalCommand() bool
- func (p EffectivePolicy) PreferredAuthentications() algebraic.Option[PreferredAuthList]
- func (p EffectivePolicy) Proxy() ProxyRoute
- func (p EffectivePolicy) PubkeyAuthentication() bool
- func (p EffectivePolicy) RemoteCommand() algebraic.Option[RemoteCommandSpec]
- func (p EffectivePolicy) RemoteForwards() ForwardList
- func (p EffectivePolicy) RequestTTY() RequestTTYMode
- func (p EffectivePolicy) SendEnv() EnvFilter
- func (p EffectivePolicy) ServerAliveCountMax() uint32
- func (p EffectivePolicy) ServerAliveInterval() algebraic.Duration
- func (p EffectivePolicy) SessionType() SessionTypeMode
- func (p EffectivePolicy) SetEnv() EnvSet
- func (p EffectivePolicy) StdinNull() bool
- func (p EffectivePolicy) StreamLocalBindMask() StreamLocalBindMask
- func (p EffectivePolicy) StreamLocalBindUnlink() bool
- func (p EffectivePolicy) StrictHostKeyChecking() StrictHostKeyCheckingMode
- func (p EffectivePolicy) TCPKeepAlive() bool
- func (p EffectivePolicy) Tunnel() TunnelMode
- func (p EffectivePolicy) TunnelDevice() TunnelDeviceSpec
- func (p *EffectivePolicy) UnmarshalJSONFrom(dec *jsontext.Decoder) error
- func (p EffectivePolicy) User() algebraic.Option[Username]
- func (p EffectivePolicy) UserKnownHostsFiles() KnownHostsList
- func (p EffectivePolicy) VerifyHostKeyDNS() VerifyHostKeyDNSMode
- type EnvAssignment
- type EnvFilter
- type EnvSet
- type EscapeCharKind
- type EscapeCharSpec
- type ForwardAgentKind
- type ForwardAgentSpec
- type ForwardEndpoint
- type ForwardList
- type ForwardSpec
- type GatewayPortsMode
- type HopTarget
- func (h HopTarget) AppendText(b []byte) ([]byte, error)
- func (h HopTarget) Equal(o HopTarget) bool
- func (h HopTarget) Host() string
- func (h HopTarget) IsValid() bool
- func (h HopTarget) IsZero() bool
- func (h HopTarget) MarshalText() ([]byte, error)
- func (h HopTarget) Port() (uint16, bool)
- func (h HopTarget) String() string
- func (h *HopTarget) UnmarshalText(t []byte) error
- func (h HopTarget) User() string
- type HostNameSpec
- func (h HostNameSpec) AppendText(b []byte) ([]byte, error)
- func (h HostNameSpec) Equal(o HostNameSpec) bool
- func (t HostNameSpec) IsValid() bool
- func (t HostNameSpec) IsZero() bool
- func (h HostNameSpec) MarshalText() ([]byte, error)
- func (h HostNameSpec) ResolveHost(origHost netaddr.CanonicalHost) (z netaddr.CanonicalHost, err error)
- func (h HostNameSpec) ResolveHostFor(origHost OriginalHostSpec) (z netaddr.CanonicalHost, err error)
- func (t HostNameSpec) String() string
- func (h *HostNameSpec) UnmarshalText(t []byte) error
- type IdentityAgentKind
- type IdentityAgentSpec
- type KnownHostsList
- func (k KnownHostsList) Compose(lo KnownHostsList) KnownHostsList
- func (b KnownHostsList) DefaultsAllowed() bool
- func (k KnownHostsList) Equal(o KnownHostsList) bool
- func (b KnownHostsList) IsDisabled() bool
- func (b KnownHostsList) IsSet() bool
- func (b KnownHostsList) IsUnset() bool
- func (b KnownHostsList) IsZero() bool
- func (b KnownHostsList) Items() []PathEntry
- func (k KnownHostsList) MarshalJSONTo(e *jsontext.Encoder) error
- func (b KnownHostsList) RawItems() []string
- func (b KnownHostsList) State() PathListState
- func (k *KnownHostsList) UnmarshalJSONFrom(d *jsontext.Decoder) error
- type OptionClass
- type OptionKey
- type OptionLayer
- func (l OptionLayer) AddressFamily() algebraic.Option[AddressFamily]
- func (l OptionLayer) ApplyParsedOption(opt ParsedOption) OptionLayer
- func (l OptionLayer) BatchMode() algebraic.Option[bool]
- func (l OptionLayer) CanonicalDomains() CanonicalDomains
- func (l OptionLayer) CanonicalizeFallbackLocal() algebraic.Option[bool]
- func (l OptionLayer) CanonicalizeHostname() algebraic.Option[CanonicalizeMode]
- func (l OptionLayer) CanonicalizeMaxDots() algebraic.Option[int]
- func (l OptionLayer) CanonicalizePermittedCNAMEs() CanonicalizePermittedCNAMEs
- func (l OptionLayer) CertificateFiles() PathList
- func (l OptionLayer) Ciphers() AlgoPolicy
- func (l OptionLayer) ClearAllForwardings() algebraic.Option[bool]
- func (l OptionLayer) Compose(lo OptionLayer) OptionLayer
- func (l OptionLayer) ConnectTimeout() algebraic.Option[algebraic.Duration]
- func (l OptionLayer) Control() ControlPolicy
- func (l OptionLayer) DynamicForwards() DynamicForwardList
- func (l OptionLayer) Equal(o OptionLayer) bool
- func (l OptionLayer) EscapeChar() algebraic.Option[EscapeCharSpec]
- func (l OptionLayer) ExitOnForwardFailure() algebraic.Option[bool]
- func (l OptionLayer) FilterForNonOpenSSHOrigin() OptionLayer
- func (l OptionLayer) ForkAfterAuthentication() algebraic.Option[bool]
- func (l OptionLayer) ForwardAgent() algebraic.Option[bool]
- func (l OptionLayer) ForwardAgentSpec() algebraic.Option[ForwardAgentSpec]
- func (l OptionLayer) GatewayPorts() algebraic.Option[GatewayPortsMode]
- func (l OptionLayer) GlobalKnownHostsFiles() KnownHostsList
- func (l OptionLayer) HashKnownHosts() algebraic.Option[bool]
- func (l OptionLayer) HostKeyAlgorithms() AlgoPolicy
- func (l OptionLayer) HostName() algebraic.Option[HostNameSpec]
- func (l OptionLayer) IdentitiesOnly() algebraic.Option[bool]
- func (l OptionLayer) IdentityAgent() algebraic.Option[IdentityAgentSpec]
- func (l OptionLayer) IdentityFiles() PathList
- func (l OptionLayer) IsUnset() bool
- func (l OptionLayer) IsZero() bool
- func (l OptionLayer) KbdInteractiveAuthentication() algebraic.Option[bool]
- func (l OptionLayer) KexAlgorithms() AlgoPolicy
- func (l OptionLayer) LocalCommand() algebraic.Option[SanitizedCmd]
- func (l OptionLayer) LocalForwards() ForwardList
- func (l OptionLayer) MACs() AlgoPolicy
- func (l OptionLayer) MarshalJSONTo(enc *jsontext.Encoder) error
- func (l OptionLayer) PasswordAuthentication() algebraic.Option[bool]
- func (l OptionLayer) PermitLocalCommand() algebraic.Option[bool]
- func (l OptionLayer) Port() algebraic.Option[uint16]
- func (l OptionLayer) PreferredAuthentications() algebraic.Option[PreferredAuthList]
- func (l OptionLayer) Proxy() ProxyRoute
- func (l OptionLayer) PubkeyAuthentication() algebraic.Option[bool]
- func (l OptionLayer) RemoteCommand() algebraic.Option[RemoteCommandSpec]
- func (l OptionLayer) RemoteForwards() ForwardList
- func (l OptionLayer) RequestTTY() algebraic.Option[RequestTTYMode]
- func (l OptionLayer) SendEnv() EnvFilter
- func (l OptionLayer) ServerAliveCountMax() algebraic.Option[uint32]
- func (l OptionLayer) ServerAliveInterval() algebraic.Option[algebraic.Duration]
- func (l OptionLayer) SessionType() algebraic.Option[SessionTypeMode]
- func (l OptionLayer) SetEnv() EnvSet
- func (l OptionLayer) StdinNull() algebraic.Option[bool]
- func (l OptionLayer) StreamLocalBindMask() algebraic.Option[StreamLocalBindMask]
- func (l OptionLayer) StreamLocalBindUnlink() algebraic.Option[bool]
- func (l OptionLayer) StrictHostKeyChecking() algebraic.Option[StrictHostKeyCheckingMode]
- func (l OptionLayer) StripIntermediateHopOptions() OptionLayer
- func (l OptionLayer) TCPKeepAlive() algebraic.Option[bool]
- func (l OptionLayer) Tunnel() algebraic.Option[TunnelMode]
- func (l OptionLayer) TunnelDevice() algebraic.Option[TunnelDeviceSpec]
- func (l *OptionLayer) UnmarshalJSONFrom(dec *jsontext.Decoder) error
- func (l OptionLayer) User() algebraic.Option[Username]
- func (l OptionLayer) UserKnownHostsFiles() KnownHostsList
- func (l OptionLayer) Validate() error
- func (l OptionLayer) VerifyHostKeyDNS() algebraic.Option[VerifyHostKeyDNSMode]
- func (l OptionLayer) WithAddressFamily(f AddressFamily) OptionLayer
- func (l OptionLayer) WithBatchMode(v bool) OptionLayer
- func (l OptionLayer) WithCanonicalDomains(d CanonicalDomains) OptionLayer
- func (l OptionLayer) WithCanonicalizeFallbackLocal(v bool) OptionLayer
- func (l OptionLayer) WithCanonicalizeHostname(m CanonicalizeMode) OptionLayer
- func (l OptionLayer) WithCanonicalizeMaxDots(n int) OptionLayer
- func (l OptionLayer) WithCanonicalizePermittedCNAMEs(c CanonicalizePermittedCNAMEs) OptionLayer
- func (l OptionLayer) WithCertificateFiles(p PathList) OptionLayer
- func (l OptionLayer) WithCiphers(p AlgoPolicy) OptionLayer
- func (l OptionLayer) WithClearAllForwardings(v bool) OptionLayer
- func (l OptionLayer) WithConnectTimeout(d algebraic.Duration) OptionLayer
- func (l OptionLayer) WithControlPolicy(c ControlPolicy) OptionLayer
- func (l OptionLayer) WithDynamicForwards(f DynamicForwardList) OptionLayer
- func (l OptionLayer) WithEscapeChar(e EscapeCharSpec) OptionLayer
- func (l OptionLayer) WithExitOnForwardFailure(v bool) OptionLayer
- func (l OptionLayer) WithForkAfterAuthentication(v bool) OptionLayer
- func (l OptionLayer) WithForwardAgent(v bool) OptionLayer
- func (l OptionLayer) WithForwardAgentSpec(f ForwardAgentSpec) OptionLayer
- func (l OptionLayer) WithGatewayPorts(m GatewayPortsMode) OptionLayer
- func (l OptionLayer) WithGlobalKnownHostsFiles(p KnownHostsList) OptionLayer
- func (l OptionLayer) WithHashKnownHosts(v bool) OptionLayer
- func (l OptionLayer) WithHostKeyAlgorithms(p AlgoPolicy) OptionLayer
- func (l OptionLayer) WithHostName(h HostNameSpec) OptionLayer
- func (l OptionLayer) WithIdentitiesOnly(v bool) OptionLayer
- func (l OptionLayer) WithIdentityAgent(a IdentityAgentSpec) OptionLayer
- func (l OptionLayer) WithIdentityFiles(p PathList) OptionLayer
- func (l OptionLayer) WithKbdInteractiveAuthentication(v bool) OptionLayer
- func (l OptionLayer) WithKexAlgorithms(p AlgoPolicy) OptionLayer
- func (l OptionLayer) WithLocalCommand(c SanitizedCmd) OptionLayer
- func (l OptionLayer) WithLocalForwards(f ForwardList) OptionLayer
- func (l OptionLayer) WithMACs(p AlgoPolicy) OptionLayer
- func (l OptionLayer) WithPasswordAuthentication(v bool) OptionLayer
- func (l OptionLayer) WithPermitLocalCommand(v bool) OptionLayer
- func (l OptionLayer) WithPort(p uint16) OptionLayer
- func (l OptionLayer) WithPreferredAuthentications(p PreferredAuthList) OptionLayer
- func (l OptionLayer) WithProxyRoute(r ProxyRoute) OptionLayer
- func (l OptionLayer) WithPubkeyAuthentication(v bool) OptionLayer
- func (l OptionLayer) WithRemoteCommand(c RemoteCommandSpec) OptionLayer
- func (l OptionLayer) WithRemoteForwards(f ForwardList) OptionLayer
- func (l OptionLayer) WithRequestTTY(m RequestTTYMode) OptionLayer
- func (l OptionLayer) WithSendEnv(f EnvFilter) OptionLayer
- func (l OptionLayer) WithServerAliveCountMax(n uint32) OptionLayer
- func (l OptionLayer) WithServerAliveInterval(d algebraic.Duration) OptionLayer
- func (l OptionLayer) WithSessionType(m SessionTypeMode) OptionLayer
- func (l OptionLayer) WithSetEnv(s EnvSet) OptionLayer
- func (l OptionLayer) WithStdinNull(v bool) OptionLayer
- func (l OptionLayer) WithStreamLocalBindMask(m StreamLocalBindMask) OptionLayer
- func (l OptionLayer) WithStreamLocalBindUnlink(v bool) OptionLayer
- func (l OptionLayer) WithStrictHostKeyChecking(m StrictHostKeyCheckingMode) OptionLayer
- func (l OptionLayer) WithTCPKeepAlive(v bool) OptionLayer
- func (l OptionLayer) WithTunnel(m TunnelMode) OptionLayer
- func (l OptionLayer) WithTunnelDevice(d TunnelDeviceSpec) OptionLayer
- func (l OptionLayer) WithUser(u Username) OptionLayer
- func (l OptionLayer) WithUserKnownHostsFiles(p KnownHostsList) OptionLayer
- func (l OptionLayer) WithVerifyHostKeyDNS(m VerifyHostKeyDNSMode) OptionLayer
- type OptionSpec
- type OriginKind
- type OriginalHostSpec
- func (h OriginalHostSpec) AppendText(b []byte) ([]byte, error)
- func (h OriginalHostSpec) CanonicalHost() (netaddr.CanonicalHost, bool)
- func (h OriginalHostSpec) Equal(o OriginalHostSpec) bool
- func (t OriginalHostSpec) IsValid() bool
- func (t OriginalHostSpec) IsZero() bool
- func (h OriginalHostSpec) MarshalText() ([]byte, error)
- func (t OriginalHostSpec) String() string
- func (h *OriginalHostSpec) UnmarshalText(t []byte) error
- type ParsedOption
- type PathEntry
- func (e PathEntry) AppendText(b []byte) ([]byte, error)
- func (e PathEntry) Equal(o PathEntry) bool
- func (e PathEntry) IsTemplate() bool
- func (e PathEntry) IsValid() bool
- func (e PathEntry) IsZero() bool
- func (e PathEntry) Kind() PathEntryKind
- func (e PathEntry) MarshalText() ([]byte, error)
- func (e PathEntry) String() string
- func (e *PathEntry) UnmarshalText(t []byte) error
- type PathEntryKind
- type PathList
- func (p PathList) Compose(lower PathList) PathList
- func (b PathList) DefaultsAllowed() bool
- func (p PathList) Equal(o PathList) bool
- func (b PathList) IsDisabled() bool
- func (b PathList) IsSet() bool
- func (b PathList) IsUnset() bool
- func (b PathList) IsZero() bool
- func (b PathList) Items() []PathEntry
- func (p PathList) MarshalJSONTo(e *jsontext.Encoder) error
- func (b PathList) RawItems() []string
- func (b PathList) State() PathListState
- func (p PathList) Terminated() bool
- func (p *PathList) UnmarshalJSONFrom(d *jsontext.Decoder) error
- type PathListState
- type PolicyResolveOptions
- type PreferredAuthList
- type ProxyCommandSpec
- type ProxyDisabled
- type ProxyJumpChain
- type ProxyRoute
- type ProxyUnset
- type RemoteCommandKind
- type RemoteCommandSpec
- type RequestTTYMode
- type SanitizedCmd
- func (c SanitizedCmd) AppendText(b []byte) ([]byte, error)
- func (c SanitizedCmd) Equal(o SanitizedCmd) bool
- func (t SanitizedCmd) IsValid() bool
- func (t SanitizedCmd) IsZero() bool
- func (c SanitizedCmd) MarshalText() ([]byte, error)
- func (t SanitizedCmd) String() string
- func (c *SanitizedCmd) UnmarshalText(t []byte) error
- type SessionTypeMode
- type StreamLocalBindMask
- type StrictHostKeyCheckingMode
- func (m StrictHostKeyCheckingMode) AppendText(b []byte) ([]byte, error)
- func (m StrictHostKeyCheckingMode) IsSet() bool
- func (m StrictHostKeyCheckingMode) MarshalText() ([]byte, error)
- func (m StrictHostKeyCheckingMode) String() string
- func (m *StrictHostKeyCheckingMode) UnmarshalText(t []byte) error
- type TokenContext
- type TunnelDeviceSpec
- type TunnelMode
- type Username
- type VerifyHostKeyDNSMode
Constants ¶
const ( OptionClassInvalid OptionClass = OptionClass(optparse.ClassInvalid) OptionClassTarget OptionClass = OptionClass(optparse.ClassTarget) OptionClassMux OptionClass = OptionClass(optparse.ClassMux) OptionClassTransport OptionClass = OptionClass(optparse.ClassTransport) OptionClassAuth OptionClass = OptionClass(optparse.ClassAuth) OptionClassTrust OptionClass = OptionClass(optparse.ClassTrust) OptionClassForward OptionClass = OptionClass(optparse.ClassForward) OptionClassSession OptionClass = OptionClass(optparse.ClassSession) OptionClassLocalExec OptionClass = OptionClass(optparse.ClassLocalExec) StrictHostKeyCheckingUnset StrictHostKeyCheckingMode = StrictHostKeyCheckingMode(optparse.StrictHostKeyUnset) StrictHostKeyCheckingYes StrictHostKeyCheckingMode = StrictHostKeyCheckingMode(optparse.StrictHostKeyYes) StrictHostKeyCheckingNo StrictHostKeyCheckingMode = StrictHostKeyCheckingMode(optparse.StrictHostKeyNo) StrictHostKeyCheckingAsk StrictHostKeyCheckingMode = StrictHostKeyCheckingMode(optparse.StrictHostKeyAsk) StrictHostKeyCheckingAcceptNew StrictHostKeyCheckingMode = StrictHostKeyCheckingMode(optparse.StrictHostKeyAcceptNew) AddressFamilyUnset AddressFamily = AddressFamily(optparse.AddressFamilyUnset) AddressFamilyAny AddressFamily = AddressFamily(optparse.AddressFamilyAny) AddressFamilyInet AddressFamily = AddressFamily(optparse.AddressFamilyInet) AddressFamilyInet6 AddressFamily = AddressFamily(optparse.AddressFamilyInet6) VerifyHostKeyDNSUnset VerifyHostKeyDNSMode = VerifyHostKeyDNSMode(optparse.VerifyHostKeyDNSUnset) VerifyHostKeyDNSNo VerifyHostKeyDNSMode = VerifyHostKeyDNSMode(optparse.VerifyHostKeyDNSNo) VerifyHostKeyDNSYes VerifyHostKeyDNSMode = VerifyHostKeyDNSMode(optparse.VerifyHostKeyDNSYes) VerifyHostKeyDNSAsk VerifyHostKeyDNSMode = VerifyHostKeyDNSMode(optparse.VerifyHostKeyDNSAsk) GatewayPortsUnset GatewayPortsMode = GatewayPortsMode(optparse.GatewayPortsUnset) GatewayPortsNo GatewayPortsMode = GatewayPortsMode(optparse.GatewayPortsNo) GatewayPortsYes GatewayPortsMode = GatewayPortsMode(optparse.GatewayPortsYes) GatewayPortsClientSpecified GatewayPortsMode = GatewayPortsMode(optparse.GatewayPortsClientSpecified) TunnelUnset TunnelMode = TunnelMode(optparse.TunnelUnset) TunnelNo TunnelMode = TunnelMode(optparse.TunnelNo) TunnelPointToPoint TunnelMode = TunnelMode(optparse.TunnelPointToPoint) TunnelEthernet TunnelMode = TunnelMode(optparse.TunnelEthernet) TunnelYes TunnelMode = TunnelMode(optparse.TunnelYes) RequestTTYUnset RequestTTYMode = RequestTTYMode(optparse.RequestTTYUnset) RequestTTYNo RequestTTYMode = RequestTTYMode(optparse.RequestTTYNo) RequestTTYYes RequestTTYMode = RequestTTYMode(optparse.RequestTTYYes) RequestTTYForce RequestTTYMode = RequestTTYMode(optparse.RequestTTYForce) RequestTTYAuto RequestTTYMode = RequestTTYMode(optparse.RequestTTYAuto) SessionTypeUnset SessionTypeMode = SessionTypeMode(optparse.SessionTypeUnset) SessionTypeDefault SessionTypeMode = SessionTypeMode(optparse.SessionTypeDefault) SessionTypeNone SessionTypeMode = SessionTypeMode(optparse.SessionTypeNone) SessionTypeSubsystem SessionTypeMode = SessionTypeMode(optparse.SessionTypeSubsystem) )
const ( DefaultStreamLocalBindMask uint32 = optval.DefaultStreamLocalBindMask TunnelIDAny uint32 = optval.TunnelIDAny DefaultCanonicalizeMaxDots = optval.DefaultCanonicalizeMaxDots MaxCanonicalizeMaxDots = optval.MaxCanonicalizeMaxDots CanonicalizeUnset = optval.CanonicalizeUnset CanonicalizeNo = optval.CanonicalizeNo CanonicalizeYes = optval.CanonicalizeYes CanonicalizeAlways = optval.CanonicalizeAlways ForwardAgentUnset = optval.ForwardAgentUnset ForwardAgentDisabled = optval.ForwardAgentDisabled ForwardAgentDefault = optval.ForwardAgentDefault ForwardAgentCustomPath = optval.ForwardAgentCustomPath ControlMasterUnset = optval.ControlMasterUnset ControlMasterNo = optval.ControlMasterNo ControlMasterYes = optval.ControlMasterYes ControlMasterAsk = optval.ControlMasterAsk ControlMasterAuto = optval.ControlMasterAuto ControlMasterAutoAsk = optval.ControlMasterAutoAsk ControlPathUnset = optval.ControlPathUnset ControlPathDisabled = optval.ControlPathDisabled ControlPathTemplate = optval.ControlPathTemplate ControlPathLiteral = optval.ControlPathLiteral ControlPersistUnset = optval.ControlPersistUnset ControlPersistNo = optval.ControlPersistNo ControlPersistIndefinite = optval.ControlPersistIndefinite ControlPersistTimeout = optval.ControlPersistTimeout IdentityAgentUnset = optval.IdentityAgentUnset IdentityAgentDisabled = optval.IdentityAgentDisabled IdentityAgentSSHAuthSock = optval.IdentityAgentSSHAuthSock IdentityAgentEnvVar = optval.IdentityAgentEnvVar IdentityAgentPath = optval.IdentityAgentPath EscapeCharUnset = optval.EscapeCharUnset EscapeCharDisabled = optval.EscapeCharDisabled EscapeCharByte = optval.EscapeCharByte RemoteCommandUnset = optval.RemoteCommandUnset RemoteCommandDisabled = optval.RemoteCommandDisabled RemoteCommandSet = optval.RemoteCommandSet )
下述常量、类型别名与构造转发函数完整重导出子包 core/domain/option/optval, 保持 core/domain/option 既有公开 API 100% 二进制与源码兼容; //xops:opaque 与 //xops:failclosed 契约唯一归属 optval 定义处,绝不在别名处重复标注。
const DefaultServerAliveCountMax uint32 = 3
DefaultServerAliveCountMax 是 OpenSSH 默认保活探测最大允许丢失次数。
Variables ¶
var ( ErrInvalidOption = optval.ErrInvalidOption ErrUnknownOption = domi18n.Sentinel(domi18n.KeyOptionUnknownOption) ErrInvalidOrigin = domi18n.Sentinel(domi18n.KeyOptionInvalidOrigin) ErrInvalidEndpoint = domi18n.Sentinel(domi18n.KeyOptionInvalidEndpoint) ErrInvalidPathList = domi18n.Sentinel(domi18n.KeyOptionInvalidPathList) ErrInvalidAlgoPolicy = domi18n.Sentinel(domi18n.KeyOptionInvalidAlgoPolicy) ErrEmptyAlgorithmList = domi18n.Sentinel(domi18n.KeyOptionEmptyAlgorithmList) ErrInvalidProxyRoute = optval.ErrInvalidProxyRoute ErrInvalidControlPolicy = optval.ErrInvalidControlPolicy ErrInvalidEnvFilter = optval.ErrInvalidEnvFilter ErrInvalidPercentInput = optval.ErrInvalidPercentInput ErrNilReceiver = optval.ErrNilReceiver )
包级哨兵错误:所有无效输入、未知选项与零值访问均严格失败关闭(共享哨兵与 optval 同源)。
Functions ¶
func ComputeConnectionHash ¶
func ComputeConnectionHash(localHost, targetHost string, port uint16, user, jumpHost string) (string, error)
ComputeConnectionHash 计算含可选末跳主机名的协议级 %C 连接哈希。
func ComputePercentC ¶
ComputePercentC 与 ComputeConnectionHash 计算 OpenSSH ssh_config(5) 协议级 %C 40 位小写十六进制 SHA-1 哈希(SHA1(%l%h%p%r%j)); localHost、targetHost、user 必须非空且 port 位于 [1, 65535],jumpHost 无跳板时可为空串。
func DefaultCiphers ¶
func DefaultCiphers() []string
DefaultCiphers、DefaultMACs、DefaultKexAlgorithms 与 DefaultHostKeyAlgorithms 返回现代安全默认算法列表副本。
func DefaultHostKeyAlgorithms ¶
func DefaultHostKeyAlgorithms() []string
func DefaultKexAlgorithms ¶
func DefaultKexAlgorithms() []string
func DefaultMACs ¶
func DefaultMACs() []string
func EqualProxyRoute ¶
func EqualProxyRoute(a, b ProxyRoute) bool
func ExpandLocalCommand ¶ added in v1.3.0
func ExpandLocalCommand(c SanitizedCmd, ctx TokenContext, env func(string) (string, bool)) ([]string, error)
func ExpandPathTokens ¶
func ExpandPathTokens(template string, ctx TokenContext) (string, error)
ExpandPathTokens 对路径模板执行路径安全的单遍 % token 展开。
func ExpandProxyCommand ¶ added in v1.3.0
func ExpandProxyCommand(c SanitizedCmd, ctx TokenContext, env func(string) (string, bool)) ([]string, error)
func ExpandTokens ¶
func ExpandTokens(template string, ctx TokenContext) (string, error)
ExpandTokens 与 ExpandPathTokens 对 OpenSSH 模板执行确定性单遍 % token 展开; 非 %j 令牌字段为空均失败关闭,ExpandPathTokens 额外禁止非 %d 令牌注入路径分隔符或目录穿越段。
func MarshalProxyRouteTo ¶
func MarshalProxyRouteTo(enc *jsontext.Encoder, route ProxyRoute) error
MarshalProxyRouteTo 与 UnmarshalProxyRouteFrom 为封闭接口 ProxyRoute 提供多态 json/v2 确定性编解码(失败严格返回 (nil, err))。
func ValidateProxyRoute ¶
func ValidateProxyRoute(route ProxyRoute) error
ValidateProxyRoute、ComposeProxyRoute、FoldProxyRoutes 与 EqualProxyRoute 提供 ProxyRoute 校验、双槽复合、折叠与等价判定。
Types ¶
type AddressFamily ¶ added in v1.3.0
type AddressFamily uint8
func ParseAddressFamily ¶ added in v1.3.0
func ParseAddressFamily(s string) (AddressFamily, error)
func (AddressFamily) AppendText ¶ added in v1.3.0
func (f AddressFamily) AppendText(b []byte) ([]byte, error)
func (AddressFamily) IsSet ¶ added in v1.3.0
func (f AddressFamily) IsSet() bool
func (AddressFamily) MarshalText ¶ added in v1.3.0
func (f AddressFamily) MarshalText() ([]byte, error)
func (AddressFamily) String ¶ added in v1.3.0
func (f AddressFamily) String() string
func (*AddressFamily) UnmarshalText ¶ added in v1.3.0
func (f *AddressFamily) UnmarshalText(t []byte) error
type AlgoOp ¶
type AlgoOp uint8
AlgoOp 表示单条 OpenSSH 算法指令的列表算子类型;零值 AlgoOpUnset 代表幺半群单位元(未设置)。
const ( AlgoOpUnset AlgoOp = AlgoOp(optparse.AlgoOpUnset) // 未设置(FirstWins 单位元,回退默认列表) AlgoOpExact AlgoOp = AlgoOp(optparse.AlgoOpExact) // 精确替换默认列表 AlgoOpAppend AlgoOp = AlgoOp(optparse.AlgoOpAppend) // 追加至默认列表末尾(+) AlgoOpRemove AlgoOp = AlgoOp(optparse.AlgoOpRemove) // 从默认列表移除匹配项,独占支持 */? 通配符(-) AlgoOpPrepend AlgoOp = AlgoOp(optparse.AlgoOpPrepend) // 前置至默认列表头部(^) )
type AlgoPolicy ¶
type AlgoPolicy struct {
// contains filtered or unexported fields
}
AlgoPolicy 表示校准后的 OpenSSH 算法列表策略: 单条指令表达列表算子 Unset | Exact | Append(+) | Remove(-, 独占支持 */? 通配) | Prepend(^), 跨指令与跨层合并严格遵循 FirstWins 幺半群(非 Unset 左吸收低层),仅在求解边界对默认集单次 Apply。
func FoldAlgoPolicies ¶
func FoldAlgoPolicies(layers ...AlgoPolicy) AlgoPolicy
func IdentityAlgoPolicy ¶
func IdentityAlgoPolicy() AlgoPolicy
func ParseAlgoPolicy ¶
func ParseAlgoPolicy(raw string) (AlgoPolicy, error)
ParseAlgoPolicy 解析单条 OpenSSH 算法策略("a,b"、"+a,b"、"-a,*-cbc"、"^a,b")。 仅当算子为 AlgoOpRemove('-')时允许 ASCII '*' 与 '?' 通配符;Exact/Append/Prepend 严格禁止通配符。
func UnsetAlgoPolicy ¶
func UnsetAlgoPolicy() AlgoPolicy
UnsetAlgoPolicy 与 IdentityAlgoPolicy 均返回未设置单位元(零值)。
func (AlgoPolicy) Compose ¶
func (p AlgoPolicy) Compose(lower AlgoPolicy) AlgoPolicy
func (AlgoPolicy) Equal ¶
func (p AlgoPolicy) Equal(o AlgoPolicy) bool
func (AlgoPolicy) IsExact ¶
func (p AlgoPolicy) IsExact() bool
func (AlgoPolicy) IsIdentity ¶
func (p AlgoPolicy) IsIdentity() bool
func (AlgoPolicy) IsUnset ¶
func (p AlgoPolicy) IsUnset() bool
func (AlgoPolicy) IsZero ¶
func (p AlgoPolicy) IsZero() bool
func (AlgoPolicy) MarshalJSONTo ¶
func (p AlgoPolicy) MarshalJSONTo(e *jsontext.Encoder) error
func (AlgoPolicy) String ¶
func (p AlgoPolicy) String() string
func (AlgoPolicy) Tokens ¶
func (p AlgoPolicy) Tokens() []string
func (AlgoPolicy) Transform ¶
func (p AlgoPolicy) Transform(defaults []string) []string
func (*AlgoPolicy) UnmarshalJSONFrom ¶
func (p *AlgoPolicy) UnmarshalJSONFrom(d *jsontext.Decoder) error
type CNAMEPermittedRule ¶ added in v1.3.0
type CNAMEPermittedRule = optval.CNAMEPermittedRule
转发、多路复用与认证/会话不可变领域值对象公开类型别名(与 optval 同一类型)。
func NewCNAMEPermittedRule ¶ added in v1.3.0
func NewCNAMEPermittedRule(s, t []string) (CNAMEPermittedRule, error)
func ParseCNAMEPermittedRule ¶ added in v1.3.0
func ParseCNAMEPermittedRule(s string) (CNAMEPermittedRule, error)
type CanonicalDomains ¶ added in v1.3.0
type CanonicalDomains = optval.CanonicalDomains
转发、多路复用与认证/会话不可变领域值对象公开类型别名(与 optval 同一类型)。
func DisabledCanonicalDomains ¶ added in v1.3.0
func DisabledCanonicalDomains() CanonicalDomains
func FoldCanonicalDomains ¶ added in v1.3.0
func FoldCanonicalDomains(ls ...CanonicalDomains) CanonicalDomains
func NewCanonicalDomains ¶ added in v1.3.0
func NewCanonicalDomains(d ...string) (CanonicalDomains, error)
func ParseCanonicalDomains ¶ added in v1.3.0
func ParseCanonicalDomains(t []string) (CanonicalDomains, error)
func UnsetCanonicalDomains ¶ added in v1.3.0
func UnsetCanonicalDomains() CanonicalDomains
type CanonicalizeMode ¶ added in v1.3.0
type CanonicalizeMode = optval.CanonicalizeMode
转发、多路复用与认证/会话不可变领域值对象公开类型别名(与 optval 同一类型)。
func ParseCanonicalizeMode ¶ added in v1.3.0
func ParseCanonicalizeMode(s string) (CanonicalizeMode, error)
主机规范化与四态 ForwardAgent 领域值对象薄转发函数。
type CanonicalizePermittedCNAMEs ¶ added in v1.3.0
type CanonicalizePermittedCNAMEs = optval.CanonicalizePermittedCNAMEs
转发、多路复用与认证/会话不可变领域值对象公开类型别名(与 optval 同一类型)。
func DisabledCanonicalizePermittedCNAMEs ¶ added in v1.3.0
func DisabledCanonicalizePermittedCNAMEs() CanonicalizePermittedCNAMEs
func FoldCanonicalizePermittedCNAMEs ¶ added in v1.3.0
func FoldCanonicalizePermittedCNAMEs(ls ...CanonicalizePermittedCNAMEs) CanonicalizePermittedCNAMEs
func NewCanonicalizePermittedCNAMEs ¶ added in v1.3.0
func NewCanonicalizePermittedCNAMEs(r ...CNAMEPermittedRule) (CanonicalizePermittedCNAMEs, error)
func ParseCanonicalizePermittedCNAMEs ¶ added in v1.3.0
func ParseCanonicalizePermittedCNAMEs(t []string) (CanonicalizePermittedCNAMEs, error)
func UnsetCanonicalizePermittedCNAMEs ¶ added in v1.3.0
func UnsetCanonicalizePermittedCNAMEs() CanonicalizePermittedCNAMEs
type CommandTemplate ¶ added in v1.3.0
type CommandTemplate = optval.CommandTemplate
转发、多路复用与认证/会话不可变领域值对象公开类型别名(与 optval 同一类型)。
func ParseLocalCommandTemplate ¶ added in v1.3.0
func ParseLocalCommandTemplate(c SanitizedCmd) (CommandTemplate, error)
func ParseProxyCommandTemplate ¶ added in v1.3.0
func ParseProxyCommandTemplate(c SanitizedCmd) (CommandTemplate, error)
ParseProxyCommandTemplate、ParseLocalCommandTemplate、ExpandProxyCommand 与 ExpandLocalCommand 为 ProxyCommand 与 LocalCommand 提供共享 E3/C2 两阶段零 Shell 解析与单词元单遍展开入口。
type ControlMasterMode ¶
type ControlMasterMode = optval.ControlMasterMode
转发、多路复用与认证/会话不可变领域值对象公开类型别名(与 optval 同一类型)。
func ParseControlMasterMode ¶
func ParseControlMasterMode(raw string) (ControlMasterMode, error)
多路复用策略构造与幺半群折叠薄转发函数。
type ControlPathKind ¶
type ControlPathKind = optval.ControlPathKind
转发、多路复用与认证/会话不可变领域值对象公开类型别名(与 optval 同一类型)。
type ControlPathSpec ¶
type ControlPathSpec = optval.ControlPathSpec
转发、多路复用与认证/会话不可变领域值对象公开类型别名(与 optval 同一类型)。
func DisabledControlPath ¶
func DisabledControlPath() ControlPathSpec
func NewLiteralControlPath ¶
func NewLiteralControlPath(s string) (ControlPathSpec, error)
func ParseControlPath ¶
func ParseControlPath(s string) (ControlPathSpec, error)
func UnsetControlPath ¶
func UnsetControlPath() ControlPathSpec
type ControlPersistKind ¶
type ControlPersistKind = optval.ControlPersistKind
转发、多路复用与认证/会话不可变领域值对象公开类型别名(与 optval 同一类型)。
type ControlPersistSpec ¶
type ControlPersistSpec = optval.ControlPersistSpec
转发、多路复用与认证/会话不可变领域值对象公开类型别名(与 optval 同一类型)。
func DisabledControlPersist ¶
func DisabledControlPersist() ControlPersistSpec
func IndefiniteControlPersist ¶
func IndefiniteControlPersist() ControlPersistSpec
func ParseControlPersist ¶
func ParseControlPersist(raw string) (ControlPersistSpec, error)
func TimeoutControlPersist ¶
func TimeoutControlPersist(d algebraic.Duration) (ControlPersistSpec, error)
func UnsetControlPersist ¶
func UnsetControlPersist() ControlPersistSpec
type ControlPolicy ¶
type ControlPolicy = optval.ControlPolicy
转发、多路复用与认证/会话不可变领域值对象公开类型别名(与 optval 同一类型)。
func FoldControlPolicies ¶
func FoldControlPolicies(ls ...ControlPolicy) ControlPolicy
func UnsetControlPolicy ¶
func UnsetControlPolicy() ControlPolicy
type DynamicForwardList ¶ added in v1.3.0
type DynamicForwardList = optval.DynamicForwardList
转发、多路复用与认证/会话不可变领域值对象公开类型别名(与 optval 同一类型)。
func FoldDynamicForwardLists ¶ added in v1.3.0
func FoldDynamicForwardLists(ls ...DynamicForwardList) DynamicForwardList
func NewDynamicForwardList ¶ added in v1.3.0
func NewDynamicForwardList(eps ...ForwardEndpoint) (DynamicForwardList, error)
func ParseDynamicForwardList ¶ added in v1.3.0
func ParseDynamicForwardList(raws []string) (DynamicForwardList, error)
func UnsetDynamicForwardList ¶ added in v1.3.0
func UnsetDynamicForwardList() DynamicForwardList
type EffectivePolicy ¶
type EffectivePolicy struct {
// contains filtered or unexported fields
}
EffectivePolicy 表示经唯一纯求解入口 ResolveEffectivePolicy* 计算得到的不可变生效策略快照;零值恒无效。
func ResolveEffectivePolicy ¶
func ResolveEffectivePolicy(origin OriginKind, endpoint netaddr.Endpoint, t1, t2, t3, t4 OptionLayer) (EffectivePolicy, error)
ResolveEffectivePolicy 与 ResolveEffectivePolicyWithOptions 为全平面共用的纯四层 OpenSSH 策略求解入口。 优先级固定为 t1(CLI) > t2(托管节点) > t3(XOps 全局配置) > t4(OpenSSH ~/.ssh/config) + DefaultOptionLayer(); ResolveEffectivePolicy 默认 AllowFullAdHocTier4=false,对 OriginManaged 显式钳位禁用主机规范化。
func ResolveEffectivePolicyWithOptions ¶ added in v1.3.0
func ResolveEffectivePolicyWithOptions(origin OriginKind, endpoint netaddr.Endpoint, t1, t2, t3, t4 OptionLayer, opts PolicyResolveOptions) (EffectivePolicy, error)
ResolveEffectivePolicyWithOptions 在显式 PolicyResolveOptions 约束下执行四层策略求解。
func ResolveEffectivePolicyWithOriginalHost ¶
func ResolveEffectivePolicyWithOriginalHost(origin OriginKind, originalHost OriginalHostSpec, defaultPort uint16, t1, t2, t3, t4 OptionLayer) (EffectivePolicy, error)
ResolveEffectivePolicyWithOriginalHost 支持以经校验的 OpenSSH 别名(如 "prod_db")作为 OriginalHost(%n)执行默认求解。
func ResolveEffectivePolicyWithOriginalHostOptions ¶ added in v1.3.0
func ResolveEffectivePolicyWithOriginalHostOptions(origin OriginKind, originalHost OriginalHostSpec, defaultPort uint16, t1, t2, t3, t4 OptionLayer, opts PolicyResolveOptions) (EffectivePolicy, error)
ResolveEffectivePolicyWithOriginalHostOptions 在保留 OpenSSH 别名(%n)的同时应用双态 OriginAdHoc 求解开关。
func (EffectivePolicy) AddressFamily ¶ added in v1.3.0
func (p EffectivePolicy) AddressFamily() AddressFamily
func (EffectivePolicy) BatchMode ¶
func (p EffectivePolicy) BatchMode() bool
func (EffectivePolicy) CanonicalDomains ¶ added in v1.3.0
func (p EffectivePolicy) CanonicalDomains() CanonicalDomains
func (EffectivePolicy) CanonicalizeFallbackLocal ¶ added in v1.3.0
func (p EffectivePolicy) CanonicalizeFallbackLocal() bool
func (EffectivePolicy) CanonicalizeHostname ¶ added in v1.3.0
func (p EffectivePolicy) CanonicalizeHostname() CanonicalizeMode
func (EffectivePolicy) CanonicalizeMaxDots ¶ added in v1.3.0
func (p EffectivePolicy) CanonicalizeMaxDots() int
func (EffectivePolicy) CanonicalizePermittedCNAMEs ¶ added in v1.3.0
func (p EffectivePolicy) CanonicalizePermittedCNAMEs() CanonicalizePermittedCNAMEs
func (EffectivePolicy) CertificateFiles ¶
func (p EffectivePolicy) CertificateFiles() PathList
func (EffectivePolicy) Ciphers ¶
func (p EffectivePolicy) Ciphers() []string
func (EffectivePolicy) ClearAllForwardings ¶ added in v1.3.0
func (p EffectivePolicy) ClearAllForwardings() bool
func (EffectivePolicy) ConnectTimeout ¶
func (p EffectivePolicy) ConnectTimeout() algebraic.Option[algebraic.Duration]
func (EffectivePolicy) Control ¶
func (p EffectivePolicy) Control() ControlPolicy
func (EffectivePolicy) DynamicForwards ¶ added in v1.3.0
func (p EffectivePolicy) DynamicForwards() DynamicForwardList
func (EffectivePolicy) Endpoint ¶
func (p EffectivePolicy) Endpoint() netaddr.Endpoint
func (EffectivePolicy) Equal ¶
func (p EffectivePolicy) Equal(o EffectivePolicy) bool
Equal 判断两个有效 EffectivePolicy 是否完全相等(无效零值永不相等)。
func (EffectivePolicy) EscapeChar ¶ added in v1.3.0
func (p EffectivePolicy) EscapeChar() EscapeCharSpec
func (EffectivePolicy) ExitOnForwardFailure ¶ added in v1.3.0
func (p EffectivePolicy) ExitOnForwardFailure() bool
func (EffectivePolicy) ForIntermediateHop ¶ added in v1.3.0
func (p EffectivePolicy) ForIntermediateHop() EffectivePolicy
ForIntermediateHop 返回按 INV-D2 剥离全部 Forward/Session/LocalExec 与 Canonicalize* 主机规范化选项后的中间跳生效策略副本。
func (EffectivePolicy) ForkAfterAuthentication ¶ added in v1.3.0
func (p EffectivePolicy) ForkAfterAuthentication() bool
func (EffectivePolicy) ForwardAgent ¶
func (p EffectivePolicy) ForwardAgent() bool
func (EffectivePolicy) ForwardAgentSpec ¶ added in v1.3.0
func (p EffectivePolicy) ForwardAgentSpec() ForwardAgentSpec
func (EffectivePolicy) GatewayPorts ¶ added in v1.3.0
func (p EffectivePolicy) GatewayPorts() GatewayPortsMode
func (EffectivePolicy) GlobalKnownHostsFiles ¶ added in v1.3.0
func (p EffectivePolicy) GlobalKnownHostsFiles() KnownHostsList
func (EffectivePolicy) HashKnownHosts ¶ added in v1.3.0
func (p EffectivePolicy) HashKnownHosts() bool
func (EffectivePolicy) HostKeyAlgorithms ¶
func (p EffectivePolicy) HostKeyAlgorithms() []string
func (EffectivePolicy) IdentitiesOnly ¶
func (p EffectivePolicy) IdentitiesOnly() bool
func (EffectivePolicy) IdentityAgent ¶ added in v1.3.0
func (p EffectivePolicy) IdentityAgent() algebraic.Option[IdentityAgentSpec]
func (EffectivePolicy) IdentityFiles ¶
func (p EffectivePolicy) IdentityFiles() PathList
func (EffectivePolicy) IsValid ¶
func (p EffectivePolicy) IsValid() bool
EffectivePolicy 只读访问器(切片均返回防御性副本;无效零值一律失败关闭;未授权 LocalCommand 与被 ClearAllForwardings 清空的转发恒归零)。
func (EffectivePolicy) KbdInteractiveAuthentication ¶ added in v1.3.0
func (p EffectivePolicy) KbdInteractiveAuthentication() bool
func (EffectivePolicy) KexAlgorithms ¶
func (p EffectivePolicy) KexAlgorithms() []string
func (EffectivePolicy) LocalCommand ¶
func (p EffectivePolicy) LocalCommand() algebraic.Option[SanitizedCmd]
func (EffectivePolicy) LocalForwards ¶ added in v1.3.0
func (p EffectivePolicy) LocalForwards() ForwardList
func (EffectivePolicy) MACs ¶
func (p EffectivePolicy) MACs() []string
func (EffectivePolicy) MarshalJSONTo ¶
func (p EffectivePolicy) MarshalJSONTo(enc *jsontext.Encoder) error
func (EffectivePolicy) Options ¶
func (p EffectivePolicy) Options() OptionLayer
func (EffectivePolicy) Origin ¶
func (p EffectivePolicy) Origin() OriginKind
func (EffectivePolicy) OriginalHost ¶
func (p EffectivePolicy) OriginalHost() OriginalHostSpec
func (EffectivePolicy) PasswordAuthentication ¶ added in v1.3.0
func (p EffectivePolicy) PasswordAuthentication() bool
func (EffectivePolicy) PercentC ¶
func (p EffectivePolicy) PercentC(localHost, fallbackUser string) (string, error)
PercentC 基于已求解策略(Endpoint、生效 User 与活跃 ProxyJump 末跳主机名 %j)计算 OpenSSH %C 哈希。
func (EffectivePolicy) PermitLocalCommand ¶
func (p EffectivePolicy) PermitLocalCommand() bool
func (EffectivePolicy) PreferredAuthentications ¶ added in v1.3.0
func (p EffectivePolicy) PreferredAuthentications() algebraic.Option[PreferredAuthList]
func (EffectivePolicy) Proxy ¶
func (p EffectivePolicy) Proxy() ProxyRoute
func (EffectivePolicy) PubkeyAuthentication ¶ added in v1.3.0
func (p EffectivePolicy) PubkeyAuthentication() bool
func (EffectivePolicy) RemoteCommand ¶ added in v1.3.0
func (p EffectivePolicy) RemoteCommand() algebraic.Option[RemoteCommandSpec]
func (EffectivePolicy) RemoteForwards ¶ added in v1.3.0
func (p EffectivePolicy) RemoteForwards() ForwardList
func (EffectivePolicy) RequestTTY ¶ added in v1.3.0
func (p EffectivePolicy) RequestTTY() RequestTTYMode
func (EffectivePolicy) SendEnv ¶
func (p EffectivePolicy) SendEnv() EnvFilter
func (EffectivePolicy) ServerAliveCountMax ¶
func (p EffectivePolicy) ServerAliveCountMax() uint32
func (EffectivePolicy) ServerAliveInterval ¶
func (p EffectivePolicy) ServerAliveInterval() algebraic.Duration
func (EffectivePolicy) SessionType ¶ added in v1.3.0
func (p EffectivePolicy) SessionType() SessionTypeMode
func (EffectivePolicy) SetEnv ¶ added in v1.3.0
func (p EffectivePolicy) SetEnv() EnvSet
func (EffectivePolicy) StdinNull ¶ added in v1.3.0
func (p EffectivePolicy) StdinNull() bool
func (EffectivePolicy) StreamLocalBindMask ¶ added in v1.3.0
func (p EffectivePolicy) StreamLocalBindMask() StreamLocalBindMask
func (EffectivePolicy) StreamLocalBindUnlink ¶ added in v1.3.0
func (p EffectivePolicy) StreamLocalBindUnlink() bool
func (EffectivePolicy) StrictHostKeyChecking ¶
func (p EffectivePolicy) StrictHostKeyChecking() StrictHostKeyCheckingMode
func (EffectivePolicy) TCPKeepAlive ¶ added in v1.3.0
func (p EffectivePolicy) TCPKeepAlive() bool
func (EffectivePolicy) Tunnel ¶ added in v1.3.0
func (p EffectivePolicy) Tunnel() TunnelMode
func (EffectivePolicy) TunnelDevice ¶ added in v1.3.0
func (p EffectivePolicy) TunnelDevice() TunnelDeviceSpec
func (*EffectivePolicy) UnmarshalJSONFrom ¶
func (p *EffectivePolicy) UnmarshalJSONFrom(dec *jsontext.Decoder) error
func (EffectivePolicy) UserKnownHostsFiles ¶
func (p EffectivePolicy) UserKnownHostsFiles() KnownHostsList
func (EffectivePolicy) VerifyHostKeyDNS ¶ added in v1.3.0
func (p EffectivePolicy) VerifyHostKeyDNS() VerifyHostKeyDNSMode
type EnvAssignment ¶ added in v1.3.0
type EnvAssignment = optval.EnvAssignment
转发、多路复用与认证/会话不可变领域值对象公开类型别名(与 optval 同一类型)。
func NewEnvAssignment ¶ added in v1.3.0
func NewEnvAssignment(name, value string) (EnvAssignment, error)
type EnvFilter ¶
转发、多路复用与认证/会话不可变领域值对象公开类型别名(与 optval 同一类型)。
func FoldEnvFilters ¶
func ParseEnvFilter ¶
func ParseEnvFilterTokens ¶
func UnsetEnvFilter ¶
func UnsetEnvFilter() EnvFilter
type EnvSet ¶ added in v1.3.0
转发、多路复用与认证/会话不可变领域值对象公开类型别名(与 optval 同一类型)。
func FoldEnvSets ¶ added in v1.3.0
func NewEnvSet ¶ added in v1.3.0
func NewEnvSet(items ...EnvAssignment) (EnvSet, error)
func ParseEnvSet ¶ added in v1.3.0
func ParseEnvSetTokens ¶ added in v1.3.0
func UnsetEnvSet ¶ added in v1.3.0
func UnsetEnvSet() EnvSet
type EscapeCharKind ¶ added in v1.3.0
type EscapeCharKind = optval.EscapeCharKind
转发、多路复用与认证/会话不可变领域值对象公开类型别名(与 optval 同一类型)。
type EscapeCharSpec ¶ added in v1.3.0
type EscapeCharSpec = optval.EscapeCharSpec
转发、多路复用与认证/会话不可变领域值对象公开类型别名(与 optval 同一类型)。
func DefaultEscapeCharSpec ¶ added in v1.3.0
func DefaultEscapeCharSpec() EscapeCharSpec
func DisabledEscapeCharSpec ¶ added in v1.3.0
func DisabledEscapeCharSpec() EscapeCharSpec
func ParseEscapeChar ¶ added in v1.3.0
func ParseEscapeChar(raw string) (EscapeCharSpec, error)
type ForwardAgentKind ¶ added in v1.3.0
type ForwardAgentKind = optval.ForwardAgentKind
转发、多路复用与认证/会话不可变领域值对象公开类型别名(与 optval 同一类型)。
type ForwardAgentSpec ¶ added in v1.3.0
type ForwardAgentSpec = optval.ForwardAgentSpec
转发、多路复用与认证/会话不可变领域值对象公开类型别名(与 optval 同一类型)。
func DefaultForwardAgent ¶ added in v1.3.0
func DefaultForwardAgent() ForwardAgentSpec
func DisabledForwardAgent ¶ added in v1.3.0
func DisabledForwardAgent() ForwardAgentSpec
func ParseForwardAgent ¶ added in v1.3.0
func ParseForwardAgent(s string) (ForwardAgentSpec, error)
func UnsetForwardAgent ¶ added in v1.3.0
func UnsetForwardAgent() ForwardAgentSpec
type ForwardEndpoint ¶ added in v1.3.0
type ForwardEndpoint = optval.ForwardEndpoint
转发、多路复用与认证/会话不可变领域值对象公开类型别名(与 optval 同一类型)。
func ParseDynamicForward ¶ added in v1.3.0
func ParseDynamicForward(raw string) (ForwardEndpoint, error)
转发相关构造与幺半群折叠薄转发函数。
type ForwardList ¶ added in v1.3.0
type ForwardList = optval.ForwardList
转发、多路复用与认证/会话不可变领域值对象公开类型别名(与 optval 同一类型)。
func FoldForwardLists ¶ added in v1.3.0
func FoldForwardLists(ls ...ForwardList) ForwardList
func NewForwardList ¶ added in v1.3.0
func NewForwardList(specs ...ForwardSpec) (ForwardList, error)
func ParseLocalForwardList ¶ added in v1.3.0
func ParseLocalForwardList(raws []string) (ForwardList, error)
func ParseRemoteForwardList ¶ added in v1.3.0
func ParseRemoteForwardList(raws []string) (ForwardList, error)
func UnsetForwardList ¶ added in v1.3.0
func UnsetForwardList() ForwardList
type ForwardSpec ¶ added in v1.3.0
type ForwardSpec = optval.ForwardSpec
转发、多路复用与认证/会话不可变领域值对象公开类型别名(与 optval 同一类型)。
func ParseLocalForward ¶ added in v1.3.0
func ParseLocalForward(s string) (ForwardSpec, error)
func ParseRemoteForward ¶ added in v1.3.0
func ParseRemoteForward(s string) (ForwardSpec, error)
type GatewayPortsMode ¶ added in v1.3.0
type GatewayPortsMode uint8
func ParseGatewayPorts ¶ added in v1.3.0
func ParseGatewayPorts(s string) (GatewayPortsMode, error)
func (GatewayPortsMode) AppendText ¶ added in v1.3.0
func (m GatewayPortsMode) AppendText(b []byte) ([]byte, error)
func (GatewayPortsMode) IsSet ¶ added in v1.3.0
func (m GatewayPortsMode) IsSet() bool
func (GatewayPortsMode) MarshalText ¶ added in v1.3.0
func (m GatewayPortsMode) MarshalText() ([]byte, error)
func (GatewayPortsMode) String ¶ added in v1.3.0
func (m GatewayPortsMode) String() string
func (*GatewayPortsMode) UnmarshalText ¶ added in v1.3.0
func (m *GatewayPortsMode) UnmarshalText(t []byte) error
type HopTarget ¶
type HopTarget struct {
// contains filtered or unexported fields
}
HopTarget 表示经严格校验的单个 ProxyJump 跳板目标([user@]host[:port] 或别名);零值恒无效。 IPv6 字面量必须使用方括号包裹,规范化输出保留方括号而 Host() 返回无方括号规范主机名供 %j 使用。
func ParseHopTarget ¶
ParseHopTarget 校验并规范化单个 ProxyJump 跳板目标,复用 ParseUsername 校验用户段并强制 IPv6 方括号语法。
func (HopTarget) MarshalText ¶
func (*HopTarget) UnmarshalText ¶
type HostNameSpec ¶
type HostNameSpec struct {
// contains filtered or unexported fields
}
HostNameSpec 表示 OpenSSH HostName 指令值(规范字面主机或 %h 模板,字面 '%' 统一按 '%%' 规范化存储);零值恒无效。
func HostNameSpecFromHost ¶
func HostNameSpecFromHost(host netaddr.CanonicalHost) (HostNameSpec, error)
HostNameSpecFromHost 由已校验字面 netaddr.CanonicalHost 构造 HostNameSpec(% -> %% 规范存储,保证带区 IPv6 双射往返)。
func ParseHostNameSpec ¶
func ParseHostNameSpec(raw string) (HostNameSpec, error)
ParseHostNameSpec 按 OpenSSH 模板语法解析 HostName(仅允许 %% 与 %h;含 %h 时探针校验,字面主机经 % -> %% 规范存储)。
func (HostNameSpec) AppendText ¶
func (h HostNameSpec) AppendText(b []byte) ([]byte, error)
func (HostNameSpec) Equal ¶
func (h HostNameSpec) Equal(o HostNameSpec) bool
func (HostNameSpec) MarshalText ¶
func (h HostNameSpec) MarshalText() ([]byte, error)
func (HostNameSpec) ResolveHost ¶
func (h HostNameSpec) ResolveHost(origHost netaddr.CanonicalHost) (z netaddr.CanonicalHost, err error)
ResolveHost 与 ResolveHostFor 基于规范主机或 OpenSSH 别名展开 HostNameSpec 为 netaddr.CanonicalHost。
func (HostNameSpec) ResolveHostFor ¶
func (h HostNameSpec) ResolveHostFor(origHost OriginalHostSpec) (z netaddr.CanonicalHost, err error)
func (*HostNameSpec) UnmarshalText ¶
func (h *HostNameSpec) UnmarshalText(t []byte) error
type IdentityAgentKind ¶ added in v1.3.0
type IdentityAgentKind = optval.IdentityAgentKind
转发、多路复用与认证/会话不可变领域值对象公开类型别名(与 optval 同一类型)。
type IdentityAgentSpec ¶ added in v1.3.0
type IdentityAgentSpec = optval.IdentityAgentSpec
转发、多路复用与认证/会话不可变领域值对象公开类型别名(与 optval 同一类型)。
func DisabledIdentityAgent ¶ added in v1.3.0
func DisabledIdentityAgent() IdentityAgentSpec
认证与会话值对象构造与幺半群折叠薄转发函数。
func ParseIdentityAgent ¶ added in v1.3.0
func ParseIdentityAgent(raw string) (IdentityAgentSpec, error)
func SSHAuthSockIdentityAgent ¶ added in v1.3.0
func SSHAuthSockIdentityAgent() IdentityAgentSpec
type KnownHostsList ¶
type KnownHostsList struct {
// contains filtered or unexported fields
}
KnownHostsList 表示专用于 OpenSSH UserKnownHostsFile / GlobalKnownHostsFile 的独立不透明 FirstWins 幺半群。 单条指令支持空白分隔多路径或独立 "none"(禁止混用);跨指令与跨层严格 FirstWins,杜绝 HostKey 信任锚点跨层污染。
func DisabledKnownHostsList ¶
func DisabledKnownHostsList() KnownHostsList
func FoldKnownHostsLists ¶
func FoldKnownHostsLists(ls ...KnownHostsList) KnownHostsList
func NewKnownHostsList ¶
func NewKnownHostsList(entries ...PathEntry) (KnownHostsList, error)
func ParseKnownHostsList ¶
func ParseKnownHostsList(rawItems []string) (KnownHostsList, error)
func UnsetKnownHostsList ¶
func UnsetKnownHostsList() KnownHostsList
UnsetKnownHostsList、DisabledKnownHostsList、NewKnownHostsList 与 ParseKnownHostsList 构造 KnownHostsList。
func (KnownHostsList) Compose ¶
func (k KnownHostsList) Compose(lo KnownHostsList) KnownHostsList
func (KnownHostsList) DefaultsAllowed ¶
func (b KnownHostsList) DefaultsAllowed() bool
func (KnownHostsList) Equal ¶
func (k KnownHostsList) Equal(o KnownHostsList) bool
func (KnownHostsList) IsDisabled ¶
func (b KnownHostsList) IsDisabled() bool
func (KnownHostsList) MarshalJSONTo ¶
func (k KnownHostsList) MarshalJSONTo(e *jsontext.Encoder) error
func (KnownHostsList) State ¶
func (b KnownHostsList) State() PathListState
func (*KnownHostsList) UnmarshalJSONFrom ¶
func (k *KnownHostsList) UnmarshalJSONFrom(d *jsontext.Decoder) error
type OptionClass ¶
type OptionClass uint8
type OptionKey ¶
type OptionKey string
const ( OptionKeyInvalid OptionKey = "" KeyHostName OptionKey = "hostname" KeyPort OptionKey = "port" KeyUser OptionKey = "user" KeyProxyJump OptionKey = "proxy_jump" KeyProxyCommand OptionKey = "proxy_command" KeyCanonicalizeHostname OptionKey = "canonicalize_hostname" KeyCanonicalDomains OptionKey = "canonical_domains" KeyCanonicalizeMaxDots OptionKey = "canonicalize_max_dots" KeyCanonicalizeFallbackLocal OptionKey = "canonicalize_fallback_local" KeyCanonicalizePermittedCNAMEs OptionKey = "canonicalize_permitted_cnames" KeyControlMaster OptionKey = "control_master" KeyControlPath OptionKey = "control_path" KeyControlPersist OptionKey = "control_persist" KeyAddressFamily OptionKey = "address_family" KeyConnectTimeout OptionKey = "connect_timeout" KeyServerAliveInterval OptionKey = "server_alive_interval" KeyServerAliveCountMax OptionKey = "server_alive_count_max" KeyTCPKeepAlive OptionKey = "tcp_keep_alive" KeyCiphers OptionKey = "ciphers" KeyMACs OptionKey = "macs" KeyKexAlgorithms OptionKey = "kex_algorithms" KeyHostKeyAlgorithms OptionKey = "host_key_algorithms" KeyIdentityFile OptionKey = "identity_file" KeyCertificateFile OptionKey = "certificate_file" KeyIdentityAgent OptionKey = "identity_agent" KeyPubkeyAuthentication OptionKey = "pubkey_authentication" KeyPasswordAuthentication OptionKey = "password_authentication" KeyKbdInteractiveAuthentication OptionKey = "kbd_interactive_authentication" KeyIdentitiesOnly OptionKey = "identities_only" KeyPreferredAuthentications OptionKey = "preferred_authentications" KeyBatchMode OptionKey = "batch_mode" KeyStrictHostKeyChecking OptionKey = "strict_host_key_checking" KeyUserKnownHostsFile OptionKey = "user_known_hosts_file" KeyGlobalKnownHostsFile OptionKey = "global_known_hosts_file" KeyHashKnownHosts OptionKey = "hash_known_hosts" KeyVerifyHostKeyDNS OptionKey = "verify_host_key_dns" KeyForwardAgent OptionKey = "forward_agent" KeyLocalForward OptionKey = "local_forward" KeyRemoteForward OptionKey = "remote_forward" KeyDynamicForward OptionKey = "dynamic_forward" KeyGatewayPorts OptionKey = "gateway_ports" KeyExitOnForwardFailure OptionKey = "exit_on_forward_failure" KeyClearAllForwardings OptionKey = "clear_all_forwardings" KeyStreamLocalBindUnlink OptionKey = "stream_local_bind_unlink" KeyStreamLocalBindMask OptionKey = "stream_local_bind_mask" KeyTunnel OptionKey = "tunnel" KeyTunnelDevice OptionKey = "tunnel_device" KeyRequestTTY OptionKey = "request_tty" KeySendEnv OptionKey = "send_env" KeySetEnv OptionKey = "set_env" KeyRemoteCommand OptionKey = "remote_command" KeyEscapeChar OptionKey = "escape_char" KeySessionType OptionKey = "session_type" KeyStdinNull OptionKey = "stdin_null" KeyForkAfterAuthentication OptionKey = "fork_after_authentication" KeyPermitLocalCommand OptionKey = "permit_local_command" KeyLocalCommand OptionKey = "local_command" )
func CanonicalOptionKey ¶
CanonicalOptionKey 与 LookupOptionSpec 提供已注册 OpenSSH 选项的归一化与元数据查询。
func (OptionKey) MarshalText ¶
func (*OptionKey) UnmarshalText ¶
type OptionLayer ¶
type OptionLayer struct {
// contains filtered or unexported fields
}
OptionLayer 表示四层 OpenSSH 选项总幺半群 (OptionLayer, Compose, Unset) 的不可变层值对象(覆盖 57 项选项)。 零值代表单位元 UnsetOptionLayer;Compose 按正交分量复合,严格满足结合律与双侧单位元律。
func DefaultOptionLayer ¶
func DefaultOptionLayer() OptionLayer
DefaultOptionLayer 返回内置安全默认兜底层(位于四层 t1..t4 之后,对齐 OpenSSH 默认值)。
func FoldOptionLayers ¶
func FoldOptionLayers(layers ...OptionLayer) OptionLayer
FoldOptionLayers 按从高优先级到低优先级顺序折叠多个 OptionLayer。
func ParseOptionLayer ¶
func ParseOptionLayer(directives ...string) (OptionLayer, error)
func (OptionLayer) AddressFamily ¶ added in v1.3.0
func (l OptionLayer) AddressFamily() algebraic.Option[AddressFamily]
func (OptionLayer) ApplyParsedOption ¶
func (l OptionLayer) ApplyParsedOption(opt ParsedOption) OptionLayer
ApplyParsedOption 按同层自上而下 OpenSSH 语义将单条已解析选项合入当前层。
func (OptionLayer) CanonicalDomains ¶ added in v1.3.0
func (l OptionLayer) CanonicalDomains() CanonicalDomains
func (OptionLayer) CanonicalizeFallbackLocal ¶ added in v1.3.0
func (l OptionLayer) CanonicalizeFallbackLocal() algebraic.Option[bool]
func (OptionLayer) CanonicalizeHostname ¶ added in v1.3.0
func (l OptionLayer) CanonicalizeHostname() algebraic.Option[CanonicalizeMode]
func (OptionLayer) CanonicalizeMaxDots ¶ added in v1.3.0
func (l OptionLayer) CanonicalizeMaxDots() algebraic.Option[int]
func (OptionLayer) CanonicalizePermittedCNAMEs ¶ added in v1.3.0
func (l OptionLayer) CanonicalizePermittedCNAMEs() CanonicalizePermittedCNAMEs
func (OptionLayer) CertificateFiles ¶
func (l OptionLayer) CertificateFiles() PathList
func (OptionLayer) Ciphers ¶
func (l OptionLayer) Ciphers() AlgoPolicy
func (OptionLayer) ClearAllForwardings ¶ added in v1.3.0
func (l OptionLayer) ClearAllForwardings() algebraic.Option[bool]
func (OptionLayer) Compose ¶
func (l OptionLayer) Compose(lo OptionLayer) OptionLayer
Compose 执行高优先级 l 覆合低优先级 lower 的总幺半群运算(l ⊕ lower)。
func (OptionLayer) ConnectTimeout ¶
func (l OptionLayer) ConnectTimeout() algebraic.Option[algebraic.Duration]
func (OptionLayer) Control ¶
func (l OptionLayer) Control() ControlPolicy
func (OptionLayer) DynamicForwards ¶ added in v1.3.0
func (l OptionLayer) DynamicForwards() DynamicForwardList
func (OptionLayer) Equal ¶
func (l OptionLayer) Equal(o OptionLayer) bool
Equal 判断两个 OptionLayer 是否代表同一总幺半群元素。
func (OptionLayer) EscapeChar ¶ added in v1.3.0
func (l OptionLayer) EscapeChar() algebraic.Option[EscapeCharSpec]
func (OptionLayer) ExitOnForwardFailure ¶ added in v1.3.0
func (l OptionLayer) ExitOnForwardFailure() algebraic.Option[bool]
func (OptionLayer) FilterForNonOpenSSHOrigin ¶
func (l OptionLayer) FilterForNonOpenSSHOrigin() OptionLayer
FilterForNonOpenSSHOrigin 按 INV-D2 对非 OpenSSH 来源节点的 t4(~/.ssh/config 层)执行安全裁剪: 严格仅保留 OptionClassMux ∪ OptionClassTransport,完整剥离 Target(含 5 项 Canonicalize*)、Auth、Trust、Forward、Session 与 LocalExec。
func (OptionLayer) ForkAfterAuthentication ¶ added in v1.3.0
func (l OptionLayer) ForkAfterAuthentication() algebraic.Option[bool]
func (OptionLayer) ForwardAgent ¶
func (l OptionLayer) ForwardAgent() algebraic.Option[bool]
func (OptionLayer) ForwardAgentSpec ¶ added in v1.3.0
func (l OptionLayer) ForwardAgentSpec() algebraic.Option[ForwardAgentSpec]
func (OptionLayer) GatewayPorts ¶ added in v1.3.0
func (l OptionLayer) GatewayPorts() algebraic.Option[GatewayPortsMode]
func (OptionLayer) GlobalKnownHostsFiles ¶ added in v1.3.0
func (l OptionLayer) GlobalKnownHostsFiles() KnownHostsList
func (OptionLayer) HashKnownHosts ¶ added in v1.3.0
func (l OptionLayer) HashKnownHosts() algebraic.Option[bool]
func (OptionLayer) HostKeyAlgorithms ¶
func (l OptionLayer) HostKeyAlgorithms() AlgoPolicy
func (OptionLayer) HostName ¶
func (l OptionLayer) HostName() algebraic.Option[HostNameSpec]
OptionLayer 只读访问器(容器字段返回防御性拷贝,Proxy 永不返回 nil)。
func (OptionLayer) IdentitiesOnly ¶
func (l OptionLayer) IdentitiesOnly() algebraic.Option[bool]
func (OptionLayer) IdentityAgent ¶ added in v1.3.0
func (l OptionLayer) IdentityAgent() algebraic.Option[IdentityAgentSpec]
func (OptionLayer) IdentityFiles ¶
func (l OptionLayer) IdentityFiles() PathList
func (OptionLayer) IsUnset ¶
func (l OptionLayer) IsUnset() bool
func (OptionLayer) IsZero ¶
func (l OptionLayer) IsZero() bool
func (OptionLayer) KbdInteractiveAuthentication ¶ added in v1.3.0
func (l OptionLayer) KbdInteractiveAuthentication() algebraic.Option[bool]
func (OptionLayer) KexAlgorithms ¶
func (l OptionLayer) KexAlgorithms() AlgoPolicy
func (OptionLayer) LocalCommand ¶
func (l OptionLayer) LocalCommand() algebraic.Option[SanitizedCmd]
func (OptionLayer) LocalForwards ¶ added in v1.3.0
func (l OptionLayer) LocalForwards() ForwardList
func (OptionLayer) MACs ¶
func (l OptionLayer) MACs() AlgoPolicy
func (OptionLayer) MarshalJSONTo ¶
func (l OptionLayer) MarshalJSONTo(enc *jsontext.Encoder) error
MarshalJSONTo 与 UnmarshalJSONFrom 实现 OptionLayer 与 EffectivePolicy 的 encoding/json/v2 确定性编解码。
func (OptionLayer) PasswordAuthentication ¶ added in v1.3.0
func (l OptionLayer) PasswordAuthentication() algebraic.Option[bool]
func (OptionLayer) PermitLocalCommand ¶
func (l OptionLayer) PermitLocalCommand() algebraic.Option[bool]
func (OptionLayer) PreferredAuthentications ¶ added in v1.3.0
func (l OptionLayer) PreferredAuthentications() algebraic.Option[PreferredAuthList]
func (OptionLayer) Proxy ¶
func (l OptionLayer) Proxy() ProxyRoute
func (OptionLayer) PubkeyAuthentication ¶ added in v1.3.0
func (l OptionLayer) PubkeyAuthentication() algebraic.Option[bool]
func (OptionLayer) RemoteCommand ¶ added in v1.3.0
func (l OptionLayer) RemoteCommand() algebraic.Option[RemoteCommandSpec]
func (OptionLayer) RemoteForwards ¶ added in v1.3.0
func (l OptionLayer) RemoteForwards() ForwardList
func (OptionLayer) RequestTTY ¶ added in v1.3.0
func (l OptionLayer) RequestTTY() algebraic.Option[RequestTTYMode]
func (OptionLayer) SendEnv ¶
func (l OptionLayer) SendEnv() EnvFilter
func (OptionLayer) ServerAliveCountMax ¶
func (l OptionLayer) ServerAliveCountMax() algebraic.Option[uint32]
func (OptionLayer) ServerAliveInterval ¶
func (l OptionLayer) ServerAliveInterval() algebraic.Option[algebraic.Duration]
func (OptionLayer) SessionType ¶ added in v1.3.0
func (l OptionLayer) SessionType() algebraic.Option[SessionTypeMode]
func (OptionLayer) SetEnv ¶ added in v1.3.0
func (l OptionLayer) SetEnv() EnvSet
func (OptionLayer) StdinNull ¶ added in v1.3.0
func (l OptionLayer) StdinNull() algebraic.Option[bool]
func (OptionLayer) StreamLocalBindMask ¶ added in v1.3.0
func (l OptionLayer) StreamLocalBindMask() algebraic.Option[StreamLocalBindMask]
func (OptionLayer) StreamLocalBindUnlink ¶ added in v1.3.0
func (l OptionLayer) StreamLocalBindUnlink() algebraic.Option[bool]
func (OptionLayer) StrictHostKeyChecking ¶
func (l OptionLayer) StrictHostKeyChecking() algebraic.Option[StrictHostKeyCheckingMode]
func (OptionLayer) StripIntermediateHopOptions ¶ added in v1.3.0
func (l OptionLayer) StripIntermediateHopOptions() OptionLayer
StripIntermediateHopOptions 按 INV-D2 剥离中间跳板禁止生效的全部 Forward/Session/LocalExec 及规范化策略, 严格保留核心 Target、Mux、Transport、Auth 与 Trust 策略。
func (OptionLayer) TCPKeepAlive ¶ added in v1.3.0
func (l OptionLayer) TCPKeepAlive() algebraic.Option[bool]
func (OptionLayer) Tunnel ¶ added in v1.3.0
func (l OptionLayer) Tunnel() algebraic.Option[TunnelMode]
func (OptionLayer) TunnelDevice ¶ added in v1.3.0
func (l OptionLayer) TunnelDevice() algebraic.Option[TunnelDeviceSpec]
func (*OptionLayer) UnmarshalJSONFrom ¶
func (l *OptionLayer) UnmarshalJSONFrom(dec *jsontext.Decoder) error
func (OptionLayer) UserKnownHostsFiles ¶
func (l OptionLayer) UserKnownHostsFiles() KnownHostsList
func (OptionLayer) VerifyHostKeyDNS ¶ added in v1.3.0
func (l OptionLayer) VerifyHostKeyDNS() algebraic.Option[VerifyHostKeyDNSMode]
func (OptionLayer) WithAddressFamily ¶ added in v1.3.0
func (l OptionLayer) WithAddressFamily(f AddressFamily) OptionLayer
func (OptionLayer) WithBatchMode ¶
func (l OptionLayer) WithBatchMode(v bool) OptionLayer
func (OptionLayer) WithCanonicalDomains ¶ added in v1.3.0
func (l OptionLayer) WithCanonicalDomains(d CanonicalDomains) OptionLayer
func (OptionLayer) WithCanonicalizeFallbackLocal ¶ added in v1.3.0
func (l OptionLayer) WithCanonicalizeFallbackLocal(v bool) OptionLayer
func (OptionLayer) WithCanonicalizeHostname ¶ added in v1.3.0
func (l OptionLayer) WithCanonicalizeHostname(m CanonicalizeMode) OptionLayer
func (OptionLayer) WithCanonicalizeMaxDots ¶ added in v1.3.0
func (l OptionLayer) WithCanonicalizeMaxDots(n int) OptionLayer
func (OptionLayer) WithCanonicalizePermittedCNAMEs ¶ added in v1.3.0
func (l OptionLayer) WithCanonicalizePermittedCNAMEs(c CanonicalizePermittedCNAMEs) OptionLayer
func (OptionLayer) WithCertificateFiles ¶
func (l OptionLayer) WithCertificateFiles(p PathList) OptionLayer
func (OptionLayer) WithCiphers ¶
func (l OptionLayer) WithCiphers(p AlgoPolicy) OptionLayer
func (OptionLayer) WithClearAllForwardings ¶ added in v1.3.0
func (l OptionLayer) WithClearAllForwardings(v bool) OptionLayer
func (OptionLayer) WithConnectTimeout ¶
func (l OptionLayer) WithConnectTimeout(d algebraic.Duration) OptionLayer
func (OptionLayer) WithControlPolicy ¶
func (l OptionLayer) WithControlPolicy(c ControlPolicy) OptionLayer
func (OptionLayer) WithDynamicForwards ¶ added in v1.3.0
func (l OptionLayer) WithDynamicForwards(f DynamicForwardList) OptionLayer
func (OptionLayer) WithEscapeChar ¶ added in v1.3.0
func (l OptionLayer) WithEscapeChar(e EscapeCharSpec) OptionLayer
func (OptionLayer) WithExitOnForwardFailure ¶ added in v1.3.0
func (l OptionLayer) WithExitOnForwardFailure(v bool) OptionLayer
func (OptionLayer) WithForkAfterAuthentication ¶ added in v1.3.0
func (l OptionLayer) WithForkAfterAuthentication(v bool) OptionLayer
func (OptionLayer) WithForwardAgent ¶
func (l OptionLayer) WithForwardAgent(v bool) OptionLayer
func (OptionLayer) WithForwardAgentSpec ¶ added in v1.3.0
func (l OptionLayer) WithForwardAgentSpec(f ForwardAgentSpec) OptionLayer
func (OptionLayer) WithGatewayPorts ¶ added in v1.3.0
func (l OptionLayer) WithGatewayPorts(m GatewayPortsMode) OptionLayer
func (OptionLayer) WithGlobalKnownHostsFiles ¶ added in v1.3.0
func (l OptionLayer) WithGlobalKnownHostsFiles(p KnownHostsList) OptionLayer
func (OptionLayer) WithHashKnownHosts ¶ added in v1.3.0
func (l OptionLayer) WithHashKnownHosts(v bool) OptionLayer
func (OptionLayer) WithHostKeyAlgorithms ¶
func (l OptionLayer) WithHostKeyAlgorithms(p AlgoPolicy) OptionLayer
func (OptionLayer) WithHostName ¶
func (l OptionLayer) WithHostName(h HostNameSpec) OptionLayer
OptionLayer 不可变构造器链:所有 With* 返回新副本,绝不修改接收者。
func (OptionLayer) WithIdentitiesOnly ¶
func (l OptionLayer) WithIdentitiesOnly(v bool) OptionLayer
func (OptionLayer) WithIdentityAgent ¶ added in v1.3.0
func (l OptionLayer) WithIdentityAgent(a IdentityAgentSpec) OptionLayer
func (OptionLayer) WithIdentityFiles ¶
func (l OptionLayer) WithIdentityFiles(p PathList) OptionLayer
func (OptionLayer) WithKbdInteractiveAuthentication ¶ added in v1.3.0
func (l OptionLayer) WithKbdInteractiveAuthentication(v bool) OptionLayer
func (OptionLayer) WithKexAlgorithms ¶
func (l OptionLayer) WithKexAlgorithms(p AlgoPolicy) OptionLayer
func (OptionLayer) WithLocalCommand ¶
func (l OptionLayer) WithLocalCommand(c SanitizedCmd) OptionLayer
func (OptionLayer) WithLocalForwards ¶ added in v1.3.0
func (l OptionLayer) WithLocalForwards(f ForwardList) OptionLayer
func (OptionLayer) WithMACs ¶
func (l OptionLayer) WithMACs(p AlgoPolicy) OptionLayer
func (OptionLayer) WithPasswordAuthentication ¶ added in v1.3.0
func (l OptionLayer) WithPasswordAuthentication(v bool) OptionLayer
func (OptionLayer) WithPermitLocalCommand ¶
func (l OptionLayer) WithPermitLocalCommand(v bool) OptionLayer
func (OptionLayer) WithPort ¶
func (l OptionLayer) WithPort(p uint16) OptionLayer
func (OptionLayer) WithPreferredAuthentications ¶ added in v1.3.0
func (l OptionLayer) WithPreferredAuthentications(p PreferredAuthList) OptionLayer
func (OptionLayer) WithProxyRoute ¶
func (l OptionLayer) WithProxyRoute(r ProxyRoute) OptionLayer
func (OptionLayer) WithPubkeyAuthentication ¶ added in v1.3.0
func (l OptionLayer) WithPubkeyAuthentication(v bool) OptionLayer
func (OptionLayer) WithRemoteCommand ¶ added in v1.3.0
func (l OptionLayer) WithRemoteCommand(c RemoteCommandSpec) OptionLayer
func (OptionLayer) WithRemoteForwards ¶ added in v1.3.0
func (l OptionLayer) WithRemoteForwards(f ForwardList) OptionLayer
func (OptionLayer) WithRequestTTY ¶ added in v1.3.0
func (l OptionLayer) WithRequestTTY(m RequestTTYMode) OptionLayer
func (OptionLayer) WithSendEnv ¶
func (l OptionLayer) WithSendEnv(f EnvFilter) OptionLayer
func (OptionLayer) WithServerAliveCountMax ¶
func (l OptionLayer) WithServerAliveCountMax(n uint32) OptionLayer
func (OptionLayer) WithServerAliveInterval ¶
func (l OptionLayer) WithServerAliveInterval(d algebraic.Duration) OptionLayer
func (OptionLayer) WithSessionType ¶ added in v1.3.0
func (l OptionLayer) WithSessionType(m SessionTypeMode) OptionLayer
func (OptionLayer) WithSetEnv ¶ added in v1.3.0
func (l OptionLayer) WithSetEnv(s EnvSet) OptionLayer
func (OptionLayer) WithStdinNull ¶ added in v1.3.0
func (l OptionLayer) WithStdinNull(v bool) OptionLayer
func (OptionLayer) WithStreamLocalBindMask ¶ added in v1.3.0
func (l OptionLayer) WithStreamLocalBindMask(m StreamLocalBindMask) OptionLayer
func (OptionLayer) WithStreamLocalBindUnlink ¶ added in v1.3.0
func (l OptionLayer) WithStreamLocalBindUnlink(v bool) OptionLayer
func (OptionLayer) WithStrictHostKeyChecking ¶
func (l OptionLayer) WithStrictHostKeyChecking(m StrictHostKeyCheckingMode) OptionLayer
func (OptionLayer) WithTCPKeepAlive ¶ added in v1.3.0
func (l OptionLayer) WithTCPKeepAlive(v bool) OptionLayer
func (OptionLayer) WithTunnel ¶ added in v1.3.0
func (l OptionLayer) WithTunnel(m TunnelMode) OptionLayer
func (OptionLayer) WithTunnelDevice ¶ added in v1.3.0
func (l OptionLayer) WithTunnelDevice(d TunnelDeviceSpec) OptionLayer
func (OptionLayer) WithUser ¶
func (l OptionLayer) WithUser(u Username) OptionLayer
func (OptionLayer) WithUserKnownHostsFiles ¶
func (l OptionLayer) WithUserKnownHostsFiles(p KnownHostsList) OptionLayer
func (OptionLayer) WithVerifyHostKeyDNS ¶ added in v1.3.0
func (l OptionLayer) WithVerifyHostKeyDNS(m VerifyHostKeyDNSMode) OptionLayer
type OptionSpec ¶
type OptionSpec struct {
Key OptionKey // 规范化 snake_case 键名
OpenSSHName string // 标准 OpenSSH ssh_config(5) 关键字
Class OptionClass // 所属安全与功能分类
WholeLineCommand bool // 指示值保留整行命令语义
}
OptionSpec 描述单个已注册 OpenSSH 选项的元数据。
func LookupOptionSpec ¶
func LookupOptionSpec(key OptionKey) (OptionSpec, bool)
func RegisteredOptionSpecs ¶ added in v1.3.0
func RegisteredOptionSpecs() []OptionSpec
RegisteredOptionSpecs 返回当前已注册的全部 57 项 OpenSSH 选项元数据副本。
type OriginKind ¶
type OriginKind uint8
OriginKind 标识目标连接的来源分类(与 inventory.NodeOrigin 语义同构而零循环依赖);零值 OriginInvalid 失败关闭。
const ( OriginInvalid OriginKind = OriginKind(optparse.OriginInvalid) // 未初始化/非法来源(零值失败关闭) OriginManaged OriginKind = OriginKind(optparse.OriginManaged) // XOps 托管资产节点(按 INV-D2 仅对 t4 执行安全裁剪) OriginOpenSSHVirtual OriginKind = OriginKind(optparse.OriginOpenSSHVirtual) // ~/.ssh/config 只读虚拟节点(完整应用 t4) OriginOpenSSHDerived OriginKind = OriginKind(optparse.OriginOpenSSHDerived) // 纯 OpenSSH Host 派生节点(完整应用 t4) OriginAdHoc OriginKind = OriginKind(optparse.OriginAdHoc) // 临时 user@host 或未持久化派生会话(默认/MCP 按 INV-D2 裁剪 t4;显式 CLI 置 AllowFullAdHocTier4=true 时完整继承 t4) )
func ParseOriginKind ¶
func ParseOriginKind(raw string) (OriginKind, error)
ParseOriginKind 解析规范策略来源分类文本,严格拒绝控制与格式字符。
func (OriginKind) AllowsFullOpenSSHConfig ¶
func (o OriginKind) AllowsFullOpenSSHConfig() bool
func (OriginKind) AppendText ¶
func (o OriginKind) AppendText(b []byte) ([]byte, error)
func (OriginKind) IsValid ¶
func (o OriginKind) IsValid() bool
func (OriginKind) MarshalText ¶
func (o OriginKind) MarshalText() ([]byte, error)
func (OriginKind) String ¶
func (o OriginKind) String() string
func (*OriginKind) UnmarshalText ¶
func (o *OriginKind) UnmarshalText(t []byte) error
type OriginalHostSpec ¶
type OriginalHostSpec struct {
// contains filtered or unexported fields
}
OriginalHostSpec 表示经严格校验的 SSH 原始主机名、IP 或 OpenSSH Host 别名(供 %n 展开与审计留痕);零值恒无效。
func OriginalHostFromCanonical ¶
func OriginalHostFromCanonical(host netaddr.CanonicalHost) (OriginalHostSpec, error)
func ParseOriginalHost ¶
func ParseOriginalHost(raw string) (OriginalHostSpec, error)
ParseOriginalHost 与 OriginalHostFromCanonical 构造原始主机/别名值对象。
func (OriginalHostSpec) AppendText ¶
func (h OriginalHostSpec) AppendText(b []byte) ([]byte, error)
func (OriginalHostSpec) CanonicalHost ¶
func (h OriginalHostSpec) CanonicalHost() (netaddr.CanonicalHost, bool)
func (OriginalHostSpec) Equal ¶
func (h OriginalHostSpec) Equal(o OriginalHostSpec) bool
OriginalHostSpec 只读访问器与文本编解码方法。
func (OriginalHostSpec) MarshalText ¶
func (h OriginalHostSpec) MarshalText() ([]byte, error)
func (*OriginalHostSpec) UnmarshalText ¶
func (h *OriginalHostSpec) UnmarshalText(t []byte) error
type ParsedOption ¶
type ParsedOption struct {
// contains filtered or unexported fields
}
ParsedOption 表示经严格语法与值域校验的单条 OpenSSH 选项解析结果;零值恒无效。
func ParseOption ¶
func ParseOption(directive string) (ParsedOption, error)
ParseOption、ParseOptionKV 与 ParseOptionLayer 严格解析并折叠单条或多条 OpenSSH 指令(大小写无关,未知/畸形/注入一律失败关闭)。
func ParseOptionKV ¶
func ParseOptionKV(key, value string) (ParsedOption, error)
func (ParsedOption) IsValid ¶
func (p ParsedOption) IsValid() bool
IsValid、Key、Spec、RawValue 与 Layer 为 ParsedOption 只读访问器。
func (ParsedOption) Key ¶
func (p ParsedOption) Key() OptionKey
func (ParsedOption) Layer ¶
func (p ParsedOption) Layer() OptionLayer
func (ParsedOption) RawValue ¶
func (p ParsedOption) RawValue() string
func (ParsedOption) Spec ¶
func (p ParsedOption) Spec() OptionSpec
type PathEntry ¶
type PathEntry struct {
// contains filtered or unexported fields
}
PathEntry 表示经校验的单个 OpenSSH 路径配置项;零值恒无效。
func ParsePathEntry ¶
ParsePathEntry 严格校验并构造 PathEntry;拒绝空串、控制字符、非法占位符与保留字 "none"。
func (PathEntry) IsTemplate ¶
func (PathEntry) Kind ¶
func (e PathEntry) Kind() PathEntryKind
func (PathEntry) MarshalText ¶
func (*PathEntry) UnmarshalText ¶
type PathEntryKind ¶
type PathEntryKind uint8
PathEntryKind 与 PathListState 分别为路径项形态与路径集合状态枚举;零值代表无效或未设置单位元。
const ( PathEntryInvalid PathEntryKind = iota // 无效路径项(零值失败关闭) PathEntryLiteral // 字面路径 PathEntryTemplate // 含 OpenSSH % 或 ${VAR} 的模板路径 )
func (PathEntryKind) String ¶
func (k PathEntryKind) String() string
String 返回 PathEntryKind 与 PathListState 的可读名称。
type PathList ¶
type PathList struct {
// contains filtered or unexported fields
}
PathList 表示专用于 OpenSSH IdentityFile / CertificateFile 的三态累积路径幺半群 (PathList, Compose, Unset)。 Unset 为单位元,Disabled("none") 作为左零元吸收一切低优先级层,terminated 右封口位严格保证结合律。
func DisabledPathList ¶
func DisabledPathList() PathList
func FoldPathLists ¶
func NewPathList ¶
func ParsePathListEntries ¶
func UnsetPathList ¶
func UnsetPathList() PathList
UnsetPathList、DisabledPathList、NewPathList 与 ParsePathListEntries 构造 PathList。
func (PathList) DefaultsAllowed ¶
func (b PathList) DefaultsAllowed() bool
func (PathList) IsDisabled ¶
func (b PathList) IsDisabled() bool
func (PathList) MarshalJSONTo ¶
MarshalJSONTo 与 UnmarshalJSONFrom 实现全部容器选项值对象的 json/v2 确定性编解码。
func (PathList) State ¶
func (b PathList) State() PathListState
type PathListState ¶
type PathListState uint8
const ( PathListUnset PathListState = PathListState(optparse.PathListUnset) // 未设置(单位元,允许默认路径回退) PathListDisabled PathListState = PathListState(optparse.PathListDisabled) // 显式 "none" 禁用(吸收低优先级右操作数) PathListSet PathListState = PathListState(optparse.PathListSet) // 含至少一个有序去重路径项 )
func (PathListState) String ¶
func (s PathListState) String() string
type PolicyResolveOptions ¶ added in v1.3.0
type PolicyResolveOptions struct {
// AllowFullAdHocTier4 仅在显式 CLI OriginAdHoc 路径置 true,允许 OriginAdHoc 完整继承 Tier-4;
// 零值 false(默认,MCP 与保守路径)维持 OriginAdHoc 的 INV-D2 安全裁剪,且对 OriginManaged 永不生效。
AllowFullAdHocTier4 bool
}
PolicyResolveOptions 控制四层 OpenSSH 策略求解的显式安全开关(零值失败关闭)。
type PreferredAuthList ¶ added in v1.3.0
type PreferredAuthList = optval.PreferredAuthList
转发、多路复用与认证/会话不可变领域值对象公开类型别名(与 optval 同一类型)。
func NewPreferredAuthentications ¶ added in v1.3.0
func NewPreferredAuthentications(methods ...string) (PreferredAuthList, error)
func ParsePreferredAuthentications ¶ added in v1.3.0
func ParsePreferredAuthentications(raw string) (PreferredAuthList, error)
type ProxyCommandSpec ¶
type ProxyCommandSpec struct {
// contains filtered or unexported fields
}
func NewProxyCommandSpec ¶
func NewProxyCommandSpec(cmd SanitizedCmd) (*ProxyCommandSpec, error)
func (*ProxyCommandSpec) Command ¶
func (c *ProxyCommandSpec) Command() SanitizedCmd
func (*ProxyCommandSpec) IsValid ¶
func (c *ProxyCommandSpec) IsValid() bool
func (ProxyCommandSpec) MarshalJSONTo ¶
func (c ProxyCommandSpec) MarshalJSONTo(e *jsontext.Encoder) error
type ProxyDisabled ¶
type ProxyDisabled struct {
// contains filtered or unexported fields
}
func NewProxyDisabled ¶
func NewProxyDisabled() *ProxyDisabled
func NewProxyJumpDisabled ¶
func NewProxyJumpDisabled() *ProxyDisabled
func (*ProxyDisabled) IsFullDisable ¶
func (d *ProxyDisabled) IsFullDisable() bool
func (*ProxyDisabled) IsJumpOnly ¶
func (d *ProxyDisabled) IsJumpOnly() bool
func (ProxyDisabled) MarshalJSONTo ¶
func (d ProxyDisabled) MarshalJSONTo(e *jsontext.Encoder) error
type ProxyJumpChain ¶
type ProxyJumpChain struct {
// contains filtered or unexported fields
}
func NewProxyJumpChain ¶
func NewProxyJumpChain(hops algebraic.NonEmpty[HopTarget]) (*ProxyJumpChain, error)
func (*ProxyJumpChain) IsValid ¶
func (j *ProxyJumpChain) IsValid() bool
func (ProxyJumpChain) MarshalJSONTo ¶
func (j ProxyJumpChain) MarshalJSONTo(e *jsontext.Encoder) error
type ProxyRoute ¶
type ProxyRoute interface {
// contains filtered or unexported methods
}
ProxyRoute 表示 OpenSSH ProxyJump / ProxyCommand 路由配置的封闭和类型(Sealed Sum Type)。 四变体:*ProxyUnset、*ProxyDisabled(全禁用或仅禁跳板)、*ProxyJumpChain(含遮蔽命令槽)、*ProxyCommandSpec。
func ComposeProxyRoute ¶
func ComposeProxyRoute(higher, lower ProxyRoute) ProxyRoute
func FoldProxyRoutes ¶
func FoldProxyRoutes(layers ...ProxyRoute) ProxyRoute
func ParseProxyCommand ¶
func ParseProxyCommand(raw string) (ProxyRoute, error)
func ParseProxyJump ¶
func ParseProxyJump(raw string) (ProxyRoute, error)
ParseProxyJump 与 ParseProxyCommand 解析 OpenSSH 代理路由指令。
func UnmarshalProxyRouteFrom ¶
func UnmarshalProxyRouteFrom(dec *jsontext.Decoder) (ProxyRoute, error)
type ProxyUnset ¶
type ProxyUnset struct{}
ProxyUnset、ProxyDisabled、ProxyJumpChain 与 ProxyCommandSpec 为 ProxyRoute 全部封闭变体。
func NewProxyUnset ¶
func NewProxyUnset() *ProxyUnset
func (ProxyUnset) MarshalJSONTo ¶
func (u ProxyUnset) MarshalJSONTo(e *jsontext.Encoder) error
MarshalJSONTo 为四个具体 ProxyRoute 变体提供值接收者 json/v2 编码(无效零值失败关闭)。
type RemoteCommandKind ¶ added in v1.3.0
type RemoteCommandKind = optval.RemoteCommandKind
转发、多路复用与认证/会话不可变领域值对象公开类型别名(与 optval 同一类型)。
type RemoteCommandSpec ¶ added in v1.3.0
type RemoteCommandSpec = optval.RemoteCommandSpec
转发、多路复用与认证/会话不可变领域值对象公开类型别名(与 optval 同一类型)。
func DisabledRemoteCommand ¶ added in v1.3.0
func DisabledRemoteCommand() RemoteCommandSpec
func ParseRemoteCommand ¶ added in v1.3.0
func ParseRemoteCommand(raw string) (RemoteCommandSpec, error)
type RequestTTYMode ¶ added in v1.3.0
type RequestTTYMode uint8
func ParseRequestTTYMode ¶ added in v1.3.0
func ParseRequestTTYMode(s string) (RequestTTYMode, error)
func (RequestTTYMode) AppendText ¶ added in v1.3.0
func (m RequestTTYMode) AppendText(b []byte) ([]byte, error)
func (RequestTTYMode) IsSet ¶ added in v1.3.0
func (m RequestTTYMode) IsSet() bool
func (RequestTTYMode) MarshalText ¶ added in v1.3.0
func (m RequestTTYMode) MarshalText() ([]byte, error)
func (RequestTTYMode) String ¶ added in v1.3.0
func (m RequestTTYMode) String() string
func (*RequestTTYMode) UnmarshalText ¶ added in v1.3.0
func (m *RequestTTYMode) UnmarshalText(t []byte) error
type SanitizedCmd ¶
type SanitizedCmd struct {
// contains filtered or unexported fields
}
SanitizedCmd 表示经单行与安全字符校验的命令模板(ProxyCommand / LocalCommand);零值恒无效。
func NewLocalSanitizedCmd ¶
func NewLocalSanitizedCmd(raw string) (SanitizedCmd, error)
func NewProxySanitizedCmd ¶
func NewProxySanitizedCmd(raw string) (SanitizedCmd, error)
func NewSanitizedCmd ¶
func NewSanitizedCmd(raw string) (SanitizedCmd, error)
NewSanitizedCmd、NewProxySanitizedCmd 与 NewLocalSanitizedCmd 构造并校验单行命令模板。 NewSanitizedCmd 默认强制 INV-D4 基础占位符白名单(%%/%C/%d/%h/%i/%j/%L/%l/%n/%p/%r/%u,拒绝 %T); NewProxySanitizedCmd 进一步收紧为 ssh_config(5) ProxyCommand 占位符(%%/%h/%n/%p/%r,严格拒绝 %T); NewLocalSanitizedCmd 强制可执行词元 argv[0] 禁止 %T,仅在参数词元 argv[1:] 放行 LocalCommand 专属的 %T。
func (SanitizedCmd) AppendText ¶
func (c SanitizedCmd) AppendText(b []byte) ([]byte, error)
func (SanitizedCmd) Equal ¶
func (c SanitizedCmd) Equal(o SanitizedCmd) bool
func (SanitizedCmd) MarshalText ¶
func (c SanitizedCmd) MarshalText() ([]byte, error)
func (*SanitizedCmd) UnmarshalText ¶
func (c *SanitizedCmd) UnmarshalText(t []byte) error
type SessionTypeMode ¶ added in v1.3.0
type SessionTypeMode uint8
func ParseSessionTypeMode ¶ added in v1.3.0
func ParseSessionTypeMode(s string) (SessionTypeMode, error)
func (SessionTypeMode) AppendText ¶ added in v1.3.0
func (m SessionTypeMode) AppendText(b []byte) ([]byte, error)
func (SessionTypeMode) IsSet ¶ added in v1.3.0
func (m SessionTypeMode) IsSet() bool
func (SessionTypeMode) MarshalText ¶ added in v1.3.0
func (m SessionTypeMode) MarshalText() ([]byte, error)
func (SessionTypeMode) String ¶ added in v1.3.0
func (m SessionTypeMode) String() string
func (*SessionTypeMode) UnmarshalText ¶ added in v1.3.0
func (m *SessionTypeMode) UnmarshalText(t []byte) error
type StreamLocalBindMask ¶ added in v1.3.0
type StreamLocalBindMask = optval.StreamLocalBindMask
转发、多路复用与认证/会话不可变领域值对象公开类型别名(与 optval 同一类型)。
func NewStreamLocalBindMask ¶ added in v1.3.0
func NewStreamLocalBindMask(mask uint32) (StreamLocalBindMask, error)
func ParseStreamLocalBindMask ¶ added in v1.3.0
func ParseStreamLocalBindMask(raw string) (StreamLocalBindMask, error)
type StrictHostKeyCheckingMode ¶
type StrictHostKeyCheckingMode uint8
func ParseStrictHostKeyChecking ¶
func ParseStrictHostKeyChecking(s string) (StrictHostKeyCheckingMode, error)
ParseStrictHostKeyChecking、ParseAddressFamily、ParseVerifyHostKeyDNS、ParseGatewayPorts、 ParseTunnelMode、ParseRequestTTYMode 与 ParseSessionTypeMode 解析各强类型 OpenSSH 枚举(零值失败关闭)。
func (StrictHostKeyCheckingMode) AppendText ¶
func (m StrictHostKeyCheckingMode) AppendText(b []byte) ([]byte, error)
func (StrictHostKeyCheckingMode) IsSet ¶ added in v1.3.0
func (m StrictHostKeyCheckingMode) IsSet() bool
func (StrictHostKeyCheckingMode) MarshalText ¶
func (m StrictHostKeyCheckingMode) MarshalText() ([]byte, error)
func (StrictHostKeyCheckingMode) String ¶
func (m StrictHostKeyCheckingMode) String() string
func (*StrictHostKeyCheckingMode) UnmarshalText ¶
func (m *StrictHostKeyCheckingMode) UnmarshalText(t []byte) error
type TokenContext ¶
type TokenContext = optval.TokenContext
转发、多路复用与认证/会话不可变领域值对象公开类型别名(与 optval 同一类型)。
type TunnelDeviceSpec ¶ added in v1.3.0
type TunnelDeviceSpec = optval.TunnelDeviceSpec
转发、多路复用与认证/会话不可变领域值对象公开类型别名(与 optval 同一类型)。
func DefaultTunnelDeviceSpec ¶ added in v1.3.0
func DefaultTunnelDeviceSpec() TunnelDeviceSpec
func NewTunnelDeviceSpec ¶ added in v1.3.0
func NewTunnelDeviceSpec(localUnit, remoteUnit uint32) (TunnelDeviceSpec, error)
func ParseTunnelDevice ¶ added in v1.3.0
func ParseTunnelDevice(raw string) (TunnelDeviceSpec, error)
type TunnelMode ¶ added in v1.3.0
type TunnelMode uint8
func ParseTunnelMode ¶ added in v1.3.0
func ParseTunnelMode(s string) (TunnelMode, error)
func (TunnelMode) AppendText ¶ added in v1.3.0
func (m TunnelMode) AppendText(b []byte) ([]byte, error)
func (TunnelMode) IsSet ¶ added in v1.3.0
func (m TunnelMode) IsSet() bool
func (TunnelMode) MarshalText ¶ added in v1.3.0
func (m TunnelMode) MarshalText() ([]byte, error)
func (TunnelMode) String ¶ added in v1.3.0
func (m TunnelMode) String() string
func (*TunnelMode) UnmarshalText ¶ added in v1.3.0
func (m *TunnelMode) UnmarshalText(t []byte) error
type Username ¶
type Username struct {
// contains filtered or unexported fields
}
Username 表示经严格校验的 SSH 用户名值对象;零值恒无效。
func ParseUsername ¶
ParseUsername 校验 SSH 用户名(拒绝空白、控制字符、'.'/'..'、'/'、':'、'['、']'、'@'、前导 '-' 与 Shell 元字符)。
func (Username) MarshalText ¶
func (*Username) UnmarshalText ¶
type VerifyHostKeyDNSMode ¶ added in v1.3.0
type VerifyHostKeyDNSMode uint8
func ParseVerifyHostKeyDNS ¶ added in v1.3.0
func ParseVerifyHostKeyDNS(s string) (VerifyHostKeyDNSMode, error)
func (VerifyHostKeyDNSMode) AppendText ¶ added in v1.3.0
func (m VerifyHostKeyDNSMode) AppendText(b []byte) ([]byte, error)
func (VerifyHostKeyDNSMode) IsSet ¶ added in v1.3.0
func (m VerifyHostKeyDNSMode) IsSet() bool
func (VerifyHostKeyDNSMode) MarshalText ¶ added in v1.3.0
func (m VerifyHostKeyDNSMode) MarshalText() ([]byte, error)
func (VerifyHostKeyDNSMode) String ¶ added in v1.3.0
func (m VerifyHostKeyDNSMode) String() string
func (*VerifyHostKeyDNSMode) UnmarshalText ¶ added in v1.3.0
func (m *VerifyHostKeyDNSMode) UnmarshalText(t []byte) error
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
internal
|
|
|
optparse
Package optparse 为 core/domain/option 提供无环叶级纯函数辅助: 涵盖已注册 OpenSSH 选项元数据表、指令词法分词与引号解析、% token 与协议级 %C SHA-1 哈希、 OpenSSH 时长/端口/布尔/算法/环境变量/路径/跳板主机解析,以及通用编解码辅助函数。
|
Package optparse 为 core/domain/option 提供无环叶级纯函数辅助: 涵盖已注册 OpenSSH 选项元数据表、指令词法分词与引号解析、% token 与协议级 %C SHA-1 哈希、 OpenSSH 时长/端口/布尔/算法/环境变量/路径/跳板主机解析,以及通用编解码辅助函数。 |
|
Package optval 提供 core/domain/option 拆分的不可变 OpenSSH 转发、多路复用与认证/会话领域值对象子包。
|
Package optval 提供 core/domain/option 拆分的不可变 OpenSSH 转发、多路复用与认证/会话领域值对象子包。 |