add Network.Init method
This commit is contained in:
		| @@ -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() | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user