Documentation
¶
Index ¶
- Constants
- func CachePath(elem ...string) (string, error)
- func EnsureLogReadable(path, what, name string) error
- func HasEntitlement(key string) bool
- func OwnCodeRequirement() (string, error)
- func ProcessAlive(pid int) bool
- func StreamLogFile(path string, out io.Writer, opts TailOptions) error
- type Logger
- type TailOptions
Constants ¶
const ( LvlTrace = iota LvlInfo LvlWarn LvlError )
Log level constants — numeric for comparison, string labels for output.
const EntitlementHostNetworking = "com.apple.vm.networking"
EntitlementHostNetworking is the entitlement Apple requires for using VZBridgedNetworkDeviceAttachment (i.e. host/bridged network mode).
Variables ¶
This section is empty.
Functions ¶
func CachePath ¶
CachePath returns a path under the monolith cache root, ~/.cache/monolith. It does not create anything.
func EnsureLogReadable ¶
EnsureLogReadable returns a friendly error if the log file is missing.
func HasEntitlement ¶
HasEntitlement reports whether the currently running binary has been codesigned with the given entitlement key set to true.
The result is cached for the lifetime of the process. On any error reading the signature (binary not signed, codesign missing, etc.) it returns false. This is intended for best-effort pre-flight checks; the authoritative enforcement happens inside Virtualization.framework at VM startup.
func OwnCodeRequirement ¶
OwnCodeRequirement returns a code signing requirement that matches only the currently running binary (`cdhash H"<hash>"`). Network daemons and VM daemons run the same binary, so each side uses this to authenticate the other when sharing a vmnet network over XPC. Rebuilding or re-signing the binary changes the hash, so daemons from an older build won't match.
func ProcessAlive ¶
ProcessAlive checks if a process with the given PID is still running. On Unix, sending signal 0 to a process checks for existence without actually sending a signal.
func StreamLogFile ¶
func StreamLogFile(path string, out io.Writer, opts TailOptions) error
StreamLogFile prints the contents of the log file at path to out, with optional tail/follow semantics analogous to `tail -F`. When Follow is true, it keeps reading the file as the daemon appends to it. The function exits when out returns an error (e.g. the user closes stdout) or, if Follow is false, after the existing content has been written.
Types ¶
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger writes structured log lines with timestamps and levels. It supports multiple output sinks, each with an independent minimum level. It is safe for concurrent use.
func (*Logger) AddSink ¶
AddSink adds an additional output writer that receives messages at or above minLevel.
type TailOptions ¶
type TailOptions struct {
// Lines is the number of trailing lines to print before streaming.
// Zero means "print everything from the start of the file".
// A negative value means "skip the existing backlog entirely".
Lines int
// Follow keeps reading new content appended to the file until ctx
// is cancelled or the writer to out returns an error.
Follow bool
}
TailOptions controls how StreamLogFile reads a log file.
Directories
¶
| Path | Synopsis |
|---|---|
|
docker
Package docker implements `monolith docker`: container host VMs for the docker CLI (docker engine) or nerdctl (containerd engine), in the style of Colima.
|
Package docker implements `monolith docker`: container host VMs for the docker CLI (docker engine) or nerdctl (containerd engine), in the style of Colima. |
|
cmd
|
|
|
monolith
command
|
|