Files
gluetun/internal/wireguard/ipv6.go
Quentin McGaw 7fd45cf17f feat(wireguard): add debug logs for IPv6 detection
- To debug issue #998
- Enable with `LOG_LEVEL=debug`
2022-05-27 17:27:53 +00:00

35 lines
760 B
Go

package wireguard
import (
"fmt"
"github.com/qdm12/gluetun/internal/netlink"
)
func (w *Wireguard) isIPv6Supported() (supported bool, err error) {
links, err := w.netlink.LinkList()
if err != nil {
return false, fmt.Errorf("cannot list links: %w", err)
}
w.logger.Debug("Checking for IPv6 support...")
for _, link := range links {
linkName := link.Attrs().Name
routes, err := w.netlink.RouteList(link, netlink.FAMILY_V6)
if err != nil {
return false, fmt.Errorf("cannot list routes for link %s: %w", linkName, err)
}
if len(routes) == 0 {
w.logger.Debugf("Link %s has no IPv6 route", linkName)
continue
}
w.logger.Debugf("Link %s has IPv6 routes: %#v",
linkName, routes)
supported = true
}
return supported, nil
}