aboutsummaryrefslogtreecommitdiff
path: root/cmd/dendrite-demo-yggdrasil/yggconn
diff options
context:
space:
mode:
authorNeil Alexander <neilalexander@users.noreply.github.com>2020-07-07 14:18:58 +0100
committerNeil Alexander <neilalexander@users.noreply.github.com>2020-07-07 14:18:58 +0100
commitb21fad92e57451e7a7186630c02214f23c1b9d03 (patch)
tree4b5ad4c900338a7d138d798db10ccb5363dd8aca /cmd/dendrite-demo-yggdrasil/yggconn
parent99ea1f9b4875e9458e640daa3358c3e9ad4fe065 (diff)
Tweaks to Dendrite Yggdrasil demo setup
Diffstat (limited to 'cmd/dendrite-demo-yggdrasil/yggconn')
-rw-r--r--cmd/dendrite-demo-yggdrasil/yggconn/node.go28
1 files changed, 11 insertions, 17 deletions
diff --git a/cmd/dendrite-demo-yggdrasil/yggconn/node.go b/cmd/dendrite-demo-yggdrasil/yggconn/node.go
index c89b0dc1..140e582c 100644
--- a/cmd/dendrite-demo-yggdrasil/yggconn/node.go
+++ b/cmd/dendrite-demo-yggdrasil/yggconn/node.go
@@ -80,7 +80,7 @@ func (n *Node) DialerContext(ctx context.Context, network, address string) (net.
}
// nolint:gocyclo
-func Setup(instanceName, instancePeer, storageDirectory string, enableMulticast bool) (*Node, error) {
+func Setup(instanceName, storageDirectory string) (*Node, error) {
n := &Node{
core: &yggdrasil.Core{},
config: yggdrasilconfig.GenerateConfig(),
@@ -102,17 +102,9 @@ func Setup(instanceName, instancePeer, storageDirectory string, enableMulticast
}
}
- if instancePeer != "" {
- n.config.Peers = []string{instancePeer}
- } else {
- n.config.Peers = []string{}
- }
+ n.config.Peers = []string{}
n.config.AdminListen = "none"
- if enableMulticast {
- n.config.MulticastInterfaces = []string{".*"}
- } else {
- n.config.MulticastInterfaces = []string{}
- }
+ n.config.MulticastInterfaces = []string{}
n.config.EncryptionPrivateKey = hex.EncodeToString(n.EncryptionPrivateKey())
n.config.EncryptionPublicKey = hex.EncodeToString(n.EncryptionPublicKey())
@@ -197,11 +189,9 @@ func (n *Node) PeerCount() int {
func (n *Node) KnownNodes() []gomatrixserverlib.ServerName {
nodemap := map[string]struct{}{}
- /*
- for _, peer := range n.core.GetSwitchPeers() {
- nodemap[hex.EncodeToString(peer.SigningKey[:])] = struct{}{}
- }
- */
+ for _, peer := range n.core.GetSwitchPeers() {
+ nodemap[hex.EncodeToString(peer.SigningKey[:])] = struct{}{}
+ }
n.sessions.Range(func(_, v interface{}) bool {
session, ok := v.(quic.Session)
if !ok {
@@ -262,7 +252,11 @@ func (n *Node) SetStaticPeer(uri string) error {
if uri != "" {
n.log.Infoln("Adding static peer", uri)
if err := n.core.AddPeer(uri, ""); err != nil {
- n.log.Infoln("Adding static peer failed:", err)
+ n.log.Warnln("Adding static peer failed:", err)
+ return err
+ }
+ if err := n.core.CallPeer(uri, ""); err != nil {
+ n.log.Warnln("Calling static peer failed:", err)
return err
}
}