host

package
v3.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Info

type Info struct {
	// contains filtered or unexported fields
}

func NewInfo

func NewInfo() *Info

NewInfo creates and returns a new Info instance with default settings for container detection and operating system information retrieval.

func (*Info) ContainerInfo

func (i *Info) ContainerInfo(ctx context.Context) (*v1.Resource_ContainerInfo, error)

ContainerInfo returns container-specific information including container ID, hostname, and operating system release details when running in a containerized environment.

func (*Info) HostInfo

func (i *Info) HostInfo(ctx context.Context) (*v1.Resource_HostInfo, error)

HostInfo returns information about the host system including host ID, hostname, and operating system release details.

func (*Info) IsContainer

func (i *Info) IsContainer() (bool, error)

IsContainer determines if the current environment is running inside a container. It checks for container-specific files and container references in cgroup. Returns true if running in a container, false otherwise.

func (*Info) ResourceID

func (i *Info) ResourceID(ctx context.Context) (string, error)

ResourceID returns a unique identifier for the resource. If running in a container, it returns the container ID. Otherwise, it returns the host ID.

type InfoInterface

type InfoInterface interface {
	IsContainer() (bool, error)
	ResourceID(ctx context.Context) (string, error)
	ContainerInfo(ctx context.Context) (*v1.Resource_ContainerInfo, error)
	HostInfo(ctx context.Context) (*v1.Resource_HostInfo, error)
}

InfoInterface is an interface that defines methods to get information about the host or container.

Directories

Path Synopsis
execfakes
Code generated by counterfeiter.
Code generated by counterfeiter.
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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