Define generic adapter type, rename tunDevice to tunAdapter

This commit is contained in:
Neil Alexander 2018-12-14 18:21:08 +00:00
parent f28360ce4d
commit 8045cb4dc3
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
8 changed files with 25 additions and 24 deletions

View file

@ -31,7 +31,9 @@ import (
)
type adapter struct {
tunDevice
core *Core
send chan<- []byte
recv <-chan []byte
}
// The router struct has channels to/from the tun/tap device and a self peer (0), which is how messages are passed between this node and the peers/switch layer.
@ -43,7 +45,8 @@ type router struct {
in <-chan []byte // packets we received from the network, link to peer's "out"
out func([]byte) // packets we're sending to the network, link to peer's "in"
toRecv chan router_recvPacket // packets to handle via recvPacket()
tun tunDevice // TUN/TAP adapter
tun tunAdapter // TUN/TAP adapter
adapters []adapter // Other adapters
recv chan<- []byte // place where the tun pulls received packets from
send <-chan []byte // place where the tun puts outgoing packets
reset chan struct{} // signal that coords changed (re-init sessions/dht)