From dd8cd39ef5288cc4d384e941707457b12a5b58d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Sat, 1 Jun 2024 20:39:54 +0800 Subject: [PATCH] Add control.Interface.HardwareAddr --- common/control/bind_finder.go | 10 ++++++---- common/control/bind_finder_default.go | 9 +++++---- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/common/control/bind_finder.go b/common/control/bind_finder.go index 4d40b0d..2383217 100644 --- a/common/control/bind_finder.go +++ b/common/control/bind_finder.go @@ -1,6 +1,7 @@ package control import ( + "net" "net/netip" ) @@ -12,8 +13,9 @@ type InterfaceFinder interface { } type Interface struct { - Index int - MTU int - Name string - Addresses []netip.Prefix + Index int + MTU int + Name string + Addresses []netip.Prefix + HardwareAddr net.HardwareAddr } diff --git a/common/control/bind_finder_default.go b/common/control/bind_finder_default.go index 76dacbd..9d9230e 100644 --- a/common/control/bind_finder_default.go +++ b/common/control/bind_finder_default.go @@ -31,10 +31,11 @@ func (f *DefaultInterfaceFinder) Update() error { return err } interfaces = append(interfaces, Interface{ - Index: netIf.Index, - MTU: netIf.MTU, - Name: netIf.Name, - Addresses: common.Map(ifAddrs, M.PrefixFromNet), + Index: netIf.Index, + MTU: netIf.MTU, + Name: netIf.Name, + Addresses: common.Map(ifAddrs, M.PrefixFromNet), + HardwareAddr: netIf.HardwareAddr, }) } f.interfaces = interfaces