mirror of
https://github.com/shtorm-7/sing-box-extended.git
synced 2026-06-25 03:43:12 +03:00
Add wifi_ssid and wifi_bssid route and DNS rules
This commit is contained in:
@@ -60,11 +60,11 @@ func (s *CommandServer) handleLogConn(conn net.Conn) error {
|
||||
for element := s.savedLines.Front(); element != nil; element = element.Next() {
|
||||
savedLines = append(savedLines, element.Value)
|
||||
}
|
||||
s.access.Unlock()
|
||||
subscription, done, err := s.observer.Subscribe()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
s.access.Unlock()
|
||||
defer s.observer.UnSubscribe(subscription)
|
||||
for _, line := range savedLines {
|
||||
err = writeLog(conn, []byte(line))
|
||||
|
||||
@@ -19,6 +19,7 @@ type PlatformInterface interface {
|
||||
UsePlatformInterfaceGetter() bool
|
||||
GetInterfaces() (NetworkInterfaceIterator, error)
|
||||
UnderNetworkExtension() bool
|
||||
ReadWIFIState() *WIFIState
|
||||
ClearDNSCache()
|
||||
}
|
||||
|
||||
@@ -38,6 +39,15 @@ type NetworkInterface struct {
|
||||
Addresses StringIterator
|
||||
}
|
||||
|
||||
type WIFIState struct {
|
||||
SSID string
|
||||
BSSID string
|
||||
}
|
||||
|
||||
func NewWIFIState(wifiSSID string, wifiBSSID string) *WIFIState {
|
||||
return &WIFIState{wifiSSID, wifiBSSID}
|
||||
}
|
||||
|
||||
type NetworkInterfaceIterator interface {
|
||||
Next() *NetworkInterface
|
||||
HasNext() bool
|
||||
|
||||
@@ -23,6 +23,7 @@ type Interface interface {
|
||||
Interfaces() ([]NetworkInterface, error)
|
||||
UnderNetworkExtension() bool
|
||||
ClearDNSCache()
|
||||
ReadWIFIState() adapter.WIFIState
|
||||
process.Searcher
|
||||
}
|
||||
|
||||
|
||||
@@ -210,6 +210,14 @@ func (w *platformInterfaceWrapper) ClearDNSCache() {
|
||||
w.iif.ClearDNSCache()
|
||||
}
|
||||
|
||||
func (w *platformInterfaceWrapper) ReadWIFIState() adapter.WIFIState {
|
||||
wifiState := w.iif.ReadWIFIState()
|
||||
if wifiState == nil {
|
||||
return adapter.WIFIState{}
|
||||
}
|
||||
return (adapter.WIFIState)(*wifiState)
|
||||
}
|
||||
|
||||
func (w *platformInterfaceWrapper) DisableColors() bool {
|
||||
return runtime.GOOS != "android"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user