Generate peer name / mac address in Go

This commit is contained in:
Bryan Boreham committed 2017-01-11 13:12:30 +00:00
1 parent d143470d77
commit 70a20b4d26
4 files changed
+101

No files matched your search

+1
View File
@@ -36,6 +36,7 @@ func init() {
"cni-ipam": cniIPAM,
"expose-nat": exposeNAT,
"bridge-ip": bridgeIP,
"unique-id": uniqueID,
}
}
+20
View File
@@ -0,0 +1,20 @@
package main
import (
"fmt"
weavenet "github.com/weaveworks/weave/net"
)
func uniqueID(args []string) error {
if len(args) != 1 {
cmdUsage("unique-id", "<host-root>")
}
hostRoot := args[0]
uid, err := weavenet.GetSystemPeerName(hostRoot)
if err != nil {
return err
}
fmt.Printf(uid)
return nil
}