diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-03-03 04:04:41 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-03-03 05:00:40 +0100 |
commit | 69f0fe67b63d90e523a5a1241fb1b46c2e8dbe03 (patch) | |
tree | 1ef86da3242afde462dcadb7241bb09f499d5bd7 /endpoint_test.go | |
parent | d435be35cac49af9367b2005d831d55e570c4b1b (diff) |
global: begin modularization
Diffstat (limited to 'endpoint_test.go')
-rw-r--r-- | endpoint_test.go | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/endpoint_test.go b/endpoint_test.go deleted file mode 100644 index fe6677c..0000000 --- a/endpoint_test.go +++ /dev/null @@ -1,53 +0,0 @@ -/* SPDX-License-Identifier: MIT - * - * Copyright (C) 2017-2019 WireGuard LLC. All Rights Reserved. - */ - -package main - -import ( - "math/rand" - "net" -) - -type DummyEndpoint struct { - src [16]byte - dst [16]byte -} - -func CreateDummyEndpoint() (*DummyEndpoint, error) { - var end DummyEndpoint - if _, err := rand.Read(end.src[:]); err != nil { - return nil, err - } - _, err := rand.Read(end.dst[:]) - return &end, err -} - -func (e *DummyEndpoint) ClearSrc() {} - -func (e *DummyEndpoint) SrcToString() string { - var addr net.UDPAddr - addr.IP = e.SrcIP() - addr.Port = 1000 - return addr.String() -} - -func (e *DummyEndpoint) DstToString() string { - var addr net.UDPAddr - addr.IP = e.DstIP() - addr.Port = 1000 - return addr.String() -} - -func (e *DummyEndpoint) SrcToBytes() []byte { - return e.src[:] -} - -func (e *DummyEndpoint) DstIP() net.IP { - return e.dst[:] -} - -func (e *DummyEndpoint) SrcIP() net.IP { - return e.src[:] -} |