Documentation
¶
Overview ¶
Package platform isolates the OS-specific behaviour sshmgr needs, so the rest of the tree can stay free of runtime.GOOS branches: terminal handling for reading secrets without echoing them (here), and the OS predicates every other package asks its questions through (os.go).
The one deliberate exception is util/desktop, which dispatches to a different notification backend per OS. That is a self-contained implementation choice rather than a predicate leaking across the tree, so it keeps its own switch.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotATerminal = errors.New("standard input is not a terminal")
ErrNotATerminal is returned by ReadSecret when standard input is not a terminal, so callers can fall back to reading a piped line instead.
Functions ¶
func EmitUseKeychain ¶
func EmitUseKeychain() bool
EmitUseKeychain reports whether the rendered ssh config should carry UseKeychain.
It is an Apple extension: ssh on macOS reads a key's passphrase from the login keychain instead of prompting. OpenSSH elsewhere does not know the keyword, and an unknown keyword is a hard parse error for the whole file - which is why the renderer also pins `IgnoreUnknown UseKeychain`, and why this has to be decided per machine rather than baked into the manifest.
func FirstClass ¶
func FirstClass() bool
FirstClass reports whether this OS is one sshmgr is tested on. Elsewhere it still builds and mostly works, but the platform layer falls back to generic behaviour and preflight says so.
func ReadLine ¶
ReadLine consumes a single line, one byte at a time. A buffered reader would swallow whatever follows the newline, which matters here because callers read a second line to confirm a passphrase.
func ReadSecret ¶
ReadSecret prompts on stderr and reads one line with terminal echo disabled. The previous terminal state is restored before returning, including when the user interrupts the prompt, so a cancelled read cannot leave the terminal unable to echo.
func StdinIsTerminal ¶
func StdinIsTerminal() bool
StdinIsTerminal reports whether standard input is a terminal.
Types ¶
This section is empty.