Add Linux WI-FI state support

Support monitoring WIFI state on Linux through:
- NetworkManager (D-Bus)
- IWD (D-Bus)
- wpa_supplicant (control socket)
- ConnMan (D-Bus)
This commit is contained in:
世界
2025-12-07 11:05:43 +08:00
parent eca6a5da18
commit 5ce866cc8a
19 changed files with 913 additions and 31 deletions

View File

@@ -107,6 +107,10 @@ func (s *platformInterfaceStub) IncludeAllNetworks() bool {
func (s *platformInterfaceStub) ClearDNSCache() {
}
func (s *platformInterfaceStub) UsePlatformWIFIMonitor() bool {
return false
}
func (s *platformInterfaceStub) ReadWIFIState() adapter.WIFIState {
return adapter.WIFIState{}
}

View File

@@ -18,6 +18,7 @@ type Interface interface {
UnderNetworkExtension() bool
IncludeAllNetworks() bool
ClearDNSCache()
UsePlatformWIFIMonitor() bool
ReadWIFIState() adapter.WIFIState
SystemCertificates() []string
process.Searcher

View File

@@ -111,7 +111,7 @@ func (s *BoxService) Close() error {
}
func (s *BoxService) NeedWIFIState() bool {
return s.instance.Router().NeedWIFIState()
return s.instance.Network().NeedWIFIState()
}
var (
@@ -224,6 +224,10 @@ func (w *platformInterfaceWrapper) ClearDNSCache() {
w.iif.ClearDNSCache()
}
func (w *platformInterfaceWrapper) UsePlatformWIFIMonitor() bool {
return true
}
func (w *platformInterfaceWrapper) ReadWIFIState() adapter.WIFIState {
wifiState := w.iif.ReadWIFIState()
if wifiState == nil {