mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-28 22:25:07 +03:00
Add API functions for manipulating maximum session MTU, fix TUN/TAP to use that
This commit is contained in:
parent
789307d52b
commit
e90be6f569
3 changed files with 24 additions and 3 deletions
|
@ -35,6 +35,7 @@ const tun_ETHER_HEADER_LENGTH = 14
|
|||
// you should pass this object to the yggdrasil.SetRouterAdapter() function
|
||||
// before calling yggdrasil.Start().
|
||||
type TunAdapter struct {
|
||||
core *yggdrasil.Core
|
||||
writer tunWriter
|
||||
reader tunReader
|
||||
config *config.NodeState
|
||||
|
@ -131,6 +132,7 @@ func (tun *TunAdapter) Init(core *yggdrasil.Core, config *config.NodeState, log
|
|||
if !ok {
|
||||
return fmt.Errorf("invalid options supplied to TunAdapter module")
|
||||
}
|
||||
tun.core = core
|
||||
tun.config = config
|
||||
tun.log = log
|
||||
tun.listener = tunoptions.Listener
|
||||
|
@ -181,6 +183,7 @@ func (tun *TunAdapter) _start() error {
|
|||
if tun.MTU() != current.IfMTU {
|
||||
tun.log.Warnf("Warning: Interface MTU %d automatically adjusted to %d (supported range is 1280-%d)", current.IfMTU, tun.MTU(), MaximumMTU(tun.IsTAP()))
|
||||
}
|
||||
tun.core.SetMaximumSessionMTU(uint16(tun.MTU()))
|
||||
tun.isOpen = true
|
||||
go tun.handler()
|
||||
tun.reader.Act(nil, tun.reader._read) // Start the reader
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue