[service] Deactivate android interface code for now

This commit is contained in:
Daniel 2024-08-21 15:00:52 +02:00
parent b7ec90e2c5
commit 4d5bbe42bd
2 changed files with 62 additions and 56 deletions
base/utils/debug
service/netenv

View file

@ -1,31 +1,34 @@
package debug package debug
import ( // TODO: Re-enable Android interfaces.
"context" // Deactived for transition to new module system.
"fmt"
"github.com/safing/portmaster-android/go/app_interface" // import (
) // "context"
// "fmt"
// AddPlatformInfo adds OS and platform information. // "github.com/safing/portmaster-android/go/app_interface"
func (di *Info) AddPlatformInfo(_ context.Context) { // )
// Get information from the system.
info, err := app_interface.GetPlatformInfo()
if err != nil {
di.AddSection(
"Platform Information",
NoFlags,
fmt.Sprintf("Failed to get: %s", err),
)
return
}
// Add section. // // AddPlatformInfo adds OS and platform information.
di.AddSection( // func (di *Info) AddPlatformInfo(_ context.Context) {
fmt.Sprintf("Platform: Android"), // // Get information from the system.
UseCodeSection|AddContentLineBreaks, // info, err := app_interface.GetPlatformInfo()
fmt.Sprintf("SDK: %d", info.SDK), // if err != nil {
fmt.Sprintf("Device: %s %s (%s)", info.Manufacturer, info.Brand, info.Board), // di.AddSection(
fmt.Sprintf("App: %s: %s %s", info.ApplicationID, info.VersionName, info.BuildType)) // "Platform Information",
// NoFlags,
// fmt.Sprintf("Failed to get: %s", err),
// )
// return
// }
} // // Add section.
// di.AddSection(
// fmt.Sprintf("Platform: Android"),
// UseCodeSection|AddContentLineBreaks,
// fmt.Sprintf("SDK: %d", info.SDK),
// fmt.Sprintf("Device: %s %s (%s)", info.Manufacturer, info.Brand, info.Board),
// fmt.Sprintf("App: %s: %s %s", info.ApplicationID, info.VersionName, info.BuildType))
// }

View file

@ -1,40 +1,43 @@
package netenv package netenv
import ( // TODO: Re-enable Android interfaces.
"net" // Deactived for transition to new module system.
"time"
"github.com/safing/portmaster-android/go/app_interface" // import (
) // "net"
// "time"
var ( // "github.com/safing/portmaster-android/go/app_interface"
monitorNetworkChangeOnlineTicker = time.NewTicker(time.Second) // )
monitorNetworkChangeOfflineTicker = time.NewTicker(time.Second)
)
func init() { // var (
// Network change event is monitored by the android system. // monitorNetworkChangeOnlineTicker = time.NewTicker(time.Second)
monitorNetworkChangeOnlineTicker.Stop() // monitorNetworkChangeOfflineTicker = time.NewTicker(time.Second)
monitorNetworkChangeOfflineTicker.Stop() // )
}
func osGetInterfaceAddrs() ([]net.Addr, error) { // func init() {
list, err := app_interface.GetNetworkAddresses() // // Network change event is monitored by the android system.
if err != nil { // monitorNetworkChangeOnlineTicker.Stop()
return nil, err // monitorNetworkChangeOfflineTicker.Stop()
} // }
var netList []net.Addr // func osGetInterfaceAddrs() ([]net.Addr, error) {
for _, addr := range list { // list, err := app_interface.GetNetworkAddresses()
ipNetAddr, err := addr.ToIPNet() // if err != nil {
if err == nil { // return nil, err
netList = append(netList, ipNetAddr) // }
}
}
return netList, nil // var netList []net.Addr
} // for _, addr := range list {
// ipNetAddr, err := addr.ToIPNet()
// if err == nil {
// netList = append(netList, ipNetAddr)
// }
// }
func osGetNetworkInterfaces() ([]app_interface.NetworkInterface, error) { // return netList, nil
return app_interface.GetNetworkInterfaces() // }
}
// func osGetNetworkInterfaces() ([]app_interface.NetworkInterface, error) {
// return app_interface.GetNetworkInterfaces()
// }