MCPcopy Create free account
hub / github.com/google/uuid / getHardwareInterface

Function getHardwareInterface

node_net.go:19–33  ·  view source on GitHub ↗

cached list of interfaces getHardwareInterface returns the name and hardware address of interface name. If name is "" then the name and hardware address of one of the system's interfaces is returned. If no interfaces are found (name does not exist or there are no interfaces) then "", nil is returne

(name string)

Source from the content-addressed store, hash-verified

17//
18// Only addresses of at least 6 bytes are returned.
19func getHardwareInterface(name string) (string, []byte) {
20 if interfaces == nil {
21 var err error
22 interfaces, err = net.Interfaces()
23 if err != nil {
24 return "", nil
25 }
26 }
27 for _, ifs := range interfaces {
28 if len(ifs.HardwareAddr) >= 6 && (name == "" || name == ifs.Name) {
29 return ifs.Name, ifs.HardwareAddr
30 }
31 }
32 return "", nil
33}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected