From 7e05d2c440e5f183b07f353f4d15543a5da68b0d Mon Sep 17 00:00:00 2001 From: Asim Aslam Date: Thu, 19 Sep 2019 16:32:15 +0100 Subject: [PATCH] Replace Nodes with Peers --- network/default.go | 4 ++-- network/options.go | 11 +++++------ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/network/default.go b/network/default.go index 8ed2b763..fb98e545 100644 --- a/network/default.go +++ b/network/default.go @@ -73,7 +73,7 @@ func newNetwork(opts ...Option) Network { // init tunnel address to the network bind address options.Tunnel.Init( tunnel.Address(options.Address), - tunnel.Nodes(options.Nodes...), + tunnel.Nodes(options.Peers...), ) // init router Id to the network id @@ -169,7 +169,7 @@ func (n *network) resolveNodes() ([]string, error) { } // append seed nodes if we have them - for _, node := range n.options.Nodes { + for _, node := range n.options.Peers { if _, ok := nodeMap[node]; !ok { nodes = append(nodes, node) } diff --git a/network/options.go b/network/options.go index eb3aa61c..0a3c5b2b 100644 --- a/network/options.go +++ b/network/options.go @@ -22,8 +22,8 @@ type Options struct { Address string // Advertise sets the address to advertise Advertise string - // Nodes is a list of seed nodes - Nodes []string + // Peers is a list of peers to connect to + Peers []string // Tunnel is network tunnel Tunnel tunnel.Tunnel // Router is network router @@ -62,11 +62,10 @@ func Advertise(a string) Option { } } -// Nodes is a list of seed nodes used along -// with resolved node -func Nodes(n ...string) Option { +// Peers is a list of peers to connect to +func Peers(n ...string) Option { return func(o *Options) { - o.Nodes = n + o.Peers = n } }