From 418f5d6d424b89305231e9f7de48199e475f45ec Mon Sep 17 00:00:00 2001 From: Wolfgang Welz <welzwo@gmail.com> Date: Mon, 30 Dec 2019 19:41:46 +0100 Subject: [PATCH] Make masterNodes a StringSlice parameter --- plugins/autopeering/autopeering.go | 8 ++++---- plugins/autopeering/entrynodes.go | 2 +- plugins/autopeering/parameters.go | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/plugins/autopeering/autopeering.go b/plugins/autopeering/autopeering.go index 7dc06d78..314459ed 100644 --- a/plugins/autopeering/autopeering.go +++ b/plugins/autopeering/autopeering.go @@ -82,12 +82,12 @@ func configureAP() { log.Fatalf("ListenUDP: %v", err) } - masterPeers := []*peer.Peer{} - master, err := parseEntryNodes() + var masterPeers []*peer.Peer + peers, err := parseEntryNodes() if err != nil { log.Fatalf("Ignoring entry nodes: %v\n", err) - } else if master != nil { - masterPeers = master + } else if peers != nil { + masterPeers = peers } // use the UDP connection for transport diff --git a/plugins/autopeering/entrynodes.go b/plugins/autopeering/entrynodes.go index 0dc48627..1b4384d3 100644 --- a/plugins/autopeering/entrynodes.go +++ b/plugins/autopeering/entrynodes.go @@ -11,7 +11,7 @@ import ( ) func parseEntryNodes() (result []*peer.Peer, err error) { - for _, entryNodeDefinition := range strings.Fields(parameter.NodeConfig.GetString(CFG_ENTRY_NODES)) { + for _, entryNodeDefinition := range parameter.NodeConfig.GetStringSlice(CFG_ENTRY_NODES) { if entryNodeDefinition == "" { continue } diff --git a/plugins/autopeering/parameters.go b/plugins/autopeering/parameters.go index e5b2c7f2..27b11700 100644 --- a/plugins/autopeering/parameters.go +++ b/plugins/autopeering/parameters.go @@ -13,7 +13,7 @@ const ( func init() { flag.String(CFG_ADDRESS, "0.0.0.0", "address to bind for incoming peering requests") - flag.String(CFG_ENTRY_NODES, "V8LYtWWcPYYDTTXLeIEFjJEuWlsjDiI0+Pq/Cx9ai6g=@116.202.49.178:14626", "list of trusted entry nodes for auto peering") + flag.StringSlice(CFG_ENTRY_NODES, []string{"V8LYtWWcPYYDTTXLeIEFjJEuWlsjDiI0+Pq/Cx9ai6g=@116.202.49.178:14626"}, "list of trusted entry nodes for auto peering") flag.Int(CFG_PORT, 14626, "udp port for incoming peering requests") flag.Bool(CFG_SELECTION, true, "enable peer selection") } -- GitLab