mqtt/vendor/github.com/rs/xid/hostid_linux.go

14 lines
264 B
Go
Raw Normal View History

2022-08-15 23:06:20 +03:00
// +build linux
package xid
import "io/ioutil"
func readPlatformMachineID() (string, error) {
b, err := ioutil.ReadFile("/etc/machine-id")
if err != nil || len(b) == 0 {
b, err = ioutil.ReadFile("/sys/class/dmi/id/product_uuid")
}
return string(b), err
}