From 7ae9cffccc6e8d9e322ec52f8c6a6becf1052b6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Papp?= Date: Wed, 24 Jul 2024 16:51:33 +0200 Subject: [PATCH] Fix missing method after merge --- client/internal/engine.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/client/internal/engine.go b/client/internal/engine.go index 57a2acb14..0f66f5a4e 100644 --- a/client/internal/engine.go +++ b/client/internal/engine.go @@ -1428,3 +1428,20 @@ func isChecksEqual(checks []*mgmProto.Checks, oChecks []*mgmProto.Checks) bool { return slices.Equal(checks.Files, oChecks.Files) }) } + +func (e *Engine) IsWGIfaceUp() bool { + if e == nil || e.wgInterface == nil { + return false + } + iface, err := net.InterfaceByName(e.wgInterface.Name()) + if err != nil { + log.Debugf("failed to get interface by name %s: %v", e.wgInterface.Name(), err) + return false + } + + if iface.Flags&net.FlagUp != 0 { + return true + } + + return false +}