micro/router/router.go
Milos Gajdos f62fcaad76
Added router ID. Deregister remote services when router is stopped.
Added ID function to router interface.

Network registry addresses are deregistered when the router is stopped.

Query has been updated to search for particular GW in lookups.
2019-06-19 18:03:42 +01:00

35 lines
859 B
Go

// Package router provides an interface for micro network router
package router
// Router is micro network router
type Router interface {
// Init initializes the router with options
Init(...Option) error
// Options returns the router options
Options() Options
// ID returns id of the router
ID() string
// Table returns the router routing table
Table() Table
// Address returns the router adddress
Address() string
// Gossip returns the router gossip address
Gossip() string
// Network returns the router network address
Network() string
// Start starts the router
Start() error
// Stop stops the router
Stop() error
// String returns debug info
String() string
}
// Option used by the router
type Option func(*Options)
// NewRouter creates new Router and returns it
func NewRouter(opts ...Option) Router {
return newRouter(opts...)
}