[client] Use static requested GUID when creating Windows interface (#2479)

RequestedGUID is the GUID of the created network adapter, which then influences NLA generation deterministically.

With this change, NetBird should not generate multiple interfaces in every restart on Windows.
This commit is contained in:
Maycon Santos
2024-08-27 19:21:14 +02:00
committed by GitHub
parent 63a75d72fc
commit 7efaf7eadb
4 changed files with 30 additions and 1 deletions

View File

@ -13,6 +13,7 @@ import (
"testing"
"time"
"github.com/google/uuid"
"github.com/pion/transport/v3/stdnet"
log "github.com/sirupsen/logrus"
"github.com/stretchr/testify/assert"
@ -845,6 +846,8 @@ func TestEngine_MultiplePeers(t *testing.T) {
engine.dnsServer = &dns.MockServer{}
mu.Lock()
defer mu.Unlock()
guid := fmt.Sprintf("{%s}", uuid.New().String())
iface.CustomWindowsGUIDString = strings.ToLower(guid)
err = engine.Start()
if err != nil {
t.Errorf("unable to start engine for peer %d with error %v", j, err)