Merge remote-tracking branch 'origin/develop' into metadata

This commit is contained in:
Neil Alexander 2018-12-15 00:48:54 +00:00
commit cdd2e7910a
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
14 changed files with 99 additions and 77 deletions

View file

@ -28,7 +28,6 @@ type Core struct {
sessions sessions
router router
dht dht
tun tunDevice
admin admin
searches searches
multicast multicast
@ -60,7 +59,6 @@ func (c *Core) init(bpub *boxPubKey,
c.peers.init(c)
c.router.init(c)
c.switchTable.init(c, c.sigPub) // TODO move before peers? before router?
c.tun.init(c)
}
// Get the current build name. This is usually injected if built from git,
@ -192,7 +190,7 @@ func (c *Core) Start(nc *config.NodeConfig, log *log.Logger) error {
}
ip := net.IP(c.router.addr[:]).String()
if err := c.tun.start(nc.IfName, nc.IfTAPMode, fmt.Sprintf("%s/%d", ip, 8*len(address_prefix)-1), nc.IfMTU); err != nil {
if err := c.router.tun.start(nc.IfName, nc.IfTAPMode, fmt.Sprintf("%s/%d", ip, 8*len(address_prefix)-1), nc.IfMTU); err != nil {
c.log.Println("Failed to start TUN/TAP")
return err
}
@ -204,7 +202,7 @@ func (c *Core) Start(nc *config.NodeConfig, log *log.Logger) error {
// Stops the Yggdrasil node.
func (c *Core) Stop() {
c.log.Println("Stopping...")
c.tun.close()
c.router.tun.close()
c.admin.close()
}
@ -307,10 +305,10 @@ func (c *Core) GetTUNDefaultIfTAPMode() bool {
// Gets the current TUN/TAP interface name.
func (c *Core) GetTUNIfName() string {
return c.tun.iface.Name()
return c.router.tun.iface.Name()
}
// Gets the current TUN/TAP interface MTU.
func (c *Core) GetTUNIfMTU() int {
return c.tun.mtu
return c.router.tun.mtu
}