(name string)
| 37 | } |
| 38 | |
| 39 | func setNodeInterface(name string) bool { |
| 40 | iname, addr := getHardwareInterface(name) // null implementation for js |
| 41 | if iname != "" && addr != nil { |
| 42 | ifname = iname |
| 43 | copy(nodeID[:], addr) |
| 44 | return true |
| 45 | } |
| 46 | |
| 47 | // We found no interfaces with a valid hardware address. If name |
| 48 | // does not specify a specific interface generate a random Node ID |
| 49 | // (section 4.1.6) |
| 50 | if name == "" { |
| 51 | ifname = "random" |
| 52 | randomBits(nodeID[:]) |
| 53 | return true |
| 54 | } |
| 55 | return false |
| 56 | } |
| 57 | |
| 58 | // NodeID returns a slice of a copy of the current Node ID, setting the Node ID |
| 59 | // if not already set. |
no test coverage detected