device: test up/down using virtual conn

This prevents port clashing bugs.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jason A. Donenfeld
2021-02-22 04:30:31 +01:00
parent 6603c05a4a
commit 9a29ae267c
3 changed files with 155 additions and 24 deletions

View File

@@ -79,7 +79,6 @@ func genICMPv4(payload []byte, dst, src net.IP) []byte {
return pkt
}
// TODO(crawshaw): find a reusable home for this. package devicetest?
type ChannelTUN struct {
Inbound chan []byte // incoming packets, closed on TUN close
Outbound chan []byte // outbound packets, blocks forever on TUN close