Android support for getting network addresses and interfaces (#1056)
* Replace unsupported network functions for android * Refactor default/android net addresses processing * Add default connection values, Refactor netenv * Fix compilation error * Combine network change default/android functions
This commit is contained in:
23
netenv/os_android.go
Normal file
23
netenv/os_android.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package netenv
|
||||
|
||||
import (
|
||||
"github.com/safing/portmaster-android/go/app_interface"
|
||||
"net"
|
||||
)
|
||||
|
||||
func osGetInterfaceAddrs() ([]net.Addr, error) {
|
||||
list, err := app_interface.GetNetworkAddresses()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var netList []net.Addr
|
||||
for _, addr := range list {
|
||||
netList = append(netList, addr.ToIPNet())
|
||||
}
|
||||
|
||||
return netList, nil
|
||||
}
|
||||
|
||||
func osGetNetworkInterfaces() ([]app_interface.NetworkInterface, error) {
|
||||
return app_interface.GetNetworkInterfaces()
|
||||
}
|
||||
Reference in New Issue
Block a user