Versions in this module Expand all Collapse all v1 v1.9.1 Sep 5, 2019 Changes in this version + const AdvertRecover + const AdvertSuppress + const AdvertiseEventsTick + const AdvertiseFlushTick + const AdvertiseTableTick + const DefaultAdvertTTL + const DeletePenalty + const MaxSuppressTime + const PenaltyHalfLife + const UpdatePenalty + var DefaultAddress = ":9093" + var DefaultLink = "local" + var DefaultLocalMetric = 1 + var DefaultName = "go.micro.router" + var DefaultNetwork = "go.micro" + var DefaultNetworkMetric = 10 + var DefaultRouter = NewRouter() + var ErrDuplicateRoute = errors.New("duplicate route") + var ErrRouteNotFound = errors.New("route not found") + var ErrWatcherStopped = errors.New("watcher stopped") + var PenaltyDecay = math.Log(2) / PenaltyHalfLife + type Advert struct + Events []*Event + Id string + TTL time.Duration + Timestamp time.Time + Type AdvertType + type AdvertType int + const Announce + const RouteUpdate + func (t AdvertType) String() string + type Event struct + Route Route + Timestamp time.Time + Type EventType + type EventType int + const Create + const Delete + const Update + func (t EventType) String() string + type Option func(*Options) + func Address(a string) Option + func Client(c client.Client) Option + func Gateway(g string) Option + func Id(id string) Option + func Network(n string) Option + func Registry(r registry.Registry) Option + type Options struct + Address string + Client client.Client + Gateway string + Id string + Network string + Registry registry.Registry + func DefaultOptions() Options + type Query interface + Options func() QueryOptions + func NewQuery(opts ...QueryOption) Query + type QueryOption func(*QueryOptions) + func QueryGateway(g string) QueryOption + func QueryNetwork(n string) QueryOption + func QueryRouter(r string) QueryOption + func QueryService(s string) QueryOption + type QueryOptions struct + Gateway string + Network string + Router string + Service string + type Route struct + Address string + Gateway string + Link string + Metric int + Network string + Router string + Service string + func (r *Route) Hash() uint64 + type Router interface + Advertise func() (<-chan *Advert, error) + Init func(...Option) error + Lookup func(Query) ([]Route, error) + Options func() Options + Process func(*Advert) error + Start func() error + Status func() Status + Stop func() error + String func() string + Table func() Table + Watch func(opts ...WatchOption) (Watcher, error) + func NewRouter(opts ...Option) Router + type Status struct + Code StatusCode + Error error + func (s Status) String() string + type StatusCode int + const Advertising + const Error + const Running + const Stopped + func (s StatusCode) String() string + type Table interface + Create func(Route) error + Delete func(Route) error + List func() ([]Route, error) + Query func(Query) ([]Route, error) + Update func(Route) error + type WatchOption func(*WatchOptions) + func WatchService(s string) WatchOption + type WatchOptions struct + Service string + type Watcher interface + Chan func() (<-chan *Event, error) + Next func() (*Event, error) + Stop func()