feat: agent metadata with custom collectors

This commit is contained in:
2023-03-02 13:05:24 +01:00
parent 3310c09320
commit 1ff29ae1fb
40 changed files with 998 additions and 256 deletions

29
internal/machineid/get.go Normal file
View File

@ -0,0 +1,29 @@
package machineid
import (
"github.com/btcsuite/btcd/btcutil/base58"
"github.com/denisbrodbeck/machineid"
"github.com/pkg/errors"
)
const salt = "emissary.cadoles.com"
func Get() (string, error) {
machineID, err := getProtectedMachineID()
if err != nil {
return "", errors.WithStack(err)
}
return machineID, nil
}
func getProtectedMachineID() (string, error) {
id, err := machineid.ProtectedID(salt)
if err != nil {
return "", errors.WithStack(err)
}
encoded := base58.Encode([]byte(id))
return encoded, nil
}