Documentation
¶
Overview ¶
Package timeout provides a context-based timeout wrapper with Enter-to-skip and Escape/Ctrl+C support via /dev/tty for hardware provider derivation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Result ¶
type Result struct {
Secret []byte
Err error
SkipReason SkipReason
}
Result holds the outcome of a timeout-wrapped provider call.
func Run ¶
Run calls fn with a context that cancels after the given timeout or when the user presses Enter/Escape on /dev/tty. Ctrl+C sends SIGINT to quit. Returns the result and the skip reason.
When the context is canceled (timeout, skip, or interrupt), Run returns immediately without waiting for fn to complete. The goroutine running fn will eventually finish when the underlying call returns.
type SkipReason ¶
type SkipReason int
SkipReason indicates why a provider was skipped.
const ( NotSkipped SkipReason = iota SkippedTimeout // deadline exceeded SkippedUser // user pressed Enter/Escape to skip )