Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrFailedToIdentify = errors.New("Failed to establish a unique ID of the device/machine.")
Functions ¶
This section is empty.
Types ¶
type CachingIdentifier ¶
type CachingIdentifier struct { Identifier Identifier Dir string File string }
CachingIdentifier stores an id in a file, trying to load first prior to dispatching to a subsequent MachineIdentifier
func (CachingIdentifier) Identify ¶
func (self CachingIdentifier) Identify() ([]byte, error)
Identify tries to load the id from the configured file. If no id is stored, yet, it dispatches to a subsequent identifier, storing its result.
type ChainingIdentifier ¶
type ChainingIdentifier struct { Current Identifier Next Identifier }
ChainingIdentifier satisfies Identify requests relying on a current and a next Identifier. If the call to Current fails, the request is handed over to Next.
func (ChainingIdentifier) Identify ¶
func (self ChainingIdentifier) Identify() ([]byte, error)
Identify establishes an identity by first invoking Current. If Current.Identify fails, it hands over to Next.
type FileIdentifier ¶
type FileIdentifier struct {
Path string // Path to the file containing the ID.
}
FileIdentifier reads an ID from a file.
func (FileIdentifier) Identify ¶
func (self FileIdentifier) Identify() ([]byte, error)
Identify tries to read the machine/device ID from the file under Path.
type Identifier ¶
type Identifier interface { // Identify returns a byte-slice containing the globally-unique // ID of the machine. Identify() ([]byte, error) }
Identifier abstracts ID generation for a device/machine.
func DefaultIdentifier ¶
func DefaultIdentifier() (Identifier, error)
DefaultIdentifier sets up the default machine identifier that is used for tagging uploads.
type MACAddressIdentifier ¶
type MACAddressIdentifier struct {
// contains filtered or unexported fields
}
func NewMACAddressIdentifier ¶
func NewMACAddressIdentifier() MACAddressIdentifier
func (MACAddressIdentifier) Identify ¶
func (self MACAddressIdentifier) Identify() ([]byte, error)
type MockIdentifier ¶
func (*MockIdentifier) Identify ¶
func (self *MockIdentifier) Identify() ([]byte, error)
type SHA512Identifier ¶
type SHA512Identifier struct {
Identifier Identifier
}
SHA512Identifier computes the SHA512 hash of the result of a MachineIdentifier.Identify call.
func (SHA512Identifier) Identify ¶
func (self SHA512Identifier) Identify() ([]byte, error)
Identify calls into the contained Identifier instance and hashes the result if the call to the inner MachineIdentifier succeeds.