chore(netlink): separate linux only and OS independent code

- Move `Addr` and its `String` method to `types.go`
- Move `IsWireguardSupported` to `wireguard.go` to have `family.go` OS independant
- Remove dependency on vishvananda/netlink in `ipv6.go`
- Move `Link` to `types.go`
- Move `Route` to `types.go`
- Move `Rule` and its `String` method to `types.go`
This commit is contained in:
Quentin McGaw
2023-05-29 06:55:54 +00:00
parent c26476a2fd
commit d6924597dd
9 changed files with 79 additions and 77 deletions

View File

@@ -2,8 +2,6 @@ package netlink
import (
"fmt"
"github.com/vishvananda/netlink"
)
const (
@@ -24,16 +22,3 @@ func FamilyToString(family int) string {
return fmt.Sprint(family)
}
}
func (n *NetLink) IsWireguardSupported() (ok bool, err error) {
families, err := netlink.GenlFamilyList()
if err != nil {
return false, fmt.Errorf("listing gen 1 families: %w", err)
}
for _, family := range families {
if family.Name == "wireguard" {
return true, nil
}
}
return false, nil
}