diff options
Diffstat (limited to 'device/boundif_windows.go')
-rw-r--r-- | device/boundif_windows.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/device/boundif_windows.go b/device/boundif_windows.go index b842ba8..7879a43 100644 --- a/device/boundif_windows.go +++ b/device/boundif_windows.go @@ -7,6 +7,7 @@ package device import ( "encoding/binary" + "errors" "unsafe" "golang.org/x/sys/windows" @@ -23,6 +24,10 @@ func (device *Device) BindSocketToInterface4(interfaceIndex uint32) error { binary.BigEndian.PutUint32(bytes, interfaceIndex) interfaceIndex = *(*uint32)(unsafe.Pointer(&bytes[0])) + if device.net.bind == nil { + return errors.New("Bind is not yet initialized") + } + sysconn, err := device.net.bind.(*nativeBind).ipv4.SyscallConn() if err != nil { return err |