1// Copyright 2016 Google Inc. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
13 ifname string // name of interface being used
14 nodeID [6]byte // hardware for version 1 UUIDs
15 zeroID [6]byte // nodeID with only 0's
18// NodeInterface returns the name of the interface from which the NodeID was
19// derived. The interface "user" is returned if the NodeID was set by
21func NodeInterface() string {
27// SetNodeInterface selects the hardware address to be used for Version 1 UUIDs.
28// If name is "" then the first usable interface found will be used or a random
29// Node ID will be generated. If a named interface cannot be found then false
32// SetNodeInterface never fails when name is "".
33func SetNodeInterface(name string) bool {
36 return setNodeInterface(name)
39func setNodeInterface(name string) bool {
40 iname, addr := getHardwareInterface(name) // null implementation for js
41 if iname != "" && addr != nil {
47 // We found no interfaces with a valid hardware address. If name
48 // does not specify a specific interface generate a random Node ID
58// NodeID returns a slice of a copy of the current Node ID, setting the Node ID
70// SetNodeID sets the Node ID to be used for Version 1 UUIDs. The first 6 bytes
71// of id are used. If id is less than 6 bytes then false is returned and the
73func SetNodeID(id []byte) bool {
84// NodeID returns the 6 byte node id encoded in uuid. It returns nil if uuid is
85// not valid. The NodeID is only well defined for version 1 and 2 UUIDs.
86func (uuid UUID) NodeID() []byte {
88 copy(node[:], uuid[10:])
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list