File tree 3 files changed +27
-80
lines changed
3 files changed +27
-80
lines changed Original file line number Diff line number Diff line change @@ -314,30 +314,6 @@ func TestConcurrencySafety(t *testing.T) {
314
314
close (done )
315
315
}
316
316
317
- func assertNil (t * testing.T , err error ) {
318
- if err != nil {
319
- t .Fatal (err )
320
- }
321
- }
322
-
323
- func assertEqual (t * testing.T , a , b []byte ) {
324
- if ! bytes .Equal (a , b ) {
325
- t .Fatal (a , "!=" , b )
326
- }
327
- }
328
-
329
- func randDevice (t * testing.T ) * Device {
330
- sk , err := newPrivateKey ()
331
- if err != nil {
332
- t .Fatal (err )
333
- }
334
- tun := newDummyTUN ("dummy" )
335
- logger := NewLogger (LogLevelError , "" )
336
- device := NewDevice (tun , conn .NewDefaultBind (), logger )
337
- device .SetPrivateKey (sk )
338
- return device
339
- }
340
-
341
317
func BenchmarkLatency (b * testing.B ) {
342
318
pair := genTestPair (b )
343
319
Original file line number Diff line number Diff line change 9
9
"bytes"
10
10
"encoding/binary"
11
11
"testing"
12
+
13
+ "golang.zx2c4.com/wireguard/conn"
14
+ "golang.zx2c4.com/wireguard/tun/tuntest"
12
15
)
13
16
14
17
func TestCurveWrappers (t * testing.T ) {
@@ -29,6 +32,30 @@ func TestCurveWrappers(t *testing.T) {
29
32
}
30
33
}
31
34
35
+ func randDevice (t * testing.T ) * Device {
36
+ sk , err := newPrivateKey ()
37
+ if err != nil {
38
+ t .Fatal (err )
39
+ }
40
+ tun := tuntest .NewChannelTUN ()
41
+ logger := NewLogger (LogLevelError , "" )
42
+ device := NewDevice (tun .TUN (), conn .NewDefaultBind (), logger )
43
+ device .SetPrivateKey (sk )
44
+ return device
45
+ }
46
+
47
+ func assertNil (t * testing.T , err error ) {
48
+ if err != nil {
49
+ t .Fatal (err )
50
+ }
51
+ }
52
+
53
+ func assertEqual (t * testing.T , a , b []byte ) {
54
+ if ! bytes .Equal (a , b ) {
55
+ t .Fatal (a , "!=" , b )
56
+ }
57
+ }
58
+
32
59
func TestNoiseHandshake (t * testing.T ) {
33
60
dev1 := randDevice (t )
34
61
dev2 := randDevice (t )
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments