cmd/xdpderper: add autodetection for default interface name
This makes deployment easier in hetrogenous environments. Updates ENG-4274 Signed-off-by: James Tucker <james@tailscale.com>
This commit is contained in:

committed by
James Tucker

parent
781f79408d
commit
b565a9faa7
25
net/netutil/default_interface_portable_test.go
Normal file
25
net/netutil/default_interface_portable_test.go
Normal file
@ -0,0 +1,25 @@
|
||||
// Copyright (c) Tailscale Inc & AUTHORS
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
package netutil
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestDefaultInterfacePortable(t *testing.T) {
|
||||
ifName, addr, err := DefaultInterfacePortable()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
t.Logf("Default interface: %s", ifName)
|
||||
t.Logf("Default address: %s", addr)
|
||||
|
||||
if ifName == "" {
|
||||
t.Fatal("Default interface name is empty")
|
||||
}
|
||||
if !addr.IsValid() {
|
||||
t.Fatal("Default address is invalid")
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user