diff options
Diffstat (limited to 'device/boundif_android.go')
-rw-r--r-- | device/boundif_android.go | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/device/boundif_android.go b/device/boundif_android.go new file mode 100644 index 0000000..ecc9331 --- /dev/null +++ b/device/boundif_android.go @@ -0,0 +1,34 @@ +/* SPDX-License-Identifier: MIT + * + * Copyright (C) 2017-2019 WireGuard LLC. All Rights Reserved. + */ + +package device + +func (device *Device) PeekLookAtSocketFd4() (fd int, err error) { + sysconn, err := device.net.bind.(*nativeBind).ipv4.SyscallConn() + if err != nil { + return + } + err = sysconn.Control(func(f uintptr) { + fd = int(f) + }) + if err != nil { + return + } + return +} + +func (device *Device) PeekLookAtSocketFd6() (fd int, err error) { + sysconn, err := device.net.bind.(*nativeBind).ipv6.SyscallConn() + if err != nil { + return + } + err = sysconn.Control(func(f uintptr) { + fd = int(f) + }) + if err != nil { + return + } + return +} |