mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-28 14:15:06 +03:00
Add an admin socket
This commit is contained in:
parent
502ab3cfaa
commit
b754d68068
6 changed files with 92 additions and 15 deletions
23
yggdrasil.go
23
yggdrasil.go
|
@ -29,15 +29,16 @@ import . "yggdrasil"
|
|||
*/
|
||||
|
||||
type nodeConfig struct {
|
||||
Listen string
|
||||
Peers []string
|
||||
BoxPub string
|
||||
BoxPriv string
|
||||
SigPub string
|
||||
SigPriv string
|
||||
Multicast bool
|
||||
LinkLocal string
|
||||
IfName string
|
||||
Listen string
|
||||
AdminListen string
|
||||
Peers []string
|
||||
BoxPub string
|
||||
BoxPriv string
|
||||
SigPub string
|
||||
SigPriv string
|
||||
Multicast bool
|
||||
LinkLocal string
|
||||
IfName string
|
||||
}
|
||||
|
||||
type node struct {
|
||||
|
@ -72,6 +73,9 @@ func (n *node) init(cfg *nodeConfig, logger *log.Logger) {
|
|||
logger.Println("Starting interface...")
|
||||
n.core.DEBUG_setupAndStartGlobalUDPInterface(cfg.Listen)
|
||||
logger.Println("Started interface")
|
||||
logger.Println("Starting admin socket...")
|
||||
n.core.DEBUG_setupAndStartAdminInterface(cfg.AdminListen)
|
||||
logger.Println("Started admin socket")
|
||||
go func() {
|
||||
if len(cfg.Peers) == 0 {
|
||||
return
|
||||
|
@ -92,6 +96,7 @@ func generateConfig() *nodeConfig {
|
|||
spub, spriv := core.DEBUG_newSigKeys()
|
||||
cfg := nodeConfig{}
|
||||
cfg.Listen = "[::]:0"
|
||||
cfg.AdminListen = "[::]:0"
|
||||
cfg.BoxPub = hex.EncodeToString(bpub[:])
|
||||
cfg.BoxPriv = hex.EncodeToString(bpriv[:])
|
||||
cfg.SigPub = hex.EncodeToString(spub[:])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue