mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-29 06:35:07 +03:00
TUN/TAP now uses config, log, etc from adapter.go
This commit is contained in:
parent
58f5cc88d0
commit
350b51cabb
7 changed files with 65 additions and 65 deletions
|
@ -6,13 +6,15 @@ import (
|
|||
"github.com/yggdrasil-network/yggdrasil-go/src/config"
|
||||
)
|
||||
|
||||
// Defines the minimum required struct members for an adapter type. This is now
|
||||
// the base type for adapters like tun.go. When implementing a new adapter type,
|
||||
// you should extend the adapter struct with this one and should call the
|
||||
// Adapter.Init() function when initialising.
|
||||
// Adapter defines the minimum required struct members for an adapter type. This
|
||||
// is now the base type for adapters like tun.go. When implementing a new
|
||||
// adapter type, you should extend the adapter struct with this one and should
|
||||
// call the Adapter.Init() function when initialising.
|
||||
type Adapter struct {
|
||||
adapterImplementation
|
||||
Core *Core
|
||||
Config *config.NodeState
|
||||
Log *log.Logger
|
||||
Send chan<- []byte
|
||||
Recv <-chan []byte
|
||||
Reject <-chan RejectedPacket
|
||||
|
@ -31,11 +33,13 @@ type adapterImplementation interface {
|
|||
Close() error
|
||||
}
|
||||
|
||||
// Initialises the adapter with the necessary channels to operate from the
|
||||
// Init initialises the adapter with the necessary channels to operate from the
|
||||
// router. When defining a new Adapter type, the Adapter should call this
|
||||
// function from within it's own Init function to set up the channels. It is
|
||||
// otherwise not expected for you to call this function directly.
|
||||
func (adapter *Adapter) Init(config *config.NodeState, log *log.Logger, send chan<- []byte, recv <-chan []byte, reject <-chan RejectedPacket) {
|
||||
adapter.Config = config
|
||||
adapter.Log = log
|
||||
adapter.Send = send
|
||||
adapter.Recv = recv
|
||||
adapter.Reject = reject
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue