aboutsummaryrefslogtreecommitdiffstats
path: root/device/bind_test.go
diff options
context:
space:
mode:
authorDavid Crawshaw <crawshaw@tailscale.com>2019-11-07 11:13:05 -0500
committerJason A. Donenfeld <Jason@zx2c4.com>2020-05-02 01:46:42 -0600
commit203554620dc8114de1ff70bb30b80f828e9e26ad (patch)
tree49f36961f2090dc07d15cad3204a1a3531dc233d /device/bind_test.go
parentwintun: split error message for create vs open namespace. (diff)
downloadwireguard-go-203554620dc8114de1ff70bb30b80f828e9e26ad.tar.xz
wireguard-go-203554620dc8114de1ff70bb30b80f828e9e26ad.zip
conn: introduce new package that splits out the Bind and Endpoint types
The sticky socket code stays in the device package for now, as it reaches deeply into the peer list. This is the first step in an effort to split some code out of the very busy device package. Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
Diffstat (limited to 'device/bind_test.go')
-rw-r--r--device/bind_test.go14
1 files changed, 9 insertions, 5 deletions
diff --git a/device/bind_test.go b/device/bind_test.go
index 0c2e2cf..c5f7f68 100644
--- a/device/bind_test.go
+++ b/device/bind_test.go
@@ -5,11 +5,15 @@
package device
-import "errors"
+import (
+ "errors"
+
+ "golang.zx2c4.com/wireguard/conn"
+)
type DummyDatagram struct {
msg []byte
- endpoint Endpoint
+ endpoint conn.Endpoint
world bool // better type
}
@@ -25,7 +29,7 @@ func (b *DummyBind) SetMark(v uint32) error {
return nil
}
-func (b *DummyBind) ReceiveIPv6(buff []byte) (int, Endpoint, error) {
+func (b *DummyBind) ReceiveIPv6(buff []byte) (int, conn.Endpoint, error) {
datagram, ok := <-b.in6
if !ok {
return 0, nil, errors.New("closed")
@@ -34,7 +38,7 @@ func (b *DummyBind) ReceiveIPv6(buff []byte) (int, Endpoint, error) {
return len(datagram.msg), datagram.endpoint, nil
}
-func (b *DummyBind) ReceiveIPv4(buff []byte) (int, Endpoint, error) {
+func (b *DummyBind) ReceiveIPv4(buff []byte) (int, conn.Endpoint, error) {
datagram, ok := <-b.in4
if !ok {
return 0, nil, errors.New("closed")
@@ -50,6 +54,6 @@ func (b *DummyBind) Close() error {
return nil
}
-func (b *DummyBind) Send(buff []byte, end Endpoint) error {
+func (b *DummyBind) Send(buff []byte, end conn.Endpoint) error {
return nil
}