blob: ed33e892575ecad1e708b8619fbcc3eb7823fefc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
package main
import (
"fmt"
"github.com/vishvananda/netlink"
)
// zero value is unspec=all
type Family int
func (f *Family) UnmarshalFlag(value string) error {
switch value {
case "unspec", "all":
*f = netlink.FAMILY_ALL
case "inet", "ipv4":
*f = netlink.FAMILY_V4
case "inet6", "ipv6":
*f = netlink.FAMILY_V6
default:
return fmt.Errorf("Invalid --family=%v", value)
}
return nil
}
|