Simplified API. Correct Router initialization. Debug printing.
This commit is contained in:
@@ -6,10 +6,14 @@ import (
|
||||
|
||||
// Options allows to set Router options
|
||||
type Options struct {
|
||||
// ID is router ID
|
||||
ID string
|
||||
// Address is router address
|
||||
Address string
|
||||
// Network defines micro network address
|
||||
Network string
|
||||
// GossipAddr is router gossip address
|
||||
GossipAddr string
|
||||
// NetworkAddr defines micro network address
|
||||
NetworkAddr string
|
||||
// RIB is Routing Information Base
|
||||
RIB RIB
|
||||
// Table is routing table
|
||||
@@ -18,6 +22,13 @@ type Options struct {
|
||||
Context context.Context
|
||||
}
|
||||
|
||||
// ID sets Router ID
|
||||
func ID(id string) Option {
|
||||
return func(o *Options) {
|
||||
o.ID = id
|
||||
}
|
||||
}
|
||||
|
||||
// Address allows to set router address
|
||||
func Address(a string) Option {
|
||||
return func(o *Options) {
|
||||
@@ -25,10 +36,17 @@ func Address(a string) Option {
|
||||
}
|
||||
}
|
||||
|
||||
// Network allows to set router network
|
||||
func Network(n string) Option {
|
||||
// GossipAddress allows to set router address
|
||||
func GossipAddress(a string) Option {
|
||||
return func(o *Options) {
|
||||
o.Network = n
|
||||
o.GossipAddr = a
|
||||
}
|
||||
}
|
||||
|
||||
// NetworkAddr allows to set router network
|
||||
func NetworkAddr(n string) Option {
|
||||
return func(o *Options) {
|
||||
o.NetworkAddr = n
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user