diff options
author | Mathias Hall-Andersen <mathias@hall-andersen.dk> | 2018-03-08 16:44:27 +0100 |
---|---|---|
committer | Mathias Hall-Andersen <mathias@hall-andersen.dk> | 2018-03-08 16:44:46 +0100 |
commit | 6cecaf31575d77d8f30be65a0a5d34055ee220a4 (patch) | |
tree | 4b2114afb2c19b59d7f03a752df7e37b842f5fe6 /device_test.go | |
parent | fd248c6cb1873229b5e487045accdf7ed7ac822e (diff) | |
download | wireguard-go-6cecaf31575d77d8f30be65a0a5d34055ee220a4.tar.gz wireguard-go-6cecaf31575d77d8f30be65a0a5d34055ee220a4.zip |
Begin work on full device<->device unit-test
To simulate a full interaction between two WireGuard
instances without networking, using dummy instances of the interfaces
Diffstat (limited to 'device_test.go')
-rw-r--r-- | device_test.go | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/device_test.go b/device_test.go new file mode 100644 index 0000000..abd0208 --- /dev/null +++ b/device_test.go @@ -0,0 +1,43 @@ +package main + +/* Create two device instances and simulate full WireGuard interaction + * without network dependencies + */ + +import "testing" + +func TestDevice(t *testing.T) { + + // prepare tun devices for generating traffic + + tun1, err := CreateDummyTUN("tun1") + if err != nil { + t.Error("failed to create tun:", err.Error()) + } + + tun2, err := CreateDummyTUN("tun2") + if err != nil { + t.Error("failed to create tun:", err.Error()) + } + + println(tun1) + println(tun2) + + // prepare endpoints + + end1, err := CreateDummyEndpoint() + if err != nil { + t.Error("failed to create endpoint:", err.Error()) + } + + end2, err := CreateDummyEndpoint() + if err != nil { + t.Error("failed to create endpoint:", err.Error()) + } + + println(end1) + println(end2) + + // create binds + +} |