Documentation
¶
Overview ¶
Package ports 定义 XOps v2 六边形核心的全部出站端口契约(公开契约 2,ADR-002 / ADR-003)。
本包仅允许依赖 core/domain/** 与受控标准库,严禁引入 core/internal/**、core/osfs、core/conc、 core/events、testing 或具体协议实现库;全作用域闭包(//xops:syncclosure + //xops:borrowed)、 双模态本地 FS 隔离(ScopedRootFS vs OperatorReadFS)、失败关闭零值与严格 json/v2 编解码均由本包确立。
Index ¶
- Constants
- Variables
- type ApprovalDecisionResponse
- func (r ApprovalDecisionResponse) Approved() bool
- func (r ApprovalDecisionResponse) Comment() string
- func (r ApprovalDecisionResponse) EnvelopeDigest() security.Digest
- func (r ApprovalDecisionResponse) Equal(o ApprovalDecisionResponse) bool
- func (r ApprovalDecisionResponse) IsValid() bool
- func (r ApprovalDecisionResponse) IsZero() bool
- func (r ApprovalDecisionResponse) MarshalJSONTo(e jEnc) error
- func (r *ApprovalDecisionResponse) UnmarshalJSONFrom(c jDec) error
- func (r ApprovalDecisionResponse) Verdict() security.Verdict
- type AuditEntry
- func (e AuditEntry) Binding() security.OperationBinding
- func (e AuditEntry) CanonicalJSON() ([]byte, error)
- func (e AuditEntry) Decision() security.DecisionKind
- func (e AuditEntry) Duration() algebraic.Option[algebraic.Duration]
- func (e AuditEntry) Equal(o AuditEntry) bool
- func (e AuditEntry) ErrorCode() string
- func (e AuditEntry) IsValid() bool
- func (e AuditEntry) IsZero() bool
- func (e AuditEntry) MarshalJSONTo(x jEnc) error
- func (e AuditEntry) OperationID() security.OperationID
- func (e AuditEntry) Outcome() AuditOutcome
- func (e AuditEntry) Phase() AuditPhase
- func (e AuditEntry) ProcessID() ProcessInstanceID
- func (e AuditEntry) Reason() string
- func (e AuditEntry) Risk() security.RiskLevel
- func (e AuditEntry) Timestamp() time.Time
- func (e AuditEntry) TraceID() security.TraceID
- func (e *AuditEntry) UnmarshalJSONFrom(c jDec) error
- type AuditEntrySpec
- type AuditOutcome
- type AuditPhase
- type AuditPostWriteError
- func (e *AuditPostWriteError) Error() string
- func (e *AuditPostWriteError) Is(t error) bool
- func (e *AuditPostWriteError) IsValid() bool
- func (e *AuditPostWriteError) LocalizableView() domi18n.ErrorNode
- func (e *AuditPostWriteError) OperationID() security.OperationID
- func (e *AuditPostWriteError) Unwrap() error
- type AuditReconciler
- type AuditSink
- type BoundedReadHandle
- type Clock
- type ConfirmRequest
- func (r ConfirmRequest) BodyMessage() algebraic.Option[domi18n.Message]
- func (r ConfirmRequest) Equal(o ConfirmRequest) bool
- func (r ConfirmRequest) IsValid() bool
- func (r ConfirmRequest) IsZero() bool
- func (r ConfirmRequest) MarshalJSONTo(e jEnc) error
- func (r ConfirmRequest) Message() string
- func (r ConfirmRequest) Risk() security.RiskLevel
- func (r ConfirmRequest) Subject() string
- func (r ConfirmRequest) Title() string
- func (r ConfirmRequest) TitleMessage() algebraic.Option[domi18n.Message]
- func (r *ConfirmRequest) UnmarshalJSONFrom(c jDec) error
- type ConfirmRequestSpec
- type CrashReconcileReport
- func (r CrashReconcileReport) AbortedOperations() []security.OperationID
- func (r CrashReconcileReport) DeadLocksClaimed() int
- func (r CrashReconcileReport) Equal(o CrashReconcileReport) bool
- func (r CrashReconcileReport) IsValid() bool
- func (r CrashReconcileReport) IsZero() bool
- func (r CrashReconcileReport) LiveLocksSkipped() int
- func (r CrashReconcileReport) MarshalJSONTo(e jEnc) error
- func (r CrashReconcileReport) ScannedLocks() int
- func (r *CrashReconcileReport) UnmarshalJSONFrom(c jDec) error
- type CrashReconcileReportSpec
- type DialerPort
- type DurabilityOutcome
- func NewDurabilityAppliedNotDurable(revision algebraic.Option[Revision], detail string) (DurabilityOutcome, error)
- func NewDurabilityCommitted(revision Revision) (DurabilityOutcome, error)
- func NewDurabilityNotApplied(detail string) (DurabilityOutcome, error)
- func NewDurabilityOutcomeUnknown(detail string) (DurabilityOutcome, error)
- func (d DurabilityOutcome) Applied() bool
- func (d DurabilityOutcome) Detail() string
- func (d DurabilityOutcome) Durable() bool
- func (d DurabilityOutcome) Equal(o DurabilityOutcome) bool
- func (d DurabilityOutcome) IsValid() bool
- func (d DurabilityOutcome) IsZero() bool
- func (d DurabilityOutcome) MarshalJSONTo(e jEnc) error
- func (d DurabilityOutcome) Revision() algebraic.Option[Revision]
- func (d DurabilityOutcome) Status() fsm.DurabilityStatus
- func (d *DurabilityOutcome) UnmarshalJSONFrom(c jDec) error
- type Entropy
- type EnvPort
- type ExecStreams
- type FormatImporter
- type ForwardDirection
- type ForwardEndpointKind
- func (k ForwardEndpointKind) AppendText(b []byte) ([]byte, error)
- func (k ForwardEndpointKind) IsValid() bool
- func (k ForwardEndpointKind) IsZero() bool
- func (k ForwardEndpointKind) MarshalText() ([]byte, error)
- func (k ForwardEndpointKind) String() string
- func (k *ForwardEndpointKind) UnmarshalText(t []byte) error
- type ForwardHandle
- type ForwardSpec
- func (f ForwardSpec) BindAddr() string
- func (f ForwardSpec) BindKind() ForwardEndpointKind
- func (f ForwardSpec) Direction() ForwardDirection
- func (f ForwardSpec) Equal(o ForwardSpec) bool
- func (f ForwardSpec) IsValid() bool
- func (f ForwardSpec) IsZero() bool
- func (f ForwardSpec) MarshalJSONTo(e jEnc) error
- func (f ForwardSpec) TUN() algebraic.Option[TUNSpec]
- func (f ForwardSpec) TargetAddr() string
- func (f ForwardSpec) TargetKind() ForwardEndpointKind
- func (f *ForwardSpec) UnmarshalJSONFrom(c jDec) error
- type ForwarderPort
- type HostTrustCheck
- func (c HostTrustCheck) Endpoint() netaddr.Endpoint
- func (c HostTrustCheck) Equal(o HostTrustCheck) bool
- func (c HostTrustCheck) ExpectedFingerprints() []inventory.KeyFingerprint
- func (c HostTrustCheck) IsTrusted() bool
- func (c HostTrustCheck) IsValid() bool
- func (c HostTrustCheck) IsZero() bool
- func (c HostTrustCheck) MarshalJSONTo(e jEnc) error
- func (c HostTrustCheck) Presented() PublicKeyInfo
- func (c HostTrustCheck) Reason() string
- func (c HostTrustCheck) Status() HostTrustStatus
- func (c *HostTrustCheck) UnmarshalJSONFrom(d jDec) error
- type HostTrustCheckSpec
- type HostTrustPort
- type HostTrustRequest
- func (r HostTrustRequest) Endpoint() netaddr.Endpoint
- func (r HostTrustRequest) IsValid() bool
- func (r HostTrustRequest) IsZero() bool
- func (r HostTrustRequest) KnownHosts() option.KnownHostsList
- func (r HostTrustRequest) Mode() option.StrictHostKeyCheckingMode
- func (r HostTrustRequest) Presented() PublicKeyInfo
- type HostTrustRequestSpec
- type HostTrustStatus
- type InteractionPort
- type InventorySnapshot
- type InventoryStore
- type JournalGenerationSnapshot
- func (s JournalGenerationSnapshot) Corrupt() bool
- func (s JournalGenerationSnapshot) Equal(o JournalGenerationSnapshot) bool
- func (s JournalGenerationSnapshot) Err() error
- func (s JournalGenerationSnapshot) Generation() uint64
- func (s JournalGenerationSnapshot) IsValid() bool
- func (s JournalGenerationSnapshot) IsZero() bool
- func (s JournalGenerationSnapshot) PartialRecords() []fsm.TransferJournalRecord
- func (s JournalGenerationSnapshot) Records() []fsm.TransferJournalRecord
- type JournalStore
- type KeySignerPort
- type LocalDirEntry
- func (e LocalDirEntry) Equal(o LocalDirEntry) bool
- func (e LocalDirEntry) IsDir() bool
- func (e LocalDirEntry) IsRegular() bool
- func (e LocalDirEntry) IsSymlink() bool
- func (e LocalDirEntry) IsValid() bool
- func (e LocalDirEntry) IsZero() bool
- func (e LocalDirEntry) Mode() fs.FileMode
- func (e LocalDirEntry) Name() string
- func (e LocalDirEntry) Size() int64
- type LocalFileInfo
- func (i LocalFileInfo) Equal(o LocalFileInfo) bool
- func (i LocalFileInfo) IsDir() bool
- func (i LocalFileInfo) IsRegular() bool
- func (i LocalFileInfo) IsSymlink() bool
- func (i LocalFileInfo) IsValid() bool
- func (i LocalFileInfo) IsZero() bool
- func (i LocalFileInfo) ModTime() time.Time
- func (i LocalFileInfo) Mode() fs.FileMode
- func (i LocalFileInfo) Name() string
- func (i LocalFileInfo) Perm() fs.FileMode
- func (i LocalFileInfo) Size() int64
- type LocalFileInfoSpec
- type LocalIdentityInfo
- func (i LocalIdentityInfo) ApplyToTokenContext(base option.TokenContext) option.TokenContext
- func (i LocalIdentityInfo) Equal(o LocalIdentityInfo) bool
- func (i LocalIdentityInfo) HomeDir() string
- func (i LocalIdentityInfo) IsValid() bool
- func (i LocalIdentityInfo) IsZero() bool
- func (i LocalIdentityInfo) LocalHost() string
- func (i LocalIdentityInfo) LocalUID() string
- func (i LocalIdentityInfo) LocalUser() string
- func (i LocalIdentityInfo) MarshalJSONTo(e jEnc) error
- func (i *LocalIdentityInfo) UnmarshalJSONFrom(c jDec) error
- type LocalIdentityInfoSpec
- type LockMode
- type LockedFile
- type MuxControlAction
- type MuxControlRequest
- type MuxControlResponse
- func (r MuxControlResponse) Alive() bool
- func (r MuxControlResponse) Detail() string
- func (r MuxControlResponse) Equal(o MuxControlResponse) bool
- func (r MuxControlResponse) IsValid() bool
- func (r MuxControlResponse) IsZero() bool
- func (r MuxControlResponse) MarshalJSONTo(e jEnc) error
- func (r MuxControlResponse) MasterPID() uint32
- func (r *MuxControlResponse) UnmarshalJSONFrom(c jDec) error
- type MuxSocketPort
- type OpenSSHConfigSource
- type OpenSSHVirtualHost
- func (h OpenSSHVirtualHost) Alias() string
- func (h OpenSSHVirtualHost) Endpoint() algebraic.Option[netaddr.Endpoint]
- func (h OpenSSHVirtualHost) Equal(o OpenSSHVirtualHost) bool
- func (h OpenSSHVirtualHost) IsValid() bool
- func (h OpenSSHVirtualHost) IsZero() bool
- func (h OpenSSHVirtualHost) JumpNode() (inventory.OpenSSHJumpNode, error)
- func (h OpenSSHVirtualHost) Layer() option.OptionLayer
- func (h OpenSSHVirtualHost) MarshalJSONTo(e jEnc) error
- func (h OpenSSHVirtualHost) Proxy() option.ProxyRoute
- func (h OpenSSHVirtualHost) SourceFile() string
- func (h *OpenSSHVirtualHost) UnmarshalJSONFrom(c jDec) error
- func (h OpenSSHVirtualHost) User() algebraic.Option[option.Username]
- type OpenSSHVirtualHostSpec
- type OperatorReadFS
- type PTYRequest
- type PrivilegeEscalationPort
- type PrivilegeMethod
- type PrivilegeRequest
- func (r PrivilegeRequest) Command() execution.CommandPlan
- func (r PrivilegeRequest) Equal(o PrivilegeRequest) bool
- func (r PrivilegeRequest) IsValid() bool
- func (r PrivilegeRequest) IsZero() bool
- func (r PrivilegeRequest) MarshalJSONTo(e jEnc) error
- func (r PrivilegeRequest) Method() PrivilegeMethod
- func (r PrivilegeRequest) NonInteractive() bool
- func (r PrivilegeRequest) TargetUser() algebraic.Option[option.Username]
- func (r PrivilegeRequest) Timeout() algebraic.Option[algebraic.Duration]
- func (r *PrivilegeRequest) UnmarshalJSONFrom(c jDec) error
- type PrivilegeRequestSpec
- type ProcessInstanceID
- func (id ProcessInstanceID) AppendText(b []byte) ([]byte, error)
- func (id ProcessInstanceID) Compare(o ProcessInstanceID) int
- func (id ProcessInstanceID) Equal(o ProcessInstanceID) bool
- func (id ProcessInstanceID) IsValid() bool
- func (id ProcessInstanceID) IsZero() bool
- func (id ProcessInstanceID) LockFileName() (pathalg.LocalRootedDest, error)
- func (id ProcessInstanceID) MarshalText() ([]byte, error)
- func (id ProcessInstanceID) String() string
- func (id *ProcessInstanceID) UnmarshalText(t []byte) error
- type ProcessPort
- type ProcessResult
- func (r ProcessResult) Equal(o ProcessResult) bool
- func (r ProcessResult) ExitStatus() execution.ExitStatus
- func (r ProcessResult) IsValid() bool
- func (r ProcessResult) IsZero() bool
- func (r ProcessResult) Stderr() []byte
- func (r ProcessResult) Stdout() []byte
- func (r ProcessResult) Succeeded() bool
- func (r ProcessResult) Truncated() bool
- type ProcessResultSpec
- type ProcessSpec
- func (p ProcessSpec) Args() []string
- func (p ProcessSpec) Command() string
- func (p ProcessSpec) Env() map[string]string
- func (p ProcessSpec) Equal(o ProcessSpec) bool
- func (p ProcessSpec) IsValid() bool
- func (p ProcessSpec) IsZero() bool
- func (p ProcessSpec) MarshalJSONTo(e jEnc) error
- func (p ProcessSpec) MaxOutputBytes() uint64
- func (p ProcessSpec) Timeout() algebraic.Option[algebraic.Duration]
- func (p *ProcessSpec) UnmarshalJSONFrom(c jDec) error
- func (p ProcessSpec) WorkDir() algebraic.Option[pathalg.LocalDir]
- type ProcessSpecInput
- type PublicKeyInfo
- func (k PublicKeyInfo) Algorithm() string
- func (k PublicKeyInfo) Comment() string
- func (k PublicKeyInfo) Equal(o PublicKeyInfo) bool
- func (k PublicKeyInfo) Fingerprint() inventory.KeyFingerprint
- func (k PublicKeyInfo) IsValid() bool
- func (k PublicKeyInfo) IsZero() bool
- func (k PublicKeyInfo) MarshalJSONTo(e jEnc) error
- func (k *PublicKeyInfo) UnmarshalJSONFrom(c jDec) error
- func (k PublicKeyInfo) WireBlob() []byte
- type PublicKeyInfoSpec
- type ReadLimits
- type RemoteDirEntry
- func (e RemoteDirEntry) Equal(o RemoteDirEntry) bool
- func (e RemoteDirEntry) FileType() RemoteFileType
- func (e RemoteDirEntry) IsValid() bool
- func (e RemoteDirEntry) IsZero() bool
- func (e RemoteDirEntry) MarshalJSONTo(x jEnc) error
- func (e RemoteDirEntry) ModTime() time.Time
- func (e RemoteDirEntry) Mode() fs.FileMode
- func (e RemoteDirEntry) Name() pathalg.RemoteName
- func (e RemoteDirEntry) Perm() fs.FileMode
- func (e RemoteDirEntry) Size() int64
- func (e *RemoteDirEntry) UnmarshalJSONFrom(c jDec) error
- type RemoteDirEntrySpec
- type RemoteFSPort
- type RemoteFileAnchor
- func (a RemoteFileAnchor) Dev() uint64
- func (a RemoteFileAnchor) Equal(o RemoteFileAnchor) bool
- func (a RemoteFileAnchor) FileType() RemoteFileType
- func (a RemoteFileAnchor) HasDevIno() bool
- func (a RemoteFileAnchor) Ino() uint64
- func (a RemoteFileAnchor) IsValid() bool
- func (a RemoteFileAnchor) IsZero() bool
- func (a RemoteFileAnchor) MarshalJSONTo(e jEnc) error
- func (a RemoteFileAnchor) Matches(o RemoteFileAnchor) bool
- func (a *RemoteFileAnchor) UnmarshalJSONFrom(c jDec) error
- type RemoteFileStat
- func (s RemoteFileStat) Anchor() RemoteFileAnchor
- func (s RemoteFileStat) Equal(o RemoteFileStat) bool
- func (s RemoteFileStat) FileType() RemoteFileType
- func (s RemoteFileStat) IsDir() bool
- func (s RemoteFileStat) IsRegular() bool
- func (s RemoteFileStat) IsSymlink() bool
- func (s RemoteFileStat) IsValid() bool
- func (s RemoteFileStat) IsZero() bool
- func (s RemoteFileStat) MarshalJSONTo(e jEnc) error
- func (s RemoteFileStat) ModTime() time.Time
- func (s RemoteFileStat) Mode() fs.FileMode
- func (s RemoteFileStat) Path() pathalg.RemotePath
- func (s RemoteFileStat) Perm() fs.FileMode
- func (s RemoteFileStat) Size() int64
- func (s *RemoteFileStat) UnmarshalJSONFrom(c jDec) error
- type RemoteFileStatSpec
- type RemoteFileType
- type RemoteRenameSpec
- func (s RemoteRenameSpec) Equal(o RemoteRenameSpec) bool
- func (s RemoteRenameSpec) ExpectedAnchor() algebraic.Option[RemoteFileAnchor]
- func (s RemoteRenameSpec) IsValid() bool
- func (s RemoteRenameSpec) IsZero() bool
- func (s RemoteRenameSpec) MarshalJSONTo(e jEnc) error
- func (s RemoteRenameSpec) NoClobber() bool
- func (r *RemoteRenameSpec) UnmarshalJSONFrom(c jDec) error
- type RemoteRenameSpecInput
- type RemoteSession
- type RemoteWriteSpec
- func (s RemoteWriteSpec) AtomicRename() bool
- func (s RemoteWriteSpec) Equal(o RemoteWriteSpec) bool
- func (s RemoteWriteSpec) ExpectedAnchor() algebraic.Option[RemoteFileAnchor]
- func (s RemoteWriteSpec) IsValid() bool
- func (s RemoteWriteSpec) IsZero() bool
- func (s RemoteWriteSpec) MarshalJSONTo(e jEnc) error
- func (s RemoteWriteSpec) NoClobber() bool
- func (s RemoteWriteSpec) Perm() fs.FileMode
- func (s *RemoteWriteSpec) UnmarshalJSONFrom(c jDec) error
- type RemoteWriteSpecInput
- type Revision
- func (r Revision) AppendText(b []byte) ([]byte, error)
- func (r Revision) Compare(o Revision) int
- func (r Revision) Equal(o Revision) bool
- func (r Revision) IsValid() bool
- func (r Revision) IsZero() bool
- func (r Revision) MarshalText() ([]byte, error)
- func (r Revision) String() string
- func (r *Revision) UnmarshalText(t []byte) error
- type RootHandle
- type SSHAgentPort
- type SSHFPLookupPort
- type SSHFPRecord
- func (r SSHFPRecord) Algorithm() uint8
- func (r SSHFPRecord) Authenticated() bool
- func (r SSHFPRecord) Digest() []byte
- func (r SSHFPRecord) Equal(o SSHFPRecord) bool
- func (r SSHFPRecord) FingerprintType() uint8
- func (r SSHFPRecord) IsValid() bool
- func (r SSHFPRecord) IsZero() bool
- func (r SSHFPRecord) MarshalJSONTo(e jEnc) error
- func (r *SSHFPRecord) UnmarshalJSONFrom(c jDec) error
- type SSHFPRecordSpec
- type ScopedRootFS
- type SecretPromptRequest
- func (r SecretPromptRequest) AllowEmpty() bool
- func (r SecretPromptRequest) BodyMessage() algebraic.Option[domi18n.Message]
- func (r SecretPromptRequest) Equal(o SecretPromptRequest) bool
- func (r SecretPromptRequest) IsValid() bool
- func (r SecretPromptRequest) IsZero() bool
- func (r SecretPromptRequest) MarshalJSONTo(e jEnc) error
- func (r SecretPromptRequest) Prompt() string
- func (r SecretPromptRequest) Subject() string
- func (r SecretPromptRequest) Title() string
- func (r SecretPromptRequest) TitleMessage() algebraic.Option[domi18n.Message]
- func (r *SecretPromptRequest) UnmarshalJSONFrom(c jDec) error
- type SecretPromptRequestSpec
- type SecretVault
- type SessionOpener
- type ShellProbePort
- type ShellProbeResult
- func (r ShellProbeResult) Dialect() execution.LaunchDialect
- func (r ShellProbeResult) Equal(o ShellProbeResult) bool
- func (r ShellProbeResult) Interpreter() execution.Interpreter
- func (r ShellProbeResult) IsValid() bool
- func (r ShellProbeResult) IsZero() bool
- func (r ShellProbeResult) LaunchProfile() execution.LaunchProfile
- func (r ShellProbeResult) MarshalJSONTo(e jEnc) error
- func (r ShellProbeResult) OSFamily() string
- func (r ShellProbeResult) ProbeStage() uint8
- func (r ShellProbeResult) RawBanner() string
- func (r *ShellProbeResult) UnmarshalJSONFrom(c jDec) error
- type ShellProbeResultSpec
- type Signature
- type TUNDevicePort
- type TUNMode
- type TUNSpec
- func (s TUNSpec) Equal(o TUNSpec) bool
- func (s TUNSpec) IsValid() bool
- func (s TUNSpec) IsZero() bool
- func (s TUNSpec) LocalUnit() uint32
- func (s TUNSpec) MarshalJSONTo(e jEnc) error
- func (s TUNSpec) Mode() TUNMode
- func (s TUNSpec) RemoteUnit() uint32
- func (s *TUNSpec) UnmarshalJSONFrom(c jDec) error
- type TerminalHandle
- type TerminalPort
- type TerminalSize
- type TextPromptRequest
- func (r TextPromptRequest) AllowEmpty() bool
- func (r TextPromptRequest) BodyMessage() algebraic.Option[domi18n.Message]
- func (r TextPromptRequest) Equal(o TextPromptRequest) bool
- func (r TextPromptRequest) IsValid() bool
- func (r TextPromptRequest) IsZero() bool
- func (r TextPromptRequest) MarshalJSONTo(e jEnc) error
- func (r TextPromptRequest) Prompt() string
- func (r TextPromptRequest) Subject() string
- func (r TextPromptRequest) Title() string
- func (r TextPromptRequest) TitleMessage() algebraic.Option[domi18n.Message]
- func (r *TextPromptRequest) UnmarshalJSONFrom(c jDec) error
- type TextPromptRequestSpec
- type Timer
- type TransportConn
- type TunnelTransport
- type VaultControlPort
- type VaultState
- type VaultStatus
- func (s VaultStatus) Detail() string
- func (s VaultStatus) Equal(o VaultStatus) bool
- func (s VaultStatus) IsUnlocked() bool
- func (s VaultStatus) IsValid() bool
- func (s VaultStatus) IsZero() bool
- func (s VaultStatus) KnownStores() []string
- func (s VaultStatus) MarshalJSONTo(e jEnc) error
- func (s VaultStatus) State() VaultState
- func (s *VaultStatus) UnmarshalJSONFrom(c jDec) error
- type VaultStatusSpec
Constants ¶
const TUNUnitAny, _ uint32 = 0x7fffffff, 4096
TUNUnitAny 表示由对端动态分配 TUN/TAP 单元号(对应 OpenSSH -w any:any);maxTUNUnit 为显式单元号上限。
Variables ¶
var ( // 通用契约与参数错误。 ErrNilContext = domi18n.Sentinel(domi18n.KeyPortsNilContext) ErrNilCallback = domi18n.Sentinel(domi18n.KeyPortsNilCallback) ErrNilReceiver = domi18n.Sentinel(domi18n.KeyPortsNilReceiver) ErrInvalidArgument = domi18n.Sentinel(domi18n.KeyPortsInvalidArgument) ErrUnsupported = domi18n.Sentinel(domi18n.KeyPortsUnsupported) ErrClosed = domi18n.Sentinel(domi18n.KeyPortsClosed) ErrNotFound = domi18n.Sentinel(domi18n.KeyPortsNotFound) ErrAlreadyExists = domi18n.Sentinel(domi18n.KeyPortsAlreadyExists) ErrPermissionDenied = domi18n.Sentinel(domi18n.KeyPortsPermissionDenied) ErrLimitExceeded = domi18n.Sentinel(domi18n.KeyPortsLimitExceeded) // 配置存储、CAS 与持久化结果错误。 ErrRevisionConflict = domi18n.Sentinel(domi18n.KeyPortsRevisionConflict) ErrCorruptData = domi18n.Sentinel(domi18n.KeyPortsCorruptData) ErrInvalidRevision = domi18n.Sentinel(domi18n.KeyPortsInvalidRevision) ErrInvalidDurability = domi18n.Sentinel(domi18n.KeyPortsInvalidDurability) // 本地双模态文件系统与文件锁错误。 ErrInvalidLockMode = domi18n.Sentinel(domi18n.KeyPortsInvalidLockMode) ErrInvalidReadLimits = domi18n.Sentinel(domi18n.KeyPortsInvalidReadLimits) ErrLockBusy = domi18n.Sentinel(domi18n.KeyPortsLockBusy) ErrNotRegularFile = domi18n.Sentinel(domi18n.KeyPortsNotRegularFile) ErrSymlinkRejected = domi18n.Sentinel(domi18n.KeyPortsSymlinkRejected) ErrHandleExpired = domi18n.Sentinel(domi18n.KeyPortsHandleExpired) // 凭据库、签名器与主机密钥信任错误。 ErrVaultLocked = domi18n.Sentinel(domi18n.KeyPortsVaultLocked) ErrSecretNotFound = domi18n.Sentinel(domi18n.KeyPortsSecretNotFound) ErrSecretVerifyFailed = domi18n.Sentinel(domi18n.KeyPortsSecretVerifyFailed) ErrHostKeyMismatch = domi18n.Sentinel(domi18n.KeyPortsHostKeyMismatch) ErrHostKeyUnknown = domi18n.Sentinel(domi18n.KeyPortsHostKeyUnknown) ErrHostKeyRevoked = domi18n.Sentinel(domi18n.KeyPortsHostKeyRevoked) // 传输拨号、多路复用与远端 SFTP 错误。 ErrDialFailed = domi18n.Sentinel(domi18n.KeyPortsDialFailed) ErrAuthFailed = domi18n.Sentinel(domi18n.KeyPortsAuthFailed) ErrRemoteAnchorMismatch = domi18n.Sentinel(domi18n.KeyPortsRemoteAnchorMismatch) ErrRemoteIsDir = domi18n.Sentinel(domi18n.KeyPortsRemoteIsDir) // 安全审计、崩溃对账、系统与交互错误。 ErrAuditWriteFailed = domi18n.Sentinel(domi18n.KeyPortsAuditWriteFailed) ErrAuditPostWrite = domi18n.Sentinel(domi18n.KeyPortsAuditPostWrite) ErrAuditHalted = domi18n.Sentinel(domi18n.KeyPortsAuditHalted) ErrInvalidAuditEntry = domi18n.Sentinel(domi18n.KeyPortsInvalidAuditEntry) ErrInvalidProcessInstanceID = domi18n.Sentinel(domi18n.KeyPortsInvalidProcInstID) ErrInteractionCanceled = domi18n.Sentinel(domi18n.KeyPortsInteractionCanceled) ErrEntropyShortRead = domi18n.Sentinel(domi18n.KeyPortsEntropyShortRead) ErrInvalidTTYSize = domi18n.Sentinel(domi18n.KeyPortsInvalidTTYSize) )
本包导出的规范化哨兵错误,供用例、连接池、能力门控、宿主适配器、仿真器与 TCK 统一以 errors.Is 判定。
Functions ¶
This section is empty.
Types ¶
type ApprovalDecisionResponse ¶
type ApprovalDecisionResponse struct {
// contains filtered or unexported fields
}
ApprovalDecisionResponse 表示用户对不可变 ApprovalEnvelope 的显式审批回执(INV-E5);零值恒拒绝。
func NewApprovalDecisionResponse ¶
func NewApprovalDecisionResponse(verdict security.Verdict, envelopeDigest security.Digest, comment string) (ApprovalDecisionResponse, error)
NewApprovalDecisionResponse 校验判定值与信封摘要并构造不可变 ApprovalDecisionResponse。
func (ApprovalDecisionResponse) Approved ¶
func (r ApprovalDecisionResponse) Approved() bool
func (ApprovalDecisionResponse) Comment ¶
func (r ApprovalDecisionResponse) Comment() string
func (ApprovalDecisionResponse) EnvelopeDigest ¶
func (r ApprovalDecisionResponse) EnvelopeDigest() security.Digest
func (ApprovalDecisionResponse) Equal ¶
func (r ApprovalDecisionResponse) Equal(o ApprovalDecisionResponse) bool
func (ApprovalDecisionResponse) IsValid ¶
func (r ApprovalDecisionResponse) IsValid() bool
func (ApprovalDecisionResponse) IsZero ¶
func (r ApprovalDecisionResponse) IsZero() bool
func (ApprovalDecisionResponse) MarshalJSONTo ¶
func (r ApprovalDecisionResponse) MarshalJSONTo(e jEnc) error
func (*ApprovalDecisionResponse) UnmarshalJSONFrom ¶
func (r *ApprovalDecisionResponse) UnmarshalJSONFrom(c jDec) error
func (ApprovalDecisionResponse) Verdict ¶
func (r ApprovalDecisionResponse) Verdict() security.Verdict
type AuditEntry ¶
type AuditEntry struct {
// contains filtered or unexported fields
}
AuditEntry 表示一条面向 JSONL 同步落盘的不可变安全审计记录(ADR-008);零值恒无效。
func NewAuditEntry ¶
func NewAuditEntry(spec AuditEntrySpec) (AuditEntry, error)
NewAuditEntry 校验标识、阶段/结果/决策配对、RFC 3339 时间戳与非负可选耗时并构造 AuditEntry。
func (AuditEntry) Binding ¶
func (e AuditEntry) Binding() security.OperationBinding
func (AuditEntry) CanonicalJSON ¶
func (e AuditEntry) CanonicalJSON() ([]byte, error)
func (AuditEntry) Decision ¶
func (e AuditEntry) Decision() security.DecisionKind
func (AuditEntry) Equal ¶
func (e AuditEntry) Equal(o AuditEntry) bool
func (AuditEntry) ErrorCode ¶
func (e AuditEntry) ErrorCode() string
func (AuditEntry) IsValid ¶
func (e AuditEntry) IsValid() bool
func (AuditEntry) IsZero ¶
func (e AuditEntry) IsZero() bool
func (AuditEntry) MarshalJSONTo ¶
func (e AuditEntry) MarshalJSONTo(x jEnc) error
func (AuditEntry) OperationID ¶
func (e AuditEntry) OperationID() security.OperationID
func (AuditEntry) Outcome ¶
func (e AuditEntry) Outcome() AuditOutcome
func (AuditEntry) Phase ¶
func (e AuditEntry) Phase() AuditPhase
func (AuditEntry) ProcessID ¶
func (e AuditEntry) ProcessID() ProcessInstanceID
func (AuditEntry) Reason ¶
func (e AuditEntry) Reason() string
func (AuditEntry) Risk ¶
func (e AuditEntry) Risk() security.RiskLevel
func (AuditEntry) Timestamp ¶
func (e AuditEntry) Timestamp() time.Time
func (AuditEntry) TraceID ¶
func (e AuditEntry) TraceID() security.TraceID
func (*AuditEntry) UnmarshalJSONFrom ¶
func (e *AuditEntry) UnmarshalJSONFrom(c jDec) error
type AuditEntrySpec ¶
type AuditEntrySpec struct {
ProcessID ProcessInstanceID
TraceID security.TraceID
OperationID security.OperationID
Phase AuditPhase
Outcome AuditOutcome
Risk security.RiskLevel
Decision security.DecisionKind
Binding security.OperationBinding
Timestamp time.Time
Duration algebraic.Option[algebraic.Duration]
ErrorCode, Reason string
}
AuditEntrySpec 是构造不可变 AuditEntry 的显式入参规格(严禁 SecretBox 或裸 time.Duration)。
type AuditOutcome ¶
type AuditOutcome uint8
AuditOutcome 标识审计记录对应的结果语义;零值 AuditOutcomeInvalid 失败关闭。
const ( AuditOutcomeInvalid AuditOutcome = iota // 无效结果(零值失败关闭) AuditOutcomePending // 已授权待执行闭合(仅配对 Authorized) AuditOutcomeDenied // 策略或审批拒绝(仅配对 Denied) AuditOutcomeSucceeded // 终态:执行成功 AuditOutcomeFailed // 终态:执行失败 AuditOutcomeCanceled // 终态:上下文取消或中断 AuditOutcomeEscalated // 终态:二阶段规范化作用域升级并撤销放行 AuditOutcomeAbortedByCrash // 终态:崩溃恢复对账补写 AuditOutcomeUnknown // 终态:副作用结果未知(严禁降级为 Failed) )
func ParseAuditOutcome ¶
func ParseAuditOutcome(s string) (AuditOutcome, error)
func (AuditOutcome) AppendText ¶
func (o AuditOutcome) AppendText(b []byte) ([]byte, error)
func (AuditOutcome) IsValid ¶
func (o AuditOutcome) IsValid() bool
func (AuditOutcome) IsZero ¶
func (o AuditOutcome) IsZero() bool
func (AuditOutcome) MarshalText ¶
func (o AuditOutcome) MarshalText() ([]byte, error)
func (AuditOutcome) String ¶
func (o AuditOutcome) String() string
func (*AuditOutcome) UnmarshalText ¶
func (o *AuditOutcome) UnmarshalText(t []byte) error
type AuditPhase ¶
type AuditPhase uint8
AuditPhase 标识单条审计记录所处的操作生命周期阶段(ADR-008);零值 AuditPhaseInvalid 失败关闭。
const ( AuditPhaseInvalid AuditPhase = iota // 无效阶段(零值失败关闭) AuditPhaseDenied // 准入或审批阶段直接拒绝 AuditPhaseAuthorized // 能力证明签发前置落盘记录 AuditPhaseFinalized // 操作终态闭合记录 )
func ParseAuditPhase ¶
func ParseAuditPhase(s string) (AuditPhase, error)
func (AuditPhase) AppendText ¶
func (p AuditPhase) AppendText(b []byte) ([]byte, error)
func (AuditPhase) IsValid ¶
func (p AuditPhase) IsValid() bool
func (AuditPhase) IsZero ¶
func (p AuditPhase) IsZero() bool
func (AuditPhase) MarshalText ¶
func (p AuditPhase) MarshalText() ([]byte, error)
func (AuditPhase) String ¶
func (p AuditPhase) String() string
func (*AuditPhase) UnmarshalText ¶
func (p *AuditPhase) UnmarshalText(t []byte) error
type AuditPostWriteError ¶
type AuditPostWriteError struct {
// contains filtered or unexported fields
}
AuditPostWriteError 表示副作用完成后写入终态审计失败的致命故障(ADR-008);实现单值 Unwrap 与 Is(ErrAuditPostWrite)。
func NewAuditPostWriteError ¶
func NewAuditPostWriteError(opID security.OperationID, cause error) (*AuditPostWriteError, error)
NewAuditPostWriteError 校验 operationID 有效后构造不可变 *AuditPostWriteError。
func (*AuditPostWriteError) Error ¶
func (e *AuditPostWriteError) Error() string
func (*AuditPostWriteError) Is ¶
func (e *AuditPostWriteError) Is(t error) bool
func (*AuditPostWriteError) IsValid ¶
func (e *AuditPostWriteError) IsValid() bool
func (*AuditPostWriteError) LocalizableView ¶ added in v1.1.0
func (e *AuditPostWriteError) LocalizableView() domi18n.ErrorNode
LocalizableView 返回结构化错误节点视图,供边界无穿透本地化并在默认 cause==ErrAuditPostWrite 时精准折叠。
func (*AuditPostWriteError) OperationID ¶
func (e *AuditPostWriteError) OperationID() security.OperationID
func (*AuditPostWriteError) Unwrap ¶
func (e *AuditPostWriteError) Unwrap() error
type AuditReconciler ¶
type AuditReconciler interface {
ReconcileCrashedAudits(ctx context.Context, now time.Time) (CrashReconcileReport, error)
}
AuditReconciler 定义引擎启动期 O(1) 跨进程崩溃审计对账出站端口(ADR-008 / RFC §3.4)。
type AuditSink ¶
type AuditSink interface {
ProcessInstanceID() ProcessInstanceID
StageOperation(ctx context.Context, opID security.OperationID) error
UnstageOperation(ctx context.Context, opID security.OperationID) error
Record(ctx context.Context, entry AuditEntry) error
Close() error
}
AuditSink 定义同步 Fail-Closed 审计写入与只追加活跃操作登记出站端口(ADR-008)。
type BoundedReadHandle ¶
BoundedReadHandle 是同步闭包内借出的有界随机只读句柄(顺序 Reader + 并发安全 ReaderAt),退出后返回 ErrHandleExpired。
type Clock ¶
type Clock interface {
Now() time.Time
Since(t time.Time) time.Duration
NewTimer(d time.Duration) Timer
Sleep(ctx context.Context, d time.Duration) error
}
Clock 定义时钟与定时等待出站端口(ADR-002 / DST 确定性基础)。
type ConfirmRequest ¶
type ConfirmRequest struct {
// contains filtered or unexported fields
}
ConfirmRequest 描述面向 InteractionPort.Confirm 的失败关闭二值确认请求(默认拒绝);零值恒无效。
func NewConfirmRequest ¶
func NewConfirmRequest(spec ConfirmRequestSpec) (ConfirmRequest, error)
NewConfirmRequest 校验并脱敏确认文案与风险等级,并对可选结构化消息(TitleMessage/BodyMessage) 递归严格拒绝非法控制/Bidi 字符与字节预算超限后构造不可变 ConfirmRequest。
func (ConfirmRequest) BodyMessage ¶ added in v1.1.0
func (r ConfirmRequest) BodyMessage() algebraic.Option[domi18n.Message]
func (ConfirmRequest) Equal ¶
func (r ConfirmRequest) Equal(o ConfirmRequest) bool
func (ConfirmRequest) IsValid ¶
func (r ConfirmRequest) IsValid() bool
func (ConfirmRequest) IsZero ¶
func (r ConfirmRequest) IsZero() bool
func (ConfirmRequest) MarshalJSONTo ¶
func (r ConfirmRequest) MarshalJSONTo(e jEnc) error
func (ConfirmRequest) Message ¶
func (r ConfirmRequest) Message() string
func (ConfirmRequest) Risk ¶
func (r ConfirmRequest) Risk() security.RiskLevel
func (ConfirmRequest) Subject ¶
func (r ConfirmRequest) Subject() string
func (ConfirmRequest) Title ¶
func (r ConfirmRequest) Title() string
func (ConfirmRequest) TitleMessage ¶ added in v1.1.0
func (r ConfirmRequest) TitleMessage() algebraic.Option[domi18n.Message]
func (*ConfirmRequest) UnmarshalJSONFrom ¶
func (r *ConfirmRequest) UnmarshalJSONFrom(c jDec) error
type ConfirmRequestSpec ¶
type ConfirmRequestSpec struct {
Title string `json:"title,omitzero"`
Message string `json:"message"`
Subject string `json:"subject,omitzero"`
Risk security.RiskLevel `json:"risk"`
TitleMessage algebraic.Option[domi18n.Message] `json:"title_message,omitzero"`
BodyMessage algebraic.Option[domi18n.Message] `json:"body_message,omitzero"`
}
ConfirmRequestSpec 是构造不可变 ConfirmRequest 的显式入参规格。
type CrashReconcileReport ¶
type CrashReconcileReport struct {
// contains filtered or unexported fields
}
CrashReconcileReport 描述启动期 O(1) 崩溃对账的确定性汇总报告(RFC §3.4);零值恒无效。
func NewCrashReconcileReport ¶
func NewCrashReconcileReport(spec CrashReconcileReportSpec) (CrashReconcileReport, error)
NewCrashReconcileReport 校验计数非负、一致性及全部补写 OperationID 有效后构造不可变报告。
func (CrashReconcileReport) AbortedOperations ¶
func (r CrashReconcileReport) AbortedOperations() []security.OperationID
func (CrashReconcileReport) DeadLocksClaimed ¶
func (r CrashReconcileReport) DeadLocksClaimed() int
func (CrashReconcileReport) Equal ¶
func (r CrashReconcileReport) Equal(o CrashReconcileReport) bool
func (CrashReconcileReport) IsValid ¶
func (r CrashReconcileReport) IsValid() bool
func (CrashReconcileReport) IsZero ¶
func (r CrashReconcileReport) IsZero() bool
func (CrashReconcileReport) LiveLocksSkipped ¶
func (r CrashReconcileReport) LiveLocksSkipped() int
func (CrashReconcileReport) MarshalJSONTo ¶
func (r CrashReconcileReport) MarshalJSONTo(e jEnc) error
func (CrashReconcileReport) ScannedLocks ¶
func (r CrashReconcileReport) ScannedLocks() int
func (*CrashReconcileReport) UnmarshalJSONFrom ¶
func (r *CrashReconcileReport) UnmarshalJSONFrom(c jDec) error
type CrashReconcileReportSpec ¶
type CrashReconcileReportSpec struct {
ScannedLocks, LiveLocksSkipped, DeadLocksClaimed int
AbortedOperations []security.OperationID
}
CrashReconcileReportSpec 是构造不可变 CrashReconcileReport 的显式入参规格。
type DialerPort ¶
type DialerPort interface {
DialHop(ctx context.Context, hop plan.HopSpec, hopDigest plan.HopDigest, parent TransportConn) (TransportConn, error)
}
DialerPort 定义协议无关的 SSH 单跳/多跳拨号出站端口(ADR-009 / ADR-015)。
type DurabilityOutcome ¶
type DurabilityOutcome struct {
// contains filtered or unexported fields
}
DurabilityOutcome 表示配置 CAS 提交后的结构化持久化结果(INV-F3): 严分 Committed、NotApplied、AppliedNotDurable(Applied && !Durable)与 OutcomeUnknown。
func NewDurabilityAppliedNotDurable ¶
func NewDurabilityAppliedNotDurable(revision algebraic.Option[Revision], detail string) (DurabilityOutcome, error)
NewDurabilityAppliedNotDurable 构造已生效但未确认落盘(Applied && !Durable)的停机结果。
func NewDurabilityCommitted ¶
func NewDurabilityCommitted(revision Revision) (DurabilityOutcome, error)
NewDurabilityCommitted 构造已生效且已落盘(Applied && Durable)的提交结果。
func NewDurabilityNotApplied ¶
func NewDurabilityNotApplied(detail string) (DurabilityOutcome, error)
NewDurabilityNotApplied 构造确认未生效(可安全补偿)的提交结果。
func NewDurabilityOutcomeUnknown ¶
func NewDurabilityOutcomeUnknown(detail string) (DurabilityOutcome, error)
NewDurabilityOutcomeUnknown 构造提交结果未知的失败关闭结果(严禁自动重试)。
func (DurabilityOutcome) Applied ¶
func (d DurabilityOutcome) Applied() bool
func (DurabilityOutcome) Detail ¶
func (d DurabilityOutcome) Detail() string
func (DurabilityOutcome) Durable ¶
func (d DurabilityOutcome) Durable() bool
func (DurabilityOutcome) Equal ¶
func (d DurabilityOutcome) Equal(o DurabilityOutcome) bool
func (DurabilityOutcome) IsValid ¶
func (d DurabilityOutcome) IsValid() bool
func (DurabilityOutcome) IsZero ¶
func (d DurabilityOutcome) IsZero() bool
func (DurabilityOutcome) MarshalJSONTo ¶
func (d DurabilityOutcome) MarshalJSONTo(e jEnc) error
MarshalJSONTo 与 UnmarshalJSONFrom 实现全包不可变值对象的严格 json/v2 编解码。
func (DurabilityOutcome) Revision ¶
func (d DurabilityOutcome) Revision() algebraic.Option[Revision]
func (DurabilityOutcome) Status ¶
func (d DurabilityOutcome) Status() fsm.DurabilityStatus
func (*DurabilityOutcome) UnmarshalJSONFrom ¶
func (d *DurabilityOutcome) UnmarshalJSONFrom(c jDec) error
type EnvPort ¶
type EnvPort interface {
LookupEnv(key string) (string, bool)
Environ() map[string]string
LookupLocalIdentity() (LocalIdentityInfo, error)
}
EnvPort 定义只读本机环境变量与本机主机/用户元信息出站端口(由 internal/host/sys 或 sim 实现,ADR-002)。
type ExecStreams ¶
type ExecStreams struct {
Stdin io.Reader
Stdout, Stderr io.Writer
PTY algebraic.Option[PTYRequest]
Env map[string]string
}
ExecStreams 聚合单次远端会话执行的运行期数据面流、可选 PTY 与经 SendEnv 过滤后的环境变量(非持久化 DTO)。
type FormatImporter ¶
type FormatImporter interface {
Format() string
Import(ctx context.Context, sourceName string, r io.Reader) (inventory.ImportBundle, error)
}
FormatImporter 定义配置导入层的格式无关扩展端口(ADR-006,如 openssh / csv,100% 零 v1 代码)。
type ForwardDirection ¶
type ForwardDirection uint8
ForwardDirection 标识 SSH 隧道转发方向类别(-L/-R/-D/TUN);零值 ForwardDirectionInvalid 失败关闭。
const ( ForwardDirectionInvalid ForwardDirection = iota // 无效转发方向(零值失败关闭) ForwardLocal // 本地监听 -> 远端目标转发(-L,支持 TCP 与 StreamLocal 双向/混合) ForwardRemote // 远端监听 -> 本地目标转发(-R,支持 TCP 与 StreamLocal 双向/混合) ForwardDynamic // 本地动态 SOCKS5 转发(-D) ForwardTUN // L2/L3 隧道设备转发(-w) )
func ParseForwardDirection ¶
func ParseForwardDirection(s string) (ForwardDirection, error)
func (ForwardDirection) AppendText ¶
func (d ForwardDirection) AppendText(b []byte) ([]byte, error)
func (ForwardDirection) IsValid ¶
func (d ForwardDirection) IsValid() bool
func (ForwardDirection) IsZero ¶
func (d ForwardDirection) IsZero() bool
func (ForwardDirection) MarshalText ¶
func (d ForwardDirection) MarshalText() ([]byte, error)
func (ForwardDirection) String ¶
func (d ForwardDirection) String() string
func (*ForwardDirection) UnmarshalText ¶
func (d *ForwardDirection) UnmarshalText(t []byte) error
type ForwardEndpointKind ¶
type ForwardEndpointKind uint8
ForwardEndpointKind 标识隧道转发监听端或目标端的端点协议类别(TCP / Unix Domain Socket);零值失败关闭。
const ( ForwardEndpointInvalid ForwardEndpointKind = iota // 无效端点类别(零值失败关闭) ForwardEndpointTCP // TCP host:port 端点 ForwardEndpointUnix // Unix Domain Socket (StreamLocal) 端点 )
func ParseForwardEndpointKind ¶
func ParseForwardEndpointKind(s string) (ForwardEndpointKind, error)
func (ForwardEndpointKind) AppendText ¶
func (k ForwardEndpointKind) AppendText(b []byte) ([]byte, error)
func (ForwardEndpointKind) IsValid ¶
func (k ForwardEndpointKind) IsValid() bool
func (ForwardEndpointKind) IsZero ¶
func (k ForwardEndpointKind) IsZero() bool
func (ForwardEndpointKind) MarshalText ¶
func (k ForwardEndpointKind) MarshalText() ([]byte, error)
func (ForwardEndpointKind) String ¶
func (k ForwardEndpointKind) String() string
func (*ForwardEndpointKind) UnmarshalText ¶
func (k *ForwardEndpointKind) UnmarshalText(t []byte) error
type ForwardHandle ¶
type ForwardHandle interface {
IsValid() bool
Spec() ForwardSpec
BoundAddr() string
Done() <-chan struct{}
Err() error
Close() error
}
ForwardHandle 表示受管长生命周期隧道转发实例(满足 pool.ManagedResource),经 pool.RegisterLeaseHandleWith 纳入世代撤销与跳板钉选。
type ForwardSpec ¶
type ForwardSpec struct {
// contains filtered or unexported fields
}
ForwardSpec 描述单条 SSH 隧道转发规则(显式区分方向、监听/目标端点类型与强类型 TUNSpec);零值恒无效。
func NewForwardSpec ¶
func NewForwardSpec(direction ForwardDirection, bindAddr, targetAddr string) (ForwardSpec, error)
NewForwardSpec 构造默认 TCP 端点的非 TUN 转发规则(ForwardLocal/ForwardRemote 为 TCP->TCP, ForwardDynamic 为 TCP 无目标);涉及 StreamLocal(Unix 套接字)请使用 NewTypedForwardSpec,ForwardTUN 须经 NewForwardTUNSpec。
func NewForwardTUNSpec ¶
func NewForwardTUNSpec(tun TUNSpec) (ForwardSpec, error)
NewForwardTUNSpec 校验强类型 TUNSpec 并构造 ForwardTUN 方向的不可变 ForwardSpec。
func NewTypedForwardSpec ¶
func NewTypedForwardSpec(direction ForwardDirection, bindKind ForwardEndpointKind, bindAddr string, targetKind ForwardEndpointKind, targetAddr string) (ForwardSpec, error)
NewTypedForwardSpec 校验非 TUN 转发方向、显式监听/目标端点类型与地址组合并构造不可变 ForwardSpec, 完整支持 -L/-R 下的 TCP↔TCP、Unix↔Unix、TCP↔Unix 四类组合而零字符串嗅探。
func (ForwardSpec) BindAddr ¶
func (f ForwardSpec) BindAddr() string
func (ForwardSpec) BindKind ¶
func (f ForwardSpec) BindKind() ForwardEndpointKind
func (ForwardSpec) Direction ¶
func (f ForwardSpec) Direction() ForwardDirection
func (ForwardSpec) Equal ¶
func (f ForwardSpec) Equal(o ForwardSpec) bool
func (ForwardSpec) IsValid ¶
func (f ForwardSpec) IsValid() bool
func (ForwardSpec) IsZero ¶
func (f ForwardSpec) IsZero() bool
func (ForwardSpec) MarshalJSONTo ¶
func (f ForwardSpec) MarshalJSONTo(e jEnc) error
func (ForwardSpec) TargetAddr ¶
func (f ForwardSpec) TargetAddr() string
func (ForwardSpec) TargetKind ¶
func (f ForwardSpec) TargetKind() ForwardEndpointKind
func (*ForwardSpec) UnmarshalJSONFrom ¶
func (f *ForwardSpec) UnmarshalJSONFrom(c jDec) error
type ForwarderPort ¶
type ForwarderPort interface {
// StartForward 启动受管隧道转发;transport 持留至 ForwardHandle.Close()(非 //xops:borrowed),须由 pool.RegisterLeaseHandleWith 传入池钉选视图。
StartForward(ctx context.Context, transport TunnelTransport, spec ForwardSpec) (ForwardHandle, error)
}
ForwarderPort 定义 SSH 端口转发(-L/-R/-D)、StreamLocal 与 TUN 启动出站端口(P3-T2 <-> P4-T2 sshnet/forward)。
type HostTrustCheck ¶
type HostTrustCheck struct {
// contains filtered or unexported fields
}
HostTrustCheck 表示 HostTrustPort.VerifyHostKey 返回的不可变核验结论;零值恒无效并拒绝信任。
func NewHostTrustCheck ¶
func NewHostTrustCheck(spec HostTrustCheckSpec) (HostTrustCheck, error)
NewHostTrustCheck 校验核验状态、端点、呈递公钥与可选预期指纹列表并构造不可变 HostTrustCheck。
func (HostTrustCheck) Endpoint ¶
func (c HostTrustCheck) Endpoint() netaddr.Endpoint
func (HostTrustCheck) Equal ¶
func (c HostTrustCheck) Equal(o HostTrustCheck) bool
func (HostTrustCheck) ExpectedFingerprints ¶
func (c HostTrustCheck) ExpectedFingerprints() []inventory.KeyFingerprint
func (HostTrustCheck) IsTrusted ¶
func (c HostTrustCheck) IsTrusted() bool
func (HostTrustCheck) IsValid ¶
func (c HostTrustCheck) IsValid() bool
func (HostTrustCheck) IsZero ¶
func (c HostTrustCheck) IsZero() bool
func (HostTrustCheck) MarshalJSONTo ¶
func (c HostTrustCheck) MarshalJSONTo(e jEnc) error
func (HostTrustCheck) Presented ¶
func (c HostTrustCheck) Presented() PublicKeyInfo
func (HostTrustCheck) Reason ¶
func (c HostTrustCheck) Reason() string
func (HostTrustCheck) Status ¶
func (c HostTrustCheck) Status() HostTrustStatus
func (*HostTrustCheck) UnmarshalJSONFrom ¶
func (c *HostTrustCheck) UnmarshalJSONFrom(d jDec) error
type HostTrustCheckSpec ¶
type HostTrustCheckSpec struct {
Status HostTrustStatus `json:"status"`
Endpoint netaddr.Endpoint `json:"endpoint"`
Presented PublicKeyInfo `json:"presented"`
ExpectedFingerprints []inventory.KeyFingerprint `json:"expected_fingerprints,omitzero"`
Reason string `json:"reason,omitzero"`
}
HostTrustCheckSpec 是构造不可变 HostTrustCheck 的显式入参规格。
type HostTrustPort ¶
type HostTrustPort interface {
PreferredAlgorithms(ctx context.Context, endpoint netaddr.Endpoint, knownHosts option.KnownHostsList) ([]string, error)
VerifyHostKey(ctx context.Context, req HostTrustRequest) (HostTrustCheck, error)
RecordHostKey(ctx context.Context, endpoint netaddr.Endpoint, key PublicKeyInfo, knownHosts option.KnownHostsList) error
}
HostTrustPort 定义主机密钥信任库(known_hosts / SSHFP)查询、校验与记录出站端口(INV-C5 / INV-E2)。
type HostTrustRequest ¶
type HostTrustRequest struct {
// contains filtered or unexported fields
}
HostTrustRequest 表示面向 HostTrustPort.VerifyHostKey 的强类型核验请求(INV-E2)。
func NewHostTrustRequest ¶
func NewHostTrustRequest(spec HostTrustRequestSpec) (HostTrustRequest, error)
NewHostTrustRequest 校验端点、远端公钥与校验模式并构造不可变 HostTrustRequest。
func (HostTrustRequest) Endpoint ¶
func (r HostTrustRequest) Endpoint() netaddr.Endpoint
func (HostTrustRequest) IsValid ¶
func (r HostTrustRequest) IsValid() bool
func (HostTrustRequest) IsZero ¶
func (r HostTrustRequest) IsZero() bool
func (HostTrustRequest) KnownHosts ¶
func (r HostTrustRequest) KnownHosts() option.KnownHostsList
func (HostTrustRequest) Mode ¶
func (r HostTrustRequest) Mode() option.StrictHostKeyCheckingMode
func (HostTrustRequest) Presented ¶
func (r HostTrustRequest) Presented() PublicKeyInfo
type HostTrustRequestSpec ¶
type HostTrustRequestSpec struct {
Endpoint netaddr.Endpoint
Presented PublicKeyInfo
Mode option.StrictHostKeyCheckingMode
KnownHosts option.KnownHostsList
}
HostTrustRequestSpec 是构造不可变 HostTrustRequest 的显式入参规格。
type HostTrustStatus ¶
type HostTrustStatus uint8
HostTrustStatus 表示远端主机密钥核验状态枚举;零值 HostTrustStatusInvalid 恒拒绝。
const ( HostTrustStatusInvalid HostTrustStatus = iota // 无效状态(零值失败关闭) HostTrustTrusted // 与信任库匹配 HostTrustUnknown // 尚无端点信任记录 HostTrustMismatch // 与既有记录冲突(疑似 MITM) HostTrustRevoked // 已被显式吊销(@revoked) )
func ParseHostTrustStatus ¶
func ParseHostTrustStatus(s string) (HostTrustStatus, error)
func (HostTrustStatus) AppendText ¶
func (s HostTrustStatus) AppendText(b []byte) ([]byte, error)
func (HostTrustStatus) IsValid ¶
func (s HostTrustStatus) IsValid() bool
func (HostTrustStatus) IsZero ¶
func (s HostTrustStatus) IsZero() bool
func (HostTrustStatus) MarshalText ¶
func (s HostTrustStatus) MarshalText() ([]byte, error)
func (HostTrustStatus) String ¶
func (s HostTrustStatus) String() string
func (*HostTrustStatus) UnmarshalText ¶
func (s *HostTrustStatus) UnmarshalText(t []byte) error
type InteractionPort ¶
type InteractionPort interface {
CanInteract() bool
Confirm(ctx context.Context, req ConfirmRequest) (security.Verdict, error)
PromptApproval(ctx context.Context, envelope security.ApprovalEnvelope) (ApprovalDecisionResponse, error)
PromptText(ctx context.Context, req TextPromptRequest) (string, error)
// PromptSecret 以无回显方式采集用户机密输入并在同步闭包内借出 *secret.SecretBox。
//xops:syncclosure
//xops:borrowed
PromptSecret(ctx context.Context, req SecretPromptRequest, fn func(box *secret.SecretBox) error) error
}
InteractionPort 定义人工确认、审批挑战、非敏感文本与全作用域闭包机密输入出站端口。
type InventorySnapshot ¶
type InventorySnapshot struct {
// contains filtered or unexported fields
}
InventorySnapshot 封装单次加载取得的不可变资产图快照与 CAS 版本令牌;零值恒无效。
func NewInventorySnapshot ¶
func NewInventorySnapshot(revision Revision, graph inventory.Graph) (InventorySnapshot, error)
NewInventorySnapshot 校验版本令牌与资产图均有效后构造不可变 InventorySnapshot。
func (InventorySnapshot) Graph ¶
func (s InventorySnapshot) Graph() inventory.Graph
func (InventorySnapshot) IsValid ¶
func (s InventorySnapshot) IsValid() bool
func (InventorySnapshot) IsZero ¶
func (s InventorySnapshot) IsZero() bool
func (InventorySnapshot) Revision ¶
func (s InventorySnapshot) Revision() Revision
type InventoryStore ¶
type InventoryStore interface {
Load(ctx context.Context) (InventorySnapshot, error)
CommitCAS(ctx context.Context, expected Revision, next inventory.Graph) (DurabilityOutcome, error)
}
InventoryStore 定义本地资产配置的原子加载与 CAS 持久化出站端口(INV-F1 / INV-F3)。
type JournalGenerationSnapshot ¶
type JournalGenerationSnapshot struct {
// contains filtered or unexported fields
}
JournalGenerationSnapshot 表示单个传输世代(如 active 或 staging)的只读 WAL 快照; 零值恒无效并失败关闭(Corrupt()==true);某世代损坏时 Records() 恒返回 nil,同时经 PartialRecords() 保留损坏前有效前缀供上层识别 CommitStarted/UncertainCommit,严禁盲目丢弃损坏高世代回退低世代。
func NewCorruptJournalGenerationSnapshot ¶
func NewCorruptJournalGenerationSnapshot(generation uint64, cause error, partialPrefix ...fsm.TransferJournalRecord) (JournalGenerationSnapshot, error)
NewCorruptJournalGenerationSnapshot 构造显式标记损坏的世代快照,并可选保留损坏点前已校验的同代前缀记录。
func NewJournalGenerationSnapshot ¶
func NewJournalGenerationSnapshot(generation uint64, records []fsm.TransferJournalRecord) (JournalGenerationSnapshot, error)
NewJournalGenerationSnapshot 校验世代号与非空同代记录列表并构造健康世代快照。
func (JournalGenerationSnapshot) Corrupt ¶
func (s JournalGenerationSnapshot) Corrupt() bool
func (JournalGenerationSnapshot) Equal ¶
func (s JournalGenerationSnapshot) Equal(o JournalGenerationSnapshot) bool
func (JournalGenerationSnapshot) Err ¶
func (s JournalGenerationSnapshot) Err() error
func (JournalGenerationSnapshot) Generation ¶
func (s JournalGenerationSnapshot) Generation() uint64
func (JournalGenerationSnapshot) IsValid ¶
func (s JournalGenerationSnapshot) IsValid() bool
func (JournalGenerationSnapshot) IsZero ¶
func (s JournalGenerationSnapshot) IsZero() bool
func (JournalGenerationSnapshot) PartialRecords ¶
func (s JournalGenerationSnapshot) PartialRecords() []fsm.TransferJournalRecord
PartialRecords 返回损坏世代在损坏点前已解码校验的前缀记录副本;健康、无效或头部即损坏的快照返回 nil。
func (JournalGenerationSnapshot) Records ¶
func (s JournalGenerationSnapshot) Records() []fsm.TransferJournalRecord
type JournalStore ¶
type JournalStore interface {
Append(ctx context.Context, record fsm.TransferJournalRecord) error
Load(ctx context.Context, transferID security.OperationID) ([]fsm.TransferJournalRecord, error)
LoadGenerations(ctx context.Context, transferID security.OperationID) ([]JournalGenerationSnapshot, error)
PruneGeneration(ctx context.Context, transferID security.OperationID, generation uint64) error
ListActive(ctx context.Context) ([]security.OperationID, error)
Delete(ctx context.Context, transferID security.OperationID) error
}
JournalStore 定义可恢复分片文件传输(最高 10 GiB)双代(active/staging)WAL/Journal 持久化出站端口(P3-T3 <-> P4-T3)。
- Append 按 (TransferID, Generation) 分代追加;
- Load 按 (Generation 升序, Seq 升序) 确定性返回全部保留记录,任一代损坏则返回 ErrCorruptData;
- LoadGenerations 按 Generation 升序返回逐代隔离快照(损坏代 Corrupt()==true/Records()==nil,经 PartialRecords() 保留损坏前有效前缀);严禁盲目丢弃损坏高世代回退低世代(前缀含 CommitStarted/Committed 须停于 TransferUncertainCommit,高世代空前缀须失败关闭);
- PruneGeneration 仅移除指定 (transferID, generation),若无剩余世代则 transferID 移出 ListActive。
type KeySignerPort ¶
type KeySignerPort interface {
ListPublicKeys(ctx context.Context, auth inventory.AuthMethod) ([]PublicKeyInfo, error)
Sign(ctx context.Context, key inventory.KeyFingerprint, algorithm string, data []byte) (Signature, error)
InspectPrivateKeyFingerprint(ctx context.Context, keyPath inventory.KeyPathSpec, passphrase algebraic.Option[secret.Ref]) (inventory.KeyFingerprint, error)
}
KeySignerPort 定义私钥解析、指纹核验与公钥签名出站端口。
type LocalDirEntry ¶
type LocalDirEntry struct {
// contains filtered or unexported fields
}
LocalDirEntry 表示沙箱目录枚举返回的单个已校验目录项;零值恒无效。
func NewLocalDirEntry ¶
NewLocalDirEntry 校验目录项名称分量与非负大小并构造不可变 LocalDirEntry。
func (LocalDirEntry) Equal ¶
func (e LocalDirEntry) Equal(o LocalDirEntry) bool
func (LocalDirEntry) IsDir ¶
func (e LocalDirEntry) IsDir() bool
func (LocalDirEntry) IsRegular ¶
func (e LocalDirEntry) IsRegular() bool
func (LocalDirEntry) IsSymlink ¶
func (e LocalDirEntry) IsSymlink() bool
func (LocalDirEntry) IsValid ¶
func (e LocalDirEntry) IsValid() bool
func (LocalDirEntry) IsZero ¶
func (e LocalDirEntry) IsZero() bool
func (LocalDirEntry) Mode ¶
func (e LocalDirEntry) Mode() fs.FileMode
func (LocalDirEntry) Name ¶
func (e LocalDirEntry) Name() string
func (LocalDirEntry) Size ¶
func (e LocalDirEntry) Size() int64
type LocalFileInfo ¶
type LocalFileInfo struct {
// contains filtered or unexported fields
}
LocalFileInfo 表示沙箱内单个本地对象的只读元信息快照;零值恒无效。
func NewLocalFileInfo ¶
func NewLocalFileInfo(spec LocalFileInfoSpec) (LocalFileInfo, error)
NewLocalFileInfo 校验名称分量、非负大小与合法时间戳并构造不可变 LocalFileInfo。
func (LocalFileInfo) Equal ¶
func (i LocalFileInfo) Equal(o LocalFileInfo) bool
func (LocalFileInfo) IsDir ¶
func (i LocalFileInfo) IsDir() bool
func (LocalFileInfo) IsRegular ¶
func (i LocalFileInfo) IsRegular() bool
func (LocalFileInfo) IsSymlink ¶
func (i LocalFileInfo) IsSymlink() bool
func (LocalFileInfo) IsValid ¶
func (i LocalFileInfo) IsValid() bool
func (LocalFileInfo) IsZero ¶
func (i LocalFileInfo) IsZero() bool
func (LocalFileInfo) ModTime ¶
func (i LocalFileInfo) ModTime() time.Time
func (LocalFileInfo) Mode ¶
func (i LocalFileInfo) Mode() fs.FileMode
func (LocalFileInfo) Name ¶
func (i LocalFileInfo) Name() string
func (LocalFileInfo) Perm ¶
func (i LocalFileInfo) Perm() fs.FileMode
func (LocalFileInfo) Size ¶
func (i LocalFileInfo) Size() int64
type LocalFileInfoSpec ¶
LocalFileInfoSpec 是构造不可变 LocalFileInfo 的显式入参规格。
type LocalIdentityInfo ¶
type LocalIdentityInfo struct {
// contains filtered or unexported fields
}
LocalIdentityInfo 表示用于填充 OpenSSH option.TokenContext 的本机非敏感主机/用户元信息快照;零值恒无效。
func NewLocalIdentityInfo ¶
func NewLocalIdentityInfo(spec LocalIdentityInfoSpec) (LocalIdentityInfo, error)
NewLocalIdentityInfo 校验本机主机名、用户名、可选数值 UID 与主目录并构造不可变 LocalIdentityInfo。
func (LocalIdentityInfo) ApplyToTokenContext ¶
func (i LocalIdentityInfo) ApplyToTokenContext(base option.TokenContext) option.TokenContext
ApplyToTokenContext 将本机主机/用户/UID/主目录写入基础 TokenContext 副本并返回(零值时原样返回)。
func (LocalIdentityInfo) Equal ¶
func (i LocalIdentityInfo) Equal(o LocalIdentityInfo) bool
func (LocalIdentityInfo) HomeDir ¶
func (i LocalIdentityInfo) HomeDir() string
func (LocalIdentityInfo) IsValid ¶
func (i LocalIdentityInfo) IsValid() bool
func (LocalIdentityInfo) IsZero ¶
func (i LocalIdentityInfo) IsZero() bool
func (LocalIdentityInfo) LocalHost ¶
func (i LocalIdentityInfo) LocalHost() string
func (LocalIdentityInfo) LocalUID ¶
func (i LocalIdentityInfo) LocalUID() string
func (LocalIdentityInfo) LocalUser ¶
func (i LocalIdentityInfo) LocalUser() string
func (LocalIdentityInfo) MarshalJSONTo ¶
func (i LocalIdentityInfo) MarshalJSONTo(e jEnc) error
func (*LocalIdentityInfo) UnmarshalJSONFrom ¶
func (i *LocalIdentityInfo) UnmarshalJSONFrom(c jDec) error
type LocalIdentityInfoSpec ¶
type LocalIdentityInfoSpec struct {
LocalHost string `json:"local_host"`
LocalUser string `json:"local_user"`
LocalUID string `json:"local_uid,omitzero"`
HomeDir string `json:"home_dir"`
}
LocalIdentityInfoSpec 是构造不可变 LocalIdentityInfo 的显式入参规格。
type LockMode ¶
type LockMode uint8
LockMode 定义句柄级本地文件锁的加锁模式(INV-A5);零值 LockModeInvalid 严格失败关闭。
func ParseLockMode ¶
全部 11 个失败关闭端口枚举的 Parse / IsValid / IsZero / String 与 TextCodec 统一实现。
func (LockMode) MarshalText ¶
func (*LockMode) UnmarshalText ¶
type LockedFile ¶
type LockedFile interface {
io.Reader
io.Writer
io.Seeker
// Truncate 截断持锁文件至指定长度;注意 Truncate(0) 不重置内核偏移,后续写入前须 Seek(0, io.SeekStart)。
Truncate(size int64) error
Sync() error
Stat() (LocalFileInfo, error)
}
LockedFile 是 RootHandle.WithLockedFile / TryWithLockedFile 在同步回调内借出的持锁文件句柄。
type MuxControlAction ¶
type MuxControlAction uint8
MuxControlAction 标识 OpenSSH PROTOCOL.mux v4 控制面动作;零值 MuxActionInvalid 严格失败关闭。
const ( MuxActionInvalid MuxControlAction = iota // 无效控制动作(零值失败关闭) MuxActionCheck // 探测存活并查询 PID MuxActionForward // 开启端口转发 MuxActionCancel // 取消端口转发 MuxActionExit // 优雅退出 MuxActionStop // 立即停止 MuxActionProxy // 代理透传模式 )
func ParseMuxControlAction ¶
func ParseMuxControlAction(s string) (MuxControlAction, error)
func (MuxControlAction) AppendText ¶
func (a MuxControlAction) AppendText(b []byte) ([]byte, error)
func (MuxControlAction) IsValid ¶
func (a MuxControlAction) IsValid() bool
func (MuxControlAction) IsZero ¶
func (a MuxControlAction) IsZero() bool
func (MuxControlAction) MarshalText ¶
func (a MuxControlAction) MarshalText() ([]byte, error)
func (MuxControlAction) String ¶
func (a MuxControlAction) String() string
func (*MuxControlAction) UnmarshalText ¶
func (a *MuxControlAction) UnmarshalText(t []byte) error
type MuxControlRequest ¶
type MuxControlRequest struct {
// contains filtered or unexported fields
}
MuxControlRequest 描述面向 MuxSocketPort.Control 的多路复用控制面请求;零值恒无效。
func NewMuxControlRequest ¶
func NewMuxControlRequest(action MuxControlAction, socketPath pathalg.LocalSourcePath, forward algebraic.Option[ForwardSpec]) (MuxControlRequest, error)
NewMuxControlRequest 校验控制动作、套接字路径与可选转发规格(forward/cancel 必填)并构造请求。
func (MuxControlRequest) Action ¶
func (r MuxControlRequest) Action() MuxControlAction
func (MuxControlRequest) Forward ¶
func (r MuxControlRequest) Forward() algebraic.Option[ForwardSpec]
func (MuxControlRequest) IsValid ¶
func (r MuxControlRequest) IsValid() bool
func (MuxControlRequest) IsZero ¶
func (r MuxControlRequest) IsZero() bool
func (MuxControlRequest) SocketPath ¶
func (r MuxControlRequest) SocketPath() pathalg.LocalSourcePath
type MuxControlResponse ¶
type MuxControlResponse struct {
// contains filtered or unexported fields
}
MuxControlResponse 描述多路复用探测或控制动作的不可变结果;零值恒无效。
func NewMuxControlResponse ¶
func NewMuxControlResponse(alive bool, masterPID uint32, detail string) (MuxControlResponse, error)
NewMuxControlResponse 校验主进程状态与诊断说明并构造不可变 MuxControlResponse。
func (MuxControlResponse) Alive ¶
func (r MuxControlResponse) Alive() bool
func (MuxControlResponse) Detail ¶
func (r MuxControlResponse) Detail() string
func (MuxControlResponse) Equal ¶
func (r MuxControlResponse) Equal(o MuxControlResponse) bool
func (MuxControlResponse) IsValid ¶
func (r MuxControlResponse) IsValid() bool
func (MuxControlResponse) IsZero ¶
func (r MuxControlResponse) IsZero() bool
func (MuxControlResponse) MarshalJSONTo ¶
func (r MuxControlResponse) MarshalJSONTo(e jEnc) error
func (MuxControlResponse) MasterPID ¶
func (r MuxControlResponse) MasterPID() uint32
func (*MuxControlResponse) UnmarshalJSONFrom ¶
func (r *MuxControlResponse) UnmarshalJSONFrom(c jDec) error
type MuxSocketPort ¶
type MuxSocketPort interface {
Probe(ctx context.Context, socketPath pathalg.LocalSourcePath) (MuxControlResponse, error)
Control(ctx context.Context, req MuxControlRequest) (MuxControlResponse, error)
// DialMux 连接至活跃 ControlMaster 并返回绑定精确 (hopDigest, endpoint) 身份的 TransportConn。
DialMux(ctx context.Context, socketPath pathalg.LocalSourcePath, hopDigest plan.HopDigest, endpoint netaddr.Endpoint) (TransportConn, error)
// OpenProxy 以 PROTOCOL.mux v4 `-O proxy`(MuxActionProxy)模式打开与 ControlMaster 的双向 stdio 透传流。
OpenProxy(ctx context.Context, socketPath pathalg.LocalSourcePath) (net.Conn, error)
// Serve 在 ln 上以 PROTOCOL.mux v4 服务端模式响应会话、转发、探活、退出与代理请求(upstream 为非借用池钉选连接,forwarder 可选;具体实现如 P4-T2 sshnet/mux 须在 ln 参数上标注参数级 //xops:borrowed 确保零逃逸)。
Serve(ctx context.Context, ln net.Listener, upstream TransportConn, forwarder ForwarderPort) error
// WithListener 在独占目录锁下绑定 AF_UNIX 套接字(Accept 校验对端凭证),退出时按锁->SameFile->unlink->close->解锁释放。
//xops:syncclosure
//xops:borrowed
WithListener(ctx context.Context, socketPath pathalg.LocalSourcePath, fn func(ln net.Listener) error) error
}
MuxSocketPort 定义本地 ControlMaster/ControlPersist AF_UNIX 套接字探测、控制、服务端与代理出站端口(INV-A3 / INV-C4)。
type OpenSSHConfigSource ¶
type OpenSSHConfigSource interface {
ListVirtualHosts(ctx context.Context) ([]OpenSSHVirtualHost, error)
// ResolveTier4 针对显式原始主机 target 与可选规范化端点 endpoint 折叠返回单一 t4 OptionLayer;
// endpoint 为 None 时支撑非 DNS 或通配符别名的初始展开,为 Some 时必须携带有效 Endpoint。
ResolveTier4(ctx context.Context, target option.OriginalHostSpec, endpoint algebraic.Option[netaddr.Endpoint]) (option.OptionLayer, error)
}
OpenSSHConfigSource 定义只读 ~/.ssh/config(含递归 Include)虚拟节点源与 Tier-4 选项折叠端口(ADR-004)。
type OpenSSHVirtualHost ¶
type OpenSSHVirtualHost struct {
// contains filtered or unexported fields
}
OpenSSHVirtualHost 表示从只读 ~/.ssh/config 提取的不可变虚拟主机视图(ADR-004);零值恒无效。
func NewOpenSSHVirtualHost ¶
func NewOpenSSHVirtualHost(spec OpenSSHVirtualHostSpec) (OpenSSHVirtualHost, error)
NewOpenSSHVirtualHost 校验别名、来源路径、可选端点/用户名、代理路由与选项层并构造值对象。
func (OpenSSHVirtualHost) Alias ¶
func (h OpenSSHVirtualHost) Alias() string
func (OpenSSHVirtualHost) Endpoint ¶
func (h OpenSSHVirtualHost) Endpoint() algebraic.Option[netaddr.Endpoint]
func (OpenSSHVirtualHost) Equal ¶
func (h OpenSSHVirtualHost) Equal(o OpenSSHVirtualHost) bool
func (OpenSSHVirtualHost) IsValid ¶
func (h OpenSSHVirtualHost) IsValid() bool
func (OpenSSHVirtualHost) IsZero ¶
func (h OpenSSHVirtualHost) IsZero() bool
func (OpenSSHVirtualHost) JumpNode ¶
func (h OpenSSHVirtualHost) JumpNode() (inventory.OpenSSHJumpNode, error)
func (OpenSSHVirtualHost) Layer ¶
func (h OpenSSHVirtualHost) Layer() option.OptionLayer
func (OpenSSHVirtualHost) MarshalJSONTo ¶
func (h OpenSSHVirtualHost) MarshalJSONTo(e jEnc) error
func (OpenSSHVirtualHost) Proxy ¶
func (h OpenSSHVirtualHost) Proxy() option.ProxyRoute
func (OpenSSHVirtualHost) SourceFile ¶
func (h OpenSSHVirtualHost) SourceFile() string
func (*OpenSSHVirtualHost) UnmarshalJSONFrom ¶
func (h *OpenSSHVirtualHost) UnmarshalJSONFrom(c jDec) error
type OpenSSHVirtualHostSpec ¶
type OpenSSHVirtualHostSpec struct {
Alias, SourceFile string
Endpoint algebraic.Option[netaddr.Endpoint]
User algebraic.Option[option.Username]
Proxy option.ProxyRoute
Layer option.OptionLayer
}
OpenSSHVirtualHostSpec 是构造不可变 OpenSSHVirtualHost 的显式入参规格。
type OperatorReadFS ¶
type OperatorReadFS interface {
// WithOperatorRead 按 policy 管控软链打开只读源文件并在同步闭包内借出随机只读句柄与大小。
//xops:syncclosure
//xops:borrowed
WithOperatorRead(ctx context.Context, path pathalg.LocalSourcePath, policy pathalg.SymlinkPolicy, fn func(r BoundedReadHandle, size int64) error) error
}
OperatorReadFS 定义面向 CLI/Playbook 的人工显式只读源端口(ADR-007);xopsvet/archbound 物理封禁 mcpruntime 引用。
type PTYRequest ¶
type PTYRequest struct {
// contains filtered or unexported fields
}
PTYRequest 描述远端伪终端分配请求(终端类型与窗口尺寸);零值恒无效。
func NewPTYRequest ¶
func NewPTYRequest(term string, size TerminalSize) (PTYRequest, error)
NewPTYRequest 校验终端类型名称与窗口尺寸并构造不可变 PTYRequest。
func (PTYRequest) Equal ¶
func (p PTYRequest) Equal(o PTYRequest) bool
func (PTYRequest) IsValid ¶
func (p PTYRequest) IsValid() bool
func (PTYRequest) IsZero ¶
func (p PTYRequest) IsZero() bool
func (PTYRequest) MarshalJSONTo ¶
func (p PTYRequest) MarshalJSONTo(e jEnc) error
func (PTYRequest) Size ¶
func (p PTYRequest) Size() TerminalSize
func (PTYRequest) Term ¶
func (p PTYRequest) Term() string
func (*PTYRequest) UnmarshalJSONFrom ¶
func (p *PTYRequest) UnmarshalJSONFrom(c jDec) error
type PrivilegeEscalationPort ¶
type PrivilegeEscalationPort interface {
// RunPrivileged 通过 opener 打开远端会话并按 req 执行提权命令,流向 streams 并返回封闭 ExecutionOutcome。
RunPrivileged(ctx context.Context, opener SessionOpener, req PrivilegeRequest, password *secret.SecretBox, streams ExecStreams) (execution.ExecutionOutcome, error)
}
PrivilegeEscalationPort 定义远端提权执行(sudo/su/doas)出站端口(P3-T2 <-> P4-T1 sshnet/priv)。 仅 sshnet/priv 与 sim 列入明文消费白名单;RunPrivileged 无回调参数,password 由 secretbox Rule 1 与具体实现上的参数级 //xops:borrowed 共同强制零逃逸(严禁跨调用留存 opener 或 password)。
type PrivilegeMethod ¶
type PrivilegeMethod uint8
PrivilegeMethod 标识远端提权执行协议类别(sudo/su/doas);零值 PrivilegeMethodInvalid 失败关闭。
const ( PrivilegeMethodInvalid PrivilegeMethod = iota // 无效提权方式(零值失败关闭) PrivilegeMethodSudo // POSIX sudo 提权 PrivilegeMethodSu // POSIX su 提权 PrivilegeMethodDoas // OpenBSD/Linux doas 提权 )
func ParsePrivilegeMethod ¶
func ParsePrivilegeMethod(s string) (PrivilegeMethod, error)
func (PrivilegeMethod) AppendText ¶
func (m PrivilegeMethod) AppendText(b []byte) ([]byte, error)
func (PrivilegeMethod) IsValid ¶
func (m PrivilegeMethod) IsValid() bool
func (PrivilegeMethod) IsZero ¶
func (m PrivilegeMethod) IsZero() bool
func (PrivilegeMethod) MarshalText ¶
func (m PrivilegeMethod) MarshalText() ([]byte, error)
func (PrivilegeMethod) String ¶
func (m PrivilegeMethod) String() string
func (*PrivilegeMethod) UnmarshalText ¶
func (m *PrivilegeMethod) UnmarshalText(t []byte) error
type PrivilegeRequest ¶
type PrivilegeRequest struct {
// contains filtered or unexported fields
}
PrivilegeRequest 描述不含明文凭据的不可变远端提权请求;零值恒无效。 提权口令须作为独立借用参数 *secret.SecretBox 经 PrivilegeEscalationPort.RunPrivileged 传入。
func NewPrivilegeRequest ¶
func NewPrivilegeRequest(spec PrivilegeRequestSpec) (PrivilegeRequest, error)
NewPrivilegeRequest 校验提权方式、命令计划、可选目标用户与可选正时长超时并构造不可变 PrivilegeRequest。
func (PrivilegeRequest) Command ¶
func (r PrivilegeRequest) Command() execution.CommandPlan
func (PrivilegeRequest) Equal ¶
func (r PrivilegeRequest) Equal(o PrivilegeRequest) bool
func (PrivilegeRequest) IsValid ¶
func (r PrivilegeRequest) IsValid() bool
func (PrivilegeRequest) IsZero ¶
func (r PrivilegeRequest) IsZero() bool
func (PrivilegeRequest) MarshalJSONTo ¶
func (r PrivilegeRequest) MarshalJSONTo(e jEnc) error
func (PrivilegeRequest) Method ¶
func (r PrivilegeRequest) Method() PrivilegeMethod
func (PrivilegeRequest) NonInteractive ¶
func (r PrivilegeRequest) NonInteractive() bool
func (PrivilegeRequest) TargetUser ¶
func (r PrivilegeRequest) TargetUser() algebraic.Option[option.Username]
func (PrivilegeRequest) Timeout ¶
func (r PrivilegeRequest) Timeout() algebraic.Option[algebraic.Duration]
func (*PrivilegeRequest) UnmarshalJSONFrom ¶
func (r *PrivilegeRequest) UnmarshalJSONFrom(c jDec) error
type PrivilegeRequestSpec ¶
type PrivilegeRequestSpec struct {
Method PrivilegeMethod `json:"method"`
Command execution.CommandPlan `json:"command"`
TargetUser algebraic.Option[option.Username] `json:"target_user,omitzero"`
NonInteractive bool `json:"non_interactive,omitzero"`
Timeout algebraic.Option[algebraic.Duration] `json:"timeout,omitzero"`
}
PrivilegeRequestSpec 是构造不可变 PrivilegeRequest 的显式入参规格(严禁携带 SecretBox)。
type ProcessInstanceID ¶
type ProcessInstanceID struct {
// contains filtered or unexported fields
}
ProcessInstanceID 唯一标识单个运行期 Engine 实例,映射 ~/.xops/run/<ProcessInstanceID>.lock(ADR-008)。
func NewProcessInstanceIDFrom ¶
func NewProcessInstanceIDFrom(entropy io.Reader) (ProcessInstanceID, error)
NewProcessInstanceIDFrom 从显式熵源读取 16 字节非全零随机数据并生成 32 位小写十六进制 ProcessInstanceID。
func ParseProcessInstanceID ¶
func ParseProcessInstanceID(raw string) (ProcessInstanceID, error)
ParseProcessInstanceID 校验并构造 ProcessInstanceID(1..64 位安全 ASCII 标识符,满足跨平台单文件名规则)。
func (ProcessInstanceID) AppendText ¶
func (id ProcessInstanceID) AppendText(b []byte) ([]byte, error)
func (ProcessInstanceID) Compare ¶
func (id ProcessInstanceID) Compare(o ProcessInstanceID) int
func (ProcessInstanceID) Equal ¶
func (id ProcessInstanceID) Equal(o ProcessInstanceID) bool
func (ProcessInstanceID) IsValid ¶
func (id ProcessInstanceID) IsValid() bool
func (ProcessInstanceID) IsZero ¶
func (id ProcessInstanceID) IsZero() bool
func (ProcessInstanceID) LockFileName ¶
func (id ProcessInstanceID) LockFileName() (pathalg.LocalRootedDest, error)
func (ProcessInstanceID) MarshalText ¶
func (id ProcessInstanceID) MarshalText() ([]byte, error)
func (ProcessInstanceID) String ¶
func (id ProcessInstanceID) String() string
func (*ProcessInstanceID) UnmarshalText ¶
func (id *ProcessInstanceID) UnmarshalText(t []byte) error
type ProcessPort ¶
type ProcessPort interface {
Run(ctx context.Context, spec ProcessSpec, stdin io.Reader) (ProcessResult, error)
DialStdio(ctx context.Context, spec ProcessSpec) (net.Conn, error)
}
ProcessPort 定义本机外部进程执行与 stdio 管道连接出站端口(仅由 internal/host/sys 或 sim 实现)。
type ProcessResult ¶
type ProcessResult struct {
// contains filtered or unexported fields
}
ProcessResult 描述本机子进程一次性执行的不可变结果;零值恒无效。
func NewProcessResult ¶
func NewProcessResult(spec ProcessResultSpec) (ProcessResult, error)
NewProcessResult 校验 ExitStatus 非空有效并构造不可变 ProcessResult。
func (ProcessResult) Equal ¶
func (r ProcessResult) Equal(o ProcessResult) bool
func (ProcessResult) ExitStatus ¶
func (r ProcessResult) ExitStatus() execution.ExitStatus
func (ProcessResult) IsValid ¶
func (r ProcessResult) IsValid() bool
func (ProcessResult) IsZero ¶
func (r ProcessResult) IsZero() bool
func (ProcessResult) Stderr ¶
func (r ProcessResult) Stderr() []byte
func (ProcessResult) Stdout ¶
func (r ProcessResult) Stdout() []byte
func (ProcessResult) Succeeded ¶
func (r ProcessResult) Succeeded() bool
func (ProcessResult) Truncated ¶
func (r ProcessResult) Truncated() bool
type ProcessResultSpec ¶
type ProcessResultSpec struct {
ExitStatus execution.ExitStatus
Stdout, Stderr []byte
Truncated bool
}
ProcessResultSpec 是构造不可变 ProcessResult 的显式入参规格。
type ProcessSpec ¶
type ProcessSpec struct {
// contains filtered or unexported fields
}
ProcessSpec 描述面向 ProcessPort 的本机受控子进程执行规格;零值恒无效并失败关闭。
func NewProcessSpec ¶
func NewProcessSpec(in ProcessSpecInput) (ProcessSpec, error)
NewProcessSpec 校验命令路径、参数向量、工作目录、环境变量、超时与输出上限并构造 ProcessSpec。
func (ProcessSpec) Args ¶
func (p ProcessSpec) Args() []string
func (ProcessSpec) Command ¶
func (p ProcessSpec) Command() string
func (ProcessSpec) Env ¶
func (p ProcessSpec) Env() map[string]string
func (ProcessSpec) Equal ¶
func (p ProcessSpec) Equal(o ProcessSpec) bool
func (ProcessSpec) IsValid ¶
func (p ProcessSpec) IsValid() bool
func (ProcessSpec) IsZero ¶
func (p ProcessSpec) IsZero() bool
func (ProcessSpec) MarshalJSONTo ¶
func (p ProcessSpec) MarshalJSONTo(e jEnc) error
func (ProcessSpec) MaxOutputBytes ¶
func (p ProcessSpec) MaxOutputBytes() uint64
func (*ProcessSpec) UnmarshalJSONFrom ¶
func (p *ProcessSpec) UnmarshalJSONFrom(c jDec) error
type ProcessSpecInput ¶
type ProcessSpecInput struct {
Command string `json:"command"`
Args []string `json:"args,omitzero"`
WorkDir algebraic.Option[pathalg.LocalDir] `json:"work_dir,omitzero"`
Env map[string]string `json:"env,omitzero"`
Timeout algebraic.Option[algebraic.Duration] `json:"timeout,omitzero"`
MaxOutputBytes algebraic.Option[uint64] `json:"max_output_bytes"`
}
ProcessSpecInput 是构造不可变 ProcessSpec 的显式入参规格(超时统一使用 algebraic.Duration)。
type PublicKeyInfo ¶
type PublicKeyInfo struct {
// contains filtered or unexported fields
}
PublicKeyInfo 表示协议库无关的不可变 SSH 公钥元数据;零值恒无效。
func NewPublicKeyInfo ¶
func NewPublicKeyInfo(spec PublicKeyInfoSpec) (PublicKeyInfo, error)
NewPublicKeyInfo 校验算法名、指纹与非空公钥线缆载荷并构造不可变 PublicKeyInfo。
func (PublicKeyInfo) Algorithm ¶
func (k PublicKeyInfo) Algorithm() string
func (PublicKeyInfo) Comment ¶
func (k PublicKeyInfo) Comment() string
func (PublicKeyInfo) Equal ¶
func (k PublicKeyInfo) Equal(o PublicKeyInfo) bool
func (PublicKeyInfo) Fingerprint ¶
func (k PublicKeyInfo) Fingerprint() inventory.KeyFingerprint
func (PublicKeyInfo) IsValid ¶
func (k PublicKeyInfo) IsValid() bool
func (PublicKeyInfo) IsZero ¶
func (k PublicKeyInfo) IsZero() bool
func (PublicKeyInfo) MarshalJSONTo ¶
func (k PublicKeyInfo) MarshalJSONTo(e jEnc) error
func (*PublicKeyInfo) UnmarshalJSONFrom ¶
func (k *PublicKeyInfo) UnmarshalJSONFrom(c jDec) error
func (PublicKeyInfo) WireBlob ¶
func (k PublicKeyInfo) WireBlob() []byte
type PublicKeyInfoSpec ¶
type PublicKeyInfoSpec struct {
Algorithm string
Fingerprint inventory.KeyFingerprint
WireBlob []byte
Comment string
}
PublicKeyInfoSpec 是构造不可变 PublicKeyInfo 的显式入参规格。
type ReadLimits ¶
type ReadLimits struct {
// contains filtered or unexported fields
}
ReadLimits 定义有界文件读取的字节上限值对象(INV-A5);零值严格失败关闭。
func NewReadLimits ¶
func NewReadLimits(maxBytes int64) (ReadLimits, error)
NewReadLimits 校验上限严格为正整数后构造不可变 ReadLimits。
func (ReadLimits) Equal ¶
func (l ReadLimits) Equal(o ReadLimits) bool
func (ReadLimits) IsValid ¶
func (l ReadLimits) IsValid() bool
func (ReadLimits) IsZero ¶
func (l ReadLimits) IsZero() bool
func (ReadLimits) MarshalJSONTo ¶
func (l ReadLimits) MarshalJSONTo(e jEnc) error
func (ReadLimits) MaxBytes ¶
func (l ReadLimits) MaxBytes() int64
func (*ReadLimits) UnmarshalJSONFrom ¶
func (l *ReadLimits) UnmarshalJSONFrom(c jDec) error
type RemoteDirEntry ¶
type RemoteDirEntry struct {
// contains filtered or unexported fields
}
RemoteDirEntry 表示经 pathalg.RemoteName 校验的远端目录项(INV-B1);零值恒无效。
func NewRemoteDirEntry ¶
func NewRemoteDirEntry(spec RemoteDirEntrySpec) (RemoteDirEntry, error)
NewRemoteDirEntry 校验远端目录项名、文件类型、非负大小与时间戳并构造不可变 RemoteDirEntry。
func (RemoteDirEntry) Equal ¶
func (e RemoteDirEntry) Equal(o RemoteDirEntry) bool
func (RemoteDirEntry) FileType ¶
func (e RemoteDirEntry) FileType() RemoteFileType
func (RemoteDirEntry) IsValid ¶
func (e RemoteDirEntry) IsValid() bool
func (RemoteDirEntry) IsZero ¶
func (e RemoteDirEntry) IsZero() bool
func (RemoteDirEntry) MarshalJSONTo ¶
func (e RemoteDirEntry) MarshalJSONTo(x jEnc) error
func (RemoteDirEntry) ModTime ¶
func (e RemoteDirEntry) ModTime() time.Time
func (RemoteDirEntry) Mode ¶
func (e RemoteDirEntry) Mode() fs.FileMode
func (RemoteDirEntry) Name ¶
func (e RemoteDirEntry) Name() pathalg.RemoteName
func (RemoteDirEntry) Perm ¶
func (e RemoteDirEntry) Perm() fs.FileMode
func (RemoteDirEntry) Size ¶
func (e RemoteDirEntry) Size() int64
func (*RemoteDirEntry) UnmarshalJSONFrom ¶
func (e *RemoteDirEntry) UnmarshalJSONFrom(c jDec) error
type RemoteDirEntrySpec ¶
type RemoteDirEntrySpec struct {
Name pathalg.RemoteName
FileType RemoteFileType
Size int64
Mode fs.FileMode
ModTime time.Time
}
RemoteDirEntrySpec 是构造不可变 RemoteDirEntry 的显式入参规格。
type RemoteFSPort ¶
type RemoteFSPort interface {
RealPath(ctx context.Context, p pathalg.RemotePath) (pathalg.RemotePath, error)
Stat(ctx context.Context, p pathalg.RemotePath) (RemoteFileStat, error)
Lstat(ctx context.Context, p pathalg.RemotePath) (RemoteFileStat, error)
ReadLink(ctx context.Context, p pathalg.RemotePath) (string, error)
ReadDir(ctx context.Context, dir pathalg.RemotePath) ([]RemoteDirEntry, error)
// WithReadFile 在 limits 字节上限内打开远端常规文件并在同步闭包内借出只读流与文件大小。
//xops:syncclosure
//xops:borrowed
WithReadFile(ctx context.Context, p pathalg.RemotePath, limits ReadLimits, fn func(r io.Reader, size int64) error) error
// ReadChunk 从远端常规文件 p 的 offset 处读取至多 length 字节写入 dst;读满返回 (length, nil),遇 EOF 返回 (实际字节数, io.EOF)。
ReadChunk(ctx context.Context, p pathalg.RemotePath, offset int64, dst io.Writer, length int64) (int64, error)
WriteFileAtomic(ctx context.Context, p pathalg.RemotePath, spec RemoteWriteSpec, r io.Reader) (RemoteFileStat, error)
WriteChunk(ctx context.Context, p pathalg.RemotePath, offset int64, r io.Reader, length int64) error
// RenameAtomic 按已校验 RemoteRenameSpec(支持互斥 NoClobber / ExpectedAnchor)执行远端原子重命名。
RenameAtomic(ctx context.Context, oldPath, newPath pathalg.RemotePath, spec RemoteRenameSpec) error
// Chmod 修改远端对象标准权限位(0o001..0o777,拒绝零值及特殊权限位,支撑 scp -p 与 sftpshell)。
Chmod(ctx context.Context, p pathalg.RemotePath, perm fs.FileMode) error
// Chtimes 修改远端对象访问与修改时间(拒绝零值及超出 RFC 3339 年份 [1,9999] 的时间戳,支撑 scp -p 时间戳保留)。
Chtimes(ctx context.Context, p pathalg.RemotePath, atime, mtime time.Time) error
MkdirAll(ctx context.Context, dir pathalg.RemotePath, perm fs.FileMode) error
// Remove 仅删除常规文件或符号链接(SFTP SSH_FXP_REMOVE);若目标为目录须返回 ErrRemoteIsDir。
Remove(ctx context.Context, p pathalg.RemotePath) error
// RemoveDir 仅删除空目录(SFTP SSH_FXP_RMDIR);非目录或非空目录须返回 ErrInvalidArgument,不存在返回 ErrNotFound。
RemoveDir(ctx context.Context, dir pathalg.RemotePath) error
Close() error
}
RemoteFSPort 定义协议库无关的远端 SFTP v3 安全文件访问出站端口(ADR-008 / ADR-016,严禁裸客户端逃生口)。
type RemoteFileAnchor ¶
type RemoteFileAnchor struct {
// contains filtered or unexported fields
}
RemoteFileAnchor 表示 SFTP 写路径纵深防御所需的 SSH_FXP_FSTAT 类型与可选 (dev, ino) 锚点(ADR-016)。
func NewRemoteFileAnchor ¶
func NewRemoteFileAnchor(fileType RemoteFileType, hasDevIno bool, dev, ino uint64) (RemoteFileAnchor, error)
NewRemoteFileAnchor 校验文件类型与可选 (dev, ino) 并构造不可变 RemoteFileAnchor。
func (RemoteFileAnchor) Dev ¶
func (a RemoteFileAnchor) Dev() uint64
func (RemoteFileAnchor) Equal ¶
func (a RemoteFileAnchor) Equal(o RemoteFileAnchor) bool
func (RemoteFileAnchor) FileType ¶
func (a RemoteFileAnchor) FileType() RemoteFileType
func (RemoteFileAnchor) HasDevIno ¶
func (a RemoteFileAnchor) HasDevIno() bool
func (RemoteFileAnchor) Ino ¶
func (a RemoteFileAnchor) Ino() uint64
func (RemoteFileAnchor) IsValid ¶
func (a RemoteFileAnchor) IsValid() bool
func (RemoteFileAnchor) IsZero ¶
func (a RemoteFileAnchor) IsZero() bool
func (RemoteFileAnchor) MarshalJSONTo ¶
func (a RemoteFileAnchor) MarshalJSONTo(e jEnc) error
func (RemoteFileAnchor) Matches ¶
func (a RemoteFileAnchor) Matches(o RemoteFileAnchor) bool
func (*RemoteFileAnchor) UnmarshalJSONFrom ¶
func (a *RemoteFileAnchor) UnmarshalJSONFrom(c jDec) error
type RemoteFileStat ¶
type RemoteFileStat struct {
// contains filtered or unexported fields
}
RemoteFileStat 表示远端文件或目录的已校验元信息快照(强制 Size >= 0);零值恒无效。
func NewRemoteFileStat ¶
func NewRemoteFileStat(spec RemoteFileStatSpec) (RemoteFileStat, error)
NewRemoteFileStat 校验远端路径、非负大小、时间戳与锚点并构造不可变 RemoteFileStat。
func (RemoteFileStat) Anchor ¶
func (s RemoteFileStat) Anchor() RemoteFileAnchor
func (RemoteFileStat) Equal ¶
func (s RemoteFileStat) Equal(o RemoteFileStat) bool
func (RemoteFileStat) FileType ¶
func (s RemoteFileStat) FileType() RemoteFileType
func (RemoteFileStat) IsDir ¶
func (s RemoteFileStat) IsDir() bool
func (RemoteFileStat) IsRegular ¶
func (s RemoteFileStat) IsRegular() bool
func (RemoteFileStat) IsSymlink ¶
func (s RemoteFileStat) IsSymlink() bool
func (RemoteFileStat) IsValid ¶
func (s RemoteFileStat) IsValid() bool
func (RemoteFileStat) IsZero ¶
func (s RemoteFileStat) IsZero() bool
func (RemoteFileStat) MarshalJSONTo ¶
func (s RemoteFileStat) MarshalJSONTo(e jEnc) error
func (RemoteFileStat) ModTime ¶
func (s RemoteFileStat) ModTime() time.Time
func (RemoteFileStat) Mode ¶
func (s RemoteFileStat) Mode() fs.FileMode
func (RemoteFileStat) Path ¶
func (s RemoteFileStat) Path() pathalg.RemotePath
func (RemoteFileStat) Perm ¶
func (s RemoteFileStat) Perm() fs.FileMode
func (RemoteFileStat) Size ¶
func (s RemoteFileStat) Size() int64
func (*RemoteFileStat) UnmarshalJSONFrom ¶
func (s *RemoteFileStat) UnmarshalJSONFrom(c jDec) error
type RemoteFileStatSpec ¶
type RemoteFileStatSpec struct {
Path pathalg.RemotePath
Size int64
Mode fs.FileMode
ModTime time.Time
Anchor RemoteFileAnchor
}
RemoteFileStatSpec 是构造不可变 RemoteFileStat 的显式入参规格。
type RemoteFileType ¶
type RemoteFileType uint8
RemoteFileType 标识远端 SFTP 文件系统对象类型;零值 RemoteFileTypeInvalid 严格失败关闭。
const ( RemoteFileTypeInvalid RemoteFileType = iota // 无效类型(零值失败关闭) RemoteFileRegular // 常规文件 RemoteFileDir // 目录 RemoteFileSymlink // 符号链接 RemoteFileOther // 非常规特殊对象(下载路径一律拒绝) )
func ParseRemoteFileType ¶
func ParseRemoteFileType(s string) (RemoteFileType, error)
func (RemoteFileType) AppendText ¶
func (t RemoteFileType) AppendText(b []byte) ([]byte, error)
func (RemoteFileType) IsValid ¶
func (t RemoteFileType) IsValid() bool
func (RemoteFileType) IsZero ¶
func (t RemoteFileType) IsZero() bool
func (RemoteFileType) MarshalText ¶
func (t RemoteFileType) MarshalText() ([]byte, error)
func (RemoteFileType) String ¶
func (t RemoteFileType) String() string
func (*RemoteFileType) UnmarshalText ¶
func (t *RemoteFileType) UnmarshalText(b []byte) error
type RemoteRenameSpec ¶
type RemoteRenameSpec struct {
// contains filtered or unexported fields
}
RemoteRenameSpec 描述远端原子重命名策略(ADR-016):支持互斥的 NoClobber 或 ExpectedAnchor 校验;零值恒无效。
func NewRemoteRenameSpec ¶
func NewRemoteRenameSpec(in RemoteRenameSpecInput) (RemoteRenameSpec, error)
NewRemoteRenameSpec 校验互斥的 NoClobber 与可选 FSTAT ExpectedAnchor 并构造不可变 RemoteRenameSpec。
func (RemoteRenameSpec) Equal ¶
func (s RemoteRenameSpec) Equal(o RemoteRenameSpec) bool
func (RemoteRenameSpec) ExpectedAnchor ¶
func (s RemoteRenameSpec) ExpectedAnchor() algebraic.Option[RemoteFileAnchor]
func (RemoteRenameSpec) IsValid ¶
func (s RemoteRenameSpec) IsValid() bool
func (RemoteRenameSpec) IsZero ¶
func (s RemoteRenameSpec) IsZero() bool
func (RemoteRenameSpec) MarshalJSONTo ¶
func (s RemoteRenameSpec) MarshalJSONTo(e jEnc) error
func (RemoteRenameSpec) NoClobber ¶
func (s RemoteRenameSpec) NoClobber() bool
func (*RemoteRenameSpec) UnmarshalJSONFrom ¶
func (r *RemoteRenameSpec) UnmarshalJSONFrom(c jDec) error
type RemoteRenameSpecInput ¶
type RemoteRenameSpecInput struct {
ExpectedAnchor algebraic.Option[RemoteFileAnchor]
NoClobber bool
}
RemoteRenameSpecInput 是构造不可变 RemoteRenameSpec 的显式入参规格。
type RemoteSession ¶
type RemoteSession interface {
StdinPipe() (io.WriteCloser, error)
StdoutPipe() (io.Reader, error)
StderrPipe() (io.Reader, error)
Start(ctx context.Context, cmd execution.CommandPlan, streams ExecStreams) error
// StartShell 启动远端交互式 Shell 会话(可选 PTY 与环境变量统一由 streams.PTY / streams.Env 承载)。
StartShell(ctx context.Context, streams ExecStreams) error
ResizePTY(ctx context.Context, size TerminalSize) error
Signal(ctx context.Context, signal string) error
Wait(ctx context.Context) (execution.ExecutionOutcome, error)
Close() error
}
RemoteSession 表示单条 SSH 通道上建立的远端命令或交互式 Shell 会话(隔离 x/crypto/ssh.Session)。 StdinPipe / StdoutPipe / StderrPipe 须在 Start / StartShell 前获取且分别与非空 ExecStreams.{Stdin,Stdout,Stderr} 互斥, 支撑 TerminalHandle.Relay 双向流中继与 sshnet/priv 随机 -p 提权握手(含 PROTOCOL.mux v4)。
type RemoteWriteSpec ¶
type RemoteWriteSpec struct {
// contains filtered or unexported fields
}
RemoteWriteSpec 描述远端安全写路径策略(ADR-016):非零标准权限位、可选 FSTAT 锚点、NoClobber 与原子重命名。
func NewRemoteWriteSpec ¶
func NewRemoteWriteSpec(in RemoteWriteSpecInput) (RemoteWriteSpec, error)
NewRemoteWriteSpec 校验标准权限位(0o001..0o777)与可选 FSTAT 锚点并构造不可变 RemoteWriteSpec。
func (RemoteWriteSpec) AtomicRename ¶
func (s RemoteWriteSpec) AtomicRename() bool
func (RemoteWriteSpec) Equal ¶
func (s RemoteWriteSpec) Equal(o RemoteWriteSpec) bool
func (RemoteWriteSpec) ExpectedAnchor ¶
func (s RemoteWriteSpec) ExpectedAnchor() algebraic.Option[RemoteFileAnchor]
func (RemoteWriteSpec) IsValid ¶
func (s RemoteWriteSpec) IsValid() bool
func (RemoteWriteSpec) IsZero ¶
func (s RemoteWriteSpec) IsZero() bool
func (RemoteWriteSpec) MarshalJSONTo ¶
func (s RemoteWriteSpec) MarshalJSONTo(e jEnc) error
func (RemoteWriteSpec) NoClobber ¶
func (s RemoteWriteSpec) NoClobber() bool
func (RemoteWriteSpec) Perm ¶
func (s RemoteWriteSpec) Perm() fs.FileMode
func (*RemoteWriteSpec) UnmarshalJSONFrom ¶
func (s *RemoteWriteSpec) UnmarshalJSONFrom(c jDec) error
type RemoteWriteSpecInput ¶
type RemoteWriteSpecInput struct {
Perm fs.FileMode `json:"perm"`
ExpectedAnchor algebraic.Option[RemoteFileAnchor] `json:"expected_anchor,omitzero"`
NoClobber bool `json:"no_clobber,omitzero"`
AtomicRename bool `json:"atomic_rename,omitzero"`
}
RemoteWriteSpecInput 是构造不可变 RemoteWriteSpec 的显式入参规格。
type Revision ¶
type Revision struct {
// contains filtered or unexported fields
}
Revision 表示资产存储快照的不透明 CAS 版本令牌;零值恒无效并失败关闭。
func ParseRevision ¶
ParseRevision 校验并构造不可变 CAS 版本令牌(1..128 位可打印非空白 ASCII)。
func (Revision) MarshalText ¶
func (*Revision) UnmarshalText ¶
type RootHandle ¶
type RootHandle interface {
ReadAllBounded(dest pathalg.LocalRootedDest, limits ReadLimits) ([]byte, error)
// WithReadRegular 以有界随机只读句柄在同步闭包内借出常规文件,退出后自动失效关闭。
//xops:syncclosure
//xops:borrowed
WithReadRegular(dest pathalg.LocalRootedDest, limits ReadLimits, fn func(r BoundedReadHandle, size int64) error) error
// CreateExclusive 以 O_CREAT|O_EXCL|O_NOFOLLOW 独占创建常规文件并写入内容。
//xops:syncclosure
//xops:borrowed
CreateExclusive(dest pathalg.LocalRootedDest, perm fs.FileMode, fn func(w io.Writer) error) error
// AtomicReplace 写同目录随机临时文件、刷盘后原子替换目标文件。
//xops:syncclosure
//xops:borrowed
AtomicReplace(dest pathalg.LocalRootedDest, perm fs.FileMode, fn func(w io.Writer) error) error
// WriteChunk 向暂存文件 dest 的 offset 处非截断写入来自 r 的精确 length 字节并刷盘;流提前结束返回 (已写字节数, io.ErrUnexpectedEOF)。
WriteChunk(dest pathalg.LocalRootedDest, offset int64, r io.Reader, length int64, perm fs.FileMode) (int64, error)
// Rename 在沙箱根内原子重命名 oldDest -> newDest(非软链校验 + os.Root.Rename + 父目录同步)。
Rename(oldDest, newDest pathalg.LocalRootedDest) error
// WithLockedFile 在 ctx 取消控制下获取文件锁并校验 SameFile 后借出 LockedFile。
//xops:syncclosure
//xops:borrowed
WithLockedFile(ctx context.Context, dest pathalg.LocalRootedDest, mode LockMode, create bool, perm fs.FileMode, fn func(f LockedFile) error) error
// TryWithLockedFile 非阻塞尝试抢锁:锁忙立即返回 (false, nil),成功则同步执行 fn。
//xops:syncclosure
//xops:borrowed
TryWithLockedFile(dest pathalg.LocalRootedDest, mode LockMode, create bool, perm fs.FileMode, fn func(f LockedFile) error) (acquired bool, err error)
AppendLine(dest pathalg.LocalRootedDest, perm fs.FileMode, line []byte) error
Stat(dest pathalg.LocalRootedDest) (LocalFileInfo, error)
Lstat(dest pathalg.LocalRootedDest) (LocalFileInfo, error)
ReadDir(dir algebraic.Option[pathalg.LocalRootedDest]) ([]LocalDirEntry, error)
MkdirAll(dir pathalg.LocalRootedDest, perm fs.FileMode) error
CreateSymlink(link pathalg.LocalRootedDest, target string) error
// Chtimes 修改沙箱内常规文件或目录的访问与修改时间(拒绝符号链接、零值及超出 RFC 3339 年份 [1,9999] 的时间戳,支撑 scp -p)。
Chtimes(dest pathalg.LocalRootedDest, atime, mtime time.Time) error
Remove(dest pathalg.LocalRootedDest) error
}
RootHandle 是 ScopedRootFS.WithRoot 在同步回调内借出的沙箱目录根句柄(ADR-007 / INV-A1..A5)。 全部路径须为已校验 LocalRootedDest;写锁一律加在同根旁路锁 <name>.lock,绝不对数据文件本身加锁后再 Rename。
type SSHAgentPort ¶
type SSHAgentPort interface {
DialAgent(ctx context.Context, spec algebraic.Option[inventory.AgentSpec]) (net.Conn, error)
ListAgentKeys(ctx context.Context, spec algebraic.Option[inventory.AgentSpec]) ([]PublicKeyInfo, error)
SignWithAgent(ctx context.Context, spec algebraic.Option[inventory.AgentSpec], key inventory.KeyFingerprint, algorithm string, data []byte) (Signature, error)
}
SSHAgentPort 定义本机 SSH Agent 通道连接、公钥列举与签名出站端口(统一封装 Unix $SSH_AUTH_SOCK 与 Windows 命名管道)。
type SSHFPLookupPort ¶
type SSHFPLookupPort interface {
LookupSSHFP(ctx context.Context, host netaddr.CanonicalHost) ([]SSHFPRecord, error)
}
SSHFPLookupPort 定义 DNS SSHFP 记录只读查询出站端口(由 internal/host/sys 实现并注入 sshnet/hostkey)。
type SSHFPRecord ¶
type SSHFPRecord struct {
// contains filtered or unexported fields
}
SSHFPRecord 表示单条经校验的 DNS SSHFP 记录;零值恒无效且 Authenticated==false。
func NewSSHFPRecord ¶
func NewSSHFPRecord(spec SSHFPRecordSpec) (SSHFPRecord, error)
NewSSHFPRecord 校验算法编号、摘要类型(1=SHA-1/20B, 2=SHA-256/32B)与长度并构造不可变记录。
func (SSHFPRecord) Algorithm ¶
func (r SSHFPRecord) Algorithm() uint8
func (SSHFPRecord) Authenticated ¶
func (r SSHFPRecord) Authenticated() bool
func (SSHFPRecord) Digest ¶
func (r SSHFPRecord) Digest() []byte
func (SSHFPRecord) Equal ¶
func (r SSHFPRecord) Equal(o SSHFPRecord) bool
func (SSHFPRecord) FingerprintType ¶
func (r SSHFPRecord) FingerprintType() uint8
func (SSHFPRecord) IsValid ¶
func (r SSHFPRecord) IsValid() bool
func (SSHFPRecord) IsZero ¶
func (r SSHFPRecord) IsZero() bool
func (SSHFPRecord) MarshalJSONTo ¶
func (r SSHFPRecord) MarshalJSONTo(e jEnc) error
func (*SSHFPRecord) UnmarshalJSONFrom ¶
func (r *SSHFPRecord) UnmarshalJSONFrom(c jDec) error
type SSHFPRecordSpec ¶
type SSHFPRecordSpec struct {
Algorithm, FingerprintType uint8
Digest []byte
Authenticated bool // DNSSEC AD 校验标记(零值 false 失败关闭)
}
SSHFPRecordSpec 是构造不可变 SSHFPRecord 的显式入参规格(RFC 4255 / RFC 6594)。
type ScopedRootFS ¶
type ScopedRootFS interface {
// EnsureRoot 跨平台安全确保根目录 dir 存在且末段非软链(Unix 按 perm/0700,Windows 0700 附 Owner-Only DACL)。
EnsureRoot(dir pathalg.LocalDir, perm fs.FileMode) error
// WithRoot 打开绑定至 dir 的沙箱根句柄并在同步闭包内借出;退出前无条件关闭。
//xops:syncclosure
//xops:borrowed
WithRoot(dir pathalg.LocalDir, fn func(root RootHandle) error) error
}
ScopedRootFS 定义基于 Go *os.Root 的沙箱本地文件系统出站端口(ADR-007)。
type SecretPromptRequest ¶
type SecretPromptRequest struct {
// contains filtered or unexported fields
}
SecretPromptRequest 描述面向 InteractionPort.PromptSecret 的脱敏机密输入提示请求;零值恒无效。
func NewSecretPromptRequest ¶
func NewSecretPromptRequest(spec SecretPromptRequestSpec) (SecretPromptRequest, error)
NewSecretPromptRequest 校验并脱敏提示文案,并对可选结构化消息(TitleMessage/BodyMessage) 递归严格拒绝非法控制/Bidi 字符与字节预算超限后构造不可变 SecretPromptRequest。
func (SecretPromptRequest) AllowEmpty ¶
func (r SecretPromptRequest) AllowEmpty() bool
func (SecretPromptRequest) BodyMessage ¶ added in v1.1.0
func (r SecretPromptRequest) BodyMessage() algebraic.Option[domi18n.Message]
func (SecretPromptRequest) Equal ¶
func (r SecretPromptRequest) Equal(o SecretPromptRequest) bool
func (SecretPromptRequest) IsValid ¶
func (r SecretPromptRequest) IsValid() bool
func (SecretPromptRequest) IsZero ¶
func (r SecretPromptRequest) IsZero() bool
func (SecretPromptRequest) MarshalJSONTo ¶
func (r SecretPromptRequest) MarshalJSONTo(e jEnc) error
func (SecretPromptRequest) Prompt ¶
func (r SecretPromptRequest) Prompt() string
func (SecretPromptRequest) Subject ¶
func (r SecretPromptRequest) Subject() string
func (SecretPromptRequest) Title ¶
func (r SecretPromptRequest) Title() string
func (SecretPromptRequest) TitleMessage ¶ added in v1.1.0
func (r SecretPromptRequest) TitleMessage() algebraic.Option[domi18n.Message]
func (*SecretPromptRequest) UnmarshalJSONFrom ¶
func (r *SecretPromptRequest) UnmarshalJSONFrom(c jDec) error
type SecretPromptRequestSpec ¶
type SecretPromptRequestSpec struct {
Title string `json:"title,omitzero"`
Prompt string `json:"prompt"`
Subject string `json:"subject,omitzero"`
AllowEmpty bool `json:"allow_empty,omitzero"`
TitleMessage algebraic.Option[domi18n.Message] `json:"title_message,omitzero"`
BodyMessage algebraic.Option[domi18n.Message] `json:"body_message,omitzero"`
}
SecretPromptRequestSpec 是构造不可变 SecretPromptRequest 的显式入参规格(严禁包含 SecretBox)。
type SecretVault ¶
type SecretVault interface {
// WithSecret 按 ref 读取机密并在同步闭包内借出 *secret.SecretBox;退出前无条件清零。
//xops:syncclosure
//xops:borrowed
WithSecret(ctx context.Context, ref secret.Ref, fn func(box *secret.SecretBox) error) error
PutAndVerify(ctx context.Context, ref secret.Ref, box *secret.SecretBox) error
Delete(ctx context.Context, ref secret.Ref) error
}
SecretVault 定义 100% 作用域闭包化的凭据存储出站端口(ADR-011 / RFC §3.2)。
type SessionOpener ¶
type SessionOpener interface {
OpenSession(ctx context.Context) (RemoteSession, error)
}
SessionOpener 是打开隔离远端会话通道的最小能力窄接口;*pool.Lease 与 TransportConn 均天然满足。
type ShellProbePort ¶
type ShellProbePort interface {
ProbeShell(ctx context.Context, opener SessionOpener) (ShellProbeResult, error)
}
ShellProbePort 定义远端默认启动方言与解释器两阶段探测出站端口(P3-T2 <-> P4-T1 sshnet/probe)。
type ShellProbeResult ¶
type ShellProbeResult struct {
// contains filtered or unexported fields
}
ShellProbeResult 表示远端两阶段 Shell 探测产出的已校验启动方言与解释器快照;零值恒无效。
func NewShellProbeResult ¶
func NewShellProbeResult(spec ShellProbeResultSpec) (ShellProbeResult, error)
NewShellProbeResult 校验方言/解释器兼容性矩阵、探测阶段(1 或 2)与可选元信息并构造不可变结果。
func (ShellProbeResult) Dialect ¶
func (r ShellProbeResult) Dialect() execution.LaunchDialect
func (ShellProbeResult) Equal ¶
func (r ShellProbeResult) Equal(o ShellProbeResult) bool
func (ShellProbeResult) Interpreter ¶
func (r ShellProbeResult) Interpreter() execution.Interpreter
func (ShellProbeResult) IsValid ¶
func (r ShellProbeResult) IsValid() bool
func (ShellProbeResult) IsZero ¶
func (r ShellProbeResult) IsZero() bool
func (ShellProbeResult) LaunchProfile ¶
func (r ShellProbeResult) LaunchProfile() execution.LaunchProfile
func (ShellProbeResult) MarshalJSONTo ¶
func (r ShellProbeResult) MarshalJSONTo(e jEnc) error
func (ShellProbeResult) OSFamily ¶
func (r ShellProbeResult) OSFamily() string
func (ShellProbeResult) ProbeStage ¶
func (r ShellProbeResult) ProbeStage() uint8
func (ShellProbeResult) RawBanner ¶
func (r ShellProbeResult) RawBanner() string
func (*ShellProbeResult) UnmarshalJSONFrom ¶
func (r *ShellProbeResult) UnmarshalJSONFrom(c jDec) error
type ShellProbeResultSpec ¶
type ShellProbeResultSpec struct {
Dialect execution.LaunchDialect `json:"dialect"`
Interpreter execution.Interpreter `json:"interpreter"`
OSFamily string `json:"os_family,omitzero"`
ProbeStage uint8 `json:"probe_stage"`
RawBanner string `json:"raw_banner,omitzero"`
}
ShellProbeResultSpec 是构造不可变 ShellProbeResult 的显式入参规格。
type Signature ¶
type Signature struct {
// contains filtered or unexported fields
}
Signature 表示协议库无关的不可变 SSH 数字签名值对象;零值恒无效。
func NewSignature ¶
NewSignature 校验签名算法格式与非空载荷并构造不可变 Signature。
type TUNDevicePort ¶
type TUNDevicePort interface {
// OpenLocalTUN 按 spec 打开本机 TUN/TAP 设备,返回双向帧流与操作系统实际分配的接口名(如 "tun0"/"utun3")。
OpenLocalTUN(ctx context.Context, spec TUNSpec) (dev io.ReadWriteCloser, ifaceName string, err error)
}
TUNDevicePort 定义本机 TUN/TAP 虚拟网卡打开出站端口(P4-T4 internal/host/sys <-> P4-T2 sshnet/forward),隔离平台系统调用。
type TUNMode ¶
type TUNMode uint8
TUNMode 标识 OpenSSH tun@openssh.com 隧道工作模式(L3 点对点 / L2 以太网);零值 TUNModeInvalid 失败关闭。
func ParseTUNMode ¶
func (TUNMode) MarshalText ¶
func (*TUNMode) UnmarshalText ¶
type TUNSpec ¶
type TUNSpec struct {
// contains filtered or unexported fields
}
TUNSpec 描述 OpenSSH tun@openssh.com 通道规格(模式与本地/远端单元号);零值恒无效。
func NewTUNSpec ¶
NewTUNSpec 校验 TUN 模式与合法单元号(0..4096 或 TUNUnitAny)并构造不可变 TUNSpec。
func (TUNSpec) MarshalJSONTo ¶
func (TUNSpec) RemoteUnit ¶
func (*TUNSpec) UnmarshalJSONFrom ¶
type TerminalHandle ¶
type TerminalHandle interface {
io.Reader
io.Writer
Size() (TerminalSize, error)
ResizeEvents() <-chan TerminalSize
// Relay 在同步作用域内将本机输入/输出与缩放事件并发中继至远端(本机 EOF 半关闭并排空 remoteOut,
// remoteOut EOF 或 ctx 取消时唤醒阻塞端并零泄漏收敛;nil ctx/流返回 ErrNilContext/ErrInvalidArgument,过期返回 ErrHandleExpired)。
//xops:syncclosure
Relay(ctx context.Context, remoteIn io.Writer, remoteOut io.Reader, onResize func(ctx context.Context, size TerminalSize) error) error
}
TerminalHandle 是 TerminalPort.WithRawTerminal 在同步作用域闭包内借出的原始终端句柄。
type TerminalPort ¶
type TerminalPort interface {
IsInteractive() bool
Size() (TerminalSize, error)
// WithRawTerminal 进入原始终端/ConPTY 模式并在同步闭包内借出 TerminalHandle,退出前无条件恢复。
//xops:syncclosure
//xops:borrowed
WithRawTerminal(ctx context.Context, fn func(term TerminalHandle) error) error
// CanSuspendProcessGroup 执行 POSIX 孤儿进程组安全挂起判定(INV-E1:任何错误失败关闭返回 VerdictDeny + error)。
CanSuspendProcessGroup() (security.Verdict, error)
}
TerminalPort 定义本机 PTY / Windows ConPTY 控制台与进程组挂起判定出站端口(仅由 internal/host/sys 或 sim 实现)。
type TerminalSize ¶
type TerminalSize struct {
// contains filtered or unexported fields
}
TerminalSize 表示本机或远端终端窗口尺寸(列数与行数均须 >= 1);零值恒无效。
func NewTerminalSize ¶
func NewTerminalSize(cols, rows uint16) (TerminalSize, error)
NewTerminalSize 校验列数与行数均为正整数并构造不可变 TerminalSize。
func (TerminalSize) Cols ¶
func (s TerminalSize) Cols() uint16
func (TerminalSize) Equal ¶
func (s TerminalSize) Equal(o TerminalSize) bool
func (TerminalSize) IsValid ¶
func (s TerminalSize) IsValid() bool
func (TerminalSize) IsZero ¶
func (s TerminalSize) IsZero() bool
func (TerminalSize) MarshalJSONTo ¶
func (s TerminalSize) MarshalJSONTo(e jEnc) error
func (TerminalSize) Rows ¶
func (s TerminalSize) Rows() uint16
func (*TerminalSize) UnmarshalJSONFrom ¶
func (s *TerminalSize) UnmarshalJSONFrom(c jDec) error
type TextPromptRequest ¶
type TextPromptRequest struct {
// contains filtered or unexported fields
}
TextPromptRequest 描述非敏感文本质询提示请求;零值恒无效。
func NewTextPromptRequest ¶
func NewTextPromptRequest(spec TextPromptRequestSpec) (TextPromptRequest, error)
NewTextPromptRequest 校验并脱敏提示文案,并对可选结构化消息(TitleMessage/BodyMessage) 递归严格拒绝非法控制/Bidi 字符与字节预算超限后构造不可变 TextPromptRequest。
func (TextPromptRequest) AllowEmpty ¶
func (r TextPromptRequest) AllowEmpty() bool
func (TextPromptRequest) BodyMessage ¶ added in v1.1.0
func (r TextPromptRequest) BodyMessage() algebraic.Option[domi18n.Message]
func (TextPromptRequest) Equal ¶
func (r TextPromptRequest) Equal(o TextPromptRequest) bool
func (TextPromptRequest) IsValid ¶
func (r TextPromptRequest) IsValid() bool
func (TextPromptRequest) IsZero ¶
func (r TextPromptRequest) IsZero() bool
func (TextPromptRequest) MarshalJSONTo ¶
func (r TextPromptRequest) MarshalJSONTo(e jEnc) error
func (TextPromptRequest) Prompt ¶
func (r TextPromptRequest) Prompt() string
func (TextPromptRequest) Subject ¶
func (r TextPromptRequest) Subject() string
func (TextPromptRequest) Title ¶
func (r TextPromptRequest) Title() string
func (TextPromptRequest) TitleMessage ¶ added in v1.1.0
func (r TextPromptRequest) TitleMessage() algebraic.Option[domi18n.Message]
func (*TextPromptRequest) UnmarshalJSONFrom ¶
func (r *TextPromptRequest) UnmarshalJSONFrom(c jDec) error
type TextPromptRequestSpec ¶
type TextPromptRequestSpec struct {
Title string `json:"title,omitzero"`
Prompt string `json:"prompt"`
Subject string `json:"subject,omitzero"`
AllowEmpty bool `json:"allow_empty,omitzero"`
TitleMessage algebraic.Option[domi18n.Message] `json:"title_message,omitzero"`
BodyMessage algebraic.Option[domi18n.Message] `json:"body_message,omitzero"`
}
TextPromptRequestSpec 是构造不可变 TextPromptRequest 的显式入参规格。
type TransportConn ¶
type TransportConn interface {
SessionOpener
TunnelTransport
HopDigest() plan.HopDigest
Endpoint() netaddr.Endpoint
OpenRemoteFS(ctx context.Context) (RemoteFSPort, error)
SendKeepalive(ctx context.Context) error
IsAlive() bool
Close() error
}
TransportConn 表示一条已认证的实时 SSH 传输连接,由 core/internal/pool 独占托管(ADR-009)。
type TunnelTransport ¶
type TunnelTransport interface {
DialTCP(ctx context.Context, target netaddr.HostPort) (net.Conn, error)
ListenTCP(ctx context.Context, bindAddr string) (net.Listener, error)
DialStreamLocal(ctx context.Context, remoteSocket pathalg.RemotePath) (net.Conn, error)
ListenStreamLocal(ctx context.Context, remoteSocket pathalg.RemotePath) (net.Listener, error)
OpenTUN(ctx context.Context, spec TUNSpec) (io.ReadWriteCloser, error)
}
TunnelTransport 是面向端口转发、StreamLocal 与 TUN 隧道的最小数据面窄接口;*pool.Lease 与 TransportConn 均满足。
type VaultControlPort ¶
type VaultControlPort interface {
Init(ctx context.Context, pass *secret.SecretBox) error // 使用借用主口令初始化;已初始化返回 ErrAlreadyExists
Unlock(ctx context.Context, pass *secret.SecretBox) error // 解锁凭据库;口令错返回 ErrAuthFailed,未初始化返回 ErrNotFound
Lock(ctx context.Context) error
Status(ctx context.Context) (VaultStatus, error)
}
VaultControlPort 定义凭据库初始化、解锁、锁定与状态查询出站端口(P3-T1 <-> P4-T4)。 Init / Unlock 无回调参数,借用的主口令 *secret.SecretBox 由 secretbox Rule 1 与具体实现参数级 //xops:borrowed 共同保证零逃逸。
type VaultState ¶
type VaultState uint8
VaultState 表示凭据库生命周期状态;零值 VaultStateInvalid 严格失败关闭。
const ( VaultStateInvalid VaultState = iota // 无效状态(零值失败关闭) VaultStateUninitialized // 尚未初始化凭据库 VaultStateLocked // 已初始化但处于锁定状态 VaultStateUnlocked // 已解锁并可供读写 )
func ParseVaultState ¶
func ParseVaultState(s string) (VaultState, error)
func (VaultState) AppendText ¶
func (s VaultState) AppendText(b []byte) ([]byte, error)
func (VaultState) IsValid ¶
func (s VaultState) IsValid() bool
func (VaultState) IsZero ¶
func (s VaultState) IsZero() bool
func (VaultState) MarshalText ¶
func (s VaultState) MarshalText() ([]byte, error)
func (VaultState) String ¶
func (s VaultState) String() string
func (*VaultState) UnmarshalText ¶
func (s *VaultState) UnmarshalText(t []byte) error
type VaultStatus ¶
type VaultStatus struct {
// contains filtered or unexported fields
}
VaultStatus 描述凭据库当前锁定状态、可用存储后端清单与诊断摘要;零值恒无效。
func NewVaultStatus ¶
func NewVaultStatus(spec VaultStatusSpec) (VaultStatus, error)
NewVaultStatus 校验状态与存储后端清单并构造规范排序去重的不可变 VaultStatus。
func (VaultStatus) Detail ¶
func (s VaultStatus) Detail() string
func (VaultStatus) Equal ¶
func (s VaultStatus) Equal(o VaultStatus) bool
func (VaultStatus) IsUnlocked ¶
func (s VaultStatus) IsUnlocked() bool
func (VaultStatus) IsValid ¶
func (s VaultStatus) IsValid() bool
func (VaultStatus) IsZero ¶
func (s VaultStatus) IsZero() bool
func (VaultStatus) KnownStores ¶
func (s VaultStatus) KnownStores() []string
func (VaultStatus) MarshalJSONTo ¶
func (s VaultStatus) MarshalJSONTo(e jEnc) error
func (VaultStatus) State ¶
func (s VaultStatus) State() VaultState
func (*VaultStatus) UnmarshalJSONFrom ¶
func (s *VaultStatus) UnmarshalJSONFrom(c jDec) error
type VaultStatusSpec ¶
type VaultStatusSpec struct {
State VaultState `json:"state"`
KnownStores []string `json:"known_stores,omitzero"`
Detail string `json:"detail,omitzero"`
}
VaultStatusSpec 是构造不可变 VaultStatus 的显式入参规格。