Versions in this module Expand all Collapse all v1 v1.18.2 Oct 16, 2020 Changes in this version + var DefaultLink = "local" + var DefaultMetric int64 = 1 + var DefaultNetwork = "micro" + var ErrDuplicateRoute = errors.New("duplicate route") + var ErrRouteNotFound = errors.New("route not found") + var ErrWatcherStopped = errors.New("watcher stopped") + 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 LookupOption func(*LookupOptions) + func LookupAddress(a string) LookupOption + func LookupGateway(g string) LookupOption + func LookupLink(link string) LookupOption + func LookupNetwork(n string) LookupOption + func LookupRouter(r string) LookupOption + type LookupOptions struct + Address string + Gateway string + Link string + Network string + Router string + func NewLookup(opts ...LookupOption) LookupOptions + type Option func(*Options) + func Address(a string) Option + func Cache() 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 + Cache bool + Context context.Context + Gateway string + Id string + Network string + Registry registry.Registry + func DefaultOptions() Options + type ReadOption func(o *ReadOptions) + func ReadService(s string) ReadOption + type ReadOptions struct + Service string + type Route struct + Address string + Gateway string + Link string + Metadata map[string]string + Metric int64 + Network string + Router string + Service string + func Filter(routes []Route, opts LookupOptions) []Route + func (r *Route) Hash() uint64 + type Router interface + Close func() error + Init func(...Option) error + Lookup func(service string, opts ...LookupOption) ([]Route, error) + Options func() Options + String func() string + Table func() Table + Watch func(opts ...WatchOption) (Watcher, error) + type StatusCode int + const Error + const Running + const Stopped + type Table interface + Create func(Route) error + Delete func(Route) error + Read func(...ReadOption) ([]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()