diff options
| author | Rutger Broekhoff | 2023-12-29 21:31:53 +0100 |
|---|---|---|
| committer | Rutger Broekhoff | 2023-12-29 21:31:53 +0100 |
| commit | 404aeae4545d2426c089a5f8d5e82dae56f5212b (patch) | |
| tree | 2d84e00af272b39fc04f3795ae06bc48970e57b5 /vendor/github.com/google/uuid/node_net.go | |
| parent | 209d8b0187ed025dec9ac149ebcced3462877bff (diff) | |
| download | gitolfs3-404aeae4545d2426c089a5f8d5e82dae56f5212b.tar.gz gitolfs3-404aeae4545d2426c089a5f8d5e82dae56f5212b.zip | |
Make Nix builds work
Diffstat (limited to 'vendor/github.com/google/uuid/node_net.go')
| -rw-r--r-- | vendor/github.com/google/uuid/node_net.go | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/vendor/github.com/google/uuid/node_net.go b/vendor/github.com/google/uuid/node_net.go new file mode 100644 index 0000000..0cbbcdd --- /dev/null +++ b/vendor/github.com/google/uuid/node_net.go | |||
| @@ -0,0 +1,33 @@ | |||
| 1 | // Copyright 2017 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. | ||
| 4 | |||
| 5 | // +build !js | ||
| 6 | |||
| 7 | package uuid | ||
| 8 | |||
| 9 | import "net" | ||
| 10 | |||
| 11 | var interfaces []net.Interface // cached list of interfaces | ||
| 12 | |||
| 13 | // getHardwareInterface returns the name and hardware address of interface name. | ||
| 14 | // If name is "" then the name and hardware address of one of the system's | ||
| 15 | // interfaces is returned. If no interfaces are found (name does not exist or | ||
| 16 | // there are no interfaces) then "", nil is returned. | ||
| 17 | // | ||
| 18 | // Only addresses of at least 6 bytes are returned. | ||
| 19 | func 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 | } | ||