mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-30 23:25:36 +03:00
Add DHTCrawler module
This commit is contained in:
parent
a6275b48a3
commit
bf520c3c25
2 changed files with 286 additions and 5 deletions
|
@ -25,6 +25,7 @@ import (
|
|||
"github.com/yggdrasil-network/yggdrasil-go/src/admin"
|
||||
"github.com/yggdrasil-network/yggdrasil-go/src/config"
|
||||
"github.com/yggdrasil-network/yggdrasil-go/src/crypto"
|
||||
"github.com/yggdrasil-network/yggdrasil-go/src/dhtcrawler"
|
||||
"github.com/yggdrasil-network/yggdrasil-go/src/module"
|
||||
"github.com/yggdrasil-network/yggdrasil-go/src/multicast"
|
||||
"github.com/yggdrasil-network/yggdrasil-go/src/tuntap"
|
||||
|
@ -33,11 +34,12 @@ import (
|
|||
)
|
||||
|
||||
type node struct {
|
||||
core yggdrasil.Core
|
||||
state *config.NodeState
|
||||
tuntap module.Module // tuntap.TunAdapter
|
||||
multicast module.Module // multicast.Multicast
|
||||
admin module.Module // admin.AdminSocket
|
||||
core yggdrasil.Core
|
||||
state *config.NodeState
|
||||
tuntap module.Module // tuntap.TunAdapter
|
||||
multicast module.Module // multicast.Multicast
|
||||
admin module.Module // admin.AdminSocket
|
||||
dhtcrawler module.Module // dhtcrawler.Crawler
|
||||
}
|
||||
|
||||
func readConfig(useconf *bool, useconffile *string, normaliseconf *bool) *config.NodeConfig {
|
||||
|
@ -284,6 +286,7 @@ func main() {
|
|||
n.admin = &admin.AdminSocket{}
|
||||
n.multicast = &multicast.Multicast{}
|
||||
n.tuntap = &tuntap.TunAdapter{}
|
||||
n.dhtcrawler = &dhtcrawler.Crawler{}
|
||||
// Start the admin socket
|
||||
n.admin.Init(&n.core, n.state, logger, nil)
|
||||
if err := n.admin.Start(); err != nil {
|
||||
|
@ -310,6 +313,10 @@ func main() {
|
|||
} else {
|
||||
logger.Errorln("Unable to get Listener:", err)
|
||||
}
|
||||
|
||||
n.dhtcrawler.Init(&n.core, n.state, logger, nil)
|
||||
n.dhtcrawler.SetupAdminHandlers(n.admin.(*admin.AdminSocket))
|
||||
|
||||
// Make some nice output that tells us what our IPv6 address and subnet are.
|
||||
// This is just logged to stdout for the user.
|
||||
address := n.core.Address()
|
||||
|
@ -337,6 +344,7 @@ func main() {
|
|||
n.core.UpdateConfig(cfg)
|
||||
n.tuntap.UpdateConfig(cfg)
|
||||
n.multicast.UpdateConfig(cfg)
|
||||
n.dhtcrawler.UpdateConfig(cfg)
|
||||
} else {
|
||||
logger.Errorln("Reloading config at runtime is only possible with -useconffile")
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue