diff options
Diffstat (limited to 'device/conn_default.go')
-rw-r--r-- | device/conn_default.go | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/device/conn_default.go b/device/conn_default.go index 820bb96..661f57d 100644 --- a/device/conn_default.go +++ b/device/conn_default.go @@ -21,8 +21,10 @@ import ( */ type nativeBind struct { - ipv4 *net.UDPConn - ipv6 *net.UDPConn + ipv4 *net.UDPConn + ipv6 *net.UDPConn + blackhole4 bool + blackhole6 bool } type NativeEndpoint net.UDPAddr @@ -159,11 +161,17 @@ func (bind *nativeBind) Send(buff []byte, endpoint Endpoint) error { if bind.ipv4 == nil { return syscall.EAFNOSUPPORT } + if bind.blackhole4 { + return nil + } _, err = bind.ipv4.WriteToUDP(buff, (*net.UDPAddr)(nend)) } else { if bind.ipv6 == nil { return syscall.EAFNOSUPPORT } + if bind.blackhole6 { + return nil + } _, err = bind.ipv6.WriteToUDP(buff, (*net.UDPAddr)(nend)) } return err |