diff --git a/common/control/bind_finder.go b/common/control/bind_finder.go index 47e6a8e..4d40b0d 100644 --- a/common/control/bind_finder.go +++ b/common/control/bind_finder.go @@ -5,6 +5,7 @@ import ( ) type InterfaceFinder interface { + Interfaces() []Interface InterfaceIndexByName(name string) (int, error) InterfaceNameByIndex(index int) (string, error) InterfaceByAddr(addr netip.Addr) (*Interface, error) diff --git a/common/control/bind_finder_default.go b/common/control/bind_finder_default.go index d8c2eed..76dacbd 100644 --- a/common/control/bind_finder_default.go +++ b/common/control/bind_finder_default.go @@ -9,6 +9,8 @@ import ( M "github.com/sagernet/sing/common/metadata" ) +var _ InterfaceFinder = (*DefaultInterfaceFinder)(nil) + type DefaultInterfaceFinder struct { interfaces []Interface } @@ -43,6 +45,10 @@ func (f *DefaultInterfaceFinder) UpdateInterfaces(interfaces []Interface) { f.interfaces = interfaces } +func (f *DefaultInterfaceFinder) Interfaces() []Interface { + return f.interfaces +} + func (f *DefaultInterfaceFinder) InterfaceIndexByName(name string) (int, error) { for _, netInterface := range f.interfaces { if netInterface.Name == name {