mirror of
https://github.com/cwinfo/yggdrasil-go.git
synced 2024-11-15 23:40:28 +00:00
26 lines
615 B
Go
26 lines
615 B
Go
|
package yggdrasil
|
||
|
|
||
|
// Defines the minimum required functions for an adapter type.
|
||
|
type AdapterInterface interface {
|
||
|
init(core *Core, send chan<- []byte, recv <-chan []byte)
|
||
|
read() error
|
||
|
write() error
|
||
|
close() error
|
||
|
}
|
||
|
|
||
|
// Defines the minimum required struct members for an adapter type (this is
|
||
|
// now the base type for tunAdapter in tun.go)
|
||
|
type Adapter struct {
|
||
|
AdapterInterface
|
||
|
core *Core
|
||
|
send chan<- []byte
|
||
|
recv <-chan []byte
|
||
|
}
|
||
|
|
||
|
// Initialises the adapter.
|
||
|
func (adapter *Adapter) init(core *Core, send chan<- []byte, recv <-chan []byte) {
|
||
|
adapter.core = core
|
||
|
adapter.send = send
|
||
|
adapter.recv = recv
|
||
|
}
|