machine

package
v1.7.3 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2026 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Overview

Package machine provides utilities to generate unique machine IDs for licensing and identification purposes. The generated IDs are based on hardware characteristics that are difficult for users to modify.

The package collects hardware information such as:

  • CPU information (processor ID, features)
  • Motherboard serial number and UUID
  • Network interface MAC addresses
  • System UUID from BIOS/UEFI
  • Disk serial numbers

These hardware identifiers are combined and hashed to create a unique machine ID that remains consistent across reboots and software changes, but will change if significant hardware modifications are made to the system.

Example usage:

// Generate machine ID with default settings
id, err := machine.New().WithCPU().WithMotherboard().WithSystemUUID().WithMAC().WithDisk().ID()
if err != nil {
    log.Fatal(err)
}
fmt.Printf("Machine ID: %s\n", id)

// Generate machine ID with custom options
id, err := machine.New().WithSalt("my-app-salt").WithCPU().WithSystemUUID().ID()
if err != nil {
    log.Fatal(err)
}
fmt.Printf("Machine ID: %s\n", id)

// Generate VM-friendly machine ID
id, err := machine.New().VMFriendly().WithSalt("my-app").ID()
if err != nil {
    log.Fatal(err)
}
fmt.Printf("Machine ID: %s\n", id)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New() *generator

New creates a new machine ID generator with default settings

Types

This section is empty.

Jump to

Keyboard shortcuts

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