Generate peer name / mac address in Go
This commit is contained in:
1 parent
d143470d77
commit
70a20b4d26
4 files changed
+101
No files matched your search
@@ -36,6 +36,7 @@ func init() {
|
||||
"cni-ipam": cniIPAM,
|
||||
"expose-nat": exposeNAT,
|
||||
"bridge-ip": bridgeIP,
|
||||
"unique-id": uniqueID,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
Reference in new issue
Block a user