aboutsummaryrefslogtreecommitdiffstats
path: root/device/bind_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'device/bind_test.go')
-rw-r--r--device/bind_test.go23
1 files changed, 12 insertions, 11 deletions
diff --git a/device/bind_test.go b/device/bind_test.go
index 0c2e2cf..d3fa565 100644
--- a/device/bind_test.go
+++ b/device/bind_test.go
@@ -1,23 +1,24 @@
/* SPDX-License-Identifier: MIT
*
- * Copyright (C) 2017-2019 WireGuard LLC. All Rights Reserved.
+ * Copyright (C) 2017-2025 WireGuard LLC. All Rights Reserved.
*/
package device
-import "errors"
+import (
+ "errors"
+
+ "golang.zx2c4.com/wireguard/conn"
+)
type DummyDatagram struct {
msg []byte
- endpoint Endpoint
- world bool // better type
+ endpoint conn.Endpoint
}
type DummyBind struct {
in6 chan DummyDatagram
- ou6 chan DummyDatagram
in4 chan DummyDatagram
- ou4 chan DummyDatagram
closed bool
}
@@ -25,21 +26,21 @@ func (b *DummyBind) SetMark(v uint32) error {
return nil
}
-func (b *DummyBind) ReceiveIPv6(buff []byte) (int, Endpoint, error) {
+func (b *DummyBind) ReceiveIPv6(buf []byte) (int, conn.Endpoint, error) {
datagram, ok := <-b.in6
if !ok {
return 0, nil, errors.New("closed")
}
- copy(buff, datagram.msg)
+ copy(buf, datagram.msg)
return len(datagram.msg), datagram.endpoint, nil
}
-func (b *DummyBind) ReceiveIPv4(buff []byte) (int, Endpoint, error) {
+func (b *DummyBind) ReceiveIPv4(buf []byte) (int, conn.Endpoint, error) {
datagram, ok := <-b.in4
if !ok {
return 0, nil, errors.New("closed")
}
- copy(buff, datagram.msg)
+ copy(buf, datagram.msg)
return len(datagram.msg), datagram.endpoint, nil
}
@@ -50,6 +51,6 @@ func (b *DummyBind) Close() error {
return nil
}
-func (b *DummyBind) Send(buff []byte, end Endpoint) error {
+func (b *DummyBind) Send(buf []byte, end conn.Endpoint) error {
return nil
}