add Network.Init method

This commit is contained in:
Asim Aslam 2019-10-13 12:38:13 +01:00
parent 174f1b857c
commit 01492997ea
2 changed files with 14 additions and 0 deletions

View File

@ -144,6 +144,18 @@ func newNetwork(opts ...Option) Network {
return network
}
func (n *network) Init(opts ...Option) error {
n.Lock()
defer n.Unlock()
// TODO: maybe only allow reinit of certain opts
for _, o := range opts {
o(&n.options)
}
return nil
}
// Options returns network options
func (n *network) Options() Options {
n.RLock()

View File

@ -38,6 +38,8 @@ type Node interface {
type Network interface {
// Node is network node
Node
// Initialise options
Init(...Option) error
// Options returns the network options
Options() Options
// Name of the network