-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.go
30 lines (22 loc) · 599 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package main
import (
"fmt"
"os"
"github.com/ggiamarchi/mac6/ipv6"
cli "github.com/jawher/mow.cli"
)
func main() {
app := cli.App("mac6", "Compute IPv6 link-local address from MAC address")
app.Spec = "[ -i=<interface> ] MAC"
outInterface := app.StringOpt("i interface", "", "Out interface to build IPv6 link local string")
macAddress := app.StringArg("MAC", "", "Mac address")
app.Action = func() {
ip, err := ipv6.ComputeLinkLocalAddress(*macAddress, *outInterface)
if err != nil {
fmt.Printf("Error : %s\n", err)
os.Exit(1)
}
fmt.Println(ip)
}
app.Run(os.Args)
}