uuid

package
v0.0.0-...-3db7fe0 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DMIDecodeBinary = "dmidecode"
)

Variables

This section is empty.

Functions

func FormatUUID

func FormatUUID(buf []byte) (string, error)

func GenerateRandomBytes

func GenerateRandomBytes(size int) ([]byte, error)

GenerateRandomBytes is used to generate random bytes of given size.

func GenerateUUID

func GenerateUUID() (string, error)

GenerateUUID is used to generate a random UUID

func ParseUUID

func ParseUUID(uuid string) ([]byte, error)

Types

type DMI

type DMI struct {
	Data   map[string][]Record
	Binary string
}

func New

func New() *DMI

func (*DMI) ExecDmidecode

func (d *DMI) ExecDmidecode(binary string) (string, error)

ExecDmiDecode will attempt to execute a given binary, capture its output and return it (or an any errors it encounters)

func (*DMI) FindBin

func (d *DMI) FindBin(binary string) (string, error)

FindBin will attempt to find a given binary in common bin paths.

func (*DMI) GenericSearchBy

func (d *DMI) GenericSearchBy(param, value string) ([]Record, error)

GenericSearchBy will search for any param w/ value in the d.Data map.

func (*DMI) ParseDmidecode

func (d *DMI) ParseDmidecode(output string) error

ParseDmiDecode will attempt to parse dmidecode output and place all matching content in d.Data.

func (*DMI) Run

func (d *DMI) Run() error

Run will attempt to find a a valid `dmidecode` bin, attempt to execute it and parse whatever data it gets.

func (*DMI) SearchByName

func (d *DMI) SearchByName(name string) ([]Record, error)

SearchByName will search for a specific DMI record by name in d.Data

func (*DMI) SearchByType

func (d *DMI) SearchByType(id int) ([]Record, error)

SearchByType will search for a specific DMI record by its type in d.Data

type Record

type Record map[string]string

Jump to

Keyboard shortcuts

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