hostos

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 2, 2026 License: Apache-2.0 Imports: 5 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package hostos detects the operating system of an SSH-reachable host.

Index

Constants

View Source
const Script = `` /* 1051-byte string literal not displayed */

Script prints one KORTA_HOST line plus KORTA_INFO and KORTA_ADDR detail lines. It needs only POSIX sh, /etc/os-release and, for addresses, iproute2.

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address struct {
	Interface string `json:"interface"`
	CIDR      string `json:"cidr"`
	Family    string `json:"family"` // ipv4 or ipv6
}

Address is a global-scope IP address on a network interface.

type Profile

type Profile struct {
	Distro   string `json:"distro"`   // ubuntu, debian, rhel, rocky, almalinux, centos
	Version  string `json:"version"`  // VERSION_ID, e.g. 24.04 or 9.4
	Codename string `json:"codename"` // apt hosts only, e.g. noble
	Family   string `json:"family"`   // apt or rpm
	Arch     string `json:"arch"`     // amd64 or arm64
	Hostname string `json:"hostname"`
	CPUs     int    `json:"cpus"`
	MemoryMB int    `json:"memoryMB"`
	// Details shown to operators; deployment types do not depend on them.
	PrettyName string    `json:"prettyName,omitempty"`
	Kernel     string    `json:"kernel,omitempty"`
	CPUModel   string    `json:"cpuModel,omitempty"`
	DiskMB     int       `json:"diskMB,omitempty"` // root filesystem size
	DiskUsedMB int       `json:"diskUsedMB,omitempty"`
	Addresses  []Address `json:"addresses,omitempty"`
}

Profile is what deployment types need to know about a host.

func Parse

func Parse(out []byte) (Profile, error)

Parse reads Script output and rejects unsupported or unexpected hosts.

func (Profile) Major

func (p Profile) Major() int

Major returns the major version, e.g. 9 for "9.4" and 24 for "24.04".

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL