aboutsummaryrefslogtreecommitdiff
path: root/device/boundif_android.go
diff options
context:
space:
mode:
Diffstat (limited to 'device/boundif_android.go')
-rw-r--r--device/boundif_android.go14
1 files changed, 12 insertions, 2 deletions
diff --git a/device/boundif_android.go b/device/boundif_android.go
index ecc9331..6d0fecf 100644
--- a/device/boundif_android.go
+++ b/device/boundif_android.go
@@ -5,8 +5,14 @@
package device
+import "errors"
+
func (device *Device) PeekLookAtSocketFd4() (fd int, err error) {
- sysconn, err := device.net.bind.(*nativeBind).ipv4.SyscallConn()
+ nb, ok := device.net.bind.(*nativeBind)
+ if !ok {
+ return 0, errors.New("no socket exists")
+ }
+ sysconn, err := nb.ipv4.SyscallConn()
if err != nil {
return
}
@@ -20,7 +26,11 @@ func (device *Device) PeekLookAtSocketFd4() (fd int, err error) {
}
func (device *Device) PeekLookAtSocketFd6() (fd int, err error) {
- sysconn, err := device.net.bind.(*nativeBind).ipv6.SyscallConn()
+ nb, ok := device.net.bind.(*nativeBind)
+ if !ok {
+ return 0, errors.New("no socket exists")
+ }
+ sysconn, err := nb.ipv6.SyscallConn()
if err != nil {
return
}