chore(netlink): define own types with minimal fields

- Allow to swap `github.com/vishvananda/netlink`
- Allow to add build tags for each platform
- One step closer to development on non-Linux platforms
This commit is contained in:
Quentin McGaw
2023-05-29 06:44:58 +00:00
parent 163ac48ce4
commit 38ddcfa756
34 changed files with 828 additions and 493 deletions

View File

@@ -6,20 +6,19 @@ import (
"github.com/vishvananda/netlink"
)
//nolint:revive
const (
FAMILY_ALL = netlink.FAMILY_ALL
FAMILY_V4 = netlink.FAMILY_V4
FAMILY_V6 = netlink.FAMILY_V6
FamilyAll = 0
FamilyV4 = 2
FamilyV6 = 10
)
func FamilyToString(family int) string {
switch family {
case FAMILY_ALL:
return "all"
case FAMILY_V4:
case FamilyAll:
return "all" //nolint:goconst
case FamilyV4:
return "v4"
case FAMILY_V6:
case FamilyV6:
return "v6"
default:
return fmt.Sprint(family)