commit
66769e671f
@ -73,7 +73,7 @@ func newNetwork(opts ...Option) Network {
|
|||||||
// init tunnel address to the network bind address
|
// init tunnel address to the network bind address
|
||||||
options.Tunnel.Init(
|
options.Tunnel.Init(
|
||||||
tunnel.Address(options.Address),
|
tunnel.Address(options.Address),
|
||||||
tunnel.Nodes(options.Nodes...),
|
tunnel.Nodes(options.Peers...),
|
||||||
)
|
)
|
||||||
|
|
||||||
// init router Id to the network id
|
// init router Id to the network id
|
||||||
@ -169,7 +169,7 @@ func (n *network) resolveNodes() ([]string, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// append seed nodes if we have them
|
// append seed nodes if we have them
|
||||||
for _, node := range n.options.Nodes {
|
for _, node := range n.options.Peers {
|
||||||
if _, ok := nodeMap[node]; !ok {
|
if _, ok := nodeMap[node]; !ok {
|
||||||
nodes = append(nodes, node)
|
nodes = append(nodes, node)
|
||||||
}
|
}
|
||||||
|
@ -22,8 +22,8 @@ type Options struct {
|
|||||||
Address string
|
Address string
|
||||||
// Advertise sets the address to advertise
|
// Advertise sets the address to advertise
|
||||||
Advertise string
|
Advertise string
|
||||||
// Nodes is a list of seed nodes
|
// Peers is a list of peers to connect to
|
||||||
Nodes []string
|
Peers []string
|
||||||
// Tunnel is network tunnel
|
// Tunnel is network tunnel
|
||||||
Tunnel tunnel.Tunnel
|
Tunnel tunnel.Tunnel
|
||||||
// Router is network router
|
// Router is network router
|
||||||
@ -62,11 +62,10 @@ func Advertise(a string) Option {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Nodes is a list of seed nodes used along
|
// Peers is a list of peers to connect to
|
||||||
// with resolved node
|
func Peers(n ...string) Option {
|
||||||
func Nodes(n ...string) Option {
|
|
||||||
return func(o *Options) {
|
return func(o *Options) {
|
||||||
o.Nodes = n
|
o.Peers = n
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user