Versions in this module Expand all Collapse all v2 v2.9.4 Aug 5, 2020 v2.9.3 Aug 5, 2020 Changes in this version + var AdvertiseEventsTick = 10 * time.Second + var DefaultAddress = ":9093" + var DefaultAdvertTTL = 2 * time.Minute + var DefaultLink = "local" + var DefaultLocalMetric int64 = 1 + var DefaultName = "go.micro.router" + var DefaultNetwork = "go.micro" + var DefaultRouter = NewRouter() + var ErrDuplicateRoute = errors.New("duplicate route") + var ErrRouteNotFound = errors.New("route not found") + var ErrWatcherStopped = errors.New("watcher stopped") + 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 + Id string + 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 Advertise(a Strategy) 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 + Advertise Strategy + Client client.Client + Gateway string + Id string + Network string + Registry registry.Registry + func DefaultOptions() Options + type QueryOption func(*QueryOptions) + func QueryAddress(a string) QueryOption + func QueryGateway(g string) QueryOption + func QueryNetwork(n string) QueryOption + func QueryRouter(r string) QueryOption + func QueryService(s string) QueryOption + func QueryStrategy(s Strategy) QueryOption + type QueryOptions struct + Address string + Gateway string + Network string + Router string + Service string + Strategy Strategy + func NewQuery(opts ...QueryOption) QueryOptions + type Route struct + Address string + Gateway string + Link string + Metric int64 + 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(...QueryOption) ([]Route, error) + Options func() Options + Process func(*Advert) error + Start func() error + Stop func() error + String func() string + Table func() Table + Watch func(opts ...WatchOption) (Watcher, error) + func NewRouter(opts ...Option) Router + type StatusCode int + const Advertising + const Error + const Running + const Stopped + type Strategy int + const AdvertiseAll + const AdvertiseBest + const AdvertiseLocal + const AdvertiseNone + func (s Strategy) String() string + type Table interface + Create func(Route) error + Delete func(Route) error + List func() ([]Route, error) + Query func(...QueryOption) ([]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()