29 lines
623 B
Go
Raw Normal View History

2020-04-26 07:33:03 -05:00
package main
import (
"io/ioutil"
"github.com/gologme/log"
"github.com/yggdrasil-network/yggdrasil-go/src/config"
2020-04-26 09:59:30 -05:00
"github.com/yggdrasil-network/yggdrasil-go/src/crypto"
2020-04-26 07:33:03 -05:00
"github.com/yggdrasil-network/yggdrasil-go/src/yggdrasil"
)
type simNode struct {
2020-04-26 09:59:30 -05:00
core yggdrasil.Core
id int
nodeID crypto.NodeID
dialer *yggdrasil.Dialer
listener *yggdrasil.Listener
2020-04-26 07:33:03 -05:00
}
func newNode(id int) *simNode {
n := simNode{id: id}
n.core.Start(config.GenerateConfig(), log.New(ioutil.Discard, "", 0))
2020-04-26 09:59:30 -05:00
n.nodeID = *n.core.NodeID()
n.dialer, _ = n.core.ConnDialer()
n.listener, _ = n.core.ConnListen()
2020-04-26 07:33:03 -05:00
return &n
}