tun session protocol traffic cleanup

This commit is contained in:
Arceliar 2021-05-23 11:58:52 -05:00
parent 233cf0c962
commit 29dda650b5
6 changed files with 125 additions and 115 deletions

View file

@ -46,8 +46,7 @@ type TunAdapter struct {
isOpen bool
isEnabled bool // Used by the writer to drop sessionTraffic if not enabled
gatekeeper func(pubkey ed25519.PublicKey, initiator bool) bool
nodeinfo nodeinfo
debug debugHandler
proto protoHandler
}
func (tun *TunAdapter) SetSessionGatekeeper(gatekeeper func(pubkey ed25519.PublicKey, initiator bool) bool) {
@ -109,12 +108,11 @@ func (tun *TunAdapter) Init(core *yggdrasil.Core, config *config.NodeState, log
tun.store.init(tun)
tun.config = config
tun.log = log
tun.nodeinfo.init(tun)
tun.nodeinfo.setNodeInfo(config.Current.NodeInfo, config.Current.NodeInfoPrivacy)
tun.proto.init(tun)
tun.proto.nodeinfo.setNodeInfo(config.Current.NodeInfo, config.Current.NodeInfoPrivacy)
if err := tun.core.SetOutOfBandHandler(tun.oobHandler); err != nil {
return fmt.Errorf("tun.core.SetOutOfBandHander: %w", err)
}
tun.debug.init(tun)
return nil
}