Start de-debugging

This commit is contained in:
Neil Alexander 2018-05-24 00:36:07 +01:00
parent fae00e962f
commit 3847e6afb8
4 changed files with 35 additions and 0 deletions

View file

@ -213,6 +213,9 @@ func (a *admin) init(c *Core, listenaddr string) {
}, errors.New("Failed to remove allowed box pub key")
}
})
}
func (a *admin) start() {
go a.listen()
}

View file

@ -3,6 +3,8 @@ package yggdrasil
import "io/ioutil"
import "log"
import "regexp"
import "net"
import "yggdrasil/config"
type Core struct {
// This is the main data structure that holds everything else for a node
@ -33,6 +35,29 @@ func (c *Core) Init() {
c.init(bpub, bpriv, spub, spriv)
}
func (c *Core) Run(nc *config.NodeConfig) {
var boxPub boxPubKey
var boxPriv boxPrivKey
var sigPub sigPubKey
var sigPriv sigPrivKey
copy(boxPub[:], nc.EncryptionPublicKey)
copy(boxPriv[:], nc.EncryptionPrivateKey)
copy(sigPub[:], nc.SigningPublicKey)
copy(sigPriv[:], nc.SigningPrivateKey)
c.init(&boxPub, &boxPriv, &sigPub, &sigPriv)
c.udp.init(c, nc.Listen)
c.tcp.init(c, nc.Listen)
c.admin.init(c, nc.AdminListen)
c.multicast.start()
c.router.start()
c.switchTable.start()
c.tun.setup(nc.IfName, nc.IfTAPMode, net.IP(c.router.addr[:]).String(), nc.IfMTU)
c.admin.start()
}
func (c *Core) init(bpub *boxPubKey,
bpriv *boxPrivKey,
spub *sigPubKey,

View file

@ -64,6 +64,10 @@ func (r *router) init(core *Core) {
r.core.tun.send = send
r.reset = make(chan struct{}, 1)
r.admin = make(chan func())
// go r.mainLoop()
}
func (r *router) start() {
go r.mainLoop()
}

View file

@ -167,6 +167,9 @@ func (t *switchTable) init(core *Core, key sigPubKey) {
t.updater.Store(&sync.Once{})
t.table.Store(lookupTable{})
t.drop = make(map[sigPubKey]int64)
}
func (t *switchTable) start() {
doTicker := func() {
ticker := time.NewTicker(time.Second)
defer ticker.Stop()